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 void __attribute__((noreturn)) abort(void);
13 static inline void assert(bool expression) {
14 if (!expression) { abort(); }
17 void *malloc(size_t size);
20 #define MALLOC(a, _) malloc(a)
21 #define FREE(p) if ((unsigned long)(p) > 4096) { free(p); }
22 #define DO_ASSERT(a) (void)(a)
24 #define CHECK_ACCESS(p)
25 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
27 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
28 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
29 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
30 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
32 _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
34 #define DECL_ARR_TYPE(ty, name) \
35 struct name##array { \
39 typedef struct name##array * name##Array; \
40 static inline name##Array init_##name##Array(size_t arr_len) { \
41 name##Array arr = (name##Array)MALLOC(arr_len * sizeof(ty) + sizeof(uint32_t), "##name array init"); \
42 arr->arr_len = arr_len; \
46 DECL_ARR_TYPE(int64_t, int64_t);
47 DECL_ARR_TYPE(int8_t, int8_t);
48 DECL_ARR_TYPE(uint32_t, uint32_t);
49 DECL_ARR_TYPE(void*, ptr);
50 DECL_ARR_TYPE(char, char);
51 typedef charArray jstring;
53 static inline jstring str_ref_to_ts(const char* chars, size_t len) {
54 charArray arr = init_charArray(len);
55 memcpy(arr->elems, chars, len);
58 static inline LDKStr str_ref_to_owned_c(const jstring str) {
59 char* newchars = MALLOC(str->arr_len + 1, "String chars");
60 memcpy(newchars, str->elems, str->arr_len);
61 newchars[str->arr_len] = 0;
65 .chars_is_owned = true
70 typedef bool jboolean;
72 uint32_t __attribute__((visibility("default"))) TS_malloc(uint32_t size) {
73 return (uint32_t)MALLOC(size, "JS-Called malloc");
75 void __attribute__((visibility("default"))) TS_free(uint32_t ptr) {
78 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
79 static inline LDKAccessError LDKAccessError_from_js(int32_t ord) {
81 case 0: return LDKAccessError_UnknownChain;
82 case 1: return LDKAccessError_UnknownTx;
86 static inline int32_t LDKAccessError_to_js(LDKAccessError val) {
88 case LDKAccessError_UnknownChain: return 0;
89 case LDKAccessError_UnknownTx: return 1;
93 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_js(int32_t ord) {
95 case 0: return LDKCOption_NoneZ_Some;
96 case 1: return LDKCOption_NoneZ_None;
100 static inline int32_t LDKCOption_NoneZ_to_js(LDKCOption_NoneZ val) {
102 case LDKCOption_NoneZ_Some: return 0;
103 case LDKCOption_NoneZ_None: return 1;
107 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_js(int32_t ord) {
109 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
110 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
114 static inline int32_t LDKChannelMonitorUpdateErr_to_js(LDKChannelMonitorUpdateErr val) {
116 case LDKChannelMonitorUpdateErr_TemporaryFailure: return 0;
117 case LDKChannelMonitorUpdateErr_PermanentFailure: return 1;
121 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
123 case 0: return LDKConfirmationTarget_Background;
124 case 1: return LDKConfirmationTarget_Normal;
125 case 2: return LDKConfirmationTarget_HighPriority;
129 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
131 case LDKConfirmationTarget_Background: return 0;
132 case LDKConfirmationTarget_Normal: return 1;
133 case LDKConfirmationTarget_HighPriority: return 2;
137 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
139 case 0: return LDKLevel_Gossip;
140 case 1: return LDKLevel_Trace;
141 case 2: return LDKLevel_Debug;
142 case 3: return LDKLevel_Info;
143 case 4: return LDKLevel_Warn;
144 case 5: return LDKLevel_Error;
148 static inline int32_t LDKLevel_to_js(LDKLevel val) {
150 case LDKLevel_Gossip: return 0;
151 case LDKLevel_Trace: return 1;
152 case LDKLevel_Debug: return 2;
153 case LDKLevel_Info: return 3;
154 case LDKLevel_Warn: return 4;
155 case LDKLevel_Error: return 5;
159 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
161 case 0: return LDKNetwork_Bitcoin;
162 case 1: return LDKNetwork_Testnet;
163 case 2: return LDKNetwork_Regtest;
164 case 3: return LDKNetwork_Signet;
168 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
170 case LDKNetwork_Bitcoin: return 0;
171 case LDKNetwork_Testnet: return 1;
172 case LDKNetwork_Regtest: return 2;
173 case LDKNetwork_Signet: return 3;
177 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
179 case 0: return LDKSecp256k1Error_IncorrectSignature;
180 case 1: return LDKSecp256k1Error_InvalidMessage;
181 case 2: return LDKSecp256k1Error_InvalidPublicKey;
182 case 3: return LDKSecp256k1Error_InvalidSignature;
183 case 4: return LDKSecp256k1Error_InvalidSecretKey;
184 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
185 case 6: return LDKSecp256k1Error_InvalidTweak;
186 case 7: return LDKSecp256k1Error_TweakCheckFailed;
187 case 8: return LDKSecp256k1Error_NotEnoughMemory;
191 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
193 case LDKSecp256k1Error_IncorrectSignature: return 0;
194 case LDKSecp256k1Error_InvalidMessage: return 1;
195 case LDKSecp256k1Error_InvalidPublicKey: return 2;
196 case LDKSecp256k1Error_InvalidSignature: return 3;
197 case LDKSecp256k1Error_InvalidSecretKey: return 4;
198 case LDKSecp256k1Error_InvalidRecoveryId: return 5;
199 case LDKSecp256k1Error_InvalidTweak: return 6;
200 case LDKSecp256k1Error_TweakCheckFailed: return 7;
201 case LDKSecp256k1Error_NotEnoughMemory: return 8;
205 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
206 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
207 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
210 struct LDKCVec_u8Z TxOut_get_script_pubkey (struct LDKTxOut* thing) { return CVec_u8Z_clone(&thing->script_pubkey);}int8_tArray __attribute__((visibility("default"))) TS_TxOut_get_script_pubkey(uint32_t thing) {
211 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
212 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
213 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
214 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
215 CVec_u8Z_free(ret_var);
219 uint64_t TxOut_get_value (struct LDKTxOut* thing) { return thing->value;}int64_t __attribute__((visibility("default"))) TS_TxOut_get_value(uint32_t thing) {
220 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
221 int64_t ret_val = TxOut_get_value(thing_conv);
225 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
226 CHECK(owner->result_ok);
227 return ChannelConfig_clone(&*owner->contents.result);
229 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_get_ok(uint32_t owner) {
230 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
231 LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
232 uint64_t ret_ref = 0;
233 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
234 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
235 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
236 ret_ref = (uint64_t)ret_var.inner;
237 if (ret_var.is_owned) {
243 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
244 CHECK(!owner->result_ok);
245 return DecodeError_clone(&*owner->contents.err);
247 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_get_err(uint32_t owner) {
248 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
249 LDKDecodeError ret_var = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
250 uint64_t ret_ref = 0;
251 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
252 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
253 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
254 ret_ref = (uint64_t)ret_var.inner;
255 if (ret_var.is_owned) {
261 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
262 CHECK(owner->result_ok);
263 return OutPoint_clone(&*owner->contents.result);
265 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_get_ok(uint32_t owner) {
266 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
267 LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
268 uint64_t ret_ref = 0;
269 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
270 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
271 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
272 ret_ref = (uint64_t)ret_var.inner;
273 if (ret_var.is_owned) {
279 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
280 CHECK(!owner->result_ok);
281 return DecodeError_clone(&*owner->contents.err);
283 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_get_err(uint32_t owner) {
284 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
285 LDKDecodeError ret_var = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
286 uint64_t ret_ref = 0;
287 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
288 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
289 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
290 ret_ref = (uint64_t)ret_var.inner;
291 if (ret_var.is_owned) {
297 static inline struct LDKSecretKey CResult_SecretKeyErrorZ_get_ok(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
298 CHECK(owner->result_ok);
299 return *owner->contents.result;
301 int8_tArray __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_get_ok(uint32_t owner) {
302 LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)(owner & ~1);
303 int8_tArray ret_arr = init_int8_tArray(32);
304 memcpy(ret_arr->elems, CResult_SecretKeyErrorZ_get_ok(owner_conv).bytes, 32);
308 static inline enum LDKSecp256k1Error CResult_SecretKeyErrorZ_get_err(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
309 CHECK(!owner->result_ok);
310 return *owner->contents.err;
312 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_get_err(uint32_t owner) {
313 LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)(owner & ~1);
314 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_SecretKeyErrorZ_get_err(owner_conv));
318 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
319 CHECK(owner->result_ok);
320 return *owner->contents.result;
322 int8_tArray __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_get_ok(uint32_t owner) {
323 LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)(owner & ~1);
324 int8_tArray ret_arr = init_int8_tArray(33);
325 memcpy(ret_arr->elems, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form, 33);
329 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
330 CHECK(!owner->result_ok);
331 return *owner->contents.err;
333 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_get_err(uint32_t owner) {
334 LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)(owner & ~1);
335 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PublicKeyErrorZ_get_err(owner_conv));
339 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
340 CHECK(owner->result_ok);
341 return TxCreationKeys_clone(&*owner->contents.result);
343 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_ok(uint32_t owner) {
344 LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(owner & ~1);
345 LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
346 uint64_t ret_ref = 0;
347 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
348 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
349 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
350 ret_ref = (uint64_t)ret_var.inner;
351 if (ret_var.is_owned) {
357 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
358 CHECK(!owner->result_ok);
359 return DecodeError_clone(&*owner->contents.err);
361 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_err(uint32_t owner) {
362 LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(owner & ~1);
363 LDKDecodeError ret_var = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
364 uint64_t ret_ref = 0;
365 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
366 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
367 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
368 ret_ref = (uint64_t)ret_var.inner;
369 if (ret_var.is_owned) {
375 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
376 CHECK(owner->result_ok);
377 return ChannelPublicKeys_clone(&*owner->contents.result);
379 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint32_t owner) {
380 LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(owner & ~1);
381 LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
382 uint64_t ret_ref = 0;
383 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
384 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
385 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
386 ret_ref = (uint64_t)ret_var.inner;
387 if (ret_var.is_owned) {
393 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
394 CHECK(!owner->result_ok);
395 return DecodeError_clone(&*owner->contents.err);
397 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err(uint32_t owner) {
398 LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(owner & ~1);
399 LDKDecodeError ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
400 uint64_t ret_ref = 0;
401 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
402 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
403 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
404 ret_ref = (uint64_t)ret_var.inner;
405 if (ret_var.is_owned) {
411 static inline struct LDKTxCreationKeys CResult_TxCreationKeysErrorZ_get_ok(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
412 CHECK(owner->result_ok);
413 return TxCreationKeys_clone(&*owner->contents.result);
415 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_get_ok(uint32_t owner) {
416 LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)(owner & ~1);
417 LDKTxCreationKeys ret_var = CResult_TxCreationKeysErrorZ_get_ok(owner_conv);
418 uint64_t ret_ref = 0;
419 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
420 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
421 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
422 ret_ref = (uint64_t)ret_var.inner;
423 if (ret_var.is_owned) {
429 static inline enum LDKSecp256k1Error CResult_TxCreationKeysErrorZ_get_err(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
430 CHECK(!owner->result_ok);
431 return *owner->contents.err;
433 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_get_err(uint32_t owner) {
434 LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)(owner & ~1);
435 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_TxCreationKeysErrorZ_get_err(owner_conv));
439 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u32Z_ref_from_ptr(uint32_t ptr) {
440 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
442 case LDKCOption_u32Z_Some: {
443 return 0 /* LDKCOption_u32Z - Some */; (void) obj->some;
445 case LDKCOption_u32Z_None: {
446 return 0 /* LDKCOption_u32Z - None */;
451 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
452 CHECK(owner->result_ok);
453 return HTLCOutputInCommitment_clone(&*owner->contents.result);
455 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint32_t owner) {
456 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(owner & ~1);
457 LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
458 uint64_t ret_ref = 0;
459 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
460 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
461 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
462 ret_ref = (uint64_t)ret_var.inner;
463 if (ret_var.is_owned) {
469 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
470 CHECK(!owner->result_ok);
471 return DecodeError_clone(&*owner->contents.err);
473 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint32_t owner) {
474 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(owner & ~1);
475 LDKDecodeError ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
476 uint64_t ret_ref = 0;
477 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
478 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
479 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
480 ret_ref = (uint64_t)ret_var.inner;
481 if (ret_var.is_owned) {
487 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
488 CHECK(owner->result_ok);
489 return CounterpartyChannelTransactionParameters_clone(&*owner->contents.result);
491 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t owner) {
492 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
493 LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
494 uint64_t ret_ref = 0;
495 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
496 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
497 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
498 ret_ref = (uint64_t)ret_var.inner;
499 if (ret_var.is_owned) {
505 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
506 CHECK(!owner->result_ok);
507 return DecodeError_clone(&*owner->contents.err);
509 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint32_t owner) {
510 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
511 LDKDecodeError ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
512 uint64_t ret_ref = 0;
513 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
514 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
515 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
516 ret_ref = (uint64_t)ret_var.inner;
517 if (ret_var.is_owned) {
523 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
524 CHECK(owner->result_ok);
525 return ChannelTransactionParameters_clone(&*owner->contents.result);
527 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t owner) {
528 LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
529 LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
530 uint64_t ret_ref = 0;
531 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
532 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
533 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
534 ret_ref = (uint64_t)ret_var.inner;
535 if (ret_var.is_owned) {
541 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
542 CHECK(!owner->result_ok);
543 return DecodeError_clone(&*owner->contents.err);
545 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint32_t owner) {
546 LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
547 LDKDecodeError ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
548 uint64_t ret_ref = 0;
549 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
550 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
551 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
552 ret_ref = (uint64_t)ret_var.inner;
553 if (ret_var.is_owned) {
559 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
560 CHECK(owner->result_ok);
561 return HolderCommitmentTransaction_clone(&*owner->contents.result);
563 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint32_t owner) {
564 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(owner & ~1);
565 LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
566 uint64_t ret_ref = 0;
567 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
568 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
569 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
570 ret_ref = (uint64_t)ret_var.inner;
571 if (ret_var.is_owned) {
577 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
578 CHECK(!owner->result_ok);
579 return DecodeError_clone(&*owner->contents.err);
581 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint32_t owner) {
582 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(owner & ~1);
583 LDKDecodeError ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
584 uint64_t ret_ref = 0;
585 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
586 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
587 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
588 ret_ref = (uint64_t)ret_var.inner;
589 if (ret_var.is_owned) {
595 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
596 CHECK(owner->result_ok);
597 return BuiltCommitmentTransaction_clone(&*owner->contents.result);
599 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint32_t owner) {
600 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(owner & ~1);
601 LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
602 uint64_t ret_ref = 0;
603 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
604 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
605 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
606 ret_ref = (uint64_t)ret_var.inner;
607 if (ret_var.is_owned) {
613 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
614 CHECK(!owner->result_ok);
615 return DecodeError_clone(&*owner->contents.err);
617 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint32_t owner) {
618 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(owner & ~1);
619 LDKDecodeError ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
620 uint64_t ret_ref = 0;
621 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
622 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
623 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
624 ret_ref = (uint64_t)ret_var.inner;
625 if (ret_var.is_owned) {
631 static inline struct LDKTrustedClosingTransaction *CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
632 CHECK(owner->result_ok);
633 return &*owner->contents.result;
635 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_get_ok(uint32_t owner) {
636 LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(owner & ~1);
637 LDKTrustedClosingTransaction ret_var = *CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
638 uint64_t ret_ref = 0;
639 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
640 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
641 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
642 ret_ref = (uint64_t)ret_var.inner & ~1;
646 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
647 CHECK(!owner->result_ok);
648 return *owner->contents.err;
650 void __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_get_err(uint32_t owner) {
651 LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(owner & ~1);
652 CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
655 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
656 CHECK(owner->result_ok);
657 return CommitmentTransaction_clone(&*owner->contents.result);
659 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok(uint32_t owner) {
660 LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(owner & ~1);
661 LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
662 uint64_t ret_ref = 0;
663 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
664 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
665 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
666 ret_ref = (uint64_t)ret_var.inner;
667 if (ret_var.is_owned) {
673 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
674 CHECK(!owner->result_ok);
675 return DecodeError_clone(&*owner->contents.err);
677 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_err(uint32_t owner) {
678 LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(owner & ~1);
679 LDKDecodeError ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
680 uint64_t ret_ref = 0;
681 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
682 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
683 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
684 ret_ref = (uint64_t)ret_var.inner;
685 if (ret_var.is_owned) {
691 static inline struct LDKTrustedCommitmentTransaction *CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
692 CHECK(owner->result_ok);
693 return &*owner->contents.result;
695 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok(uint32_t owner) {
696 LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(owner & ~1);
697 LDKTrustedCommitmentTransaction ret_var = *CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
698 uint64_t ret_ref = 0;
699 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
700 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
701 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
702 ret_ref = (uint64_t)ret_var.inner & ~1;
706 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
707 CHECK(!owner->result_ok);
708 return *owner->contents.err;
710 void __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_err(uint32_t owner) {
711 LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(owner & ~1);
712 CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
715 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
716 CHECK(owner->result_ok);
717 return *owner->contents.result;
719 ptrArray __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_get_ok(uint32_t owner) {
720 LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)(owner & ~1);
721 LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
722 ptrArray ret_arr = NULL;
723 ret_arr = init_ptrArray(ret_var.datalen);
724 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
725 for (size_t m = 0; m < ret_var.datalen; m++) {
726 int8_tArray ret_conv_12_arr = init_int8_tArray(64);
727 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
728 ret_arr_ptr[m] = ret_conv_12_arr;
735 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
736 CHECK(!owner->result_ok);
737 return *owner->contents.err;
739 void __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_get_err(uint32_t owner) {
740 LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)(owner & ~1);
741 CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
744 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
745 CHECK(owner->result_ok);
746 return ShutdownScript_clone(&*owner->contents.result);
748 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_ok(uint32_t owner) {
749 LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(owner & ~1);
750 LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
751 uint64_t ret_ref = 0;
752 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
753 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
754 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
755 ret_ref = (uint64_t)ret_var.inner;
756 if (ret_var.is_owned) {
762 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
763 CHECK(!owner->result_ok);
764 return DecodeError_clone(&*owner->contents.err);
766 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_err(uint32_t owner) {
767 LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(owner & ~1);
768 LDKDecodeError ret_var = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
769 uint64_t ret_ref = 0;
770 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
771 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
772 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
773 ret_ref = (uint64_t)ret_var.inner;
774 if (ret_var.is_owned) {
780 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
781 CHECK(owner->result_ok);
782 return ShutdownScript_clone(&*owner->contents.result);
784 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint32_t owner) {
785 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(owner & ~1);
786 LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
787 uint64_t ret_ref = 0;
788 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
789 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
790 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
791 ret_ref = (uint64_t)ret_var.inner;
792 if (ret_var.is_owned) {
798 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
799 CHECK(!owner->result_ok);
800 return InvalidShutdownScript_clone(&*owner->contents.err);
802 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint32_t owner) {
803 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(owner & ~1);
804 LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
805 uint64_t ret_ref = 0;
806 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
807 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
808 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
809 ret_ref = (uint64_t)ret_var.inner;
810 if (ret_var.is_owned) {
816 typedef struct LDKType_JCalls {
817 atomic_size_t refcnt;
818 uint32_t type_id_meth;
819 uint32_t debug_str_meth;
822 static void LDKType_JCalls_free(void* this_arg) {
823 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
824 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
825 js_free_function_ptr(j_calls->type_id_meth);
826 js_free_function_ptr(j_calls->debug_str_meth);
827 js_free_function_ptr(j_calls->write_meth);
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->type_id_meth);
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->debug_str_meth);
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->write_meth);
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 (/*TODO: JS Object Reference */void* o) {
855 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
856 atomic_init(&calls->refcnt, 1);
857 //TODO: Assign calls->o from 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__((visibility("default"))) TS_LDKType_new(/*TODO: JS Object Reference */void* o) {
870 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
871 *res_ptr = LDKType_init(o);
872 return (long)res_ptr;
874 int16_t __attribute__((visibility("default"))) 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__((visibility("default"))) 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__((visibility("default"))) 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__((visibility("default"))) TS_LDKCOption_TypeZ_ref_from_ptr(uint32_t ptr) {
904 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
906 case LDKCOption_TypeZ_Some: {
907 LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
908 *some_ret = Type_clone(&obj->some);
909 return 0 /* LDKCOption_TypeZ - Some */; (void) (uint64_t)some_ret;
911 case LDKCOption_TypeZ_None: {
912 return 0 /* LDKCOption_TypeZ - None */;
917 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
918 CHECK(owner->result_ok);
919 return COption_TypeZ_clone(&*owner->contents.result);
921 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_get_ok(uint32_t owner) {
922 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
923 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
924 *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
925 uint64_t ret_ref = (uint64_t)ret_copy;
929 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
930 CHECK(!owner->result_ok);
931 return DecodeError_clone(&*owner->contents.err);
933 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_get_err(uint32_t owner) {
934 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
935 LDKDecodeError ret_var = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
936 uint64_t ret_ref = 0;
937 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
938 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
939 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
940 ret_ref = (uint64_t)ret_var.inner;
941 if (ret_var.is_owned) {
947 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
948 CHECK(owner->result_ok);
949 return *owner->contents.result;
951 jstring __attribute__((visibility("default"))) TS_CResult_StringErrorZ_get_ok(uint32_t owner) {
952 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
953 LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
954 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__((visibility("default"))) 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__((visibility("default"))) 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__((visibility("default"))) 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__((visibility("default"))) TS_LDKMonitorEvent_ref_from_ptr(uint32_t ptr) {
1006 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1008 case LDKMonitorEvent_HTLCEvent: {
1009 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
1010 uint64_t htlc_event_ref = 0;
1011 CHECK((((uint64_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1012 CHECK((((uint64_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1013 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
1014 htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
1015 return 0 /* LDKMonitorEvent - HTLCEvent */; (void) htlc_event_ref;
1017 case LDKMonitorEvent_CommitmentTxConfirmed: {
1018 LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
1019 uint64_t commitment_tx_confirmed_ref = 0;
1020 CHECK((((uint64_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1021 CHECK((((uint64_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1022 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
1023 commitment_tx_confirmed_ref = (uint64_t)commitment_tx_confirmed_var.inner & ~1;
1024 return 0 /* LDKMonitorEvent - CommitmentTxConfirmed */; (void) commitment_tx_confirmed_ref;
1026 case LDKMonitorEvent_UpdateCompleted: {
1027 LDKOutPoint funding_txo_var = obj->update_completed.funding_txo;
1028 uint64_t funding_txo_ref = 0;
1029 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1030 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1031 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
1032 funding_txo_ref = (uint64_t)funding_txo_var.inner & ~1;
1033 return 0 /* LDKMonitorEvent - UpdateCompleted */; (void) funding_txo_ref; (void) obj->update_completed.monitor_update_id;
1035 case LDKMonitorEvent_UpdateFailed: {
1036 LDKOutPoint update_failed_var = obj->update_failed;
1037 uint64_t update_failed_ref = 0;
1038 CHECK((((uint64_t)update_failed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1039 CHECK((((uint64_t)&update_failed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1040 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
1041 update_failed_ref = (uint64_t)update_failed_var.inner & ~1;
1042 return 0 /* LDKMonitorEvent - UpdateFailed */; (void) update_failed_ref;
1047 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_MonitorEventZ_ref_from_ptr(uint32_t ptr) {
1048 LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)(ptr & ~1);
1050 case LDKCOption_MonitorEventZ_Some: {
1051 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
1052 return 0 /* LDKCOption_MonitorEventZ - Some */; (void) some_ref;
1054 case LDKCOption_MonitorEventZ_None: {
1055 return 0 /* LDKCOption_MonitorEventZ - None */;
1060 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
1061 CHECK(owner->result_ok);
1062 return COption_MonitorEventZ_clone(&*owner->contents.result);
1064 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint32_t owner) {
1065 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
1066 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
1067 *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
1068 uint64_t ret_ref = (uint64_t)ret_copy;
1072 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
1073 CHECK(!owner->result_ok);
1074 return DecodeError_clone(&*owner->contents.err);
1076 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint32_t owner) {
1077 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
1078 LDKDecodeError ret_var = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
1079 uint64_t ret_ref = 0;
1080 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1081 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1082 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1083 ret_ref = (uint64_t)ret_var.inner;
1084 if (ret_var.is_owned) {
1090 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
1091 CHECK(owner->result_ok);
1092 return HTLCUpdate_clone(&*owner->contents.result);
1094 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint32_t owner) {
1095 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
1096 LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(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 LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
1109 CHECK(!owner->result_ok);
1110 return DecodeError_clone(&*owner->contents.err);
1112 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint32_t owner) {
1113 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
1114 LDKDecodeError ret_var = CResult_HTLCUpdateDecodeErrorZ_get_err(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 void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1127 CHECK(owner->result_ok);
1128 return *owner->contents.result;
1130 void __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_get_ok(uint32_t owner) {
1131 LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1);
1132 CResult_NoneNoneZ_get_ok(owner_conv);
1135 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1136 CHECK(!owner->result_ok);
1137 return *owner->contents.err;
1139 void __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_get_err(uint32_t owner) {
1140 LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1);
1141 CResult_NoneNoneZ_get_err(owner_conv);
1144 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
1145 return OutPoint_clone(&owner->a);
1147 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_get_a(uint32_t owner) {
1148 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
1149 LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
1150 uint64_t ret_ref = 0;
1151 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1152 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1153 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1154 ret_ref = (uint64_t)ret_var.inner;
1155 if (ret_var.is_owned) {
1161 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
1162 return CVec_u8Z_clone(&owner->b);
1164 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_get_b(uint32_t owner) {
1165 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
1166 LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
1167 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
1168 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1169 CVec_u8Z_free(ret_var);
1173 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
1176 int32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_get_a(uint32_t owner) {
1177 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
1178 int32_t ret_val = C2Tuple_u32ScriptZ_get_a(owner_conv);
1182 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
1183 return CVec_u8Z_clone(&owner->b);
1185 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_get_b(uint32_t owner) {
1186 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
1187 LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
1188 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
1189 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1190 CVec_u8Z_free(ret_var);
1194 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
1195 return ThirtyTwoBytes_clone(&owner->a);
1197 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint32_t owner) {
1198 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
1199 int8_tArray ret_arr = init_int8_tArray(32);
1200 memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data, 32);
1204 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
1207 uint32_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint32_t owner) {
1208 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
1209 LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
1210 uint32_tArray ret_arr = NULL;
1211 ret_arr = init_uint32_tArray(ret_var.datalen);
1212 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
1213 for (size_t v = 0; v < ret_var.datalen; v++) {
1214 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
1215 *ret_conv_21_conv = ret_var.data[v];
1216 ret_arr_ptr[v] = ((uint64_t)ret_conv_21_conv);
1223 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1224 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1225 for (size_t i = 0; i < ret.datalen; i++) {
1226 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1230 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentPurpose_ref_from_ptr(uint32_t ptr) {
1231 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1233 case LDKPaymentPurpose_InvoicePayment: {
1234 int8_tArray payment_preimage_arr = init_int8_tArray(32);
1235 memcpy(payment_preimage_arr->elems, obj->invoice_payment.payment_preimage.data, 32);
1236 int8_tArray payment_secret_arr = init_int8_tArray(32);
1237 memcpy(payment_secret_arr->elems, obj->invoice_payment.payment_secret.data, 32);
1238 return 0 /* LDKPaymentPurpose - InvoicePayment */; (void) payment_preimage_arr; (void) payment_secret_arr;
1240 case LDKPaymentPurpose_SpontaneousPayment: {
1241 int8_tArray spontaneous_payment_arr = init_int8_tArray(32);
1242 memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
1243 return 0 /* LDKPaymentPurpose - SpontaneousPayment */; (void) spontaneous_payment_arr;
1248 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u64Z_ref_from_ptr(uint32_t ptr) {
1249 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1251 case LDKCOption_u64Z_Some: {
1252 return 0 /* LDKCOption_u64Z - Some */; (void) obj->some;
1254 case LDKCOption_u64Z_None: {
1255 return 0 /* LDKCOption_u64Z - None */;
1260 uint32_t __attribute__((visibility("default"))) TS_LDKNetworkUpdate_ref_from_ptr(uint32_t ptr) {
1261 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1263 case LDKNetworkUpdate_ChannelUpdateMessage: {
1264 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1265 uint64_t msg_ref = 0;
1266 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1267 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1268 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1269 msg_ref = (uint64_t)msg_var.inner & ~1;
1270 return 0 /* LDKNetworkUpdate - ChannelUpdateMessage */; (void) msg_ref;
1272 case LDKNetworkUpdate_ChannelClosed: {
1273 return 0 /* LDKNetworkUpdate - ChannelClosed */; (void) obj->channel_closed.short_channel_id; (void) obj->channel_closed.is_permanent;
1275 case LDKNetworkUpdate_NodeFailure: {
1276 int8_tArray node_id_arr = init_int8_tArray(33);
1277 memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
1278 return 0 /* LDKNetworkUpdate - NodeFailure */; (void) node_id_arr; (void) obj->node_failure.is_permanent;
1283 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_NetworkUpdateZ_ref_from_ptr(uint32_t ptr) {
1284 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
1286 case LDKCOption_NetworkUpdateZ_Some: {
1287 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
1288 return 0 /* LDKCOption_NetworkUpdateZ - Some */; (void) some_ref;
1290 case LDKCOption_NetworkUpdateZ_None: {
1291 return 0 /* LDKCOption_NetworkUpdateZ - None */;
1296 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1297 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1298 for (size_t i = 0; i < ret.datalen; i++) {
1299 ret.data[i] = RouteHop_clone(&orig->data[i]);
1303 uint32_t __attribute__((visibility("default"))) TS_LDKSpendableOutputDescriptor_ref_from_ptr(uint32_t ptr) {
1304 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1306 case LDKSpendableOutputDescriptor_StaticOutput: {
1307 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1308 uint64_t outpoint_ref = 0;
1309 CHECK((((uint64_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1310 CHECK((((uint64_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1311 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1312 outpoint_ref = (uint64_t)outpoint_var.inner & ~1;
1313 uint64_t output_ref = ((uint64_t)&obj->static_output.output) | 1;
1314 return 0 /* LDKSpendableOutputDescriptor - StaticOutput */; (void) outpoint_ref; (void) (uint64_t)output_ref;
1316 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1317 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1318 uint64_t delayed_payment_output_ref = 0;
1319 CHECK((((uint64_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1320 CHECK((((uint64_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1321 CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1322 delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1;
1323 return 0 /* LDKSpendableOutputDescriptor - DelayedPaymentOutput */; (void) delayed_payment_output_ref;
1325 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1326 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1327 uint64_t static_payment_output_ref = 0;
1328 CHECK((((uint64_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1329 CHECK((((uint64_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1330 CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1331 static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1;
1332 return 0 /* LDKSpendableOutputDescriptor - StaticPaymentOutput */; (void) static_payment_output_ref;
1337 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1338 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1339 for (size_t i = 0; i < ret.datalen; i++) {
1340 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1344 uint32_t __attribute__((visibility("default"))) TS_LDKClosureReason_ref_from_ptr(uint32_t ptr) {
1345 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
1347 case LDKClosureReason_CounterpartyForceClosed: {
1348 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
1349 jstring peer_msg_conv = str_ref_to_ts(peer_msg_str.chars, peer_msg_str.len);
1350 return 0 /* LDKClosureReason - CounterpartyForceClosed */; (void) peer_msg_conv;
1352 case LDKClosureReason_HolderForceClosed: {
1353 return 0 /* LDKClosureReason - HolderForceClosed */;
1355 case LDKClosureReason_CooperativeClosure: {
1356 return 0 /* LDKClosureReason - CooperativeClosure */;
1358 case LDKClosureReason_CommitmentTxConfirmed: {
1359 return 0 /* LDKClosureReason - CommitmentTxConfirmed */;
1361 case LDKClosureReason_FundingTimedOut: {
1362 return 0 /* LDKClosureReason - FundingTimedOut */;
1364 case LDKClosureReason_ProcessingError: {
1365 LDKStr err_str = obj->processing_error.err;
1366 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
1367 return 0 /* LDKClosureReason - ProcessingError */; (void) err_conv;
1369 case LDKClosureReason_DisconnectedPeer: {
1370 return 0 /* LDKClosureReason - DisconnectedPeer */;
1372 case LDKClosureReason_OutdatedChannelManager: {
1373 return 0 /* LDKClosureReason - OutdatedChannelManager */;
1378 uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_t ptr) {
1379 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1381 case LDKEvent_FundingGenerationReady: {
1382 int8_tArray temporary_channel_id_arr = init_int8_tArray(32);
1383 memcpy(temporary_channel_id_arr->elems, obj->funding_generation_ready.temporary_channel_id.data, 32);
1384 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1385 int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen);
1386 memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
1387 return 0 /* LDKEvent - FundingGenerationReady */; (void) temporary_channel_id_arr; (void) obj->funding_generation_ready.channel_value_satoshis; (void) output_script_arr; (void) obj->funding_generation_ready.user_channel_id;
1389 case LDKEvent_PaymentReceived: {
1390 int8_tArray payment_hash_arr = init_int8_tArray(32);
1391 memcpy(payment_hash_arr->elems, obj->payment_received.payment_hash.data, 32);
1392 uint64_t purpose_ref = ((uint64_t)&obj->payment_received.purpose) | 1;
1393 return 0 /* LDKEvent - PaymentReceived */; (void) payment_hash_arr; (void) obj->payment_received.amt; (void) purpose_ref;
1395 case LDKEvent_PaymentSent: {
1396 int8_tArray payment_id_arr = init_int8_tArray(32);
1397 memcpy(payment_id_arr->elems, obj->payment_sent.payment_id.data, 32);
1398 int8_tArray payment_preimage_arr = init_int8_tArray(32);
1399 memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
1400 int8_tArray payment_hash_arr = init_int8_tArray(32);
1401 memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
1402 uint64_t fee_paid_msat_ref = ((uint64_t)&obj->payment_sent.fee_paid_msat) | 1;
1403 return 0 /* LDKEvent - PaymentSent */; (void) payment_id_arr; (void) payment_preimage_arr; (void) payment_hash_arr; (void) fee_paid_msat_ref;
1405 case LDKEvent_PaymentPathFailed: {
1406 int8_tArray payment_id_arr = init_int8_tArray(32);
1407 memcpy(payment_id_arr->elems, obj->payment_path_failed.payment_id.data, 32);
1408 int8_tArray payment_hash_arr = init_int8_tArray(32);
1409 memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
1410 uint64_t network_update_ref = ((uint64_t)&obj->payment_path_failed.network_update) | 1;
1411 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
1412 uint32_tArray path_arr = NULL;
1413 path_arr = init_uint32_tArray(path_var.datalen);
1414 uint32_t *path_arr_ptr = (uint32_t*)(path_arr + 4);
1415 for (size_t k = 0; k < path_var.datalen; k++) {
1416 LDKRouteHop path_conv_10_var = path_var.data[k];
1417 uint64_t path_conv_10_ref = 0;
1418 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1419 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1420 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1421 path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1;
1422 path_arr_ptr[k] = path_conv_10_ref;
1425 uint64_t short_channel_id_ref = ((uint64_t)&obj->payment_path_failed.short_channel_id) | 1;
1426 LDKRouteParameters retry_var = obj->payment_path_failed.retry;
1427 uint64_t retry_ref = 0;
1428 if ((uint64_t)retry_var.inner > 4096) {
1429 CHECK((((uint64_t)retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1430 CHECK((((uint64_t)&retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1431 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
1432 retry_ref = (uint64_t)retry_var.inner & ~1;
1434 return 0 /* LDKEvent - PaymentPathFailed */; (void) payment_id_arr; (void) payment_hash_arr; (void) obj->payment_path_failed.rejected_by_dest; (void) network_update_ref; (void) obj->payment_path_failed.all_paths_failed; (void) path_arr; (void) short_channel_id_ref; (void) retry_ref;
1436 case LDKEvent_PaymentFailed: {
1437 int8_tArray payment_id_arr = init_int8_tArray(32);
1438 memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
1439 int8_tArray payment_hash_arr = init_int8_tArray(32);
1440 memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
1441 return 0 /* LDKEvent - PaymentFailed */; (void) payment_id_arr; (void) payment_hash_arr;
1443 case LDKEvent_PendingHTLCsForwardable: {
1444 return 0 /* LDKEvent - PendingHTLCsForwardable */; (void) obj->pending_htl_cs_forwardable.time_forwardable;
1446 case LDKEvent_SpendableOutputs: {
1447 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1448 uint32_tArray outputs_arr = NULL;
1449 outputs_arr = init_uint32_tArray(outputs_var.datalen);
1450 uint32_t *outputs_arr_ptr = (uint32_t*)(outputs_arr + 4);
1451 for (size_t b = 0; b < outputs_var.datalen; b++) {
1452 uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1;
1453 outputs_arr_ptr[b] = outputs_conv_27_ref;
1456 return 0 /* LDKEvent - SpendableOutputs */; (void) outputs_arr;
1458 case LDKEvent_PaymentForwarded: {
1459 uint64_t fee_earned_msat_ref = ((uint64_t)&obj->payment_forwarded.fee_earned_msat) | 1;
1460 return 0 /* LDKEvent - PaymentForwarded */; (void) fee_earned_msat_ref; (void) obj->payment_forwarded.claim_from_onchain_tx;
1462 case LDKEvent_ChannelClosed: {
1463 int8_tArray channel_id_arr = init_int8_tArray(32);
1464 memcpy(channel_id_arr->elems, obj->channel_closed.channel_id.data, 32);
1465 uint64_t reason_ref = ((uint64_t)&obj->channel_closed.reason) | 1;
1466 return 0 /* LDKEvent - ChannelClosed */; (void) channel_id_arr; (void) obj->channel_closed.user_channel_id; (void) reason_ref;
1468 case LDKEvent_DiscardFunding: {
1469 int8_tArray channel_id_arr = init_int8_tArray(32);
1470 memcpy(channel_id_arr->elems, obj->discard_funding.channel_id.data, 32);
1471 LDKTransaction transaction_var = obj->discard_funding.transaction;
1472 int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen);
1473 memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
1474 return 0 /* LDKEvent - DiscardFunding */; (void) channel_id_arr; (void) transaction_arr;
1476 case LDKEvent_PaymentPathSuccessful: {
1477 int8_tArray payment_id_arr = init_int8_tArray(32);
1478 memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
1479 int8_tArray payment_hash_arr = init_int8_tArray(32);
1480 memcpy(payment_hash_arr->elems, obj->payment_path_successful.payment_hash.data, 32);
1481 LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
1482 uint32_tArray path_arr = NULL;
1483 path_arr = init_uint32_tArray(path_var.datalen);
1484 uint32_t *path_arr_ptr = (uint32_t*)(path_arr + 4);
1485 for (size_t k = 0; k < path_var.datalen; k++) {
1486 LDKRouteHop path_conv_10_var = path_var.data[k];
1487 uint64_t path_conv_10_ref = 0;
1488 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1489 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1490 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1491 path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1;
1492 path_arr_ptr[k] = path_conv_10_ref;
1495 return 0 /* LDKEvent - PaymentPathSuccessful */; (void) payment_id_arr; (void) payment_hash_arr; (void) path_arr;
1500 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
1501 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
1502 for (size_t i = 0; i < ret.datalen; i++) {
1503 ret.data[i] = Event_clone(&orig->data[i]);
1507 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
1510 int64_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_get_a(uint32_t owner) {
1511 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
1512 int64_t ret_val = C2Tuple_usizeTransactionZ_get_a(owner_conv);
1516 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
1519 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_get_b(uint32_t owner) {
1520 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
1521 LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
1522 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
1523 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1524 Transaction_free(ret_var);
1528 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
1529 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
1530 for (size_t i = 0; i < ret.datalen; i++) {
1531 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
1535 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
1538 int32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_get_a(uint32_t owner) {
1539 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
1540 int32_t ret_val = C2Tuple_u32TxOutZ_get_a(owner_conv);
1544 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
1545 return TxOut_clone(&owner->b);
1547 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_get_b(uint32_t owner) {
1548 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
1549 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
1550 *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
1551 return (uint64_t)ret_ref;
1554 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
1555 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
1556 for (size_t i = 0; i < ret.datalen; i++) {
1557 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
1561 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
1562 return ThirtyTwoBytes_clone(&owner->a);
1564 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint32_t owner) {
1565 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
1566 int8_tArray ret_arr = init_int8_tArray(32);
1567 memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
1571 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
1572 return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
1574 uint32_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint32_t owner) {
1575 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
1576 LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
1577 uint32_tArray ret_arr = NULL;
1578 ret_arr = init_uint32_tArray(ret_var.datalen);
1579 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
1580 for (size_t u = 0; u < ret_var.datalen; u++) {
1581 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
1582 *ret_conv_20_conv = ret_var.data[u];
1583 ret_arr_ptr[u] = ((uint64_t)ret_conv_20_conv);
1590 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
1591 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 };
1592 for (size_t i = 0; i < ret.datalen; i++) {
1593 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
1597 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
1598 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
1599 for (size_t i = 0; i < ret.datalen; i++) {
1600 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1604 uint32_t __attribute__((visibility("default"))) TS_LDKBalance_ref_from_ptr(uint32_t ptr) {
1605 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
1607 case LDKBalance_ClaimableOnChannelClose: {
1608 return 0 /* LDKBalance - ClaimableOnChannelClose */; (void) obj->claimable_on_channel_close.claimable_amount_satoshis;
1610 case LDKBalance_ClaimableAwaitingConfirmations: {
1611 return 0 /* LDKBalance - ClaimableAwaitingConfirmations */; (void) obj->claimable_awaiting_confirmations.claimable_amount_satoshis; (void) obj->claimable_awaiting_confirmations.confirmation_height;
1613 case LDKBalance_ContentiousClaimable: {
1614 return 0 /* LDKBalance - ContentiousClaimable */; (void) obj->contentious_claimable.claimable_amount_satoshis; (void) obj->contentious_claimable.timeout_height;
1616 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
1617 return 0 /* LDKBalance - MaybeClaimableHTLCAwaitingTimeout */; (void) obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis; (void) obj->maybe_claimable_htlc_awaiting_timeout.claimable_height;
1622 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
1623 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
1624 for (size_t i = 0; i < ret.datalen; i++) {
1625 ret.data[i] = Balance_clone(&orig->data[i]);
1629 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
1632 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_a(uint32_t owner) {
1633 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
1634 int8_tArray ret_arr = init_int8_tArray(64);
1635 memcpy(ret_arr->elems, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form, 64);
1639 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
1642 ptrArray __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_b(uint32_t owner) {
1643 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
1644 LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
1645 ptrArray ret_arr = NULL;
1646 ret_arr = init_ptrArray(ret_var.datalen);
1647 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
1648 for (size_t m = 0; m < ret_var.datalen; m++) {
1649 int8_tArray ret_conv_12_arr = init_int8_tArray(64);
1650 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
1651 ret_arr_ptr[m] = ret_conv_12_arr;
1658 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
1659 CHECK(owner->result_ok);
1660 return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
1662 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint32_t owner) {
1663 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
1664 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
1665 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
1666 return ((uint64_t)ret_conv);
1669 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
1670 CHECK(!owner->result_ok);
1671 return *owner->contents.err;
1673 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint32_t owner) {
1674 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
1675 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
1678 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
1679 CHECK(owner->result_ok);
1680 return *owner->contents.result;
1682 int8_tArray __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_get_ok(uint32_t owner) {
1683 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
1684 int8_tArray ret_arr = init_int8_tArray(64);
1685 memcpy(ret_arr->elems, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form, 64);
1689 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
1690 CHECK(!owner->result_ok);
1691 return *owner->contents.err;
1693 void __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_get_err(uint32_t owner) {
1694 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
1695 CResult_SignatureNoneZ_get_err(owner_conv);
1698 typedef struct LDKBaseSign_JCalls {
1699 atomic_size_t refcnt;
1700 uint32_t get_per_commitment_point_meth;
1701 uint32_t release_commitment_secret_meth;
1702 uint32_t validate_holder_commitment_meth;
1703 uint32_t channel_keys_id_meth;
1704 uint32_t sign_counterparty_commitment_meth;
1705 uint32_t validate_counterparty_revocation_meth;
1706 uint32_t sign_holder_commitment_and_htlcs_meth;
1707 uint32_t sign_justice_revoked_output_meth;
1708 uint32_t sign_justice_revoked_htlc_meth;
1709 uint32_t sign_counterparty_htlc_transaction_meth;
1710 uint32_t sign_closing_transaction_meth;
1711 uint32_t sign_channel_announcement_meth;
1712 uint32_t ready_channel_meth;
1713 } LDKBaseSign_JCalls;
1714 static void LDKBaseSign_JCalls_free(void* this_arg) {
1715 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1716 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1717 js_free_function_ptr(j_calls->get_per_commitment_point_meth);
1718 js_free_function_ptr(j_calls->release_commitment_secret_meth);
1719 js_free_function_ptr(j_calls->validate_holder_commitment_meth);
1720 js_free_function_ptr(j_calls->channel_keys_id_meth);
1721 js_free_function_ptr(j_calls->sign_counterparty_commitment_meth);
1722 js_free_function_ptr(j_calls->validate_counterparty_revocation_meth);
1723 js_free_function_ptr(j_calls->sign_holder_commitment_and_htlcs_meth);
1724 js_free_function_ptr(j_calls->sign_justice_revoked_output_meth);
1725 js_free_function_ptr(j_calls->sign_justice_revoked_htlc_meth);
1726 js_free_function_ptr(j_calls->sign_counterparty_htlc_transaction_meth);
1727 js_free_function_ptr(j_calls->sign_closing_transaction_meth);
1728 js_free_function_ptr(j_calls->sign_channel_announcement_meth);
1729 js_free_function_ptr(j_calls->ready_channel_meth);
1733 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1734 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1735 int8_tArray ret = (int8_tArray)js_invoke_function_1(j_calls->get_per_commitment_point_meth, (uint32_t)idx);
1736 LDKPublicKey ret_ref;
1737 CHECK(ret->arr_len == 33);
1738 memcpy(ret_ref.compressed_form, ret->elems, 33);
1741 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1742 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1743 int8_tArray ret = (int8_tArray)js_invoke_function_1(j_calls->release_commitment_secret_meth, (uint32_t)idx);
1744 LDKThirtyTwoBytes ret_ref;
1745 CHECK(ret->arr_len == 32);
1746 memcpy(ret_ref.data, ret->elems, 32);
1749 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx) {
1750 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1751 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
1752 uint64_t holder_tx_ref = 0;
1753 holder_tx_var = HolderCommitmentTransaction_clone(holder_tx);
1754 CHECK((((uint64_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1755 CHECK((((uint64_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1756 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
1757 holder_tx_ref = (uint64_t)holder_tx_var.inner;
1758 if (holder_tx_var.is_owned) {
1761 uint32_t ret = js_invoke_function_1(j_calls->validate_holder_commitment_meth, (uint32_t)holder_tx_ref);
1762 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1763 CHECK_ACCESS(ret_ptr);
1764 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1768 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
1769 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1770 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->channel_keys_id_meth);
1771 LDKThirtyTwoBytes ret_ref;
1772 CHECK(ret->arr_len == 32);
1773 memcpy(ret_ref.data, ret->elems, 32);
1776 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
1777 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1778 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1779 uint64_t commitment_tx_ref = 0;
1780 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
1781 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1782 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1783 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1784 commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
1785 if (commitment_tx_var.is_owned) {
1786 commitment_tx_ref |= 1;
1788 uint32_t ret = js_invoke_function_1(j_calls->sign_counterparty_commitment_meth, (uint32_t)commitment_tx_ref);
1789 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1790 CHECK_ACCESS(ret_ptr);
1791 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
1795 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
1796 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1797 int8_tArray secret_arr = init_int8_tArray(32);
1798 memcpy(secret_arr->elems, *secret, 32);
1799 uint32_t ret = js_invoke_function_2(j_calls->validate_counterparty_revocation_meth, (uint32_t)idx, (uint32_t)secret_arr);
1800 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1801 CHECK_ACCESS(ret_ptr);
1802 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1806 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1807 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1808 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1809 uint64_t commitment_tx_ref = 0;
1810 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
1811 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1812 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1813 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1814 commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
1815 if (commitment_tx_var.is_owned) {
1816 commitment_tx_ref |= 1;
1818 uint32_t ret = js_invoke_function_1(j_calls->sign_holder_commitment_and_htlcs_meth, (uint32_t)commitment_tx_ref);
1819 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1820 CHECK_ACCESS(ret_ptr);
1821 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
1825 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]) {
1826 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1827 LDKTransaction justice_tx_var = justice_tx;
1828 int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen);
1829 memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
1830 Transaction_free(justice_tx_var);
1831 int8_tArray per_commitment_key_arr = init_int8_tArray(32);
1832 memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
1833 uint32_t ret = js_invoke_function_4(j_calls->sign_justice_revoked_output_meth, (uint32_t)justice_tx_arr, (uint32_t)input, (uint32_t)amount, (uint32_t)per_commitment_key_arr);
1834 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1835 CHECK_ACCESS(ret_ptr);
1836 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1840 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) {
1841 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1842 LDKTransaction justice_tx_var = justice_tx;
1843 int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen);
1844 memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
1845 Transaction_free(justice_tx_var);
1846 int8_tArray per_commitment_key_arr = init_int8_tArray(32);
1847 memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
1848 LDKHTLCOutputInCommitment htlc_var = *htlc;
1849 uint64_t htlc_ref = 0;
1850 htlc_var = HTLCOutputInCommitment_clone(htlc);
1851 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1852 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1853 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
1854 htlc_ref = (uint64_t)htlc_var.inner;
1855 if (htlc_var.is_owned) {
1858 uint32_t ret = js_invoke_function_5(j_calls->sign_justice_revoked_htlc_meth, (uint32_t)justice_tx_arr, (uint32_t)input, (uint32_t)amount, (uint32_t)per_commitment_key_arr, (uint32_t)htlc_ref);
1859 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1860 CHECK_ACCESS(ret_ptr);
1861 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1865 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) {
1866 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1867 LDKTransaction htlc_tx_var = htlc_tx;
1868 int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen);
1869 memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
1870 Transaction_free(htlc_tx_var);
1871 int8_tArray per_commitment_point_arr = init_int8_tArray(33);
1872 memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
1873 LDKHTLCOutputInCommitment htlc_var = *htlc;
1874 uint64_t htlc_ref = 0;
1875 htlc_var = HTLCOutputInCommitment_clone(htlc);
1876 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1877 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1878 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
1879 htlc_ref = (uint64_t)htlc_var.inner;
1880 if (htlc_var.is_owned) {
1883 uint32_t ret = js_invoke_function_5(j_calls->sign_counterparty_htlc_transaction_meth, (uint32_t)htlc_tx_arr, (uint32_t)input, (uint32_t)amount, (uint32_t)per_commitment_point_arr, (uint32_t)htlc_ref);
1884 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1885 CHECK_ACCESS(ret_ptr);
1886 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1890 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
1891 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1892 LDKClosingTransaction closing_tx_var = *closing_tx;
1893 uint64_t closing_tx_ref = 0;
1894 closing_tx_var = ClosingTransaction_clone(closing_tx);
1895 CHECK((((uint64_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1896 CHECK((((uint64_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1897 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
1898 closing_tx_ref = (uint64_t)closing_tx_var.inner;
1899 if (closing_tx_var.is_owned) {
1900 closing_tx_ref |= 1;
1902 uint32_t ret = js_invoke_function_1(j_calls->sign_closing_transaction_meth, (uint32_t)closing_tx_ref);
1903 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1904 CHECK_ACCESS(ret_ptr);
1905 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1909 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
1910 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1911 LDKUnsignedChannelAnnouncement msg_var = *msg;
1912 uint64_t msg_ref = 0;
1913 msg_var = UnsignedChannelAnnouncement_clone(msg);
1914 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1915 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1916 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1917 msg_ref = (uint64_t)msg_var.inner;
1918 if (msg_var.is_owned) {
1921 uint32_t ret = js_invoke_function_1(j_calls->sign_channel_announcement_meth, (uint32_t)msg_ref);
1922 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1923 CHECK_ACCESS(ret_ptr);
1924 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1928 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1929 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1930 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1931 uint64_t channel_parameters_ref = 0;
1932 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
1933 CHECK((((uint64_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1934 CHECK((((uint64_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1935 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
1936 channel_parameters_ref = (uint64_t)channel_parameters_var.inner;
1937 if (channel_parameters_var.is_owned) {
1938 channel_parameters_ref |= 1;
1940 js_invoke_function_1(j_calls->ready_channel_meth, (uint32_t)channel_parameters_ref);
1942 static void LDKBaseSign_JCalls_cloned(LDKBaseSign* new_obj) {
1943 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) new_obj->this_arg;
1944 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1946 static inline LDKBaseSign LDKBaseSign_init (/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1947 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
1948 atomic_init(&calls->refcnt, 1);
1949 //TODO: Assign calls->o from o
1951 LDKChannelPublicKeys pubkeys_conv;
1952 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1953 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1954 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
1957 .this_arg = (void*) calls,
1958 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
1959 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
1960 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
1961 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
1962 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
1963 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
1964 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
1965 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
1966 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
1967 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
1968 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
1969 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
1970 .ready_channel = ready_channel_LDKBaseSign_jcall,
1971 .free = LDKBaseSign_JCalls_free,
1972 .pubkeys = pubkeys_conv,
1973 .set_pubkeys = NULL,
1977 long __attribute__((visibility("default"))) TS_LDKBaseSign_new(/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1978 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
1979 *res_ptr = LDKBaseSign_init(o, pubkeys);
1980 return (long)res_ptr;
1982 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_get_per_commitment_point(uint32_t this_arg, int64_t idx) {
1983 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
1984 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
1985 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
1986 int8_tArray ret_arr = init_int8_tArray(33);
1987 memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
1991 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_release_commitment_secret(uint32_t this_arg, int64_t idx) {
1992 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
1993 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
1994 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
1995 int8_tArray ret_arr = init_int8_tArray(32);
1996 memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
2000 uint32_t __attribute__((visibility("default"))) TS_BaseSign_validate_holder_commitment(uint32_t this_arg, uint32_t holder_tx) {
2001 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2002 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2003 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2004 LDKHolderCommitmentTransaction holder_tx_conv;
2005 holder_tx_conv.inner = (void*)(holder_tx & (~1));
2006 holder_tx_conv.is_owned = false;
2007 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
2008 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2009 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv);
2010 return (uint64_t)ret_conv;
2013 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_channel_keys_id(uint32_t this_arg) {
2014 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2015 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2016 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2017 int8_tArray ret_arr = init_int8_tArray(32);
2018 memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
2022 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_counterparty_commitment(uint32_t this_arg, uint32_t commitment_tx) {
2023 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2024 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2025 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2026 LDKCommitmentTransaction commitment_tx_conv;
2027 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2028 commitment_tx_conv.is_owned = false;
2029 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2030 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2031 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2032 return (uint64_t)ret_conv;
2035 uint32_t __attribute__((visibility("default"))) TS_BaseSign_validate_counterparty_revocation(uint32_t this_arg, int64_t idx, int8_tArray secret) {
2036 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2037 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2038 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2039 unsigned char secret_arr[32];
2040 CHECK(secret->arr_len == 32);
2041 memcpy(secret_arr, secret->elems, 32);
2042 unsigned char (*secret_ref)[32] = &secret_arr;
2043 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2044 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
2045 return (uint64_t)ret_conv;
2048 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_holder_commitment_and_htlcs(uint32_t this_arg, uint32_t commitment_tx) {
2049 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2050 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2051 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2052 LDKHolderCommitmentTransaction commitment_tx_conv;
2053 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2054 commitment_tx_conv.is_owned = false;
2055 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2056 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2057 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
2058 return (uint64_t)ret_conv;
2061 uint32_t __attribute__((visibility("default"))) 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) {
2062 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2063 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2064 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2065 LDKTransaction justice_tx_ref;
2066 justice_tx_ref.datalen = justice_tx->arr_len;
2067 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2068 memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen);
2069 justice_tx_ref.data_is_owned = true;
2070 unsigned char per_commitment_key_arr[32];
2071 CHECK(per_commitment_key->arr_len == 32);
2072 memcpy(per_commitment_key_arr, per_commitment_key->elems, 32);
2073 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2074 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2075 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
2076 return (uint64_t)ret_conv;
2079 uint32_t __attribute__((visibility("default"))) 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) {
2080 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2081 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2082 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2083 LDKTransaction justice_tx_ref;
2084 justice_tx_ref.datalen = justice_tx->arr_len;
2085 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2086 memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen);
2087 justice_tx_ref.data_is_owned = true;
2088 unsigned char per_commitment_key_arr[32];
2089 CHECK(per_commitment_key->arr_len == 32);
2090 memcpy(per_commitment_key_arr, per_commitment_key->elems, 32);
2091 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2092 LDKHTLCOutputInCommitment htlc_conv;
2093 htlc_conv.inner = (void*)(htlc & (~1));
2094 htlc_conv.is_owned = false;
2095 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2096 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2097 *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);
2098 return (uint64_t)ret_conv;
2101 uint32_t __attribute__((visibility("default"))) 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) {
2102 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2103 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2104 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2105 LDKTransaction htlc_tx_ref;
2106 htlc_tx_ref.datalen = htlc_tx->arr_len;
2107 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2108 memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen);
2109 htlc_tx_ref.data_is_owned = true;
2110 LDKPublicKey per_commitment_point_ref;
2111 CHECK(per_commitment_point->arr_len == 33);
2112 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33);
2113 LDKHTLCOutputInCommitment htlc_conv;
2114 htlc_conv.inner = (void*)(htlc & (~1));
2115 htlc_conv.is_owned = false;
2116 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2117 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2118 *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);
2119 return (uint64_t)ret_conv;
2122 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_closing_transaction(uint32_t this_arg, uint32_t closing_tx) {
2123 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2124 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2125 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2126 LDKClosingTransaction closing_tx_conv;
2127 closing_tx_conv.inner = (void*)(closing_tx & (~1));
2128 closing_tx_conv.is_owned = false;
2129 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
2130 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2131 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
2132 return (uint64_t)ret_conv;
2135 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_channel_announcement(uint32_t this_arg, uint32_t msg) {
2136 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2137 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2138 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2139 LDKUnsignedChannelAnnouncement msg_conv;
2140 msg_conv.inner = (void*)(msg & (~1));
2141 msg_conv.is_owned = false;
2142 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
2143 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2144 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2145 return (uint64_t)ret_conv;
2148 void __attribute__((visibility("default"))) TS_BaseSign_ready_channel(uint32_t this_arg, uint32_t channel_parameters) {
2149 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2150 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2151 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2152 LDKChannelTransactionParameters channel_parameters_conv;
2153 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
2154 channel_parameters_conv.is_owned = false;
2155 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
2156 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
2159 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
2160 if (this_arg->set_pubkeys != NULL)
2161 this_arg->set_pubkeys(this_arg);
2162 return this_arg->pubkeys;
2164 uint32_t __attribute__((visibility("default"))) TS_BaseSign_get_pubkeys(uint32_t this_arg) {
2165 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2166 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2167 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2168 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
2169 uint64_t ret_ref = 0;
2170 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2171 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2172 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2173 ret_ref = (uint64_t)ret_var.inner;
2174 if (ret_var.is_owned) {
2180 typedef struct LDKSign_JCalls {
2181 atomic_size_t refcnt;
2182 LDKBaseSign_JCalls* BaseSign;
2183 uint32_t write_meth;
2185 static void LDKSign_JCalls_free(void* this_arg) {
2186 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2187 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2188 js_free_function_ptr(j_calls->write_meth);
2192 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
2193 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2194 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->write_meth);
2195 LDKCVec_u8Z ret_ref;
2196 ret_ref.datalen = ret->arr_len;
2197 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2198 memcpy(ret_ref.data, ret->elems, ret_ref.datalen);
2201 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
2202 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
2203 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2204 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
2206 static inline LDKSign LDKSign_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* BaseSign, uint32_t pubkeys) {
2207 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
2208 atomic_init(&calls->refcnt, 1);
2209 //TODO: Assign calls->o from o
2211 LDKChannelPublicKeys pubkeys_conv;
2212 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2213 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2214 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2217 .this_arg = (void*) calls,
2218 .write = write_LDKSign_jcall,
2219 .cloned = LDKSign_JCalls_cloned,
2220 .free = LDKSign_JCalls_free,
2221 .BaseSign = LDKBaseSign_init(BaseSign, pubkeys),
2223 calls->BaseSign = ret.BaseSign.this_arg;
2226 long __attribute__((visibility("default"))) TS_LDKSign_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* BaseSign, uint32_t pubkeys) {
2227 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
2228 *res_ptr = LDKSign_init(o, BaseSign, pubkeys);
2229 return (long)res_ptr;
2231 int8_tArray __attribute__((visibility("default"))) TS_Sign_write(uint32_t this_arg) {
2232 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2233 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2234 LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
2235 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2236 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
2237 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2238 CVec_u8Z_free(ret_var);
2242 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
2243 return ThirtyTwoBytes_clone(&owner->a);
2245 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_a(uint32_t owner) {
2246 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
2247 int8_tArray ret_arr = init_int8_tArray(32);
2248 memcpy(ret_arr->elems, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data, 32);
2252 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
2253 return ChannelMonitor_clone(&owner->b);
2255 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_b(uint32_t owner) {
2256 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
2257 LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
2258 uint64_t ret_ref = 0;
2259 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2260 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2261 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2262 ret_ref = (uint64_t)ret_var.inner;
2263 if (ret_var.is_owned) {
2269 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
2270 CHECK(owner->result_ok);
2271 return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
2273 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint32_t owner) {
2274 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
2275 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
2276 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
2277 return ((uint64_t)ret_conv);
2280 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
2281 CHECK(!owner->result_ok);
2282 return DecodeError_clone(&*owner->contents.err);
2284 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint32_t owner) {
2285 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
2286 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
2287 uint64_t ret_ref = 0;
2288 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2289 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2290 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2291 ret_ref = (uint64_t)ret_var.inner;
2292 if (ret_var.is_owned) {
2298 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2299 CHECK(owner->result_ok);
2300 return RouteHop_clone(&*owner->contents.result);
2302 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_get_ok(uint32_t owner) {
2303 LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)(owner & ~1);
2304 LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
2305 uint64_t ret_ref = 0;
2306 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2307 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2308 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2309 ret_ref = (uint64_t)ret_var.inner;
2310 if (ret_var.is_owned) {
2316 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2317 CHECK(!owner->result_ok);
2318 return DecodeError_clone(&*owner->contents.err);
2320 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_get_err(uint32_t owner) {
2321 LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)(owner & ~1);
2322 LDKDecodeError ret_var = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
2323 uint64_t ret_ref = 0;
2324 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2325 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2326 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2327 ret_ref = (uint64_t)ret_var.inner;
2328 if (ret_var.is_owned) {
2334 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
2335 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
2336 for (size_t i = 0; i < ret.datalen; i++) {
2337 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
2341 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2342 CHECK(owner->result_ok);
2343 return Route_clone(&*owner->contents.result);
2345 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_get_ok(uint32_t owner) {
2346 LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)(owner & ~1);
2347 LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
2348 uint64_t ret_ref = 0;
2349 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2350 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2351 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2352 ret_ref = (uint64_t)ret_var.inner;
2353 if (ret_var.is_owned) {
2359 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2360 CHECK(!owner->result_ok);
2361 return DecodeError_clone(&*owner->contents.err);
2363 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_get_err(uint32_t owner) {
2364 LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)(owner & ~1);
2365 LDKDecodeError ret_var = CResult_RouteDecodeErrorZ_get_err(owner_conv);
2366 uint64_t ret_ref = 0;
2367 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2368 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2369 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2370 ret_ref = (uint64_t)ret_var.inner;
2371 if (ret_var.is_owned) {
2377 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2378 CHECK(owner->result_ok);
2379 return RouteParameters_clone(&*owner->contents.result);
2381 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_get_ok(uint32_t owner) {
2382 LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(owner & ~1);
2383 LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
2384 uint64_t ret_ref = 0;
2385 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2386 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2387 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2388 ret_ref = (uint64_t)ret_var.inner;
2389 if (ret_var.is_owned) {
2395 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2396 CHECK(!owner->result_ok);
2397 return DecodeError_clone(&*owner->contents.err);
2399 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_get_err(uint32_t owner) {
2400 LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(owner & ~1);
2401 LDKDecodeError ret_var = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
2402 uint64_t ret_ref = 0;
2403 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2404 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2405 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2406 ret_ref = (uint64_t)ret_var.inner;
2407 if (ret_var.is_owned) {
2413 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
2414 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
2415 for (size_t i = 0; i < ret.datalen; i++) {
2416 ret.data[i] = RouteHint_clone(&orig->data[i]);
2420 static inline struct LDKPayee CResult_PayeeDecodeErrorZ_get_ok(LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR owner){
2421 CHECK(owner->result_ok);
2422 return Payee_clone(&*owner->contents.result);
2424 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_get_ok(uint32_t owner) {
2425 LDKCResult_PayeeDecodeErrorZ* owner_conv = (LDKCResult_PayeeDecodeErrorZ*)(owner & ~1);
2426 LDKPayee ret_var = CResult_PayeeDecodeErrorZ_get_ok(owner_conv);
2427 uint64_t ret_ref = 0;
2428 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2429 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2430 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2431 ret_ref = (uint64_t)ret_var.inner;
2432 if (ret_var.is_owned) {
2438 static inline struct LDKDecodeError CResult_PayeeDecodeErrorZ_get_err(LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR owner){
2439 CHECK(!owner->result_ok);
2440 return DecodeError_clone(&*owner->contents.err);
2442 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_get_err(uint32_t owner) {
2443 LDKCResult_PayeeDecodeErrorZ* owner_conv = (LDKCResult_PayeeDecodeErrorZ*)(owner & ~1);
2444 LDKDecodeError ret_var = CResult_PayeeDecodeErrorZ_get_err(owner_conv);
2445 uint64_t ret_ref = 0;
2446 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2447 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2448 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2449 ret_ref = (uint64_t)ret_var.inner;
2450 if (ret_var.is_owned) {
2456 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
2457 LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
2458 for (size_t i = 0; i < ret.datalen; i++) {
2459 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
2463 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2464 CHECK(owner->result_ok);
2465 return RouteHint_clone(&*owner->contents.result);
2467 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_get_ok(uint32_t owner) {
2468 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
2469 LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
2470 uint64_t ret_ref = 0;
2471 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2472 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2473 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2474 ret_ref = (uint64_t)ret_var.inner;
2475 if (ret_var.is_owned) {
2481 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2482 CHECK(!owner->result_ok);
2483 return DecodeError_clone(&*owner->contents.err);
2485 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_get_err(uint32_t owner) {
2486 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
2487 LDKDecodeError ret_var = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
2488 uint64_t ret_ref = 0;
2489 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2490 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2491 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2492 ret_ref = (uint64_t)ret_var.inner;
2493 if (ret_var.is_owned) {
2499 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2500 CHECK(owner->result_ok);
2501 return RouteHintHop_clone(&*owner->contents.result);
2503 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_get_ok(uint32_t owner) {
2504 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
2505 LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
2506 uint64_t ret_ref = 0;
2507 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2508 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2509 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2510 ret_ref = (uint64_t)ret_var.inner;
2511 if (ret_var.is_owned) {
2517 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2518 CHECK(!owner->result_ok);
2519 return DecodeError_clone(&*owner->contents.err);
2521 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_get_err(uint32_t owner) {
2522 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
2523 LDKDecodeError ret_var = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
2524 uint64_t ret_ref = 0;
2525 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2526 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2527 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2528 ret_ref = (uint64_t)ret_var.inner;
2529 if (ret_var.is_owned) {
2535 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
2536 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
2537 for (size_t i = 0; i < ret.datalen; i++) {
2538 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
2542 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2543 CHECK(owner->result_ok);
2544 return Route_clone(&*owner->contents.result);
2546 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_get_ok(uint32_t owner) {
2547 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
2548 LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
2549 uint64_t ret_ref = 0;
2550 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2551 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2552 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2553 ret_ref = (uint64_t)ret_var.inner;
2554 if (ret_var.is_owned) {
2560 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2561 CHECK(!owner->result_ok);
2562 return LightningError_clone(&*owner->contents.err);
2564 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_get_err(uint32_t owner) {
2565 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
2566 LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
2567 uint64_t ret_ref = 0;
2568 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2569 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2570 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2571 ret_ref = (uint64_t)ret_var.inner;
2572 if (ret_var.is_owned) {
2578 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
2579 CHECK(owner->result_ok);
2580 return *owner->contents.result;
2582 void __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_get_ok(uint32_t owner) {
2583 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
2584 CResult_NoneLightningErrorZ_get_ok(owner_conv);
2587 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
2588 CHECK(!owner->result_ok);
2589 return LightningError_clone(&*owner->contents.err);
2591 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_get_err(uint32_t owner) {
2592 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
2593 LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
2594 uint64_t ret_ref = 0;
2595 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2596 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2597 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2598 ret_ref = (uint64_t)ret_var.inner;
2599 if (ret_var.is_owned) {
2605 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
2608 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint32_t owner) {
2609 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
2610 int8_tArray ret_arr = init_int8_tArray(33);
2611 memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
2615 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
2616 return Type_clone(&owner->b);
2618 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint32_t owner) {
2619 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
2620 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
2621 *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
2622 return (uint64_t)ret_ret;
2625 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
2626 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
2627 for (size_t i = 0; i < ret.datalen; i++) {
2628 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
2632 uint32_t __attribute__((visibility("default"))) TS_LDKErrorAction_ref_from_ptr(uint32_t ptr) {
2633 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
2635 case LDKErrorAction_DisconnectPeer: {
2636 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
2637 uint64_t msg_ref = 0;
2638 if ((uint64_t)msg_var.inner > 4096) {
2639 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2640 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2641 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2642 msg_ref = (uint64_t)msg_var.inner & ~1;
2644 return 0 /* LDKErrorAction - DisconnectPeer */; (void) msg_ref;
2646 case LDKErrorAction_IgnoreError: {
2647 return 0 /* LDKErrorAction - IgnoreError */;
2649 case LDKErrorAction_IgnoreAndLog: {
2650 uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
2651 return 0 /* LDKErrorAction - IgnoreAndLog */; (void) ignore_and_log_conv;
2653 case LDKErrorAction_IgnoreDuplicateGossip: {
2654 return 0 /* LDKErrorAction - IgnoreDuplicateGossip */;
2656 case LDKErrorAction_SendErrorMessage: {
2657 LDKErrorMessage msg_var = obj->send_error_message.msg;
2658 uint64_t msg_ref = 0;
2659 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2660 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2661 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2662 msg_ref = (uint64_t)msg_var.inner & ~1;
2663 return 0 /* LDKErrorAction - SendErrorMessage */; (void) msg_ref;
2668 uint32_t __attribute__((visibility("default"))) TS_LDKMessageSendEvent_ref_from_ptr(uint32_t ptr) {
2669 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2671 case LDKMessageSendEvent_SendAcceptChannel: {
2672 int8_tArray node_id_arr = init_int8_tArray(33);
2673 memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
2674 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
2675 uint64_t msg_ref = 0;
2676 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2677 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2678 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2679 msg_ref = (uint64_t)msg_var.inner & ~1;
2680 return 0 /* LDKMessageSendEvent - SendAcceptChannel */; (void) node_id_arr; (void) msg_ref;
2682 case LDKMessageSendEvent_SendOpenChannel: {
2683 int8_tArray node_id_arr = init_int8_tArray(33);
2684 memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
2685 LDKOpenChannel msg_var = obj->send_open_channel.msg;
2686 uint64_t msg_ref = 0;
2687 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2688 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2689 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2690 msg_ref = (uint64_t)msg_var.inner & ~1;
2691 return 0 /* LDKMessageSendEvent - SendOpenChannel */; (void) node_id_arr; (void) msg_ref;
2693 case LDKMessageSendEvent_SendFundingCreated: {
2694 int8_tArray node_id_arr = init_int8_tArray(33);
2695 memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
2696 LDKFundingCreated msg_var = obj->send_funding_created.msg;
2697 uint64_t msg_ref = 0;
2698 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2699 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2700 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2701 msg_ref = (uint64_t)msg_var.inner & ~1;
2702 return 0 /* LDKMessageSendEvent - SendFundingCreated */; (void) node_id_arr; (void) msg_ref;
2704 case LDKMessageSendEvent_SendFundingSigned: {
2705 int8_tArray node_id_arr = init_int8_tArray(33);
2706 memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
2707 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
2708 uint64_t msg_ref = 0;
2709 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2710 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2711 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2712 msg_ref = (uint64_t)msg_var.inner & ~1;
2713 return 0 /* LDKMessageSendEvent - SendFundingSigned */; (void) node_id_arr; (void) msg_ref;
2715 case LDKMessageSendEvent_SendFundingLocked: {
2716 int8_tArray node_id_arr = init_int8_tArray(33);
2717 memcpy(node_id_arr->elems, obj->send_funding_locked.node_id.compressed_form, 33);
2718 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
2719 uint64_t msg_ref = 0;
2720 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2721 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2722 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2723 msg_ref = (uint64_t)msg_var.inner & ~1;
2724 return 0 /* LDKMessageSendEvent - SendFundingLocked */; (void) node_id_arr; (void) msg_ref;
2726 case LDKMessageSendEvent_SendAnnouncementSignatures: {
2727 int8_tArray node_id_arr = init_int8_tArray(33);
2728 memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
2729 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
2730 uint64_t msg_ref = 0;
2731 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2732 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2733 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2734 msg_ref = (uint64_t)msg_var.inner & ~1;
2735 return 0 /* LDKMessageSendEvent - SendAnnouncementSignatures */; (void) node_id_arr; (void) msg_ref;
2737 case LDKMessageSendEvent_UpdateHTLCs: {
2738 int8_tArray node_id_arr = init_int8_tArray(33);
2739 memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
2740 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
2741 uint64_t updates_ref = 0;
2742 CHECK((((uint64_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2743 CHECK((((uint64_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2744 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
2745 updates_ref = (uint64_t)updates_var.inner & ~1;
2746 return 0 /* LDKMessageSendEvent - UpdateHTLCs */; (void) node_id_arr; (void) updates_ref;
2748 case LDKMessageSendEvent_SendRevokeAndACK: {
2749 int8_tArray node_id_arr = init_int8_tArray(33);
2750 memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
2751 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
2752 uint64_t msg_ref = 0;
2753 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2754 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2755 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2756 msg_ref = (uint64_t)msg_var.inner & ~1;
2757 return 0 /* LDKMessageSendEvent - SendRevokeAndACK */; (void) node_id_arr; (void) msg_ref;
2759 case LDKMessageSendEvent_SendClosingSigned: {
2760 int8_tArray node_id_arr = init_int8_tArray(33);
2761 memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
2762 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
2763 uint64_t msg_ref = 0;
2764 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2765 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2766 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2767 msg_ref = (uint64_t)msg_var.inner & ~1;
2768 return 0 /* LDKMessageSendEvent - SendClosingSigned */; (void) node_id_arr; (void) msg_ref;
2770 case LDKMessageSendEvent_SendShutdown: {
2771 int8_tArray node_id_arr = init_int8_tArray(33);
2772 memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
2773 LDKShutdown msg_var = obj->send_shutdown.msg;
2774 uint64_t msg_ref = 0;
2775 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2776 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2777 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2778 msg_ref = (uint64_t)msg_var.inner & ~1;
2779 return 0 /* LDKMessageSendEvent - SendShutdown */; (void) node_id_arr; (void) msg_ref;
2781 case LDKMessageSendEvent_SendChannelReestablish: {
2782 int8_tArray node_id_arr = init_int8_tArray(33);
2783 memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
2784 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
2785 uint64_t msg_ref = 0;
2786 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2787 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2788 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2789 msg_ref = (uint64_t)msg_var.inner & ~1;
2790 return 0 /* LDKMessageSendEvent - SendChannelReestablish */; (void) node_id_arr; (void) msg_ref;
2792 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
2793 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
2794 uint64_t msg_ref = 0;
2795 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2796 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2797 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2798 msg_ref = (uint64_t)msg_var.inner & ~1;
2799 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
2800 uint64_t update_msg_ref = 0;
2801 CHECK((((uint64_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2802 CHECK((((uint64_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2803 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
2804 update_msg_ref = (uint64_t)update_msg_var.inner & ~1;
2805 return 0 /* LDKMessageSendEvent - BroadcastChannelAnnouncement */; (void) msg_ref; (void) update_msg_ref;
2807 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
2808 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
2809 uint64_t msg_ref = 0;
2810 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2811 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2812 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2813 msg_ref = (uint64_t)msg_var.inner & ~1;
2814 return 0 /* LDKMessageSendEvent - BroadcastNodeAnnouncement */; (void) msg_ref;
2816 case LDKMessageSendEvent_BroadcastChannelUpdate: {
2817 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
2818 uint64_t msg_ref = 0;
2819 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2820 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2821 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2822 msg_ref = (uint64_t)msg_var.inner & ~1;
2823 return 0 /* LDKMessageSendEvent - BroadcastChannelUpdate */; (void) msg_ref;
2825 case LDKMessageSendEvent_SendChannelUpdate: {
2826 int8_tArray node_id_arr = init_int8_tArray(33);
2827 memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
2828 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
2829 uint64_t msg_ref = 0;
2830 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2831 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2832 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2833 msg_ref = (uint64_t)msg_var.inner & ~1;
2834 return 0 /* LDKMessageSendEvent - SendChannelUpdate */; (void) node_id_arr; (void) msg_ref;
2836 case LDKMessageSendEvent_HandleError: {
2837 int8_tArray node_id_arr = init_int8_tArray(33);
2838 memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
2839 uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
2840 return 0 /* LDKMessageSendEvent - HandleError */; (void) node_id_arr; (void) action_ref;
2842 case LDKMessageSendEvent_SendChannelRangeQuery: {
2843 int8_tArray node_id_arr = init_int8_tArray(33);
2844 memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
2845 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
2846 uint64_t msg_ref = 0;
2847 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2848 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2849 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2850 msg_ref = (uint64_t)msg_var.inner & ~1;
2851 return 0 /* LDKMessageSendEvent - SendChannelRangeQuery */; (void) node_id_arr; (void) msg_ref;
2853 case LDKMessageSendEvent_SendShortIdsQuery: {
2854 int8_tArray node_id_arr = init_int8_tArray(33);
2855 memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
2856 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
2857 uint64_t msg_ref = 0;
2858 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2859 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2860 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2861 msg_ref = (uint64_t)msg_var.inner & ~1;
2862 return 0 /* LDKMessageSendEvent - SendShortIdsQuery */; (void) node_id_arr; (void) msg_ref;
2864 case LDKMessageSendEvent_SendReplyChannelRange: {
2865 int8_tArray node_id_arr = init_int8_tArray(33);
2866 memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
2867 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
2868 uint64_t msg_ref = 0;
2869 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2870 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2871 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2872 msg_ref = (uint64_t)msg_var.inner & ~1;
2873 return 0 /* LDKMessageSendEvent - SendReplyChannelRange */; (void) node_id_arr; (void) msg_ref;
2878 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
2879 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
2880 for (size_t i = 0; i < ret.datalen; i++) {
2881 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
2885 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
2886 CHECK(owner->result_ok);
2887 return *owner->contents.result;
2889 jboolean __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_get_ok(uint32_t owner) {
2890 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
2891 jboolean ret_val = CResult_boolLightningErrorZ_get_ok(owner_conv);
2895 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
2896 CHECK(!owner->result_ok);
2897 return LightningError_clone(&*owner->contents.err);
2899 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_get_err(uint32_t owner) {
2900 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
2901 LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
2902 uint64_t ret_ref = 0;
2903 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2904 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2905 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2906 ret_ref = (uint64_t)ret_var.inner;
2907 if (ret_var.is_owned) {
2913 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
2914 return ChannelAnnouncement_clone(&owner->a);
2916 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint32_t owner) {
2917 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
2918 LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
2919 uint64_t ret_ref = 0;
2920 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2921 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2922 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2923 ret_ref = (uint64_t)ret_var.inner;
2924 if (ret_var.is_owned) {
2930 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
2931 return ChannelUpdate_clone(&owner->b);
2933 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint32_t owner) {
2934 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
2935 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
2936 uint64_t ret_ref = 0;
2937 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2938 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2939 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2940 ret_ref = (uint64_t)ret_var.inner;
2941 if (ret_var.is_owned) {
2947 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
2948 return ChannelUpdate_clone(&owner->c);
2950 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint32_t owner) {
2951 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
2952 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
2953 uint64_t ret_ref = 0;
2954 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2955 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2956 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2957 ret_ref = (uint64_t)ret_var.inner;
2958 if (ret_var.is_owned) {
2964 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
2965 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
2966 for (size_t i = 0; i < ret.datalen; i++) {
2967 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
2971 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
2972 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
2973 for (size_t i = 0; i < ret.datalen; i++) {
2974 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
2978 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
2979 CHECK(owner->result_ok);
2980 return CVec_u8Z_clone(&*owner->contents.result);
2982 int8_tArray __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint32_t owner) {
2983 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
2984 LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
2985 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
2986 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2987 CVec_u8Z_free(ret_var);
2991 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
2992 CHECK(!owner->result_ok);
2993 return PeerHandleError_clone(&*owner->contents.err);
2995 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err(uint32_t owner) {
2996 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
2997 LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
2998 uint64_t ret_ref = 0;
2999 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3000 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3001 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3002 ret_ref = (uint64_t)ret_var.inner;
3003 if (ret_var.is_owned) {
3009 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
3010 CHECK(owner->result_ok);
3011 return *owner->contents.result;
3013 void __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_get_ok(uint32_t owner) {
3014 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
3015 CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
3018 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
3019 CHECK(!owner->result_ok);
3020 return PeerHandleError_clone(&*owner->contents.err);
3022 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_get_err(uint32_t owner) {
3023 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
3024 LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
3025 uint64_t ret_ref = 0;
3026 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3027 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3028 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3029 ret_ref = (uint64_t)ret_var.inner;
3030 if (ret_var.is_owned) {
3036 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
3037 CHECK(owner->result_ok);
3038 return *owner->contents.result;
3040 jboolean __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_get_ok(uint32_t owner) {
3041 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
3042 jboolean ret_val = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
3046 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
3047 CHECK(!owner->result_ok);
3048 return PeerHandleError_clone(&*owner->contents.err);
3050 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_get_err(uint32_t owner) {
3051 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
3052 LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
3053 uint64_t ret_ref = 0;
3054 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3055 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3056 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3057 ret_ref = (uint64_t)ret_var.inner;
3058 if (ret_var.is_owned) {
3064 static inline struct LDKTxOut CResult_TxOutAccessErrorZ_get_ok(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
3065 CHECK(owner->result_ok);
3066 return TxOut_clone(&*owner->contents.result);
3068 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_get_ok(uint32_t owner) {
3069 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
3070 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
3071 *ret_ref = CResult_TxOutAccessErrorZ_get_ok(owner_conv);
3072 return (uint64_t)ret_ref;
3075 static inline enum LDKAccessError CResult_TxOutAccessErrorZ_get_err(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
3076 CHECK(!owner->result_ok);
3077 return AccessError_clone(&*owner->contents.err);
3079 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_get_err(uint32_t owner) {
3080 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
3081 uint32_t ret_conv = LDKAccessError_to_js(CResult_TxOutAccessErrorZ_get_err(owner_conv));
3085 static inline void CResult_NoneChannelMonitorUpdateErrZ_get_ok(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
3086 CHECK(owner->result_ok);
3087 return *owner->contents.result;
3089 void __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_get_ok(uint32_t owner) {
3090 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
3091 CResult_NoneChannelMonitorUpdateErrZ_get_ok(owner_conv);
3094 static inline enum LDKChannelMonitorUpdateErr CResult_NoneChannelMonitorUpdateErrZ_get_err(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
3095 CHECK(!owner->result_ok);
3096 return ChannelMonitorUpdateErr_clone(&*owner->contents.err);
3098 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_get_err(uint32_t owner) {
3099 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
3100 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(CResult_NoneChannelMonitorUpdateErrZ_get_err(owner_conv));
3104 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_ref_from_ptr(uint32_t ptr) {
3105 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
3107 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
3108 LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
3109 *some_conv = obj->some;
3110 *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
3111 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - Some */; (void) ((uint64_t)some_conv);
3113 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
3114 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - None */;
3119 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_ClosureReasonZ_ref_from_ptr(uint32_t ptr) {
3120 LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)(ptr & ~1);
3122 case LDKCOption_ClosureReasonZ_Some: {
3123 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
3124 return 0 /* LDKCOption_ClosureReasonZ - Some */; (void) some_ref;
3126 case LDKCOption_ClosureReasonZ_None: {
3127 return 0 /* LDKCOption_ClosureReasonZ - None */;
3132 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
3133 CHECK(owner->result_ok);
3134 return COption_ClosureReasonZ_clone(&*owner->contents.result);
3136 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint32_t owner) {
3137 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
3138 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
3139 *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
3140 uint64_t ret_ref = (uint64_t)ret_copy;
3144 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
3145 CHECK(!owner->result_ok);
3146 return DecodeError_clone(&*owner->contents.err);
3148 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint32_t owner) {
3149 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
3150 LDKDecodeError ret_var = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
3151 uint64_t ret_ref = 0;
3152 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3153 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3154 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3155 ret_ref = (uint64_t)ret_var.inner;
3156 if (ret_var.is_owned) {
3162 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_EventZ_ref_from_ptr(uint32_t ptr) {
3163 LDKCOption_EventZ *obj = (LDKCOption_EventZ*)(ptr & ~1);
3165 case LDKCOption_EventZ_Some: {
3166 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
3167 return 0 /* LDKCOption_EventZ - Some */; (void) some_ref;
3169 case LDKCOption_EventZ_None: {
3170 return 0 /* LDKCOption_EventZ - None */;
3175 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
3176 CHECK(owner->result_ok);
3177 return COption_EventZ_clone(&*owner->contents.result);
3179 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_get_ok(uint32_t owner) {
3180 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
3181 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
3182 *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
3183 uint64_t ret_ref = (uint64_t)ret_copy;
3187 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
3188 CHECK(!owner->result_ok);
3189 return DecodeError_clone(&*owner->contents.err);
3191 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_get_err(uint32_t owner) {
3192 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
3193 LDKDecodeError ret_var = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
3194 uint64_t ret_ref = 0;
3195 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3196 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3197 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3198 ret_ref = (uint64_t)ret_var.inner;
3199 if (ret_var.is_owned) {
3205 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3206 CHECK(owner->result_ok);
3207 return NodeId_clone(&*owner->contents.result);
3209 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_get_ok(uint32_t owner) {
3210 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
3211 LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
3212 uint64_t ret_ref = 0;
3213 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3214 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3215 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3216 ret_ref = (uint64_t)ret_var.inner;
3217 if (ret_var.is_owned) {
3223 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3224 CHECK(!owner->result_ok);
3225 return DecodeError_clone(&*owner->contents.err);
3227 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_get_err(uint32_t owner) {
3228 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
3229 LDKDecodeError ret_var = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
3230 uint64_t ret_ref = 0;
3231 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3232 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3233 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3234 ret_ref = (uint64_t)ret_var.inner;
3235 if (ret_var.is_owned) {
3241 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3242 CHECK(owner->result_ok);
3243 return COption_NetworkUpdateZ_clone(&*owner->contents.result);
3245 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint32_t owner) {
3246 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
3247 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
3248 *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
3249 uint64_t ret_ref = (uint64_t)ret_copy;
3253 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3254 CHECK(!owner->result_ok);
3255 return DecodeError_clone(&*owner->contents.err);
3257 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint32_t owner) {
3258 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
3259 LDKDecodeError ret_var = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
3260 uint64_t ret_ref = 0;
3261 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3262 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3263 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3264 ret_ref = (uint64_t)ret_var.inner;
3265 if (ret_var.is_owned) {
3271 typedef struct LDKAccess_JCalls {
3272 atomic_size_t refcnt;
3273 uint32_t get_utxo_meth;
3275 static void LDKAccess_JCalls_free(void* this_arg) {
3276 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3277 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3278 js_free_function_ptr(j_calls->get_utxo_meth);
3282 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
3283 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3284 int8_tArray genesis_hash_arr = init_int8_tArray(32);
3285 memcpy(genesis_hash_arr->elems, *genesis_hash, 32);
3286 uint32_t ret = js_invoke_function_2(j_calls->get_utxo_meth, (uint32_t)genesis_hash_arr, (uint32_t)short_channel_id);
3287 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
3288 CHECK_ACCESS(ret_ptr);
3289 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
3293 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
3294 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
3295 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3297 static inline LDKAccess LDKAccess_init (/*TODO: JS Object Reference */void* o) {
3298 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
3299 atomic_init(&calls->refcnt, 1);
3300 //TODO: Assign calls->o from o
3303 .this_arg = (void*) calls,
3304 .get_utxo = get_utxo_LDKAccess_jcall,
3305 .free = LDKAccess_JCalls_free,
3309 long __attribute__((visibility("default"))) TS_LDKAccess_new(/*TODO: JS Object Reference */void* o) {
3310 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
3311 *res_ptr = LDKAccess_init(o);
3312 return (long)res_ptr;
3314 uint32_t __attribute__((visibility("default"))) TS_Access_get_utxo(uint32_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
3315 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3316 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3317 LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
3318 unsigned char genesis_hash_arr[32];
3319 CHECK(genesis_hash->arr_len == 32);
3320 memcpy(genesis_hash_arr, genesis_hash->elems, 32);
3321 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
3322 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
3323 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
3324 return (uint64_t)ret_conv;
3327 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_AccessZ_ref_from_ptr(uint32_t ptr) {
3328 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
3330 case LDKCOption_AccessZ_Some: {
3331 LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
3332 *some_ret = obj->some;
3333 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
3334 return 0 /* LDKCOption_AccessZ - Some */; (void) (uint64_t)some_ret;
3336 case LDKCOption_AccessZ_None: {
3337 return 0 /* LDKCOption_AccessZ - None */;
3342 static inline struct LDKDirectionalChannelInfo CResult_DirectionalChannelInfoDecodeErrorZ_get_ok(LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3343 CHECK(owner->result_ok);
3344 return DirectionalChannelInfo_clone(&*owner->contents.result);
3346 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_get_ok(uint32_t owner) {
3347 LDKCResult_DirectionalChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(owner & ~1);
3348 LDKDirectionalChannelInfo ret_var = CResult_DirectionalChannelInfoDecodeErrorZ_get_ok(owner_conv);
3349 uint64_t ret_ref = 0;
3350 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3351 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3352 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3353 ret_ref = (uint64_t)ret_var.inner;
3354 if (ret_var.is_owned) {
3360 static inline struct LDKDecodeError CResult_DirectionalChannelInfoDecodeErrorZ_get_err(LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3361 CHECK(!owner->result_ok);
3362 return DecodeError_clone(&*owner->contents.err);
3364 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_get_err(uint32_t owner) {
3365 LDKCResult_DirectionalChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(owner & ~1);
3366 LDKDecodeError ret_var = CResult_DirectionalChannelInfoDecodeErrorZ_get_err(owner_conv);
3367 uint64_t ret_ref = 0;
3368 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3369 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3370 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3371 ret_ref = (uint64_t)ret_var.inner;
3372 if (ret_var.is_owned) {
3378 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3379 CHECK(owner->result_ok);
3380 return ChannelInfo_clone(&*owner->contents.result);
3382 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_get_ok(uint32_t owner) {
3383 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
3384 LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
3385 uint64_t ret_ref = 0;
3386 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3387 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3388 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3389 ret_ref = (uint64_t)ret_var.inner;
3390 if (ret_var.is_owned) {
3396 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3397 CHECK(!owner->result_ok);
3398 return DecodeError_clone(&*owner->contents.err);
3400 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_get_err(uint32_t owner) {
3401 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
3402 LDKDecodeError ret_var = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
3403 uint64_t ret_ref = 0;
3404 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3405 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3406 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3407 ret_ref = (uint64_t)ret_var.inner;
3408 if (ret_var.is_owned) {
3414 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3415 CHECK(owner->result_ok);
3416 return RoutingFees_clone(&*owner->contents.result);
3418 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_get_ok(uint32_t owner) {
3419 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
3420 LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
3421 uint64_t ret_ref = 0;
3422 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3423 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3424 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3425 ret_ref = (uint64_t)ret_var.inner;
3426 if (ret_var.is_owned) {
3432 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3433 CHECK(!owner->result_ok);
3434 return DecodeError_clone(&*owner->contents.err);
3436 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_get_err(uint32_t owner) {
3437 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
3438 LDKDecodeError ret_var = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
3439 uint64_t ret_ref = 0;
3440 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3441 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3442 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3443 ret_ref = (uint64_t)ret_var.inner;
3444 if (ret_var.is_owned) {
3450 uint32_t __attribute__((visibility("default"))) TS_LDKNetAddress_ref_from_ptr(uint32_t ptr) {
3451 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3453 case LDKNetAddress_IPv4: {
3454 int8_tArray addr_arr = init_int8_tArray(4);
3455 memcpy(addr_arr->elems, obj->i_pv4.addr.data, 4);
3456 return 0 /* LDKNetAddress - IPv4 */; (void) addr_arr; (void) obj->i_pv4.port;
3458 case LDKNetAddress_IPv6: {
3459 int8_tArray addr_arr = init_int8_tArray(16);
3460 memcpy(addr_arr->elems, obj->i_pv6.addr.data, 16);
3461 return 0 /* LDKNetAddress - IPv6 */; (void) addr_arr; (void) obj->i_pv6.port;
3463 case LDKNetAddress_OnionV2: {
3464 int8_tArray onion_v2_arr = init_int8_tArray(12);
3465 memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
3466 return 0 /* LDKNetAddress - OnionV2 */; (void) onion_v2_arr;
3468 case LDKNetAddress_OnionV3: {
3469 int8_tArray ed25519_pubkey_arr = init_int8_tArray(32);
3470 memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
3471 return 0 /* LDKNetAddress - OnionV3 */; (void) ed25519_pubkey_arr; (void) obj->onion_v3.checksum; (void) obj->onion_v3.version; (void) obj->onion_v3.port;
3476 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3477 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3478 for (size_t i = 0; i < ret.datalen; i++) {
3479 ret.data[i] = NetAddress_clone(&orig->data[i]);
3483 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3484 CHECK(owner->result_ok);
3485 return NodeAnnouncementInfo_clone(&*owner->contents.result);
3487 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint32_t owner) {
3488 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
3489 LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
3490 uint64_t ret_ref = 0;
3491 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3492 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3493 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3494 ret_ref = (uint64_t)ret_var.inner;
3495 if (ret_var.is_owned) {
3501 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3502 CHECK(!owner->result_ok);
3503 return DecodeError_clone(&*owner->contents.err);
3505 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint32_t owner) {
3506 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
3507 LDKDecodeError ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
3508 uint64_t ret_ref = 0;
3509 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3510 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3511 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3512 ret_ref = (uint64_t)ret_var.inner;
3513 if (ret_var.is_owned) {
3519 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
3520 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
3521 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
3524 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3525 CHECK(owner->result_ok);
3526 return NodeInfo_clone(&*owner->contents.result);
3528 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_get_ok(uint32_t owner) {
3529 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
3530 LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
3531 uint64_t ret_ref = 0;
3532 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3533 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3534 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3535 ret_ref = (uint64_t)ret_var.inner;
3536 if (ret_var.is_owned) {
3542 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3543 CHECK(!owner->result_ok);
3544 return DecodeError_clone(&*owner->contents.err);
3546 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_get_err(uint32_t owner) {
3547 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
3548 LDKDecodeError ret_var = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
3549 uint64_t ret_ref = 0;
3550 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3551 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3552 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3553 ret_ref = (uint64_t)ret_var.inner;
3554 if (ret_var.is_owned) {
3560 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3561 CHECK(owner->result_ok);
3562 return NetworkGraph_clone(&*owner->contents.result);
3564 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_get_ok(uint32_t owner) {
3565 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
3566 LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
3567 uint64_t ret_ref = 0;
3568 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3569 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3570 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3571 ret_ref = (uint64_t)ret_var.inner;
3572 if (ret_var.is_owned) {
3578 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3579 CHECK(!owner->result_ok);
3580 return DecodeError_clone(&*owner->contents.err);
3582 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_get_err(uint32_t owner) {
3583 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
3584 LDKDecodeError ret_var = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
3585 uint64_t ret_ref = 0;
3586 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3587 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3588 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3589 ret_ref = (uint64_t)ret_var.inner;
3590 if (ret_var.is_owned) {
3596 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_CVec_NetAddressZZ_ref_from_ptr(uint32_t ptr) {
3597 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
3599 case LDKCOption_CVec_NetAddressZZ_Some: {
3600 LDKCVec_NetAddressZ some_var = obj->some;
3601 uint32_tArray some_arr = NULL;
3602 some_arr = init_uint32_tArray(some_var.datalen);
3603 uint32_t *some_arr_ptr = (uint32_t*)(some_arr + 4);
3604 for (size_t m = 0; m < some_var.datalen; m++) {
3605 uint64_t some_conv_12_ref = ((uint64_t)&some_var.data[m]) | 1;
3606 some_arr_ptr[m] = some_conv_12_ref;
3609 return 0 /* LDKCOption_CVec_NetAddressZZ - Some */; (void) some_arr;
3611 case LDKCOption_CVec_NetAddressZZ_None: {
3612 return 0 /* LDKCOption_CVec_NetAddressZZ - None */;
3617 static inline struct LDKScoringParameters *CResult_ScoringParametersDecodeErrorZ_get_ok(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR owner){
3618 CHECK(owner->result_ok);
3619 return &*owner->contents.result;
3621 uint32_t __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_get_ok(uint32_t owner) {
3622 LDKCResult_ScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(owner & ~1);
3623 LDKScoringParameters ret_var = *CResult_ScoringParametersDecodeErrorZ_get_ok(owner_conv);
3624 uint64_t ret_ref = 0;
3625 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3626 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3627 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3628 ret_ref = (uint64_t)ret_var.inner & ~1;
3632 static inline struct LDKDecodeError CResult_ScoringParametersDecodeErrorZ_get_err(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR owner){
3633 CHECK(!owner->result_ok);
3634 return DecodeError_clone(&*owner->contents.err);
3636 uint32_t __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_get_err(uint32_t owner) {
3637 LDKCResult_ScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(owner & ~1);
3638 LDKDecodeError ret_var = CResult_ScoringParametersDecodeErrorZ_get_err(owner_conv);
3639 uint64_t ret_ref = 0;
3640 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3641 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3642 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3643 ret_ref = (uint64_t)ret_var.inner;
3644 if (ret_var.is_owned) {
3650 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3651 CHECK(owner->result_ok);
3652 return InitFeatures_clone(&*owner->contents.result);
3654 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
3655 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
3656 LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
3657 uint64_t ret_ref = 0;
3658 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3659 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3660 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3661 ret_ref = (uint64_t)ret_var.inner;
3662 if (ret_var.is_owned) {
3668 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3669 CHECK(!owner->result_ok);
3670 return DecodeError_clone(&*owner->contents.err);
3672 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_get_err(uint32_t owner) {
3673 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
3674 LDKDecodeError ret_var = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
3675 uint64_t ret_ref = 0;
3676 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3677 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3678 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3679 ret_ref = (uint64_t)ret_var.inner;
3680 if (ret_var.is_owned) {
3686 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3687 CHECK(owner->result_ok);
3688 return ChannelFeatures_clone(&*owner->contents.result);
3690 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
3691 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
3692 LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
3693 uint64_t ret_ref = 0;
3694 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3695 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3696 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3697 ret_ref = (uint64_t)ret_var.inner;
3698 if (ret_var.is_owned) {
3704 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3705 CHECK(!owner->result_ok);
3706 return DecodeError_clone(&*owner->contents.err);
3708 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_err(uint32_t owner) {
3709 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
3710 LDKDecodeError ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
3711 uint64_t ret_ref = 0;
3712 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3713 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3714 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3715 ret_ref = (uint64_t)ret_var.inner;
3716 if (ret_var.is_owned) {
3722 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3723 CHECK(owner->result_ok);
3724 return NodeFeatures_clone(&*owner->contents.result);
3726 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
3727 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
3728 LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
3729 uint64_t ret_ref = 0;
3730 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3731 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3732 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3733 ret_ref = (uint64_t)ret_var.inner;
3734 if (ret_var.is_owned) {
3740 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3741 CHECK(!owner->result_ok);
3742 return DecodeError_clone(&*owner->contents.err);
3744 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_err(uint32_t owner) {
3745 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
3746 LDKDecodeError ret_var = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
3747 uint64_t ret_ref = 0;
3748 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3749 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3750 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3751 ret_ref = (uint64_t)ret_var.inner;
3752 if (ret_var.is_owned) {
3758 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3759 CHECK(owner->result_ok);
3760 return InvoiceFeatures_clone(&*owner->contents.result);
3762 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
3763 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
3764 LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3765 uint64_t ret_ref = 0;
3766 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3767 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3768 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3769 ret_ref = (uint64_t)ret_var.inner;
3770 if (ret_var.is_owned) {
3776 static inline struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3777 CHECK(!owner->result_ok);
3778 return DecodeError_clone(&*owner->contents.err);
3780 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err(uint32_t owner) {
3781 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
3782 LDKDecodeError ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3783 uint64_t ret_ref = 0;
3784 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3785 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3786 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3787 ret_ref = (uint64_t)ret_var.inner;
3788 if (ret_var.is_owned) {
3794 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3795 CHECK(owner->result_ok);
3796 return ChannelTypeFeatures_clone(&*owner->contents.result);
3798 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
3799 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
3800 LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
3801 uint64_t ret_ref = 0;
3802 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3803 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3804 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3805 ret_ref = (uint64_t)ret_var.inner;
3806 if (ret_var.is_owned) {
3812 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3813 CHECK(!owner->result_ok);
3814 return DecodeError_clone(&*owner->contents.err);
3816 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint32_t owner) {
3817 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
3818 LDKDecodeError ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
3819 uint64_t ret_ref = 0;
3820 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3821 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3822 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3823 ret_ref = (uint64_t)ret_var.inner;
3824 if (ret_var.is_owned) {
3830 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
3831 CHECK(owner->result_ok);
3832 return NetAddress_clone(&*owner->contents.result);
3834 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_get_ok(uint32_t owner) {
3835 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
3836 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
3837 *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
3838 uint64_t ret_ref = (uint64_t)ret_copy;
3842 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
3843 CHECK(!owner->result_ok);
3844 return DecodeError_clone(&*owner->contents.err);
3846 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_get_err(uint32_t owner) {
3847 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
3848 LDKDecodeError ret_var = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
3849 uint64_t ret_ref = 0;
3850 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3851 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3852 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3853 ret_ref = (uint64_t)ret_var.inner;
3854 if (ret_var.is_owned) {
3860 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
3861 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
3862 for (size_t i = 0; i < ret.datalen; i++) {
3863 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
3867 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
3868 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
3869 for (size_t i = 0; i < ret.datalen; i++) {
3870 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
3874 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
3875 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
3876 for (size_t i = 0; i < ret.datalen; i++) {
3877 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
3881 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
3882 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
3883 for (size_t i = 0; i < ret.datalen; i++) {
3884 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
3888 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
3889 CHECK(owner->result_ok);
3890 return AcceptChannel_clone(&*owner->contents.result);
3892 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint32_t owner) {
3893 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
3894 LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
3895 uint64_t ret_ref = 0;
3896 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3897 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3898 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3899 ret_ref = (uint64_t)ret_var.inner;
3900 if (ret_var.is_owned) {
3906 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
3907 CHECK(!owner->result_ok);
3908 return DecodeError_clone(&*owner->contents.err);
3910 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint32_t owner) {
3911 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
3912 LDKDecodeError ret_var = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
3913 uint64_t ret_ref = 0;
3914 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3915 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3916 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3917 ret_ref = (uint64_t)ret_var.inner;
3918 if (ret_var.is_owned) {
3924 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
3925 CHECK(owner->result_ok);
3926 return AnnouncementSignatures_clone(&*owner->contents.result);
3928 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint32_t owner) {
3929 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
3930 LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
3931 uint64_t ret_ref = 0;
3932 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3933 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3934 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3935 ret_ref = (uint64_t)ret_var.inner;
3936 if (ret_var.is_owned) {
3942 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
3943 CHECK(!owner->result_ok);
3944 return DecodeError_clone(&*owner->contents.err);
3946 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint32_t owner) {
3947 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
3948 LDKDecodeError ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
3949 uint64_t ret_ref = 0;
3950 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3951 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3952 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3953 ret_ref = (uint64_t)ret_var.inner;
3954 if (ret_var.is_owned) {
3960 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
3961 CHECK(owner->result_ok);
3962 return ChannelReestablish_clone(&*owner->contents.result);
3964 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint32_t owner) {
3965 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
3966 LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
3967 uint64_t ret_ref = 0;
3968 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3969 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3970 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3971 ret_ref = (uint64_t)ret_var.inner;
3972 if (ret_var.is_owned) {
3978 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
3979 CHECK(!owner->result_ok);
3980 return DecodeError_clone(&*owner->contents.err);
3982 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint32_t owner) {
3983 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
3984 LDKDecodeError ret_var = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
3985 uint64_t ret_ref = 0;
3986 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3987 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3988 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3989 ret_ref = (uint64_t)ret_var.inner;
3990 if (ret_var.is_owned) {
3996 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
3997 CHECK(owner->result_ok);
3998 return ClosingSigned_clone(&*owner->contents.result);
4000 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint32_t owner) {
4001 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
4002 LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
4003 uint64_t ret_ref = 0;
4004 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4005 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4006 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4007 ret_ref = (uint64_t)ret_var.inner;
4008 if (ret_var.is_owned) {
4014 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
4015 CHECK(!owner->result_ok);
4016 return DecodeError_clone(&*owner->contents.err);
4018 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint32_t owner) {
4019 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
4020 LDKDecodeError ret_var = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
4021 uint64_t ret_ref = 0;
4022 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4023 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4024 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4025 ret_ref = (uint64_t)ret_var.inner;
4026 if (ret_var.is_owned) {
4032 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
4033 CHECK(owner->result_ok);
4034 return ClosingSignedFeeRange_clone(&*owner->contents.result);
4036 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint32_t owner) {
4037 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
4038 LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
4039 uint64_t ret_ref = 0;
4040 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4041 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4042 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4043 ret_ref = (uint64_t)ret_var.inner;
4044 if (ret_var.is_owned) {
4050 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
4051 CHECK(!owner->result_ok);
4052 return DecodeError_clone(&*owner->contents.err);
4054 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint32_t owner) {
4055 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
4056 LDKDecodeError ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
4057 uint64_t ret_ref = 0;
4058 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4059 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4060 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4061 ret_ref = (uint64_t)ret_var.inner;
4062 if (ret_var.is_owned) {
4068 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
4069 CHECK(owner->result_ok);
4070 return CommitmentSigned_clone(&*owner->contents.result);
4072 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_ok(uint32_t owner) {
4073 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
4074 LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
4075 uint64_t ret_ref = 0;
4076 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4077 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4078 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4079 ret_ref = (uint64_t)ret_var.inner;
4080 if (ret_var.is_owned) {
4086 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
4087 CHECK(!owner->result_ok);
4088 return DecodeError_clone(&*owner->contents.err);
4090 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_err(uint32_t owner) {
4091 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
4092 LDKDecodeError ret_var = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
4093 uint64_t ret_ref = 0;
4094 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4095 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4096 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4097 ret_ref = (uint64_t)ret_var.inner;
4098 if (ret_var.is_owned) {
4104 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
4105 CHECK(owner->result_ok);
4106 return FundingCreated_clone(&*owner->contents.result);
4108 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_get_ok(uint32_t owner) {
4109 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
4110 LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
4111 uint64_t ret_ref = 0;
4112 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4113 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4114 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4115 ret_ref = (uint64_t)ret_var.inner;
4116 if (ret_var.is_owned) {
4122 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
4123 CHECK(!owner->result_ok);
4124 return DecodeError_clone(&*owner->contents.err);
4126 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_get_err(uint32_t owner) {
4127 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
4128 LDKDecodeError ret_var = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
4129 uint64_t ret_ref = 0;
4130 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4131 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4132 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4133 ret_ref = (uint64_t)ret_var.inner;
4134 if (ret_var.is_owned) {
4140 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
4141 CHECK(owner->result_ok);
4142 return FundingSigned_clone(&*owner->contents.result);
4144 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_get_ok(uint32_t owner) {
4145 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
4146 LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
4147 uint64_t ret_ref = 0;
4148 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4149 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4150 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4151 ret_ref = (uint64_t)ret_var.inner;
4152 if (ret_var.is_owned) {
4158 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
4159 CHECK(!owner->result_ok);
4160 return DecodeError_clone(&*owner->contents.err);
4162 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_get_err(uint32_t owner) {
4163 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
4164 LDKDecodeError ret_var = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
4165 uint64_t ret_ref = 0;
4166 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4167 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4168 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4169 ret_ref = (uint64_t)ret_var.inner;
4170 if (ret_var.is_owned) {
4176 static inline struct LDKFundingLocked CResult_FundingLockedDecodeErrorZ_get_ok(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR owner){
4177 CHECK(owner->result_ok);
4178 return FundingLocked_clone(&*owner->contents.result);
4180 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_get_ok(uint32_t owner) {
4181 LDKCResult_FundingLockedDecodeErrorZ* owner_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(owner & ~1);
4182 LDKFundingLocked ret_var = CResult_FundingLockedDecodeErrorZ_get_ok(owner_conv);
4183 uint64_t ret_ref = 0;
4184 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4185 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4186 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4187 ret_ref = (uint64_t)ret_var.inner;
4188 if (ret_var.is_owned) {
4194 static inline struct LDKDecodeError CResult_FundingLockedDecodeErrorZ_get_err(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR owner){
4195 CHECK(!owner->result_ok);
4196 return DecodeError_clone(&*owner->contents.err);
4198 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_get_err(uint32_t owner) {
4199 LDKCResult_FundingLockedDecodeErrorZ* owner_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(owner & ~1);
4200 LDKDecodeError ret_var = CResult_FundingLockedDecodeErrorZ_get_err(owner_conv);
4201 uint64_t ret_ref = 0;
4202 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4203 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4204 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4205 ret_ref = (uint64_t)ret_var.inner;
4206 if (ret_var.is_owned) {
4212 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
4213 CHECK(owner->result_ok);
4214 return Init_clone(&*owner->contents.result);
4216 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_get_ok(uint32_t owner) {
4217 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
4218 LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
4219 uint64_t ret_ref = 0;
4220 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4221 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4222 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4223 ret_ref = (uint64_t)ret_var.inner;
4224 if (ret_var.is_owned) {
4230 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
4231 CHECK(!owner->result_ok);
4232 return DecodeError_clone(&*owner->contents.err);
4234 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_get_err(uint32_t owner) {
4235 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
4236 LDKDecodeError ret_var = CResult_InitDecodeErrorZ_get_err(owner_conv);
4237 uint64_t ret_ref = 0;
4238 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4239 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4240 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4241 ret_ref = (uint64_t)ret_var.inner;
4242 if (ret_var.is_owned) {
4248 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
4249 CHECK(owner->result_ok);
4250 return OpenChannel_clone(&*owner->contents.result);
4252 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_get_ok(uint32_t owner) {
4253 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
4254 LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
4255 uint64_t ret_ref = 0;
4256 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4257 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4258 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4259 ret_ref = (uint64_t)ret_var.inner;
4260 if (ret_var.is_owned) {
4266 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
4267 CHECK(!owner->result_ok);
4268 return DecodeError_clone(&*owner->contents.err);
4270 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_get_err(uint32_t owner) {
4271 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
4272 LDKDecodeError ret_var = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
4273 uint64_t ret_ref = 0;
4274 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4275 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4276 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4277 ret_ref = (uint64_t)ret_var.inner;
4278 if (ret_var.is_owned) {
4284 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
4285 CHECK(owner->result_ok);
4286 return RevokeAndACK_clone(&*owner->contents.result);
4288 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_ok(uint32_t owner) {
4289 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
4290 LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
4291 uint64_t ret_ref = 0;
4292 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4293 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4294 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4295 ret_ref = (uint64_t)ret_var.inner;
4296 if (ret_var.is_owned) {
4302 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
4303 CHECK(!owner->result_ok);
4304 return DecodeError_clone(&*owner->contents.err);
4306 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_err(uint32_t owner) {
4307 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
4308 LDKDecodeError ret_var = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
4309 uint64_t ret_ref = 0;
4310 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4311 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4312 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4313 ret_ref = (uint64_t)ret_var.inner;
4314 if (ret_var.is_owned) {
4320 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
4321 CHECK(owner->result_ok);
4322 return Shutdown_clone(&*owner->contents.result);
4324 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_get_ok(uint32_t owner) {
4325 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
4326 LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
4327 uint64_t ret_ref = 0;
4328 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4329 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4330 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4331 ret_ref = (uint64_t)ret_var.inner;
4332 if (ret_var.is_owned) {
4338 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
4339 CHECK(!owner->result_ok);
4340 return DecodeError_clone(&*owner->contents.err);
4342 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_get_err(uint32_t owner) {
4343 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
4344 LDKDecodeError ret_var = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
4345 uint64_t ret_ref = 0;
4346 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4347 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4348 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4349 ret_ref = (uint64_t)ret_var.inner;
4350 if (ret_var.is_owned) {
4356 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
4357 CHECK(owner->result_ok);
4358 return UpdateFailHTLC_clone(&*owner->contents.result);
4360 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint32_t owner) {
4361 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
4362 LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
4363 uint64_t ret_ref = 0;
4364 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4365 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4366 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4367 ret_ref = (uint64_t)ret_var.inner;
4368 if (ret_var.is_owned) {
4374 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
4375 CHECK(!owner->result_ok);
4376 return DecodeError_clone(&*owner->contents.err);
4378 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err(uint32_t owner) {
4379 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
4380 LDKDecodeError ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
4381 uint64_t ret_ref = 0;
4382 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4383 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4384 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4385 ret_ref = (uint64_t)ret_var.inner;
4386 if (ret_var.is_owned) {
4392 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
4393 CHECK(owner->result_ok);
4394 return UpdateFailMalformedHTLC_clone(&*owner->contents.result);
4396 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint32_t owner) {
4397 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
4398 LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
4399 uint64_t ret_ref = 0;
4400 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4401 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4402 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4403 ret_ref = (uint64_t)ret_var.inner;
4404 if (ret_var.is_owned) {
4410 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
4411 CHECK(!owner->result_ok);
4412 return DecodeError_clone(&*owner->contents.err);
4414 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint32_t owner) {
4415 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
4416 LDKDecodeError ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
4417 uint64_t ret_ref = 0;
4418 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4419 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4420 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4421 ret_ref = (uint64_t)ret_var.inner;
4422 if (ret_var.is_owned) {
4428 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
4429 CHECK(owner->result_ok);
4430 return UpdateFee_clone(&*owner->contents.result);
4432 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_get_ok(uint32_t owner) {
4433 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
4434 LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
4435 uint64_t ret_ref = 0;
4436 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4437 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4438 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4439 ret_ref = (uint64_t)ret_var.inner;
4440 if (ret_var.is_owned) {
4446 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
4447 CHECK(!owner->result_ok);
4448 return DecodeError_clone(&*owner->contents.err);
4450 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_get_err(uint32_t owner) {
4451 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
4452 LDKDecodeError ret_var = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
4453 uint64_t ret_ref = 0;
4454 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4455 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4456 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4457 ret_ref = (uint64_t)ret_var.inner;
4458 if (ret_var.is_owned) {
4464 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
4465 CHECK(owner->result_ok);
4466 return UpdateFulfillHTLC_clone(&*owner->contents.result);
4468 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint32_t owner) {
4469 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
4470 LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
4471 uint64_t ret_ref = 0;
4472 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4473 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4474 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4475 ret_ref = (uint64_t)ret_var.inner;
4476 if (ret_var.is_owned) {
4482 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
4483 CHECK(!owner->result_ok);
4484 return DecodeError_clone(&*owner->contents.err);
4486 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint32_t owner) {
4487 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
4488 LDKDecodeError ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
4489 uint64_t ret_ref = 0;
4490 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4491 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4492 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4493 ret_ref = (uint64_t)ret_var.inner;
4494 if (ret_var.is_owned) {
4500 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
4501 CHECK(owner->result_ok);
4502 return UpdateAddHTLC_clone(&*owner->contents.result);
4504 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint32_t owner) {
4505 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
4506 LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
4507 uint64_t ret_ref = 0;
4508 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4509 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4510 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4511 ret_ref = (uint64_t)ret_var.inner;
4512 if (ret_var.is_owned) {
4518 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
4519 CHECK(!owner->result_ok);
4520 return DecodeError_clone(&*owner->contents.err);
4522 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err(uint32_t owner) {
4523 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
4524 LDKDecodeError ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
4525 uint64_t ret_ref = 0;
4526 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4527 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4528 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4529 ret_ref = (uint64_t)ret_var.inner;
4530 if (ret_var.is_owned) {
4536 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
4537 CHECK(owner->result_ok);
4538 return Ping_clone(&*owner->contents.result);
4540 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_get_ok(uint32_t owner) {
4541 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
4542 LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
4543 uint64_t ret_ref = 0;
4544 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4545 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4546 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4547 ret_ref = (uint64_t)ret_var.inner;
4548 if (ret_var.is_owned) {
4554 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
4555 CHECK(!owner->result_ok);
4556 return DecodeError_clone(&*owner->contents.err);
4558 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_get_err(uint32_t owner) {
4559 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
4560 LDKDecodeError ret_var = CResult_PingDecodeErrorZ_get_err(owner_conv);
4561 uint64_t ret_ref = 0;
4562 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4563 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4564 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4565 ret_ref = (uint64_t)ret_var.inner;
4566 if (ret_var.is_owned) {
4572 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
4573 CHECK(owner->result_ok);
4574 return Pong_clone(&*owner->contents.result);
4576 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_get_ok(uint32_t owner) {
4577 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
4578 LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
4579 uint64_t ret_ref = 0;
4580 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4581 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4582 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4583 ret_ref = (uint64_t)ret_var.inner;
4584 if (ret_var.is_owned) {
4590 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
4591 CHECK(!owner->result_ok);
4592 return DecodeError_clone(&*owner->contents.err);
4594 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_get_err(uint32_t owner) {
4595 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
4596 LDKDecodeError ret_var = CResult_PongDecodeErrorZ_get_err(owner_conv);
4597 uint64_t ret_ref = 0;
4598 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4599 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4600 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4601 ret_ref = (uint64_t)ret_var.inner;
4602 if (ret_var.is_owned) {
4608 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
4609 CHECK(owner->result_ok);
4610 return UnsignedChannelAnnouncement_clone(&*owner->contents.result);
4612 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
4613 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
4614 LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
4615 uint64_t ret_ref = 0;
4616 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4617 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4618 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4619 ret_ref = (uint64_t)ret_var.inner;
4620 if (ret_var.is_owned) {
4626 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
4627 CHECK(!owner->result_ok);
4628 return DecodeError_clone(&*owner->contents.err);
4630 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
4631 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
4632 LDKDecodeError ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
4633 uint64_t ret_ref = 0;
4634 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4635 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4636 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4637 ret_ref = (uint64_t)ret_var.inner;
4638 if (ret_var.is_owned) {
4644 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
4645 CHECK(owner->result_ok);
4646 return ChannelAnnouncement_clone(&*owner->contents.result);
4648 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
4649 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
4650 LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
4651 uint64_t ret_ref = 0;
4652 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4653 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4654 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4655 ret_ref = (uint64_t)ret_var.inner;
4656 if (ret_var.is_owned) {
4662 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
4663 CHECK(!owner->result_ok);
4664 return DecodeError_clone(&*owner->contents.err);
4666 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
4667 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
4668 LDKDecodeError ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
4669 uint64_t ret_ref = 0;
4670 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4671 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4672 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4673 ret_ref = (uint64_t)ret_var.inner;
4674 if (ret_var.is_owned) {
4680 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
4681 CHECK(owner->result_ok);
4682 return UnsignedChannelUpdate_clone(&*owner->contents.result);
4684 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint32_t owner) {
4685 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
4686 LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
4687 uint64_t ret_ref = 0;
4688 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4689 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4690 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4691 ret_ref = (uint64_t)ret_var.inner;
4692 if (ret_var.is_owned) {
4698 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
4699 CHECK(!owner->result_ok);
4700 return DecodeError_clone(&*owner->contents.err);
4702 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint32_t owner) {
4703 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
4704 LDKDecodeError ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
4705 uint64_t ret_ref = 0;
4706 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4707 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4708 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4709 ret_ref = (uint64_t)ret_var.inner;
4710 if (ret_var.is_owned) {
4716 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
4717 CHECK(owner->result_ok);
4718 return ChannelUpdate_clone(&*owner->contents.result);
4720 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_ok(uint32_t owner) {
4721 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
4722 LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
4723 uint64_t ret_ref = 0;
4724 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4725 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4726 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4727 ret_ref = (uint64_t)ret_var.inner;
4728 if (ret_var.is_owned) {
4734 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
4735 CHECK(!owner->result_ok);
4736 return DecodeError_clone(&*owner->contents.err);
4738 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_err(uint32_t owner) {
4739 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
4740 LDKDecodeError ret_var = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
4741 uint64_t ret_ref = 0;
4742 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4743 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4744 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4745 ret_ref = (uint64_t)ret_var.inner;
4746 if (ret_var.is_owned) {
4752 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
4753 CHECK(owner->result_ok);
4754 return ErrorMessage_clone(&*owner->contents.result);
4756 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_get_ok(uint32_t owner) {
4757 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
4758 LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
4759 uint64_t ret_ref = 0;
4760 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4761 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4762 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4763 ret_ref = (uint64_t)ret_var.inner;
4764 if (ret_var.is_owned) {
4770 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
4771 CHECK(!owner->result_ok);
4772 return DecodeError_clone(&*owner->contents.err);
4774 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_get_err(uint32_t owner) {
4775 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
4776 LDKDecodeError ret_var = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
4777 uint64_t ret_ref = 0;
4778 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4779 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4780 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4781 ret_ref = (uint64_t)ret_var.inner;
4782 if (ret_var.is_owned) {
4788 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
4789 CHECK(owner->result_ok);
4790 return UnsignedNodeAnnouncement_clone(&*owner->contents.result);
4792 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
4793 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
4794 LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
4795 uint64_t ret_ref = 0;
4796 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4797 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4798 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4799 ret_ref = (uint64_t)ret_var.inner;
4800 if (ret_var.is_owned) {
4806 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
4807 CHECK(!owner->result_ok);
4808 return DecodeError_clone(&*owner->contents.err);
4810 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
4811 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
4812 LDKDecodeError ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
4813 uint64_t ret_ref = 0;
4814 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4815 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4816 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4817 ret_ref = (uint64_t)ret_var.inner;
4818 if (ret_var.is_owned) {
4824 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
4825 CHECK(owner->result_ok);
4826 return NodeAnnouncement_clone(&*owner->contents.result);
4828 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
4829 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
4830 LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
4831 uint64_t ret_ref = 0;
4832 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4833 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4834 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4835 ret_ref = (uint64_t)ret_var.inner;
4836 if (ret_var.is_owned) {
4842 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
4843 CHECK(!owner->result_ok);
4844 return DecodeError_clone(&*owner->contents.err);
4846 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
4847 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
4848 LDKDecodeError ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
4849 uint64_t ret_ref = 0;
4850 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4851 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4852 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4853 ret_ref = (uint64_t)ret_var.inner;
4854 if (ret_var.is_owned) {
4860 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
4861 CHECK(owner->result_ok);
4862 return QueryShortChannelIds_clone(&*owner->contents.result);
4864 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint32_t owner) {
4865 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
4866 LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
4867 uint64_t ret_ref = 0;
4868 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4869 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4870 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4871 ret_ref = (uint64_t)ret_var.inner;
4872 if (ret_var.is_owned) {
4878 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
4879 CHECK(!owner->result_ok);
4880 return DecodeError_clone(&*owner->contents.err);
4882 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint32_t owner) {
4883 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
4884 LDKDecodeError ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
4885 uint64_t ret_ref = 0;
4886 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4887 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4888 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4889 ret_ref = (uint64_t)ret_var.inner;
4890 if (ret_var.is_owned) {
4896 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
4897 CHECK(owner->result_ok);
4898 return ReplyShortChannelIdsEnd_clone(&*owner->contents.result);
4900 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint32_t owner) {
4901 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
4902 LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
4903 uint64_t ret_ref = 0;
4904 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4905 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4906 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4907 ret_ref = (uint64_t)ret_var.inner;
4908 if (ret_var.is_owned) {
4914 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
4915 CHECK(!owner->result_ok);
4916 return DecodeError_clone(&*owner->contents.err);
4918 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint32_t owner) {
4919 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
4920 LDKDecodeError ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
4921 uint64_t ret_ref = 0;
4922 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4923 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4924 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4925 ret_ref = (uint64_t)ret_var.inner;
4926 if (ret_var.is_owned) {
4932 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
4933 CHECK(owner->result_ok);
4934 return QueryChannelRange_clone(&*owner->contents.result);
4936 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok(uint32_t owner) {
4937 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
4938 LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
4939 uint64_t ret_ref = 0;
4940 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4941 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4942 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4943 ret_ref = (uint64_t)ret_var.inner;
4944 if (ret_var.is_owned) {
4950 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
4951 CHECK(!owner->result_ok);
4952 return DecodeError_clone(&*owner->contents.err);
4954 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_err(uint32_t owner) {
4955 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
4956 LDKDecodeError ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
4957 uint64_t ret_ref = 0;
4958 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4959 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4960 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4961 ret_ref = (uint64_t)ret_var.inner;
4962 if (ret_var.is_owned) {
4968 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
4969 CHECK(owner->result_ok);
4970 return ReplyChannelRange_clone(&*owner->contents.result);
4972 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint32_t owner) {
4973 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
4974 LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
4975 uint64_t ret_ref = 0;
4976 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4977 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4978 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4979 ret_ref = (uint64_t)ret_var.inner;
4980 if (ret_var.is_owned) {
4986 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
4987 CHECK(!owner->result_ok);
4988 return DecodeError_clone(&*owner->contents.err);
4990 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err(uint32_t owner) {
4991 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
4992 LDKDecodeError ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
4993 uint64_t ret_ref = 0;
4994 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4995 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4996 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4997 ret_ref = (uint64_t)ret_var.inner;
4998 if (ret_var.is_owned) {
5004 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
5005 CHECK(owner->result_ok);
5006 return GossipTimestampFilter_clone(&*owner->contents.result);
5008 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint32_t owner) {
5009 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
5010 LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
5011 uint64_t ret_ref = 0;
5012 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5013 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5014 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5015 ret_ref = (uint64_t)ret_var.inner;
5016 if (ret_var.is_owned) {
5022 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
5023 CHECK(!owner->result_ok);
5024 return DecodeError_clone(&*owner->contents.err);
5026 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err(uint32_t owner) {
5027 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
5028 LDKDecodeError ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
5029 uint64_t ret_ref = 0;
5030 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5031 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5032 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5033 ret_ref = (uint64_t)ret_var.inner;
5034 if (ret_var.is_owned) {
5040 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
5041 CHECK(owner->result_ok);
5042 return DelayedPaymentOutputDescriptor_clone(&*owner->contents.result);
5044 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t owner) {
5045 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
5046 LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
5047 uint64_t ret_ref = 0;
5048 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5049 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5050 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5051 ret_ref = (uint64_t)ret_var.inner;
5052 if (ret_var.is_owned) {
5058 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
5059 CHECK(!owner->result_ok);
5060 return DecodeError_clone(&*owner->contents.err);
5062 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t owner) {
5063 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
5064 LDKDecodeError ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
5065 uint64_t ret_ref = 0;
5066 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5067 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5068 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5069 ret_ref = (uint64_t)ret_var.inner;
5070 if (ret_var.is_owned) {
5076 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
5077 CHECK(owner->result_ok);
5078 return StaticPaymentOutputDescriptor_clone(&*owner->contents.result);
5080 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t owner) {
5081 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
5082 LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
5083 uint64_t ret_ref = 0;
5084 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5085 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5086 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5087 ret_ref = (uint64_t)ret_var.inner;
5088 if (ret_var.is_owned) {
5094 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
5095 CHECK(!owner->result_ok);
5096 return DecodeError_clone(&*owner->contents.err);
5098 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t owner) {
5099 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
5100 LDKDecodeError ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
5101 uint64_t ret_ref = 0;
5102 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5103 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5104 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5105 ret_ref = (uint64_t)ret_var.inner;
5106 if (ret_var.is_owned) {
5112 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
5113 CHECK(owner->result_ok);
5114 return SpendableOutputDescriptor_clone(&*owner->contents.result);
5116 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint32_t owner) {
5117 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
5118 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
5119 *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
5120 uint64_t ret_ref = (uint64_t)ret_copy;
5124 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
5125 CHECK(!owner->result_ok);
5126 return DecodeError_clone(&*owner->contents.err);
5128 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint32_t owner) {
5129 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
5130 LDKDecodeError ret_var = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
5131 uint64_t ret_ref = 0;
5132 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5133 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5134 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5135 ret_ref = (uint64_t)ret_var.inner;
5136 if (ret_var.is_owned) {
5142 static inline struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
5143 CHECK(owner->result_ok);
5144 return Sign_clone(&*owner->contents.result);
5146 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_get_ok(uint32_t owner) {
5147 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
5148 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
5149 *ret_ret = CResult_SignDecodeErrorZ_get_ok(owner_conv);
5150 return (uint64_t)ret_ret;
5153 static inline struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
5154 CHECK(!owner->result_ok);
5155 return DecodeError_clone(&*owner->contents.err);
5157 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_get_err(uint32_t owner) {
5158 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
5159 LDKDecodeError ret_var = CResult_SignDecodeErrorZ_get_err(owner_conv);
5160 uint64_t ret_ref = 0;
5161 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5162 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5163 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5164 ret_ref = (uint64_t)ret_var.inner;
5165 if (ret_var.is_owned) {
5171 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
5172 CHECK(owner->result_ok);
5173 return *owner->contents.result;
5175 int8_tArray __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint32_t owner) {
5176 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
5177 int8_tArray et_arr = init_int8_tArray(68);
5178 memcpy(et_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
5182 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
5183 CHECK(!owner->result_ok);
5184 return *owner->contents.err;
5186 void __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint32_t owner) {
5187 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
5188 CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
5191 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
5192 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
5193 for (size_t i = 0; i < ret.datalen; i++) {
5194 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
5198 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
5199 CHECK(owner->result_ok);
5200 return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
5202 ptrArray __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok(uint32_t owner) {
5203 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
5204 LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
5205 ptrArray ret_arr = NULL;
5206 ret_arr = init_ptrArray(ret_var.datalen);
5207 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
5208 for (size_t m = 0; m < ret_var.datalen; m++) {
5209 LDKCVec_u8Z ret_conv_12_var = ret_var.data[m];
5210 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen);
5211 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
5212 CVec_u8Z_free(ret_conv_12_var);
5213 ret_arr_ptr[m] = ret_conv_12_arr;
5220 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
5221 CHECK(!owner->result_ok);
5222 return *owner->contents.err;
5224 void __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_err(uint32_t owner) {
5225 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
5226 CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
5229 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
5230 CHECK(owner->result_ok);
5231 return InMemorySigner_clone(&*owner->contents.result);
5233 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_get_ok(uint32_t owner) {
5234 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
5235 LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(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 LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
5248 CHECK(!owner->result_ok);
5249 return DecodeError_clone(&*owner->contents.err);
5251 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_get_err(uint32_t owner) {
5252 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
5253 LDKDecodeError ret_var = CResult_InMemorySignerDecodeErrorZ_get_err(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 LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
5266 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
5267 for (size_t i = 0; i < ret.datalen; i++) {
5268 ret.data[i] = TxOut_clone(&orig->data[i]);
5272 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
5273 CHECK(owner->result_ok);
5274 return *owner->contents.result;
5276 int8_tArray __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_get_ok(uint32_t owner) {
5277 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
5278 LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
5279 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
5280 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5281 Transaction_free(ret_var);
5285 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
5286 CHECK(!owner->result_ok);
5287 return *owner->contents.err;
5289 void __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_get_err(uint32_t owner) {
5290 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
5291 CResult_TransactionNoneZ_get_err(owner_conv);
5294 typedef struct LDKFilter_JCalls {
5295 atomic_size_t refcnt;
5296 uint32_t register_tx_meth;
5297 uint32_t register_output_meth;
5299 static void LDKFilter_JCalls_free(void* this_arg) {
5300 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5301 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5302 js_free_function_ptr(j_calls->register_tx_meth);
5303 js_free_function_ptr(j_calls->register_output_meth);
5307 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
5308 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5309 int8_tArray txid_arr = init_int8_tArray(32);
5310 memcpy(txid_arr->elems, *txid, 32);
5311 LDKu8slice script_pubkey_var = script_pubkey;
5312 int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen);
5313 memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
5314 js_invoke_function_2(j_calls->register_tx_meth, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr);
5316 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
5317 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5318 LDKWatchedOutput output_var = output;
5319 uint64_t output_ref = 0;
5320 CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5321 CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5322 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
5323 output_ref = (uint64_t)output_var.inner;
5324 if (output_var.is_owned) {
5327 uint32_t ret = js_invoke_function_1(j_calls->register_output_meth, (uint32_t)output_ref);
5328 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
5329 CHECK_ACCESS(ret_ptr);
5330 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(ret_ptr);
5334 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
5335 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
5336 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5338 static inline LDKFilter LDKFilter_init (/*TODO: JS Object Reference */void* o) {
5339 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
5340 atomic_init(&calls->refcnt, 1);
5341 //TODO: Assign calls->o from o
5344 .this_arg = (void*) calls,
5345 .register_tx = register_tx_LDKFilter_jcall,
5346 .register_output = register_output_LDKFilter_jcall,
5347 .free = LDKFilter_JCalls_free,
5351 long __attribute__((visibility("default"))) TS_LDKFilter_new(/*TODO: JS Object Reference */void* o) {
5352 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
5353 *res_ptr = LDKFilter_init(o);
5354 return (long)res_ptr;
5356 void __attribute__((visibility("default"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
5357 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5358 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5359 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
5360 unsigned char txid_arr[32];
5361 CHECK(txid->arr_len == 32);
5362 memcpy(txid_arr, txid->elems, 32);
5363 unsigned char (*txid_ref)[32] = &txid_arr;
5364 LDKu8slice script_pubkey_ref;
5365 script_pubkey_ref.datalen = script_pubkey->arr_len;
5366 script_pubkey_ref.data = script_pubkey->elems;
5367 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
5370 uint32_t __attribute__((visibility("default"))) TS_Filter_register_output(uint32_t this_arg, uint32_t output) {
5371 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5372 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5373 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
5374 LDKWatchedOutput output_conv;
5375 output_conv.inner = (void*)(output & (~1));
5376 output_conv.is_owned = (output & 1) || (output == 0);
5377 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
5378 output_conv = WatchedOutput_clone(&output_conv);
5379 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
5380 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
5381 uint64_t ret_ref = (uint64_t)ret_copy;
5385 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_FilterZ_ref_from_ptr(uint32_t ptr) {
5386 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
5388 case LDKCOption_FilterZ_Some: {
5389 LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
5390 *some_ret = obj->some;
5391 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
5392 return 0 /* LDKCOption_FilterZ - Some */; (void) (uint64_t)some_ret;
5394 case LDKCOption_FilterZ_None: {
5395 return 0 /* LDKCOption_FilterZ - None */;
5400 static inline struct LDKLockedChannelMonitor *CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
5401 CHECK(owner->result_ok);
5402 return &*owner->contents.result;
5404 uint32_t __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_get_ok(uint32_t owner) {
5405 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
5406 LDKLockedChannelMonitor ret_var = *CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
5407 uint64_t ret_ref = 0;
5408 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5409 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5410 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5411 ret_ref = (uint64_t)ret_var.inner & ~1;
5415 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
5416 CHECK(!owner->result_ok);
5417 return *owner->contents.err;
5419 void __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_get_err(uint32_t owner) {
5420 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
5421 CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
5424 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
5425 LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
5426 for (size_t i = 0; i < ret.datalen; i++) {
5427 ret.data[i] = OutPoint_clone(&orig->data[i]);
5431 uint32_t __attribute__((visibility("default"))) TS_LDKAPIError_ref_from_ptr(uint32_t ptr) {
5432 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
5434 case LDKAPIError_APIMisuseError: {
5435 LDKStr err_str = obj->api_misuse_error.err;
5436 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
5437 return 0 /* LDKAPIError - APIMisuseError */; (void) err_conv;
5439 case LDKAPIError_FeeRateTooHigh: {
5440 LDKStr err_str = obj->fee_rate_too_high.err;
5441 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
5442 return 0 /* LDKAPIError - FeeRateTooHigh */; (void) err_conv; (void) obj->fee_rate_too_high.feerate;
5444 case LDKAPIError_RouteError: {
5445 LDKStr err_str = obj->route_error.err;
5446 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
5447 return 0 /* LDKAPIError - RouteError */; (void) err_conv;
5449 case LDKAPIError_ChannelUnavailable: {
5450 LDKStr err_str = obj->channel_unavailable.err;
5451 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
5452 return 0 /* LDKAPIError - ChannelUnavailable */; (void) err_conv;
5454 case LDKAPIError_MonitorUpdateFailed: {
5455 return 0 /* LDKAPIError - MonitorUpdateFailed */;
5457 case LDKAPIError_IncompatibleShutdownScript: {
5458 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
5459 uint64_t script_ref = 0;
5460 CHECK((((uint64_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5461 CHECK((((uint64_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5462 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
5463 script_ref = (uint64_t)script_var.inner & ~1;
5464 return 0 /* LDKAPIError - IncompatibleShutdownScript */; (void) script_ref;
5469 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
5470 CHECK(owner->result_ok);
5471 return *owner->contents.result;
5473 void __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_get_ok(uint32_t owner) {
5474 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
5475 CResult_NoneAPIErrorZ_get_ok(owner_conv);
5478 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
5479 CHECK(!owner->result_ok);
5480 return APIError_clone(&*owner->contents.err);
5482 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_get_err(uint32_t owner) {
5483 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
5484 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5485 *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
5486 uint64_t ret_ref = (uint64_t)ret_copy;
5490 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u16Z_ref_from_ptr(uint32_t ptr) {
5491 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
5493 case LDKCOption_u16Z_Some: {
5494 return 0 /* LDKCOption_u16Z - Some */; (void) obj->some;
5496 case LDKCOption_u16Z_None: {
5497 return 0 /* LDKCOption_u16Z - None */;
5502 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
5503 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
5504 for (size_t i = 0; i < ret.datalen; i++) {
5505 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
5509 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
5510 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
5511 for (size_t i = 0; i < ret.datalen; i++) {
5512 ret.data[i] = APIError_clone(&orig->data[i]);
5516 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
5517 CHECK(owner->result_ok);
5518 return ThirtyTwoBytes_clone(&*owner->contents.result);
5520 int8_tArray __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_get_ok(uint32_t owner) {
5521 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
5522 int8_tArray ret_arr = init_int8_tArray(32);
5523 memcpy(ret_arr->elems, CResult__u832APIErrorZ_get_ok(owner_conv).data, 32);
5527 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
5528 CHECK(!owner->result_ok);
5529 return APIError_clone(&*owner->contents.err);
5531 uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_get_err(uint32_t owner) {
5532 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
5533 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5534 *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
5535 uint64_t ret_ref = (uint64_t)ret_copy;
5539 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentSendFailure_ref_from_ptr(uint32_t ptr) {
5540 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
5542 case LDKPaymentSendFailure_ParameterError: {
5543 uint64_t parameter_error_ref = ((uint64_t)&obj->parameter_error) | 1;
5544 return 0 /* LDKPaymentSendFailure - ParameterError */; (void) parameter_error_ref;
5546 case LDKPaymentSendFailure_PathParameterError: {
5547 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
5548 uint32_tArray path_parameter_error_arr = NULL;
5549 path_parameter_error_arr = init_uint32_tArray(path_parameter_error_var.datalen);
5550 uint32_t *path_parameter_error_arr_ptr = (uint32_t*)(path_parameter_error_arr + 4);
5551 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
5552 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5553 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
5554 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
5555 path_parameter_error_arr_ptr[w] = (uint64_t)path_parameter_error_conv_22_conv;
5558 return 0 /* LDKPaymentSendFailure - PathParameterError */; (void) path_parameter_error_arr;
5560 case LDKPaymentSendFailure_AllFailedRetrySafe: {
5561 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
5562 uint32_tArray all_failed_retry_safe_arr = NULL;
5563 all_failed_retry_safe_arr = init_uint32_tArray(all_failed_retry_safe_var.datalen);
5564 uint32_t *all_failed_retry_safe_arr_ptr = (uint32_t*)(all_failed_retry_safe_arr + 4);
5565 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
5566 uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1;
5567 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
5570 return 0 /* LDKPaymentSendFailure - AllFailedRetrySafe */; (void) all_failed_retry_safe_arr;
5572 case LDKPaymentSendFailure_PartialFailure: {
5573 LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
5574 uint32_tArray results_arr = NULL;
5575 results_arr = init_uint32_tArray(results_var.datalen);
5576 uint32_t *results_arr_ptr = (uint32_t*)(results_arr + 4);
5577 for (size_t w = 0; w < results_var.datalen; w++) {
5578 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5579 *results_conv_22_conv = results_var.data[w];
5580 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
5581 results_arr_ptr[w] = (uint64_t)results_conv_22_conv;
5584 LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
5585 uint64_t failed_paths_retry_ref = 0;
5586 if ((uint64_t)failed_paths_retry_var.inner > 4096) {
5587 CHECK((((uint64_t)failed_paths_retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5588 CHECK((((uint64_t)&failed_paths_retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5589 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
5590 failed_paths_retry_ref = (uint64_t)failed_paths_retry_var.inner & ~1;
5592 int8_tArray payment_id_arr = init_int8_tArray(32);
5593 memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
5594 return 0 /* LDKPaymentSendFailure - PartialFailure */; (void) results_arr; (void) failed_paths_retry_ref; (void) payment_id_arr;
5599 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentSendFailureZ_get_ok(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
5600 CHECK(owner->result_ok);
5601 return ThirtyTwoBytes_clone(&*owner->contents.result);
5603 int8_tArray __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_get_ok(uint32_t owner) {
5604 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
5605 int8_tArray ret_arr = init_int8_tArray(32);
5606 memcpy(ret_arr->elems, CResult_PaymentIdPaymentSendFailureZ_get_ok(owner_conv).data, 32);
5610 static inline struct LDKPaymentSendFailure CResult_PaymentIdPaymentSendFailureZ_get_err(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
5611 CHECK(!owner->result_ok);
5612 return PaymentSendFailure_clone(&*owner->contents.err);
5614 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_get_err(uint32_t owner) {
5615 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
5616 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5617 *ret_copy = CResult_PaymentIdPaymentSendFailureZ_get_err(owner_conv);
5618 uint64_t ret_ref = (uint64_t)ret_copy;
5622 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5623 CHECK(owner->result_ok);
5624 return *owner->contents.result;
5626 void __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint32_t owner) {
5627 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
5628 CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
5631 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5632 CHECK(!owner->result_ok);
5633 return PaymentSendFailure_clone(&*owner->contents.err);
5635 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint32_t owner) {
5636 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
5637 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5638 *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
5639 uint64_t ret_ref = (uint64_t)ret_copy;
5643 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
5644 return ThirtyTwoBytes_clone(&owner->a);
5646 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_a(uint32_t owner) {
5647 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
5648 int8_tArray ret_arr = init_int8_tArray(32);
5649 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data, 32);
5653 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
5654 return ThirtyTwoBytes_clone(&owner->b);
5656 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_b(uint32_t owner) {
5657 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
5658 int8_tArray ret_arr = init_int8_tArray(32);
5659 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data, 32);
5663 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
5664 CHECK(owner->result_ok);
5665 return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
5667 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(uint32_t owner) {
5668 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
5669 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
5670 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
5671 return ((uint64_t)ret_conv);
5674 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
5675 CHECK(!owner->result_ok);
5676 return PaymentSendFailure_clone(&*owner->contents.err);
5678 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(uint32_t owner) {
5679 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
5680 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5681 *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
5682 uint64_t ret_ref = (uint64_t)ret_copy;
5686 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
5687 return ThirtyTwoBytes_clone(&owner->a);
5689 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_a(uint32_t owner) {
5690 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
5691 int8_tArray ret_arr = init_int8_tArray(32);
5692 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data, 32);
5696 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
5697 return ThirtyTwoBytes_clone(&owner->b);
5699 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_b(uint32_t owner) {
5700 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
5701 int8_tArray ret_arr = init_int8_tArray(32);
5702 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data, 32);
5706 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
5707 CHECK(owner->result_ok);
5708 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
5710 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(uint32_t owner) {
5711 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
5712 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
5713 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
5714 return ((uint64_t)ret_conv);
5717 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
5718 CHECK(!owner->result_ok);
5719 return *owner->contents.err;
5721 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(uint32_t owner) {
5722 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
5723 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
5726 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
5727 CHECK(owner->result_ok);
5728 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
5730 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(uint32_t owner) {
5731 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
5732 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
5733 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
5734 return ((uint64_t)ret_conv);
5737 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
5738 CHECK(!owner->result_ok);
5739 return APIError_clone(&*owner->contents.err);
5741 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(uint32_t owner) {
5742 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
5743 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5744 *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
5745 uint64_t ret_ref = (uint64_t)ret_copy;
5749 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
5750 CHECK(owner->result_ok);
5751 return ThirtyTwoBytes_clone(&*owner->contents.result);
5753 int8_tArray __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_get_ok(uint32_t owner) {
5754 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
5755 int8_tArray ret_arr = init_int8_tArray(32);
5756 memcpy(ret_arr->elems, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data, 32);
5760 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
5761 CHECK(!owner->result_ok);
5762 return *owner->contents.err;
5764 void __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_get_err(uint32_t owner) {
5765 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
5766 CResult_PaymentSecretNoneZ_get_err(owner_conv);
5769 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
5770 CHECK(owner->result_ok);
5771 return ThirtyTwoBytes_clone(&*owner->contents.result);
5773 int8_tArray __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_get_ok(uint32_t owner) {
5774 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
5775 int8_tArray ret_arr = init_int8_tArray(32);
5776 memcpy(ret_arr->elems, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data, 32);
5780 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
5781 CHECK(!owner->result_ok);
5782 return APIError_clone(&*owner->contents.err);
5784 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_get_err(uint32_t owner) {
5785 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
5786 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5787 *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
5788 uint64_t ret_ref = (uint64_t)ret_copy;
5792 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
5793 CHECK(owner->result_ok);
5794 return ThirtyTwoBytes_clone(&*owner->contents.result);
5796 int8_tArray __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_get_ok(uint32_t owner) {
5797 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
5798 int8_tArray ret_arr = init_int8_tArray(32);
5799 memcpy(ret_arr->elems, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data, 32);
5803 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
5804 CHECK(!owner->result_ok);
5805 return APIError_clone(&*owner->contents.err);
5807 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_get_err(uint32_t owner) {
5808 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
5809 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5810 *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
5811 uint64_t ret_ref = (uint64_t)ret_copy;
5815 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
5816 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
5817 for (size_t i = 0; i < ret.datalen; i++) {
5818 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
5822 typedef struct LDKWatch_JCalls {
5823 atomic_size_t refcnt;
5824 uint32_t watch_channel_meth;
5825 uint32_t update_channel_meth;
5826 uint32_t release_pending_monitor_events_meth;
5828 static void LDKWatch_JCalls_free(void* this_arg) {
5829 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5830 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5831 js_free_function_ptr(j_calls->watch_channel_meth);
5832 js_free_function_ptr(j_calls->update_channel_meth);
5833 js_free_function_ptr(j_calls->release_pending_monitor_events_meth);
5837 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
5838 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5839 LDKOutPoint funding_txo_var = funding_txo;
5840 uint64_t funding_txo_ref = 0;
5841 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5842 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5843 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5844 funding_txo_ref = (uint64_t)funding_txo_var.inner;
5845 if (funding_txo_var.is_owned) {
5846 funding_txo_ref |= 1;
5848 LDKChannelMonitor monitor_var = monitor;
5849 uint64_t monitor_ref = 0;
5850 CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5851 CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5852 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
5853 monitor_ref = (uint64_t)monitor_var.inner;
5854 if (monitor_var.is_owned) {
5857 uint32_t ret = js_invoke_function_2(j_calls->watch_channel_meth, (uint32_t)funding_txo_ref, (uint32_t)monitor_ref);
5858 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
5859 CHECK_ACCESS(ret_ptr);
5860 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
5864 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
5865 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5866 LDKOutPoint funding_txo_var = funding_txo;
5867 uint64_t funding_txo_ref = 0;
5868 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5869 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5870 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5871 funding_txo_ref = (uint64_t)funding_txo_var.inner;
5872 if (funding_txo_var.is_owned) {
5873 funding_txo_ref |= 1;
5875 LDKChannelMonitorUpdate update_var = update;
5876 uint64_t update_ref = 0;
5877 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5878 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5879 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
5880 update_ref = (uint64_t)update_var.inner;
5881 if (update_var.is_owned) {
5884 uint32_t ret = js_invoke_function_2(j_calls->update_channel_meth, (uint32_t)funding_txo_ref, (uint32_t)update_ref);
5885 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
5886 CHECK_ACCESS(ret_ptr);
5887 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
5891 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
5892 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5893 uint32_tArray ret = (uint32_tArray)js_invoke_function_0(j_calls->release_pending_monitor_events_meth);
5894 LDKCVec_MonitorEventZ ret_constr;
5895 ret_constr.datalen = ret->arr_len;
5896 if (ret_constr.datalen > 0)
5897 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
5899 ret_constr.data = NULL;
5900 uint32_t* ret_vals = ret->elems;
5901 for (size_t o = 0; o < ret_constr.datalen; o++) {
5902 uint32_t ret_conv_14 = ret_vals[o];
5903 void* ret_conv_14_ptr = (void*)(((uint64_t)ret_conv_14) & ~1);
5904 CHECK_ACCESS(ret_conv_14_ptr);
5905 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(ret_conv_14_ptr);
5906 FREE((void*)ret_conv_14);
5907 ret_constr.data[o] = ret_conv_14_conv;
5911 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
5912 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
5913 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5915 static inline LDKWatch LDKWatch_init (/*TODO: JS Object Reference */void* o) {
5916 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
5917 atomic_init(&calls->refcnt, 1);
5918 //TODO: Assign calls->o from o
5921 .this_arg = (void*) calls,
5922 .watch_channel = watch_channel_LDKWatch_jcall,
5923 .update_channel = update_channel_LDKWatch_jcall,
5924 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
5925 .free = LDKWatch_JCalls_free,
5929 long __attribute__((visibility("default"))) TS_LDKWatch_new(/*TODO: JS Object Reference */void* o) {
5930 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
5931 *res_ptr = LDKWatch_init(o);
5932 return (long)res_ptr;
5934 uint32_t __attribute__((visibility("default"))) TS_Watch_watch_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t monitor) {
5935 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5936 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5937 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5938 LDKOutPoint funding_txo_conv;
5939 funding_txo_conv.inner = (void*)(funding_txo & (~1));
5940 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
5941 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5942 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5943 LDKChannelMonitor monitor_conv;
5944 monitor_conv.inner = (void*)(monitor & (~1));
5945 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
5946 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
5947 monitor_conv = ChannelMonitor_clone(&monitor_conv);
5948 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5949 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
5950 return (uint64_t)ret_conv;
5953 uint32_t __attribute__((visibility("default"))) TS_Watch_update_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t update) {
5954 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5955 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5956 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5957 LDKOutPoint funding_txo_conv;
5958 funding_txo_conv.inner = (void*)(funding_txo & (~1));
5959 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
5960 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5961 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5962 LDKChannelMonitorUpdate update_conv;
5963 update_conv.inner = (void*)(update & (~1));
5964 update_conv.is_owned = (update & 1) || (update == 0);
5965 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
5966 update_conv = ChannelMonitorUpdate_clone(&update_conv);
5967 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5968 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
5969 return (uint64_t)ret_conv;
5972 uint32_tArray __attribute__((visibility("default"))) TS_Watch_release_pending_monitor_events(uint32_t this_arg) {
5973 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5974 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5975 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5976 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
5977 uint32_tArray ret_arr = NULL;
5978 ret_arr = init_uint32_tArray(ret_var.datalen);
5979 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
5980 for (size_t o = 0; o < ret_var.datalen; o++) {
5981 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
5982 *ret_conv_14_copy = ret_var.data[o];
5983 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
5984 ret_arr_ptr[o] = ret_conv_14_ref;
5991 typedef struct LDKBroadcasterInterface_JCalls {
5992 atomic_size_t refcnt;
5993 uint32_t broadcast_transaction_meth;
5994 } LDKBroadcasterInterface_JCalls;
5995 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
5996 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5997 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5998 js_free_function_ptr(j_calls->broadcast_transaction_meth);
6002 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
6003 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6004 LDKTransaction tx_var = tx;
6005 int8_tArray tx_arr = init_int8_tArray(tx_var.datalen);
6006 memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
6007 Transaction_free(tx_var);
6008 js_invoke_function_1(j_calls->broadcast_transaction_meth, (uint32_t)tx_arr);
6010 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
6011 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
6012 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6014 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (/*TODO: JS Object Reference */void* o) {
6015 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
6016 atomic_init(&calls->refcnt, 1);
6017 //TODO: Assign calls->o from o
6019 LDKBroadcasterInterface ret = {
6020 .this_arg = (void*) calls,
6021 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
6022 .free = LDKBroadcasterInterface_JCalls_free,
6026 long __attribute__((visibility("default"))) TS_LDKBroadcasterInterface_new(/*TODO: JS Object Reference */void* o) {
6027 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
6028 *res_ptr = LDKBroadcasterInterface_init(o);
6029 return (long)res_ptr;
6031 void __attribute__((visibility("default"))) TS_BroadcasterInterface_broadcast_transaction(uint32_t this_arg, int8_tArray tx) {
6032 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6033 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6034 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
6035 LDKTransaction tx_ref;
6036 tx_ref.datalen = tx->arr_len;
6037 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
6038 memcpy(tx_ref.data, tx->elems, tx_ref.datalen);
6039 tx_ref.data_is_owned = true;
6040 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
6043 typedef struct LDKKeysInterface_JCalls {
6044 atomic_size_t refcnt;
6045 uint32_t get_node_secret_meth;
6046 uint32_t get_destination_script_meth;
6047 uint32_t get_shutdown_scriptpubkey_meth;
6048 uint32_t get_channel_signer_meth;
6049 uint32_t get_secure_random_bytes_meth;
6050 uint32_t read_chan_signer_meth;
6051 uint32_t sign_invoice_meth;
6052 uint32_t get_inbound_payment_key_material_meth;
6053 } LDKKeysInterface_JCalls;
6054 static void LDKKeysInterface_JCalls_free(void* this_arg) {
6055 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6056 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6057 js_free_function_ptr(j_calls->get_node_secret_meth);
6058 js_free_function_ptr(j_calls->get_destination_script_meth);
6059 js_free_function_ptr(j_calls->get_shutdown_scriptpubkey_meth);
6060 js_free_function_ptr(j_calls->get_channel_signer_meth);
6061 js_free_function_ptr(j_calls->get_secure_random_bytes_meth);
6062 js_free_function_ptr(j_calls->read_chan_signer_meth);
6063 js_free_function_ptr(j_calls->sign_invoice_meth);
6064 js_free_function_ptr(j_calls->get_inbound_payment_key_material_meth);
6068 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
6069 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6070 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->get_node_secret_meth);
6071 LDKSecretKey ret_ref;
6072 CHECK(ret->arr_len == 32);
6073 memcpy(ret_ref.bytes, ret->elems, 32);
6076 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
6077 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6078 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->get_destination_script_meth);
6079 LDKCVec_u8Z ret_ref;
6080 ret_ref.datalen = ret->arr_len;
6081 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6082 memcpy(ret_ref.data, ret->elems, ret_ref.datalen);
6085 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
6086 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6087 uint32_t ret = js_invoke_function_0(j_calls->get_shutdown_scriptpubkey_meth);
6088 LDKShutdownScript ret_conv;
6089 ret_conv.inner = (void*)(ret & (~1));
6090 ret_conv.is_owned = (ret & 1) || (ret == 0);
6091 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
6094 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
6095 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6096 uint32_t ret = js_invoke_function_2(j_calls->get_channel_signer_meth, (uint32_t)inbound, (uint32_t)channel_value_satoshis);
6097 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6098 CHECK_ACCESS(ret_ptr);
6099 LDKSign ret_conv = *(LDKSign*)(ret_ptr);
6103 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
6104 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6105 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->get_secure_random_bytes_meth);
6106 LDKThirtyTwoBytes ret_ref;
6107 CHECK(ret->arr_len == 32);
6108 memcpy(ret_ref.data, ret->elems, 32);
6111 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
6112 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6113 LDKu8slice reader_var = reader;
6114 int8_tArray reader_arr = init_int8_tArray(reader_var.datalen);
6115 memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
6116 uint32_t ret = js_invoke_function_1(j_calls->read_chan_signer_meth, (uint32_t)reader_arr);
6117 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6118 CHECK_ACCESS(ret_ptr);
6119 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
6123 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
6124 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6125 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
6126 int8_tArray invoice_preimage_arr = init_int8_tArray(invoice_preimage_var.datalen);
6127 memcpy(invoice_preimage_arr->elems, invoice_preimage_var.data, invoice_preimage_var.datalen);
6128 CVec_u8Z_free(invoice_preimage_var);
6129 uint32_t ret = js_invoke_function_1(j_calls->sign_invoice_meth, (uint32_t)invoice_preimage_arr);
6130 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6131 CHECK_ACCESS(ret_ptr);
6132 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
6136 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) {
6137 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6138 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->get_inbound_payment_key_material_meth);
6139 LDKThirtyTwoBytes ret_ref;
6140 CHECK(ret->arr_len == 32);
6141 memcpy(ret_ref.data, ret->elems, 32);
6144 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
6145 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
6146 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6148 static inline LDKKeysInterface LDKKeysInterface_init (/*TODO: JS Object Reference */void* o) {
6149 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
6150 atomic_init(&calls->refcnt, 1);
6151 //TODO: Assign calls->o from o
6153 LDKKeysInterface ret = {
6154 .this_arg = (void*) calls,
6155 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
6156 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
6157 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
6158 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
6159 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
6160 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
6161 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
6162 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall,
6163 .free = LDKKeysInterface_JCalls_free,
6167 long __attribute__((visibility("default"))) TS_LDKKeysInterface_new(/*TODO: JS Object Reference */void* o) {
6168 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
6169 *res_ptr = LDKKeysInterface_init(o);
6170 return (long)res_ptr;
6172 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_node_secret(uint32_t this_arg) {
6173 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6174 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6175 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6176 int8_tArray ret_arr = init_int8_tArray(32);
6177 memcpy(ret_arr->elems, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes, 32);
6181 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_destination_script(uint32_t this_arg) {
6182 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6183 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6184 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6185 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
6186 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
6187 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6188 CVec_u8Z_free(ret_var);
6192 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_shutdown_scriptpubkey(uint32_t this_arg) {
6193 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6194 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6195 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6196 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
6197 uint64_t ret_ref = 0;
6198 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6199 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6200 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6201 ret_ref = (uint64_t)ret_var.inner;
6202 if (ret_var.is_owned) {
6208 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_channel_signer(uint32_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
6209 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6210 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6211 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6212 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
6213 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
6214 return (uint64_t)ret_ret;
6217 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_secure_random_bytes(uint32_t this_arg) {
6218 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6219 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6220 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6221 int8_tArray ret_arr = init_int8_tArray(32);
6222 memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
6226 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_read_chan_signer(uint32_t this_arg, int8_tArray reader) {
6227 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6228 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6229 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6230 LDKu8slice reader_ref;
6231 reader_ref.datalen = reader->arr_len;
6232 reader_ref.data = reader->elems;
6233 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
6234 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
6235 return (uint64_t)ret_conv;
6238 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_sign_invoice(uint32_t this_arg, int8_tArray invoice_preimage) {
6239 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6240 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6241 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6242 LDKCVec_u8Z invoice_preimage_ref;
6243 invoice_preimage_ref.datalen = invoice_preimage->arr_len;
6244 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
6245 memcpy(invoice_preimage_ref.data, invoice_preimage->elems, invoice_preimage_ref.datalen);
6246 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
6247 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
6248 return (uint64_t)ret_conv;
6251 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_inbound_payment_key_material(uint32_t this_arg) {
6252 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6253 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6254 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6255 int8_tArray ret_arr = init_int8_tArray(32);
6256 memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
6260 typedef struct LDKFeeEstimator_JCalls {
6261 atomic_size_t refcnt;
6262 uint32_t get_est_sat_per_1000_weight_meth;
6263 } LDKFeeEstimator_JCalls;
6264 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
6265 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6266 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6267 js_free_function_ptr(j_calls->get_est_sat_per_1000_weight_meth);
6271 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
6272 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6273 uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
6274 return js_invoke_function_1(j_calls->get_est_sat_per_1000_weight_meth, (uint32_t)confirmation_target_conv);
6276 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
6277 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
6278 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6280 static inline LDKFeeEstimator LDKFeeEstimator_init (/*TODO: JS Object Reference */void* o) {
6281 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
6282 atomic_init(&calls->refcnt, 1);
6283 //TODO: Assign calls->o from o
6285 LDKFeeEstimator ret = {
6286 .this_arg = (void*) calls,
6287 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
6288 .free = LDKFeeEstimator_JCalls_free,
6292 long __attribute__((visibility("default"))) TS_LDKFeeEstimator_new(/*TODO: JS Object Reference */void* o) {
6293 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
6294 *res_ptr = LDKFeeEstimator_init(o);
6295 return (long)res_ptr;
6297 int32_t __attribute__((visibility("default"))) TS_FeeEstimator_get_est_sat_per_1000_weight(uint32_t this_arg, uint32_t confirmation_target) {
6298 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6299 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6300 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
6301 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
6302 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
6306 typedef struct LDKLogger_JCalls {
6307 atomic_size_t refcnt;
6310 static void LDKLogger_JCalls_free(void* this_arg) {
6311 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
6312 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6313 js_free_function_ptr(j_calls->log_meth);
6317 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
6318 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
6319 LDKRecord record_var = *record;
6320 uint64_t record_ref = 0;
6321 record_var = Record_clone(record);
6322 CHECK((((uint64_t)record_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6323 CHECK((((uint64_t)&record_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6324 CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
6325 record_ref = (uint64_t)record_var.inner;
6326 if (record_var.is_owned) {
6329 js_invoke_function_1(j_calls->log_meth, (uint32_t)record_ref);
6331 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
6332 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
6333 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6335 static inline LDKLogger LDKLogger_init (/*TODO: JS Object Reference */void* o) {
6336 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
6337 atomic_init(&calls->refcnt, 1);
6338 //TODO: Assign calls->o from o
6341 .this_arg = (void*) calls,
6342 .log = log_LDKLogger_jcall,
6343 .free = LDKLogger_JCalls_free,
6347 long __attribute__((visibility("default"))) TS_LDKLogger_new(/*TODO: JS Object Reference */void* o) {
6348 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
6349 *res_ptr = LDKLogger_init(o);
6350 return (long)res_ptr;
6352 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
6353 return ThirtyTwoBytes_clone(&owner->a);
6355 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_get_a(uint32_t owner) {
6356 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
6357 int8_tArray ret_arr = init_int8_tArray(32);
6358 memcpy(ret_arr->elems, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data, 32);
6362 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
6365 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_get_b(uint32_t owner) {
6366 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
6367 LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
6368 uint64_t ret_ref = 0;
6369 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6370 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6371 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6372 ret_ref = (uint64_t)ret_var.inner & ~1;
6376 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6377 CHECK(owner->result_ok);
6378 return &*owner->contents.result;
6380 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint32_t owner) {
6381 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
6382 uint64_t ret_ret = (uint64_t)CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv);
6386 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6387 CHECK(!owner->result_ok);
6388 return DecodeError_clone(&*owner->contents.err);
6390 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint32_t owner) {
6391 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
6392 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
6393 uint64_t ret_ref = 0;
6394 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6395 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6396 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6397 ret_ref = (uint64_t)ret_var.inner;
6398 if (ret_var.is_owned) {
6404 typedef struct LDKMessageSendEventsProvider_JCalls {
6405 atomic_size_t refcnt;
6406 uint32_t get_and_clear_pending_msg_events_meth;
6407 } LDKMessageSendEventsProvider_JCalls;
6408 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
6409 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
6410 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6411 js_free_function_ptr(j_calls->get_and_clear_pending_msg_events_meth);
6415 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
6416 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
6417 uint32_tArray ret = (uint32_tArray)js_invoke_function_0(j_calls->get_and_clear_pending_msg_events_meth);
6418 LDKCVec_MessageSendEventZ ret_constr;
6419 ret_constr.datalen = ret->arr_len;
6420 if (ret_constr.datalen > 0)
6421 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
6423 ret_constr.data = NULL;
6424 uint32_t* ret_vals = ret->elems;
6425 for (size_t s = 0; s < ret_constr.datalen; s++) {
6426 uint32_t ret_conv_18 = ret_vals[s];
6427 void* ret_conv_18_ptr = (void*)(((uint64_t)ret_conv_18) & ~1);
6428 CHECK_ACCESS(ret_conv_18_ptr);
6429 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
6430 FREE((void*)ret_conv_18);
6431 ret_constr.data[s] = ret_conv_18_conv;
6435 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
6436 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
6437 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6439 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (/*TODO: JS Object Reference */void* o) {
6440 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
6441 atomic_init(&calls->refcnt, 1);
6442 //TODO: Assign calls->o from o
6444 LDKMessageSendEventsProvider ret = {
6445 .this_arg = (void*) calls,
6446 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
6447 .free = LDKMessageSendEventsProvider_JCalls_free,
6451 long __attribute__((visibility("default"))) TS_LDKMessageSendEventsProvider_new(/*TODO: JS Object Reference */void* o) {
6452 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
6453 *res_ptr = LDKMessageSendEventsProvider_init(o);
6454 return (long)res_ptr;
6456 uint32_tArray __attribute__((visibility("default"))) TS_MessageSendEventsProvider_get_and_clear_pending_msg_events(uint32_t this_arg) {
6457 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6458 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6459 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
6460 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
6461 uint32_tArray ret_arr = NULL;
6462 ret_arr = init_uint32_tArray(ret_var.datalen);
6463 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
6464 for (size_t s = 0; s < ret_var.datalen; s++) {
6465 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
6466 *ret_conv_18_copy = ret_var.data[s];
6467 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_copy;
6468 ret_arr_ptr[s] = ret_conv_18_ref;
6475 typedef struct LDKEventHandler_JCalls {
6476 atomic_size_t refcnt;
6477 uint32_t handle_event_meth;
6478 } LDKEventHandler_JCalls;
6479 static void LDKEventHandler_JCalls_free(void* this_arg) {
6480 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6481 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6482 js_free_function_ptr(j_calls->handle_event_meth);
6486 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
6487 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6488 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
6489 *ret_event = Event_clone(event);
6490 js_invoke_function_1(j_calls->handle_event_meth, (uint32_t)(uint64_t)ret_event);
6492 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
6493 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
6494 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6496 static inline LDKEventHandler LDKEventHandler_init (/*TODO: JS Object Reference */void* o) {
6497 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
6498 atomic_init(&calls->refcnt, 1);
6499 //TODO: Assign calls->o from o
6501 LDKEventHandler ret = {
6502 .this_arg = (void*) calls,
6503 .handle_event = handle_event_LDKEventHandler_jcall,
6504 .free = LDKEventHandler_JCalls_free,
6508 long __attribute__((visibility("default"))) TS_LDKEventHandler_new(/*TODO: JS Object Reference */void* o) {
6509 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
6510 *res_ptr = LDKEventHandler_init(o);
6511 return (long)res_ptr;
6513 void __attribute__((visibility("default"))) TS_EventHandler_handle_event(uint32_t this_arg, uint32_t event) {
6514 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6515 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6516 LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
6517 LDKEvent* event_conv = (LDKEvent*)event;
6518 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
6521 typedef struct LDKEventsProvider_JCalls {
6522 atomic_size_t refcnt;
6523 uint32_t process_pending_events_meth;
6524 } LDKEventsProvider_JCalls;
6525 static void LDKEventsProvider_JCalls_free(void* this_arg) {
6526 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6527 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6528 js_free_function_ptr(j_calls->process_pending_events_meth);
6532 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
6533 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6534 LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
6535 *handler_ret = handler;
6536 js_invoke_function_1(j_calls->process_pending_events_meth, (uint32_t)(uint64_t)handler_ret);
6538 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
6539 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
6540 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6542 static inline LDKEventsProvider LDKEventsProvider_init (/*TODO: JS Object Reference */void* o) {
6543 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
6544 atomic_init(&calls->refcnt, 1);
6545 //TODO: Assign calls->o from o
6547 LDKEventsProvider ret = {
6548 .this_arg = (void*) calls,
6549 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
6550 .free = LDKEventsProvider_JCalls_free,
6554 long __attribute__((visibility("default"))) TS_LDKEventsProvider_new(/*TODO: JS Object Reference */void* o) {
6555 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6556 *res_ptr = LDKEventsProvider_init(o);
6557 return (long)res_ptr;
6559 void __attribute__((visibility("default"))) TS_EventsProvider_process_pending_events(uint32_t this_arg, uint32_t handler) {
6560 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6561 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6562 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
6563 void* handler_ptr = (void*)(((uint64_t)handler) & ~1);
6564 CHECK_ACCESS(handler_ptr);
6565 LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
6566 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
6569 typedef struct LDKListen_JCalls {
6570 atomic_size_t refcnt;
6571 uint32_t block_connected_meth;
6572 uint32_t block_disconnected_meth;
6574 static void LDKListen_JCalls_free(void* this_arg) {
6575 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6576 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6577 js_free_function_ptr(j_calls->block_connected_meth);
6578 js_free_function_ptr(j_calls->block_disconnected_meth);
6582 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
6583 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6584 LDKu8slice block_var = block;
6585 int8_tArray block_arr = init_int8_tArray(block_var.datalen);
6586 memcpy(block_arr->elems, block_var.data, block_var.datalen);
6587 js_invoke_function_2(j_calls->block_connected_meth, (uint32_t)block_arr, (uint32_t)height);
6589 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
6590 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6591 int8_tArray header_arr = init_int8_tArray(80);
6592 memcpy(header_arr->elems, *header, 80);
6593 js_invoke_function_2(j_calls->block_disconnected_meth, (uint32_t)header_arr, (uint32_t)height);
6595 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
6596 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
6597 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6599 static inline LDKListen LDKListen_init (/*TODO: JS Object Reference */void* o) {
6600 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
6601 atomic_init(&calls->refcnt, 1);
6602 //TODO: Assign calls->o from o
6605 .this_arg = (void*) calls,
6606 .block_connected = block_connected_LDKListen_jcall,
6607 .block_disconnected = block_disconnected_LDKListen_jcall,
6608 .free = LDKListen_JCalls_free,
6612 long __attribute__((visibility("default"))) TS_LDKListen_new(/*TODO: JS Object Reference */void* o) {
6613 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
6614 *res_ptr = LDKListen_init(o);
6615 return (long)res_ptr;
6617 void __attribute__((visibility("default"))) TS_Listen_block_connected(uint32_t this_arg, int8_tArray block, int32_t height) {
6618 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6619 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6620 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
6621 LDKu8slice block_ref;
6622 block_ref.datalen = block->arr_len;
6623 block_ref.data = block->elems;
6624 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
6627 void __attribute__((visibility("default"))) TS_Listen_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height) {
6628 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6629 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6630 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
6631 unsigned char header_arr[80];
6632 CHECK(header->arr_len == 80);
6633 memcpy(header_arr, header->elems, 80);
6634 unsigned char (*header_ref)[80] = &header_arr;
6635 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
6638 typedef struct LDKConfirm_JCalls {
6639 atomic_size_t refcnt;
6640 uint32_t transactions_confirmed_meth;
6641 uint32_t transaction_unconfirmed_meth;
6642 uint32_t best_block_updated_meth;
6643 uint32_t get_relevant_txids_meth;
6644 } LDKConfirm_JCalls;
6645 static void LDKConfirm_JCalls_free(void* this_arg) {
6646 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6647 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6648 js_free_function_ptr(j_calls->transactions_confirmed_meth);
6649 js_free_function_ptr(j_calls->transaction_unconfirmed_meth);
6650 js_free_function_ptr(j_calls->best_block_updated_meth);
6651 js_free_function_ptr(j_calls->get_relevant_txids_meth);
6655 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
6656 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6657 int8_tArray header_arr = init_int8_tArray(80);
6658 memcpy(header_arr->elems, *header, 80);
6659 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
6660 uint32_tArray txdata_arr = NULL;
6661 txdata_arr = init_uint32_tArray(txdata_var.datalen);
6662 uint32_t *txdata_arr_ptr = (uint32_t*)(txdata_arr + 4);
6663 for (size_t c = 0; c < txdata_var.datalen; c++) {
6664 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
6665 *txdata_conv_28_conv = txdata_var.data[c];
6666 txdata_arr_ptr[c] = ((uint64_t)txdata_conv_28_conv);
6669 FREE(txdata_var.data);
6670 js_invoke_function_3(j_calls->transactions_confirmed_meth, (uint32_t)header_arr, (uint32_t)txdata_arr, (uint32_t)height);
6672 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
6673 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6674 int8_tArray txid_arr = init_int8_tArray(32);
6675 memcpy(txid_arr->elems, *txid, 32);
6676 js_invoke_function_1(j_calls->transaction_unconfirmed_meth, (uint32_t)txid_arr);
6678 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
6679 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6680 int8_tArray header_arr = init_int8_tArray(80);
6681 memcpy(header_arr->elems, *header, 80);
6682 js_invoke_function_2(j_calls->best_block_updated_meth, (uint32_t)header_arr, (uint32_t)height);
6684 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
6685 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6686 ptrArray ret = (ptrArray)js_invoke_function_0(j_calls->get_relevant_txids_meth);
6687 LDKCVec_TxidZ ret_constr;
6688 ret_constr.datalen = ret->arr_len;
6689 if (ret_constr.datalen > 0)
6690 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
6692 ret_constr.data = NULL;
6693 int8_tArray* ret_vals = (void*) ret->elems;
6694 for (size_t m = 0; m < ret_constr.datalen; m++) {
6695 int8_tArray ret_conv_12 = ret_vals[m];
6696 LDKThirtyTwoBytes ret_conv_12_ref;
6697 CHECK(ret_conv_12->arr_len == 32);
6698 memcpy(ret_conv_12_ref.data, ret_conv_12->elems, 32);
6699 ret_constr.data[m] = ret_conv_12_ref;
6703 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
6704 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
6705 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6707 static inline LDKConfirm LDKConfirm_init (/*TODO: JS Object Reference */void* o) {
6708 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
6709 atomic_init(&calls->refcnt, 1);
6710 //TODO: Assign calls->o from o
6713 .this_arg = (void*) calls,
6714 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
6715 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
6716 .best_block_updated = best_block_updated_LDKConfirm_jcall,
6717 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
6718 .free = LDKConfirm_JCalls_free,
6722 long __attribute__((visibility("default"))) TS_LDKConfirm_new(/*TODO: JS Object Reference */void* o) {
6723 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
6724 *res_ptr = LDKConfirm_init(o);
6725 return (long)res_ptr;
6727 void __attribute__((visibility("default"))) TS_Confirm_transactions_confirmed(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
6728 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6729 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6730 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
6731 unsigned char header_arr[80];
6732 CHECK(header->arr_len == 80);
6733 memcpy(header_arr, header->elems, 80);
6734 unsigned char (*header_ref)[80] = &header_arr;
6735 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6736 txdata_constr.datalen = txdata->arr_len;
6737 if (txdata_constr.datalen > 0)
6738 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6740 txdata_constr.data = NULL;
6741 uint32_t* txdata_vals = txdata->elems;
6742 for (size_t c = 0; c < txdata_constr.datalen; c++) {
6743 uint32_t txdata_conv_28 = txdata_vals[c];
6744 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
6745 CHECK_ACCESS(txdata_conv_28_ptr);
6746 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
6747 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
6748 txdata_constr.data[c] = txdata_conv_28_conv;
6750 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
6753 void __attribute__((visibility("default"))) TS_Confirm_transaction_unconfirmed(uint32_t this_arg, int8_tArray txid) {
6754 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6755 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6756 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
6757 unsigned char txid_arr[32];
6758 CHECK(txid->arr_len == 32);
6759 memcpy(txid_arr, txid->elems, 32);
6760 unsigned char (*txid_ref)[32] = &txid_arr;
6761 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
6764 void __attribute__((visibility("default"))) TS_Confirm_best_block_updated(uint32_t this_arg, int8_tArray header, int32_t height) {
6765 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6766 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6767 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
6768 unsigned char header_arr[80];
6769 CHECK(header->arr_len == 80);
6770 memcpy(header_arr, header->elems, 80);
6771 unsigned char (*header_ref)[80] = &header_arr;
6772 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
6775 ptrArray __attribute__((visibility("default"))) TS_Confirm_get_relevant_txids(uint32_t this_arg) {
6776 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6777 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6778 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
6779 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
6780 ptrArray ret_arr = NULL;
6781 ret_arr = init_ptrArray(ret_var.datalen);
6782 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
6783 for (size_t m = 0; m < ret_var.datalen; m++) {
6784 int8_tArray ret_conv_12_arr = init_int8_tArray(32);
6785 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
6786 ret_arr_ptr[m] = ret_conv_12_arr;
6793 typedef struct LDKPersist_JCalls {
6794 atomic_size_t refcnt;
6795 uint32_t persist_new_channel_meth;
6796 uint32_t update_persisted_channel_meth;
6797 } LDKPersist_JCalls;
6798 static void LDKPersist_JCalls_free(void* this_arg) {
6799 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6800 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6801 js_free_function_ptr(j_calls->persist_new_channel_meth);
6802 js_free_function_ptr(j_calls->update_persisted_channel_meth);
6806 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
6807 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6808 LDKOutPoint channel_id_var = channel_id;
6809 uint64_t channel_id_ref = 0;
6810 CHECK((((uint64_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6811 CHECK((((uint64_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6812 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
6813 channel_id_ref = (uint64_t)channel_id_var.inner;
6814 if (channel_id_var.is_owned) {
6815 channel_id_ref |= 1;
6817 LDKChannelMonitor data_var = *data;
6818 uint64_t data_ref = 0;
6819 data_var = ChannelMonitor_clone(data);
6820 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6821 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6822 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
6823 data_ref = (uint64_t)data_var.inner;
6824 if (data_var.is_owned) {
6827 LDKMonitorUpdateId update_id_var = update_id;
6828 uint64_t update_id_ref = 0;
6829 CHECK((((uint64_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6830 CHECK((((uint64_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6831 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
6832 update_id_ref = (uint64_t)update_id_var.inner;
6833 if (update_id_var.is_owned) {
6836 uint32_t ret = js_invoke_function_3(j_calls->persist_new_channel_meth, (uint32_t)channel_id_ref, (uint32_t)data_ref, (uint32_t)update_id_ref);
6837 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6838 CHECK_ACCESS(ret_ptr);
6839 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
6843 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
6844 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6845 LDKOutPoint channel_id_var = channel_id;
6846 uint64_t channel_id_ref = 0;
6847 CHECK((((uint64_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6848 CHECK((((uint64_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6849 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
6850 channel_id_ref = (uint64_t)channel_id_var.inner;
6851 if (channel_id_var.is_owned) {
6852 channel_id_ref |= 1;
6854 LDKChannelMonitorUpdate update_var = *update;
6855 uint64_t update_ref = 0;
6856 if ((uint64_t)update_var.inner > 4096) {
6857 update_var = ChannelMonitorUpdate_clone(update);
6858 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6859 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6860 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
6861 update_ref = (uint64_t)update_var.inner;
6862 if (update_var.is_owned) {
6866 LDKChannelMonitor data_var = *data;
6867 uint64_t data_ref = 0;
6868 data_var = ChannelMonitor_clone(data);
6869 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6870 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6871 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
6872 data_ref = (uint64_t)data_var.inner;
6873 if (data_var.is_owned) {
6876 LDKMonitorUpdateId update_id_var = update_id;
6877 uint64_t update_id_ref = 0;
6878 CHECK((((uint64_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6879 CHECK((((uint64_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6880 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
6881 update_id_ref = (uint64_t)update_id_var.inner;
6882 if (update_id_var.is_owned) {
6885 uint32_t ret = js_invoke_function_4(j_calls->update_persisted_channel_meth, (uint32_t)channel_id_ref, (uint32_t)update_ref, (uint32_t)data_ref, (uint32_t)update_id_ref);
6886 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6887 CHECK_ACCESS(ret_ptr);
6888 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
6892 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
6893 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
6894 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6896 static inline LDKPersist LDKPersist_init (/*TODO: JS Object Reference */void* o) {
6897 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
6898 atomic_init(&calls->refcnt, 1);
6899 //TODO: Assign calls->o from o
6902 .this_arg = (void*) calls,
6903 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
6904 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
6905 .free = LDKPersist_JCalls_free,
6909 long __attribute__((visibility("default"))) TS_LDKPersist_new(/*TODO: JS Object Reference */void* o) {
6910 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
6911 *res_ptr = LDKPersist_init(o);
6912 return (long)res_ptr;
6914 uint32_t __attribute__((visibility("default"))) TS_Persist_persist_new_channel(uint32_t this_arg, uint32_t channel_id, uint32_t data, uint32_t update_id) {
6915 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6916 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6917 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
6918 LDKOutPoint channel_id_conv;
6919 channel_id_conv.inner = (void*)(channel_id & (~1));
6920 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
6921 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
6922 channel_id_conv = OutPoint_clone(&channel_id_conv);
6923 LDKChannelMonitor data_conv;
6924 data_conv.inner = (void*)(data & (~1));
6925 data_conv.is_owned = false;
6926 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
6927 LDKMonitorUpdateId update_id_conv;
6928 update_id_conv.inner = (void*)(update_id & (~1));
6929 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
6930 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
6931 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
6932 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6933 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv);
6934 return (uint64_t)ret_conv;
6937 uint32_t __attribute__((visibility("default"))) TS_Persist_update_persisted_channel(uint32_t this_arg, uint32_t channel_id, uint32_t update, uint32_t data, uint32_t update_id) {
6938 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6939 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6940 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
6941 LDKOutPoint channel_id_conv;
6942 channel_id_conv.inner = (void*)(channel_id & (~1));
6943 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
6944 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
6945 channel_id_conv = OutPoint_clone(&channel_id_conv);
6946 LDKChannelMonitorUpdate update_conv;
6947 update_conv.inner = (void*)(update & (~1));
6948 update_conv.is_owned = false;
6949 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
6950 LDKChannelMonitor data_conv;
6951 data_conv.inner = (void*)(data & (~1));
6952 data_conv.is_owned = false;
6953 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
6954 LDKMonitorUpdateId update_id_conv;
6955 update_id_conv.inner = (void*)(update_id & (~1));
6956 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
6957 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
6958 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
6959 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6960 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv);
6961 return (uint64_t)ret_conv;
6964 typedef struct LDKChannelMessageHandler_JCalls {
6965 atomic_size_t refcnt;
6966 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
6967 uint32_t handle_open_channel_meth;
6968 uint32_t handle_accept_channel_meth;
6969 uint32_t handle_funding_created_meth;
6970 uint32_t handle_funding_signed_meth;
6971 uint32_t handle_funding_locked_meth;
6972 uint32_t handle_shutdown_meth;
6973 uint32_t handle_closing_signed_meth;
6974 uint32_t handle_update_add_htlc_meth;
6975 uint32_t handle_update_fulfill_htlc_meth;
6976 uint32_t handle_update_fail_htlc_meth;
6977 uint32_t handle_update_fail_malformed_htlc_meth;
6978 uint32_t handle_commitment_signed_meth;
6979 uint32_t handle_revoke_and_ack_meth;
6980 uint32_t handle_update_fee_meth;
6981 uint32_t handle_announcement_signatures_meth;
6982 uint32_t peer_disconnected_meth;
6983 uint32_t peer_connected_meth;
6984 uint32_t handle_channel_reestablish_meth;
6985 uint32_t handle_channel_update_meth;
6986 uint32_t handle_error_meth;
6987 } LDKChannelMessageHandler_JCalls;
6988 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
6989 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6990 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6991 js_free_function_ptr(j_calls->handle_open_channel_meth);
6992 js_free_function_ptr(j_calls->handle_accept_channel_meth);
6993 js_free_function_ptr(j_calls->handle_funding_created_meth);
6994 js_free_function_ptr(j_calls->handle_funding_signed_meth);
6995 js_free_function_ptr(j_calls->handle_funding_locked_meth);
6996 js_free_function_ptr(j_calls->handle_shutdown_meth);
6997 js_free_function_ptr(j_calls->handle_closing_signed_meth);
6998 js_free_function_ptr(j_calls->handle_update_add_htlc_meth);
6999 js_free_function_ptr(j_calls->handle_update_fulfill_htlc_meth);
7000 js_free_function_ptr(j_calls->handle_update_fail_htlc_meth);
7001 js_free_function_ptr(j_calls->handle_update_fail_malformed_htlc_meth);
7002 js_free_function_ptr(j_calls->handle_commitment_signed_meth);
7003 js_free_function_ptr(j_calls->handle_revoke_and_ack_meth);
7004 js_free_function_ptr(j_calls->handle_update_fee_meth);
7005 js_free_function_ptr(j_calls->handle_announcement_signatures_meth);
7006 js_free_function_ptr(j_calls->peer_disconnected_meth);
7007 js_free_function_ptr(j_calls->peer_connected_meth);
7008 js_free_function_ptr(j_calls->handle_channel_reestablish_meth);
7009 js_free_function_ptr(j_calls->handle_channel_update_meth);
7010 js_free_function_ptr(j_calls->handle_error_meth);
7014 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
7015 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7016 int8_tArray their_node_id_arr = init_int8_tArray(33);
7017 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7018 LDKInitFeatures their_features_var = their_features;
7019 uint64_t their_features_ref = 0;
7020 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7021 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7022 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
7023 their_features_ref = (uint64_t)their_features_var.inner;
7024 if (their_features_var.is_owned) {
7025 their_features_ref |= 1;
7027 LDKOpenChannel msg_var = *msg;
7028 uint64_t msg_ref = 0;
7029 msg_var = OpenChannel_clone(msg);
7030 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7031 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7032 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7033 msg_ref = (uint64_t)msg_var.inner;
7034 if (msg_var.is_owned) {
7037 js_invoke_function_3(j_calls->handle_open_channel_meth, (uint32_t)their_node_id_arr, (uint32_t)their_features_ref, (uint32_t)msg_ref);
7039 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
7040 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7041 int8_tArray their_node_id_arr = init_int8_tArray(33);
7042 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7043 LDKInitFeatures their_features_var = their_features;
7044 uint64_t their_features_ref = 0;
7045 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7046 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7047 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
7048 their_features_ref = (uint64_t)their_features_var.inner;
7049 if (their_features_var.is_owned) {
7050 their_features_ref |= 1;
7052 LDKAcceptChannel msg_var = *msg;
7053 uint64_t msg_ref = 0;
7054 msg_var = AcceptChannel_clone(msg);
7055 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7056 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7057 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7058 msg_ref = (uint64_t)msg_var.inner;
7059 if (msg_var.is_owned) {
7062 js_invoke_function_3(j_calls->handle_accept_channel_meth, (uint32_t)their_node_id_arr, (uint32_t)their_features_ref, (uint32_t)msg_ref);
7064 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
7065 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7066 int8_tArray their_node_id_arr = init_int8_tArray(33);
7067 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7068 LDKFundingCreated msg_var = *msg;
7069 uint64_t msg_ref = 0;
7070 msg_var = FundingCreated_clone(msg);
7071 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7072 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7073 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7074 msg_ref = (uint64_t)msg_var.inner;
7075 if (msg_var.is_owned) {
7078 js_invoke_function_2(j_calls->handle_funding_created_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7080 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
7081 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7082 int8_tArray their_node_id_arr = init_int8_tArray(33);
7083 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7084 LDKFundingSigned msg_var = *msg;
7085 uint64_t msg_ref = 0;
7086 msg_var = FundingSigned_clone(msg);
7087 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7088 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7089 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7090 msg_ref = (uint64_t)msg_var.inner;
7091 if (msg_var.is_owned) {
7094 js_invoke_function_2(j_calls->handle_funding_signed_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7096 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
7097 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7098 int8_tArray their_node_id_arr = init_int8_tArray(33);
7099 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7100 LDKFundingLocked msg_var = *msg;
7101 uint64_t msg_ref = 0;
7102 msg_var = FundingLocked_clone(msg);
7103 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7104 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7105 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7106 msg_ref = (uint64_t)msg_var.inner;
7107 if (msg_var.is_owned) {
7110 js_invoke_function_2(j_calls->handle_funding_locked_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7112 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
7113 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7114 int8_tArray their_node_id_arr = init_int8_tArray(33);
7115 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7116 LDKInitFeatures their_features_var = *their_features;
7117 uint64_t their_features_ref = 0;
7118 their_features_var = InitFeatures_clone(their_features);
7119 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7120 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7121 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
7122 their_features_ref = (uint64_t)their_features_var.inner;
7123 if (their_features_var.is_owned) {
7124 their_features_ref |= 1;
7126 LDKShutdown msg_var = *msg;
7127 uint64_t msg_ref = 0;
7128 msg_var = Shutdown_clone(msg);
7129 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7130 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7131 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7132 msg_ref = (uint64_t)msg_var.inner;
7133 if (msg_var.is_owned) {
7136 js_invoke_function_3(j_calls->handle_shutdown_meth, (uint32_t)their_node_id_arr, (uint32_t)their_features_ref, (uint32_t)msg_ref);
7138 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
7139 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7140 int8_tArray their_node_id_arr = init_int8_tArray(33);
7141 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7142 LDKClosingSigned msg_var = *msg;
7143 uint64_t msg_ref = 0;
7144 msg_var = ClosingSigned_clone(msg);
7145 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7146 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7147 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7148 msg_ref = (uint64_t)msg_var.inner;
7149 if (msg_var.is_owned) {
7152 js_invoke_function_2(j_calls->handle_closing_signed_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7154 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
7155 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7156 int8_tArray their_node_id_arr = init_int8_tArray(33);
7157 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7158 LDKUpdateAddHTLC msg_var = *msg;
7159 uint64_t msg_ref = 0;
7160 msg_var = UpdateAddHTLC_clone(msg);
7161 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7162 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7163 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7164 msg_ref = (uint64_t)msg_var.inner;
7165 if (msg_var.is_owned) {
7168 js_invoke_function_2(j_calls->handle_update_add_htlc_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7170 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
7171 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7172 int8_tArray their_node_id_arr = init_int8_tArray(33);
7173 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7174 LDKUpdateFulfillHTLC msg_var = *msg;
7175 uint64_t msg_ref = 0;
7176 msg_var = UpdateFulfillHTLC_clone(msg);
7177 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7178 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7179 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7180 msg_ref = (uint64_t)msg_var.inner;
7181 if (msg_var.is_owned) {
7184 js_invoke_function_2(j_calls->handle_update_fulfill_htlc_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7186 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
7187 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7188 int8_tArray their_node_id_arr = init_int8_tArray(33);
7189 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7190 LDKUpdateFailHTLC msg_var = *msg;
7191 uint64_t msg_ref = 0;
7192 msg_var = UpdateFailHTLC_clone(msg);
7193 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7194 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7195 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7196 msg_ref = (uint64_t)msg_var.inner;
7197 if (msg_var.is_owned) {
7200 js_invoke_function_2(j_calls->handle_update_fail_htlc_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7202 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
7203 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7204 int8_tArray their_node_id_arr = init_int8_tArray(33);
7205 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7206 LDKUpdateFailMalformedHTLC msg_var = *msg;
7207 uint64_t msg_ref = 0;
7208 msg_var = UpdateFailMalformedHTLC_clone(msg);
7209 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7210 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7211 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7212 msg_ref = (uint64_t)msg_var.inner;
7213 if (msg_var.is_owned) {
7216 js_invoke_function_2(j_calls->handle_update_fail_malformed_htlc_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7218 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
7219 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7220 int8_tArray their_node_id_arr = init_int8_tArray(33);
7221 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7222 LDKCommitmentSigned msg_var = *msg;
7223 uint64_t msg_ref = 0;
7224 msg_var = CommitmentSigned_clone(msg);
7225 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7226 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7227 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7228 msg_ref = (uint64_t)msg_var.inner;
7229 if (msg_var.is_owned) {
7232 js_invoke_function_2(j_calls->handle_commitment_signed_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7234 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
7235 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7236 int8_tArray their_node_id_arr = init_int8_tArray(33);
7237 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7238 LDKRevokeAndACK msg_var = *msg;
7239 uint64_t msg_ref = 0;
7240 msg_var = RevokeAndACK_clone(msg);
7241 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7242 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7243 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7244 msg_ref = (uint64_t)msg_var.inner;
7245 if (msg_var.is_owned) {
7248 js_invoke_function_2(j_calls->handle_revoke_and_ack_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7250 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
7251 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7252 int8_tArray their_node_id_arr = init_int8_tArray(33);
7253 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7254 LDKUpdateFee msg_var = *msg;
7255 uint64_t msg_ref = 0;
7256 msg_var = UpdateFee_clone(msg);
7257 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7258 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7259 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7260 msg_ref = (uint64_t)msg_var.inner;
7261 if (msg_var.is_owned) {
7264 js_invoke_function_2(j_calls->handle_update_fee_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7266 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
7267 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7268 int8_tArray their_node_id_arr = init_int8_tArray(33);
7269 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7270 LDKAnnouncementSignatures msg_var = *msg;
7271 uint64_t msg_ref = 0;
7272 msg_var = AnnouncementSignatures_clone(msg);
7273 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7274 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7275 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7276 msg_ref = (uint64_t)msg_var.inner;
7277 if (msg_var.is_owned) {
7280 js_invoke_function_2(j_calls->handle_announcement_signatures_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7282 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
7283 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7284 int8_tArray their_node_id_arr = init_int8_tArray(33);
7285 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7286 js_invoke_function_2(j_calls->peer_disconnected_meth, (uint32_t)their_node_id_arr, (uint32_t)no_connection_possible);
7288 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
7289 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7290 int8_tArray their_node_id_arr = init_int8_tArray(33);
7291 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7292 LDKInit msg_var = *msg;
7293 uint64_t msg_ref = 0;
7294 msg_var = Init_clone(msg);
7295 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7296 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7297 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7298 msg_ref = (uint64_t)msg_var.inner;
7299 if (msg_var.is_owned) {
7302 js_invoke_function_2(j_calls->peer_connected_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7304 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
7305 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7306 int8_tArray their_node_id_arr = init_int8_tArray(33);
7307 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7308 LDKChannelReestablish msg_var = *msg;
7309 uint64_t msg_ref = 0;
7310 msg_var = ChannelReestablish_clone(msg);
7311 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7312 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7313 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7314 msg_ref = (uint64_t)msg_var.inner;
7315 if (msg_var.is_owned) {
7318 js_invoke_function_2(j_calls->handle_channel_reestablish_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7320 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
7321 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7322 int8_tArray their_node_id_arr = init_int8_tArray(33);
7323 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7324 LDKChannelUpdate msg_var = *msg;
7325 uint64_t msg_ref = 0;
7326 msg_var = ChannelUpdate_clone(msg);
7327 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7328 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7329 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7330 msg_ref = (uint64_t)msg_var.inner;
7331 if (msg_var.is_owned) {
7334 js_invoke_function_2(j_calls->handle_channel_update_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7336 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
7337 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7338 int8_tArray their_node_id_arr = init_int8_tArray(33);
7339 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7340 LDKErrorMessage msg_var = *msg;
7341 uint64_t msg_ref = 0;
7342 msg_var = ErrorMessage_clone(msg);
7343 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7344 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7345 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7346 msg_ref = (uint64_t)msg_var.inner;
7347 if (msg_var.is_owned) {
7350 js_invoke_function_2(j_calls->handle_error_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7352 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
7353 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
7354 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7355 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
7357 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
7358 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
7359 atomic_init(&calls->refcnt, 1);
7360 //TODO: Assign calls->o from o
7362 LDKChannelMessageHandler ret = {
7363 .this_arg = (void*) calls,
7364 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
7365 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
7366 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
7367 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
7368 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
7369 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
7370 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
7371 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
7372 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
7373 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
7374 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
7375 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
7376 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
7377 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
7378 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
7379 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
7380 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
7381 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
7382 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
7383 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
7384 .free = LDKChannelMessageHandler_JCalls_free,
7385 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
7387 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
7390 long __attribute__((visibility("default"))) TS_LDKChannelMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
7391 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
7392 *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
7393 return (long)res_ptr;
7395 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_open_channel(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
7396 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7397 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7398 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7399 LDKPublicKey their_node_id_ref;
7400 CHECK(their_node_id->arr_len == 33);
7401 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7402 LDKInitFeatures their_features_conv;
7403 their_features_conv.inner = (void*)(their_features & (~1));
7404 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
7405 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
7406 their_features_conv = InitFeatures_clone(&their_features_conv);
7407 LDKOpenChannel msg_conv;
7408 msg_conv.inner = (void*)(msg & (~1));
7409 msg_conv.is_owned = false;
7410 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7411 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
7414 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_accept_channel(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
7415 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7416 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7417 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7418 LDKPublicKey their_node_id_ref;
7419 CHECK(their_node_id->arr_len == 33);
7420 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7421 LDKInitFeatures their_features_conv;
7422 their_features_conv.inner = (void*)(their_features & (~1));
7423 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
7424 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
7425 their_features_conv = InitFeatures_clone(&their_features_conv);
7426 LDKAcceptChannel msg_conv;
7427 msg_conv.inner = (void*)(msg & (~1));
7428 msg_conv.is_owned = false;
7429 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7430 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
7433 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_created(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7434 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7435 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7436 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7437 LDKPublicKey their_node_id_ref;
7438 CHECK(their_node_id->arr_len == 33);
7439 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7440 LDKFundingCreated msg_conv;
7441 msg_conv.inner = (void*)(msg & (~1));
7442 msg_conv.is_owned = false;
7443 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7444 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7447 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7448 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7449 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7450 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7451 LDKPublicKey their_node_id_ref;
7452 CHECK(their_node_id->arr_len == 33);
7453 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7454 LDKFundingSigned msg_conv;
7455 msg_conv.inner = (void*)(msg & (~1));
7456 msg_conv.is_owned = false;
7457 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7458 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7461 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_locked(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7462 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7463 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7464 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7465 LDKPublicKey their_node_id_ref;
7466 CHECK(their_node_id->arr_len == 33);
7467 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7468 LDKFundingLocked msg_conv;
7469 msg_conv.inner = (void*)(msg & (~1));
7470 msg_conv.is_owned = false;
7471 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7472 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7475 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_shutdown(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
7476 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7477 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7478 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7479 LDKPublicKey their_node_id_ref;
7480 CHECK(their_node_id->arr_len == 33);
7481 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7482 LDKInitFeatures their_features_conv;
7483 their_features_conv.inner = (void*)(their_features & (~1));
7484 their_features_conv.is_owned = false;
7485 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
7486 LDKShutdown msg_conv;
7487 msg_conv.inner = (void*)(msg & (~1));
7488 msg_conv.is_owned = false;
7489 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7490 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
7493 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_closing_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7494 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7495 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7496 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7497 LDKPublicKey their_node_id_ref;
7498 CHECK(their_node_id->arr_len == 33);
7499 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7500 LDKClosingSigned msg_conv;
7501 msg_conv.inner = (void*)(msg & (~1));
7502 msg_conv.is_owned = false;
7503 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7504 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7507 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_add_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7508 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7509 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7510 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7511 LDKPublicKey their_node_id_ref;
7512 CHECK(their_node_id->arr_len == 33);
7513 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7514 LDKUpdateAddHTLC msg_conv;
7515 msg_conv.inner = (void*)(msg & (~1));
7516 msg_conv.is_owned = false;
7517 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7518 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7521 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fulfill_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7522 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7523 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7524 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7525 LDKPublicKey their_node_id_ref;
7526 CHECK(their_node_id->arr_len == 33);
7527 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7528 LDKUpdateFulfillHTLC msg_conv;
7529 msg_conv.inner = (void*)(msg & (~1));
7530 msg_conv.is_owned = false;
7531 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7532 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7535 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7536 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7537 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7538 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7539 LDKPublicKey their_node_id_ref;
7540 CHECK(their_node_id->arr_len == 33);
7541 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7542 LDKUpdateFailHTLC msg_conv;
7543 msg_conv.inner = (void*)(msg & (~1));
7544 msg_conv.is_owned = false;
7545 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7546 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7549 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_malformed_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7550 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7551 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7552 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7553 LDKPublicKey their_node_id_ref;
7554 CHECK(their_node_id->arr_len == 33);
7555 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7556 LDKUpdateFailMalformedHTLC msg_conv;
7557 msg_conv.inner = (void*)(msg & (~1));
7558 msg_conv.is_owned = false;
7559 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7560 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7563 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_commitment_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7564 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7565 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7566 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7567 LDKPublicKey their_node_id_ref;
7568 CHECK(their_node_id->arr_len == 33);
7569 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7570 LDKCommitmentSigned msg_conv;
7571 msg_conv.inner = (void*)(msg & (~1));
7572 msg_conv.is_owned = false;
7573 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7574 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7577 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_revoke_and_ack(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7578 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7579 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7580 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7581 LDKPublicKey their_node_id_ref;
7582 CHECK(their_node_id->arr_len == 33);
7583 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7584 LDKRevokeAndACK msg_conv;
7585 msg_conv.inner = (void*)(msg & (~1));
7586 msg_conv.is_owned = false;
7587 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7588 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7591 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fee(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7592 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7593 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7594 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7595 LDKPublicKey their_node_id_ref;
7596 CHECK(their_node_id->arr_len == 33);
7597 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7598 LDKUpdateFee msg_conv;
7599 msg_conv.inner = (void*)(msg & (~1));
7600 msg_conv.is_owned = false;
7601 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7602 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7605 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_announcement_signatures(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7606 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7607 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7608 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7609 LDKPublicKey their_node_id_ref;
7610 CHECK(their_node_id->arr_len == 33);
7611 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7612 LDKAnnouncementSignatures msg_conv;
7613 msg_conv.inner = (void*)(msg & (~1));
7614 msg_conv.is_owned = false;
7615 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7616 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7619 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_disconnected(uint32_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
7620 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7621 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7622 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7623 LDKPublicKey their_node_id_ref;
7624 CHECK(their_node_id->arr_len == 33);
7625 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7626 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
7629 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7630 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7631 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7632 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7633 LDKPublicKey their_node_id_ref;
7634 CHECK(their_node_id->arr_len == 33);
7635 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7637 msg_conv.inner = (void*)(msg & (~1));
7638 msg_conv.is_owned = false;
7639 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7640 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7643 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_reestablish(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7644 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7645 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7646 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7647 LDKPublicKey their_node_id_ref;
7648 CHECK(their_node_id->arr_len == 33);
7649 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7650 LDKChannelReestablish msg_conv;
7651 msg_conv.inner = (void*)(msg & (~1));
7652 msg_conv.is_owned = false;
7653 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7654 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7657 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_update(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7658 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7659 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7660 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7661 LDKPublicKey their_node_id_ref;
7662 CHECK(their_node_id->arr_len == 33);
7663 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7664 LDKChannelUpdate msg_conv;
7665 msg_conv.inner = (void*)(msg & (~1));
7666 msg_conv.is_owned = false;
7667 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7668 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7671 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_error(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7672 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7673 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7674 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7675 LDKPublicKey their_node_id_ref;
7676 CHECK(their_node_id->arr_len == 33);
7677 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7678 LDKErrorMessage msg_conv;
7679 msg_conv.inner = (void*)(msg & (~1));
7680 msg_conv.is_owned = false;
7681 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7682 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7685 typedef struct LDKRoutingMessageHandler_JCalls {
7686 atomic_size_t refcnt;
7687 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
7688 uint32_t handle_node_announcement_meth;
7689 uint32_t handle_channel_announcement_meth;
7690 uint32_t handle_channel_update_meth;
7691 uint32_t get_next_channel_announcements_meth;
7692 uint32_t get_next_node_announcements_meth;
7693 uint32_t sync_routing_table_meth;
7694 uint32_t handle_reply_channel_range_meth;
7695 uint32_t handle_reply_short_channel_ids_end_meth;
7696 uint32_t handle_query_channel_range_meth;
7697 uint32_t handle_query_short_channel_ids_meth;
7698 } LDKRoutingMessageHandler_JCalls;
7699 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
7700 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7701 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7702 js_free_function_ptr(j_calls->handle_node_announcement_meth);
7703 js_free_function_ptr(j_calls->handle_channel_announcement_meth);
7704 js_free_function_ptr(j_calls->handle_channel_update_meth);
7705 js_free_function_ptr(j_calls->get_next_channel_announcements_meth);
7706 js_free_function_ptr(j_calls->get_next_node_announcements_meth);
7707 js_free_function_ptr(j_calls->sync_routing_table_meth);
7708 js_free_function_ptr(j_calls->handle_reply_channel_range_meth);
7709 js_free_function_ptr(j_calls->handle_reply_short_channel_ids_end_meth);
7710 js_free_function_ptr(j_calls->handle_query_channel_range_meth);
7711 js_free_function_ptr(j_calls->handle_query_short_channel_ids_meth);
7715 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
7716 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7717 LDKNodeAnnouncement msg_var = *msg;
7718 uint64_t msg_ref = 0;
7719 msg_var = NodeAnnouncement_clone(msg);
7720 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7721 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7722 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7723 msg_ref = (uint64_t)msg_var.inner;
7724 if (msg_var.is_owned) {
7727 uint32_t ret = js_invoke_function_1(j_calls->handle_node_announcement_meth, (uint32_t)msg_ref);
7728 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7729 CHECK_ACCESS(ret_ptr);
7730 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
7734 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
7735 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7736 LDKChannelAnnouncement msg_var = *msg;
7737 uint64_t msg_ref = 0;
7738 msg_var = ChannelAnnouncement_clone(msg);
7739 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7740 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7741 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7742 msg_ref = (uint64_t)msg_var.inner;
7743 if (msg_var.is_owned) {
7746 uint32_t ret = js_invoke_function_1(j_calls->handle_channel_announcement_meth, (uint32_t)msg_ref);
7747 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7748 CHECK_ACCESS(ret_ptr);
7749 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
7753 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
7754 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7755 LDKChannelUpdate msg_var = *msg;
7756 uint64_t msg_ref = 0;
7757 msg_var = ChannelUpdate_clone(msg);
7758 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7759 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7760 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7761 msg_ref = (uint64_t)msg_var.inner;
7762 if (msg_var.is_owned) {
7765 uint32_t ret = js_invoke_function_1(j_calls->handle_channel_update_meth, (uint32_t)msg_ref);
7766 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7767 CHECK_ACCESS(ret_ptr);
7768 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
7772 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
7773 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7774 uint32_tArray ret = (uint32_tArray)js_invoke_function_2(j_calls->get_next_channel_announcements_meth, (uint32_t)starting_point, (uint32_t)batch_amount);
7775 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
7776 ret_constr.datalen = ret->arr_len;
7777 if (ret_constr.datalen > 0)
7778 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
7780 ret_constr.data = NULL;
7781 uint32_t* ret_vals = ret->elems;
7782 for (size_t h = 0; h < ret_constr.datalen; h++) {
7783 uint32_t ret_conv_59 = ret_vals[h];
7784 void* ret_conv_59_ptr = (void*)(((uint64_t)ret_conv_59) & ~1);
7785 CHECK_ACCESS(ret_conv_59_ptr);
7786 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ret_conv_59_ptr);
7787 FREE((void*)ret_conv_59);
7788 ret_constr.data[h] = ret_conv_59_conv;
7792 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
7793 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7794 int8_tArray starting_point_arr = init_int8_tArray(33);
7795 memcpy(starting_point_arr->elems, starting_point.compressed_form, 33);
7796 uint32_tArray ret = (uint32_tArray)js_invoke_function_2(j_calls->get_next_node_announcements_meth, (uint32_t)starting_point_arr, (uint32_t)batch_amount);
7797 LDKCVec_NodeAnnouncementZ ret_constr;
7798 ret_constr.datalen = ret->arr_len;
7799 if (ret_constr.datalen > 0)
7800 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
7802 ret_constr.data = NULL;
7803 uint32_t* ret_vals = ret->elems;
7804 for (size_t s = 0; s < ret_constr.datalen; s++) {
7805 uint32_t ret_conv_18 = ret_vals[s];
7806 LDKNodeAnnouncement ret_conv_18_conv;
7807 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
7808 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
7809 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_conv);
7810 ret_constr.data[s] = ret_conv_18_conv;
7814 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
7815 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7816 int8_tArray their_node_id_arr = init_int8_tArray(33);
7817 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7818 LDKInit init_var = *init;
7819 uint64_t init_ref = 0;
7820 init_var = Init_clone(init);
7821 CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7822 CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7823 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
7824 init_ref = (uint64_t)init_var.inner;
7825 if (init_var.is_owned) {
7828 js_invoke_function_2(j_calls->sync_routing_table_meth, (uint32_t)their_node_id_arr, (uint32_t)init_ref);
7830 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
7831 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7832 int8_tArray their_node_id_arr = init_int8_tArray(33);
7833 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7834 LDKReplyChannelRange msg_var = msg;
7835 uint64_t msg_ref = 0;
7836 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7837 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7838 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7839 msg_ref = (uint64_t)msg_var.inner;
7840 if (msg_var.is_owned) {
7843 uint32_t ret = js_invoke_function_2(j_calls->handle_reply_channel_range_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7844 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7845 CHECK_ACCESS(ret_ptr);
7846 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
7850 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
7851 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7852 int8_tArray their_node_id_arr = init_int8_tArray(33);
7853 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7854 LDKReplyShortChannelIdsEnd msg_var = msg;
7855 uint64_t msg_ref = 0;
7856 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7857 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7858 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7859 msg_ref = (uint64_t)msg_var.inner;
7860 if (msg_var.is_owned) {
7863 uint32_t ret = js_invoke_function_2(j_calls->handle_reply_short_channel_ids_end_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7864 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7865 CHECK_ACCESS(ret_ptr);
7866 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
7870 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
7871 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7872 int8_tArray their_node_id_arr = init_int8_tArray(33);
7873 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7874 LDKQueryChannelRange msg_var = msg;
7875 uint64_t msg_ref = 0;
7876 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7877 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7878 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7879 msg_ref = (uint64_t)msg_var.inner;
7880 if (msg_var.is_owned) {
7883 uint32_t ret = js_invoke_function_2(j_calls->handle_query_channel_range_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7884 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7885 CHECK_ACCESS(ret_ptr);
7886 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
7890 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
7891 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7892 int8_tArray their_node_id_arr = init_int8_tArray(33);
7893 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7894 LDKQueryShortChannelIds msg_var = msg;
7895 uint64_t msg_ref = 0;
7896 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7897 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7898 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7899 msg_ref = (uint64_t)msg_var.inner;
7900 if (msg_var.is_owned) {
7903 uint32_t ret = js_invoke_function_2(j_calls->handle_query_short_channel_ids_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7904 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7905 CHECK_ACCESS(ret_ptr);
7906 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
7910 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
7911 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
7912 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7913 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
7915 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
7916 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
7917 atomic_init(&calls->refcnt, 1);
7918 //TODO: Assign calls->o from o
7920 LDKRoutingMessageHandler ret = {
7921 .this_arg = (void*) calls,
7922 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
7923 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
7924 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
7925 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
7926 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
7927 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
7928 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
7929 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
7930 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
7931 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
7932 .free = LDKRoutingMessageHandler_JCalls_free,
7933 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
7935 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
7938 long __attribute__((visibility("default"))) TS_LDKRoutingMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
7939 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
7940 *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
7941 return (long)res_ptr;
7943 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_node_announcement(uint32_t this_arg, uint32_t msg) {
7944 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7945 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7946 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7947 LDKNodeAnnouncement msg_conv;
7948 msg_conv.inner = (void*)(msg & (~1));
7949 msg_conv.is_owned = false;
7950 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7951 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
7952 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
7953 return (uint64_t)ret_conv;
7956 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_announcement(uint32_t this_arg, uint32_t msg) {
7957 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7958 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7959 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7960 LDKChannelAnnouncement msg_conv;
7961 msg_conv.inner = (void*)(msg & (~1));
7962 msg_conv.is_owned = false;
7963 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7964 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
7965 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
7966 return (uint64_t)ret_conv;
7969 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_update(uint32_t this_arg, uint32_t msg) {
7970 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7971 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7972 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7973 LDKChannelUpdate msg_conv;
7974 msg_conv.inner = (void*)(msg & (~1));
7975 msg_conv.is_owned = false;
7976 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7977 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
7978 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
7979 return (uint64_t)ret_conv;
7982 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_channel_announcements(uint32_t this_arg, int64_t starting_point, int8_t batch_amount) {
7983 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7984 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7985 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7986 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
7987 uint32_tArray ret_arr = NULL;
7988 ret_arr = init_uint32_tArray(ret_var.datalen);
7989 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
7990 for (size_t h = 0; h < ret_var.datalen; h++) {
7991 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
7992 *ret_conv_59_conv = ret_var.data[h];
7993 ret_arr_ptr[h] = ((uint64_t)ret_conv_59_conv);
8000 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_node_announcements(uint32_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
8001 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8002 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8003 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
8004 LDKPublicKey starting_point_ref;
8005 CHECK(starting_point->arr_len == 33);
8006 memcpy(starting_point_ref.compressed_form, starting_point->elems, 33);
8007 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
8008 uint32_tArray ret_arr = NULL;
8009 ret_arr = init_uint32_tArray(ret_var.datalen);
8010 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
8011 for (size_t s = 0; s < ret_var.datalen; s++) {
8012 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
8013 uint64_t ret_conv_18_ref = 0;
8014 CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8015 CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8016 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_var);
8017 ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
8018 if (ret_conv_18_var.is_owned) {
8019 ret_conv_18_ref |= 1;
8021 ret_arr_ptr[s] = ret_conv_18_ref;
8028 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_sync_routing_table(uint32_t this_arg, int8_tArray their_node_id, uint32_t init) {
8029 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8030 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8031 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
8032 LDKPublicKey their_node_id_ref;
8033 CHECK(their_node_id->arr_len == 33);
8034 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
8036 init_conv.inner = (void*)(init & (~1));
8037 init_conv.is_owned = false;
8038 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
8039 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
8042 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_reply_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
8043 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8044 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8045 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
8046 LDKPublicKey their_node_id_ref;
8047 CHECK(their_node_id->arr_len == 33);
8048 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
8049 LDKReplyChannelRange msg_conv;
8050 msg_conv.inner = (void*)(msg & (~1));
8051 msg_conv.is_owned = (msg & 1) || (msg == 0);
8052 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8053 msg_conv = ReplyChannelRange_clone(&msg_conv);
8054 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8055 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8056 return (uint64_t)ret_conv;
8059 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_reply_short_channel_ids_end(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
8060 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8061 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8062 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
8063 LDKPublicKey their_node_id_ref;
8064 CHECK(their_node_id->arr_len == 33);
8065 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
8066 LDKReplyShortChannelIdsEnd msg_conv;
8067 msg_conv.inner = (void*)(msg & (~1));
8068 msg_conv.is_owned = (msg & 1) || (msg == 0);
8069 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8070 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
8071 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8072 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8073 return (uint64_t)ret_conv;
8076 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
8077 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8078 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8079 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
8080 LDKPublicKey their_node_id_ref;
8081 CHECK(their_node_id->arr_len == 33);
8082 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
8083 LDKQueryChannelRange msg_conv;
8084 msg_conv.inner = (void*)(msg & (~1));
8085 msg_conv.is_owned = (msg & 1) || (msg == 0);
8086 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8087 msg_conv = QueryChannelRange_clone(&msg_conv);
8088 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8089 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8090 return (uint64_t)ret_conv;
8093 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_short_channel_ids(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
8094 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8095 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8096 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
8097 LDKPublicKey their_node_id_ref;
8098 CHECK(their_node_id->arr_len == 33);
8099 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
8100 LDKQueryShortChannelIds msg_conv;
8101 msg_conv.inner = (void*)(msg & (~1));
8102 msg_conv.is_owned = (msg & 1) || (msg == 0);
8103 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8104 msg_conv = QueryShortChannelIds_clone(&msg_conv);
8105 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8106 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8107 return (uint64_t)ret_conv;
8110 typedef struct LDKCustomMessageReader_JCalls {
8111 atomic_size_t refcnt;
8113 } LDKCustomMessageReader_JCalls;
8114 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
8115 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
8116 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8117 js_free_function_ptr(j_calls->read_meth);
8121 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
8122 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
8123 LDKu8slice buffer_var = buffer;
8124 int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen);
8125 memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
8126 uint32_t ret = js_invoke_function_2(j_calls->read_meth, (uint32_t)message_type, (uint32_t)buffer_arr);
8127 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8128 CHECK_ACCESS(ret_ptr);
8129 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
8133 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
8134 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
8135 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8137 static inline LDKCustomMessageReader LDKCustomMessageReader_init (/*TODO: JS Object Reference */void* o) {
8138 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
8139 atomic_init(&calls->refcnt, 1);
8140 //TODO: Assign calls->o from o
8142 LDKCustomMessageReader ret = {
8143 .this_arg = (void*) calls,
8144 .read = read_LDKCustomMessageReader_jcall,
8145 .free = LDKCustomMessageReader_JCalls_free,
8149 long __attribute__((visibility("default"))) TS_LDKCustomMessageReader_new(/*TODO: JS Object Reference */void* o) {
8150 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
8151 *res_ptr = LDKCustomMessageReader_init(o);
8152 return (long)res_ptr;
8154 uint32_t __attribute__((visibility("default"))) TS_CustomMessageReader_read(uint32_t this_arg, int16_t message_type, int8_tArray buffer) {
8155 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8156 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8157 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
8158 LDKu8slice buffer_ref;
8159 buffer_ref.datalen = buffer->arr_len;
8160 buffer_ref.data = buffer->elems;
8161 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
8162 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
8163 return (uint64_t)ret_conv;
8166 typedef struct LDKCustomMessageHandler_JCalls {
8167 atomic_size_t refcnt;
8168 LDKCustomMessageReader_JCalls* CustomMessageReader;
8169 uint32_t handle_custom_message_meth;
8170 uint32_t get_and_clear_pending_msg_meth;
8171 } LDKCustomMessageHandler_JCalls;
8172 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
8173 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
8174 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8175 js_free_function_ptr(j_calls->handle_custom_message_meth);
8176 js_free_function_ptr(j_calls->get_and_clear_pending_msg_meth);
8180 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
8181 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
8182 LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
8184 int8_tArray sender_node_id_arr = init_int8_tArray(33);
8185 memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
8186 uint32_t ret = js_invoke_function_2(j_calls->handle_custom_message_meth, (uint32_t)(uint64_t)msg_ret, (uint32_t)sender_node_id_arr);
8187 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8188 CHECK_ACCESS(ret_ptr);
8189 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
8193 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
8194 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
8195 uint32_tArray ret = (uint32_tArray)js_invoke_function_0(j_calls->get_and_clear_pending_msg_meth);
8196 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
8197 ret_constr.datalen = ret->arr_len;
8198 if (ret_constr.datalen > 0)
8199 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
8201 ret_constr.data = NULL;
8202 uint32_t* ret_vals = ret->elems;
8203 for (size_t z = 0; z < ret_constr.datalen; z++) {
8204 uint32_t ret_conv_25 = ret_vals[z];
8205 void* ret_conv_25_ptr = (void*)(((uint64_t)ret_conv_25) & ~1);
8206 CHECK_ACCESS(ret_conv_25_ptr);
8207 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
8208 FREE((void*)ret_conv_25);
8209 ret_constr.data[z] = ret_conv_25_conv;
8213 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
8214 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
8215 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8216 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
8218 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* CustomMessageReader) {
8219 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
8220 atomic_init(&calls->refcnt, 1);
8221 //TODO: Assign calls->o from o
8223 LDKCustomMessageHandler ret = {
8224 .this_arg = (void*) calls,
8225 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
8226 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
8227 .free = LDKCustomMessageHandler_JCalls_free,
8228 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
8230 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
8233 long __attribute__((visibility("default"))) TS_LDKCustomMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* CustomMessageReader) {
8234 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
8235 *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
8236 return (long)res_ptr;
8238 uint32_t __attribute__((visibility("default"))) TS_CustomMessageHandler_handle_custom_message(uint32_t this_arg, uint32_t msg, int8_tArray sender_node_id) {
8239 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8240 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8241 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
8242 void* msg_ptr = (void*)(((uint64_t)msg) & ~1);
8243 CHECK_ACCESS(msg_ptr);
8244 LDKType msg_conv = *(LDKType*)(msg_ptr);
8245 LDKPublicKey sender_node_id_ref;
8246 CHECK(sender_node_id->arr_len == 33);
8247 memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33);
8248 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8249 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
8250 return (uint64_t)ret_conv;
8253 uint32_tArray __attribute__((visibility("default"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint32_t this_arg) {
8254 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8255 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8256 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
8257 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
8258 uint32_tArray ret_arr = NULL;
8259 ret_arr = init_uint32_tArray(ret_var.datalen);
8260 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
8261 for (size_t z = 0; z < ret_var.datalen; z++) {
8262 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
8263 *ret_conv_25_conv = ret_var.data[z];
8264 ret_arr_ptr[z] = ((uint64_t)ret_conv_25_conv);
8271 typedef struct LDKSocketDescriptor_JCalls {
8272 atomic_size_t refcnt;
8273 uint32_t send_data_meth;
8274 uint32_t disconnect_socket_meth;
8277 } LDKSocketDescriptor_JCalls;
8278 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
8279 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8280 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8281 js_free_function_ptr(j_calls->send_data_meth);
8282 js_free_function_ptr(j_calls->disconnect_socket_meth);
8283 js_free_function_ptr(j_calls->eq_meth);
8284 js_free_function_ptr(j_calls->hash_meth);
8288 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
8289 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8290 LDKu8slice data_var = data;
8291 int8_tArray data_arr = init_int8_tArray(data_var.datalen);
8292 memcpy(data_arr->elems, data_var.data, data_var.datalen);
8293 return js_invoke_function_2(j_calls->send_data_meth, (uint32_t)data_arr, (uint32_t)resume_read);
8295 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
8296 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8297 js_invoke_function_0(j_calls->disconnect_socket_meth);
8299 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
8300 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8301 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
8302 *other_arg_clone = SocketDescriptor_clone(other_arg);
8303 return js_invoke_function_1(j_calls->eq_meth, (uint32_t)(uint64_t)other_arg_clone);
8305 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
8306 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8307 return js_invoke_function_0(j_calls->hash_meth);
8309 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
8310 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
8311 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8313 static inline LDKSocketDescriptor LDKSocketDescriptor_init (/*TODO: JS Object Reference */void* o) {
8314 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
8315 atomic_init(&calls->refcnt, 1);
8316 //TODO: Assign calls->o from o
8318 LDKSocketDescriptor ret = {
8319 .this_arg = (void*) calls,
8320 .send_data = send_data_LDKSocketDescriptor_jcall,
8321 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
8322 .eq = eq_LDKSocketDescriptor_jcall,
8323 .hash = hash_LDKSocketDescriptor_jcall,
8324 .cloned = LDKSocketDescriptor_JCalls_cloned,
8325 .free = LDKSocketDescriptor_JCalls_free,
8329 long __attribute__((visibility("default"))) TS_LDKSocketDescriptor_new(/*TODO: JS Object Reference */void* o) {
8330 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
8331 *res_ptr = LDKSocketDescriptor_init(o);
8332 return (long)res_ptr;
8334 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_send_data(uint32_t this_arg, int8_tArray data, jboolean resume_read) {
8335 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8336 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8337 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
8338 LDKu8slice data_ref;
8339 data_ref.datalen = data->arr_len;
8340 data_ref.data = data->elems;
8341 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
8345 void __attribute__((visibility("default"))) TS_SocketDescriptor_disconnect_socket(uint32_t this_arg) {
8346 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8347 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8348 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
8349 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
8352 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_hash(uint32_t this_arg) {
8353 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8354 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8355 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
8356 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
8360 typedef struct LDKScore_JCalls {
8361 atomic_size_t refcnt;
8362 uint32_t channel_penalty_msat_meth;
8363 uint32_t payment_path_failed_meth;
8364 uint32_t payment_path_successful_meth;
8365 uint32_t write_meth;
8367 static void LDKScore_JCalls_free(void* this_arg) {
8368 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8369 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8370 js_free_function_ptr(j_calls->channel_penalty_msat_meth);
8371 js_free_function_ptr(j_calls->payment_path_failed_meth);
8372 js_free_function_ptr(j_calls->payment_path_successful_meth);
8373 js_free_function_ptr(j_calls->write_meth);
8377 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) {
8378 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8379 LDKCOption_u64Z *channel_capacity_msat_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
8380 *channel_capacity_msat_copy = channel_capacity_msat;
8381 uint64_t channel_capacity_msat_ref = (uint64_t)channel_capacity_msat_copy;
8382 LDKNodeId source_var = *source;
8383 uint64_t source_ref = 0;
8384 source_var = NodeId_clone(source);
8385 CHECK((((uint64_t)source_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8386 CHECK((((uint64_t)&source_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8387 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
8388 source_ref = (uint64_t)source_var.inner;
8389 if (source_var.is_owned) {
8392 LDKNodeId target_var = *target;
8393 uint64_t target_ref = 0;
8394 target_var = NodeId_clone(target);
8395 CHECK((((uint64_t)target_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8396 CHECK((((uint64_t)&target_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8397 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
8398 target_ref = (uint64_t)target_var.inner;
8399 if (target_var.is_owned) {
8402 return js_invoke_function_5(j_calls->channel_penalty_msat_meth, (uint32_t)short_channel_id, (uint32_t)send_amt_msat, (uint32_t)channel_capacity_msat_ref, (uint32_t)source_ref, (uint32_t)target_ref);
8404 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
8405 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8406 LDKCVec_RouteHopZ path_var = path;
8407 uint32_tArray path_arr = NULL;
8408 path_arr = init_uint32_tArray(path_var.datalen);
8409 uint32_t *path_arr_ptr = (uint32_t*)(path_arr + 4);
8410 for (size_t k = 0; k < path_var.datalen; k++) {
8411 LDKRouteHop path_conv_10_var = path_var.data[k];
8412 uint64_t path_conv_10_ref = 0;
8413 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8414 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8415 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8416 path_conv_10_ref = (uint64_t)path_conv_10_var.inner;
8417 if (path_conv_10_var.is_owned) {
8418 path_conv_10_ref |= 1;
8420 path_arr_ptr[k] = path_conv_10_ref;
8423 FREE(path_var.data);
8424 js_invoke_function_2(j_calls->payment_path_failed_meth, (uint32_t)path_arr, (uint32_t)short_channel_id);
8426 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
8427 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8428 LDKCVec_RouteHopZ path_var = path;
8429 uint32_tArray path_arr = NULL;
8430 path_arr = init_uint32_tArray(path_var.datalen);
8431 uint32_t *path_arr_ptr = (uint32_t*)(path_arr + 4);
8432 for (size_t k = 0; k < path_var.datalen; k++) {
8433 LDKRouteHop path_conv_10_var = path_var.data[k];
8434 uint64_t path_conv_10_ref = 0;
8435 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8436 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8437 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8438 path_conv_10_ref = (uint64_t)path_conv_10_var.inner;
8439 if (path_conv_10_var.is_owned) {
8440 path_conv_10_ref |= 1;
8442 path_arr_ptr[k] = path_conv_10_ref;
8445 FREE(path_var.data);
8446 js_invoke_function_1(j_calls->payment_path_successful_meth, (uint32_t)path_arr);
8448 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
8449 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8450 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->write_meth);
8451 LDKCVec_u8Z ret_ref;
8452 ret_ref.datalen = ret->arr_len;
8453 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8454 memcpy(ret_ref.data, ret->elems, ret_ref.datalen);
8457 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
8458 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
8459 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8461 static inline LDKScore LDKScore_init (/*TODO: JS Object Reference */void* o) {
8462 LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
8463 atomic_init(&calls->refcnt, 1);
8464 //TODO: Assign calls->o from o
8467 .this_arg = (void*) calls,
8468 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
8469 .payment_path_failed = payment_path_failed_LDKScore_jcall,
8470 .payment_path_successful = payment_path_successful_LDKScore_jcall,
8471 .write = write_LDKScore_jcall,
8472 .free = LDKScore_JCalls_free,
8476 long __attribute__((visibility("default"))) TS_LDKScore_new(/*TODO: JS Object Reference */void* o) {
8477 LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
8478 *res_ptr = LDKScore_init(o);
8479 return (long)res_ptr;
8481 int64_t __attribute__((visibility("default"))) 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) {
8482 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8483 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8484 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8485 void* channel_capacity_msat_ptr = (void*)(((uint64_t)channel_capacity_msat) & ~1);
8486 CHECK_ACCESS(channel_capacity_msat_ptr);
8487 LDKCOption_u64Z channel_capacity_msat_conv = *(LDKCOption_u64Z*)(channel_capacity_msat_ptr);
8488 channel_capacity_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)channel_capacity_msat) & ~1));
8489 LDKNodeId source_conv;
8490 source_conv.inner = (void*)(source & (~1));
8491 source_conv.is_owned = false;
8492 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
8493 LDKNodeId target_conv;
8494 target_conv.inner = (void*)(target & (~1));
8495 target_conv.is_owned = false;
8496 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
8497 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);
8501 void __attribute__((visibility("default"))) TS_Score_payment_path_failed(uint32_t this_arg, uint32_tArray path, int64_t short_channel_id) {
8502 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8503 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8504 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8505 LDKCVec_RouteHopZ path_constr;
8506 path_constr.datalen = path->arr_len;
8507 if (path_constr.datalen > 0)
8508 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8510 path_constr.data = NULL;
8511 uint32_t* path_vals = path->elems;
8512 for (size_t k = 0; k < path_constr.datalen; k++) {
8513 uint32_t path_conv_10 = path_vals[k];
8514 LDKRouteHop path_conv_10_conv;
8515 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
8516 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
8517 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8518 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8519 path_constr.data[k] = path_conv_10_conv;
8521 (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
8524 void __attribute__((visibility("default"))) TS_Score_payment_path_successful(uint32_t this_arg, uint32_tArray path) {
8525 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8526 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8527 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8528 LDKCVec_RouteHopZ path_constr;
8529 path_constr.datalen = path->arr_len;
8530 if (path_constr.datalen > 0)
8531 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8533 path_constr.data = NULL;
8534 uint32_t* path_vals = path->elems;
8535 for (size_t k = 0; k < path_constr.datalen; k++) {
8536 uint32_t path_conv_10 = path_vals[k];
8537 LDKRouteHop path_conv_10_conv;
8538 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
8539 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
8540 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8541 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8542 path_constr.data[k] = path_conv_10_conv;
8544 (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
8547 int8_tArray __attribute__((visibility("default"))) TS_Score_write(uint32_t this_arg) {
8548 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8549 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8550 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8551 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8552 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
8553 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8554 CVec_u8Z_free(ret_var);
8558 typedef struct LDKLockableScore_JCalls {
8559 atomic_size_t refcnt;
8561 } LDKLockableScore_JCalls;
8562 static void LDKLockableScore_JCalls_free(void* this_arg) {
8563 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
8564 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8565 js_free_function_ptr(j_calls->lock_meth);
8569 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
8570 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
8571 uint32_t ret = js_invoke_function_0(j_calls->lock_meth);
8572 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8573 CHECK_ACCESS(ret_ptr);
8574 LDKScore ret_conv = *(LDKScore*)(ret_ptr);// Warning: we may need a move here but no clone is available for LDKScore
8578 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
8579 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
8580 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8582 static inline LDKLockableScore LDKLockableScore_init (/*TODO: JS Object Reference */void* o) {
8583 LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
8584 atomic_init(&calls->refcnt, 1);
8585 //TODO: Assign calls->o from o
8587 LDKLockableScore ret = {
8588 .this_arg = (void*) calls,
8589 .lock = lock_LDKLockableScore_jcall,
8590 .free = LDKLockableScore_JCalls_free,
8594 long __attribute__((visibility("default"))) TS_LDKLockableScore_new(/*TODO: JS Object Reference */void* o) {
8595 LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
8596 *res_ptr = LDKLockableScore_init(o);
8597 return (long)res_ptr;
8599 uint32_t __attribute__((visibility("default"))) TS_LockableScore_lock(uint32_t this_arg) {
8600 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8601 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8602 LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
8603 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
8604 *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
8605 return (uint64_t)ret_ret;
8608 jstring __attribute__((visibility("default"))) TS__ldk_get_compiled_version() {
8609 LDKStr ret_str = _ldk_get_compiled_version();
8610 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
8615 jstring __attribute__((visibility("default"))) TS__ldk_c_bindings_get_compiled_version() {
8616 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
8617 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
8622 void __attribute__((visibility("default"))) TS_Transaction_free(int8_tArray _res) {
8623 LDKTransaction _res_ref;
8624 _res_ref.datalen = _res->arr_len;
8625 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
8626 memcpy(_res_ref.data, _res->elems, _res_ref.datalen);
8627 _res_ref.data_is_owned = true;
8628 Transaction_free(_res_ref);
8631 uint32_t __attribute__((visibility("default"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
8632 LDKCVec_u8Z script_pubkey_ref;
8633 script_pubkey_ref.datalen = script_pubkey->arr_len;
8634 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
8635 memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen);
8636 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8637 *ret_ref = TxOut_new(script_pubkey_ref, value);
8638 return (uint64_t)ret_ref;
8641 void __attribute__((visibility("default"))) TS_TxOut_free(uint32_t _res) {
8642 if ((_res & 1) != 0) return;
8643 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8644 CHECK_ACCESS(_res_ptr);
8645 LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
8647 TxOut_free(_res_conv);
8650 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
8651 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8652 *ret_ref = TxOut_clone(arg);
8653 return (uint64_t)ret_ref;
8655 int64_t __attribute__((visibility("default"))) TS_TxOut_clone_ptr(uint32_t arg) {
8656 LDKTxOut* arg_conv = (LDKTxOut*)(arg & ~1);
8657 int64_t ret_val = TxOut_clone_ptr(arg_conv);
8661 uint32_t __attribute__((visibility("default"))) TS_TxOut_clone(uint32_t orig) {
8662 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
8663 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8664 *ret_ref = TxOut_clone(orig_conv);
8665 return (uint64_t)ret_ref;
8668 void __attribute__((visibility("default"))) TS_Str_free(jstring _res) {
8669 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
8673 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint32_t o) {
8674 LDKChannelConfig o_conv;
8675 o_conv.inner = (void*)(o & (~1));
8676 o_conv.is_owned = (o & 1) || (o == 0);
8677 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8678 o_conv = ChannelConfig_clone(&o_conv);
8679 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
8680 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
8681 return (uint64_t)ret_conv;
8684 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint32_t e) {
8685 LDKDecodeError e_conv;
8686 e_conv.inner = (void*)(e & (~1));
8687 e_conv.is_owned = (e & 1) || (e == 0);
8688 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8689 e_conv = DecodeError_clone(&e_conv);
8690 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
8691 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
8692 return (uint64_t)ret_conv;
8695 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint32_t o) {
8696 LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(o & ~1);
8697 jboolean ret_val = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
8701 void __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint32_t _res) {
8702 if ((_res & 1) != 0) return;
8703 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8704 CHECK_ACCESS(_res_ptr);
8705 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
8707 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
8710 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
8711 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
8712 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
8713 return (uint64_t)ret_conv;
8715 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint32_t arg) {
8716 LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
8717 int64_t ret_val = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
8721 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint32_t orig) {
8722 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
8723 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
8724 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
8725 return (uint64_t)ret_conv;
8728 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_ok(uint32_t o) {
8730 o_conv.inner = (void*)(o & (~1));
8731 o_conv.is_owned = (o & 1) || (o == 0);
8732 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8733 o_conv = OutPoint_clone(&o_conv);
8734 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
8735 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
8736 return (uint64_t)ret_conv;
8739 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_err(uint32_t e) {
8740 LDKDecodeError e_conv;
8741 e_conv.inner = (void*)(e & (~1));
8742 e_conv.is_owned = (e & 1) || (e == 0);
8743 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8744 e_conv = DecodeError_clone(&e_conv);
8745 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
8746 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
8747 return (uint64_t)ret_conv;
8750 jboolean __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint32_t o) {
8751 LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)(o & ~1);
8752 jboolean ret_val = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
8756 void __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_free(uint32_t _res) {
8757 if ((_res & 1) != 0) return;
8758 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8759 CHECK_ACCESS(_res_ptr);
8760 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
8762 CResult_OutPointDecodeErrorZ_free(_res_conv);
8765 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
8766 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
8767 *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
8768 return (uint64_t)ret_conv;
8770 int64_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint32_t arg) {
8771 LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
8772 int64_t ret_val = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
8776 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_clone(uint32_t orig) {
8777 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
8778 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
8779 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
8780 return (uint64_t)ret_conv;
8783 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
8785 CHECK(o->arr_len == 32);
8786 memcpy(o_ref.bytes, o->elems, 32);
8787 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
8788 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
8789 return (uint64_t)ret_conv;
8792 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
8793 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
8794 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
8795 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
8796 return (uint64_t)ret_conv;
8799 jboolean __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_is_ok(uint32_t o) {
8800 LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)(o & ~1);
8801 jboolean ret_val = CResult_SecretKeyErrorZ_is_ok(o_conv);
8805 void __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_free(uint32_t _res) {
8806 if ((_res & 1) != 0) return;
8807 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8808 CHECK_ACCESS(_res_ptr);
8809 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
8811 CResult_SecretKeyErrorZ_free(_res_conv);
8814 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
8816 CHECK(o->arr_len == 33);
8817 memcpy(o_ref.compressed_form, o->elems, 33);
8818 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8819 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
8820 return (uint64_t)ret_conv;
8823 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
8824 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
8825 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8826 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
8827 return (uint64_t)ret_conv;
8830 jboolean __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_is_ok(uint32_t o) {
8831 LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)(o & ~1);
8832 jboolean ret_val = CResult_PublicKeyErrorZ_is_ok(o_conv);
8836 void __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_free(uint32_t _res) {
8837 if ((_res & 1) != 0) return;
8838 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8839 CHECK_ACCESS(_res_ptr);
8840 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
8842 CResult_PublicKeyErrorZ_free(_res_conv);
8845 static inline uint64_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
8846 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8847 *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
8848 return (uint64_t)ret_conv;
8850 int64_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_clone_ptr(uint32_t arg) {
8851 LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
8852 int64_t ret_val = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
8856 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_clone(uint32_t orig) {
8857 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
8858 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8859 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
8860 return (uint64_t)ret_conv;
8863 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint32_t o) {
8864 LDKTxCreationKeys o_conv;
8865 o_conv.inner = (void*)(o & (~1));
8866 o_conv.is_owned = (o & 1) || (o == 0);
8867 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8868 o_conv = TxCreationKeys_clone(&o_conv);
8869 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8870 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
8871 return (uint64_t)ret_conv;
8874 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint32_t e) {
8875 LDKDecodeError e_conv;
8876 e_conv.inner = (void*)(e & (~1));
8877 e_conv.is_owned = (e & 1) || (e == 0);
8878 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8879 e_conv = DecodeError_clone(&e_conv);
8880 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8881 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
8882 return (uint64_t)ret_conv;
8885 jboolean __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint32_t o) {
8886 LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(o & ~1);
8887 jboolean ret_val = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
8891 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint32_t _res) {
8892 if ((_res & 1) != 0) return;
8893 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8894 CHECK_ACCESS(_res_ptr);
8895 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
8897 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
8900 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
8901 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8902 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
8903 return (uint64_t)ret_conv;
8905 int64_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint32_t arg) {
8906 LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
8907 int64_t ret_val = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
8911 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint32_t orig) {
8912 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
8913 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8914 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
8915 return (uint64_t)ret_conv;
8918 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint32_t o) {
8919 LDKChannelPublicKeys o_conv;
8920 o_conv.inner = (void*)(o & (~1));
8921 o_conv.is_owned = (o & 1) || (o == 0);
8922 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8923 o_conv = ChannelPublicKeys_clone(&o_conv);
8924 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8925 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
8926 return (uint64_t)ret_conv;
8929 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint32_t e) {
8930 LDKDecodeError e_conv;
8931 e_conv.inner = (void*)(e & (~1));
8932 e_conv.is_owned = (e & 1) || (e == 0);
8933 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8934 e_conv = DecodeError_clone(&e_conv);
8935 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8936 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
8937 return (uint64_t)ret_conv;
8940 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint32_t o) {
8941 LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(o & ~1);
8942 jboolean ret_val = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
8946 void __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint32_t _res) {
8947 if ((_res & 1) != 0) return;
8948 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8949 CHECK_ACCESS(_res_ptr);
8950 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
8952 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
8955 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
8956 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8957 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
8958 return (uint64_t)ret_conv;
8960 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint32_t arg) {
8961 LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
8962 int64_t ret_val = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
8966 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint32_t orig) {
8967 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
8968 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8969 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
8970 return (uint64_t)ret_conv;
8973 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_ok(uint32_t o) {
8974 LDKTxCreationKeys o_conv;
8975 o_conv.inner = (void*)(o & (~1));
8976 o_conv.is_owned = (o & 1) || (o == 0);
8977 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8978 o_conv = TxCreationKeys_clone(&o_conv);
8979 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
8980 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
8981 return (uint64_t)ret_conv;
8984 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
8985 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
8986 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
8987 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
8988 return (uint64_t)ret_conv;
8991 jboolean __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_is_ok(uint32_t o) {
8992 LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)(o & ~1);
8993 jboolean ret_val = CResult_TxCreationKeysErrorZ_is_ok(o_conv);
8997 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_free(uint32_t _res) {
8998 if ((_res & 1) != 0) return;
8999 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9000 CHECK_ACCESS(_res_ptr);
9001 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
9003 CResult_TxCreationKeysErrorZ_free(_res_conv);
9006 static inline uint64_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) {
9007 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
9008 *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg);
9009 return (uint64_t)ret_conv;
9011 int64_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_clone_ptr(uint32_t arg) {
9012 LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
9013 int64_t ret_val = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv);
9017 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_clone(uint32_t orig) {
9018 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
9019 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
9020 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
9021 return (uint64_t)ret_conv;
9024 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_some(int32_t o) {
9025 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
9026 *ret_copy = COption_u32Z_some(o);
9027 uint64_t ret_ref = (uint64_t)ret_copy;
9031 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_none() {
9032 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
9033 *ret_copy = COption_u32Z_none();
9034 uint64_t ret_ref = (uint64_t)ret_copy;
9038 void __attribute__((visibility("default"))) TS_COption_u32Z_free(uint32_t _res) {
9039 if ((_res & 1) != 0) return;
9040 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9041 CHECK_ACCESS(_res_ptr);
9042 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
9044 COption_u32Z_free(_res_conv);
9047 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
9048 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
9049 *ret_copy = COption_u32Z_clone(arg);
9050 uint64_t ret_ref = (uint64_t)ret_copy;
9053 int64_t __attribute__((visibility("default"))) TS_COption_u32Z_clone_ptr(uint32_t arg) {
9054 LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)arg;
9055 int64_t ret_val = COption_u32Z_clone_ptr(arg_conv);
9059 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_clone(uint32_t orig) {
9060 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
9061 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
9062 *ret_copy = COption_u32Z_clone(orig_conv);
9063 uint64_t ret_ref = (uint64_t)ret_copy;
9067 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint32_t o) {
9068 LDKHTLCOutputInCommitment o_conv;
9069 o_conv.inner = (void*)(o & (~1));
9070 o_conv.is_owned = (o & 1) || (o == 0);
9071 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9072 o_conv = HTLCOutputInCommitment_clone(&o_conv);
9073 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
9074 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
9075 return (uint64_t)ret_conv;
9078 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint32_t e) {
9079 LDKDecodeError e_conv;
9080 e_conv.inner = (void*)(e & (~1));
9081 e_conv.is_owned = (e & 1) || (e == 0);
9082 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9083 e_conv = DecodeError_clone(&e_conv);
9084 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
9085 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
9086 return (uint64_t)ret_conv;
9089 jboolean __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint32_t o) {
9090 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(o & ~1);
9091 jboolean ret_val = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
9095 void __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint32_t _res) {
9096 if ((_res & 1) != 0) return;
9097 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9098 CHECK_ACCESS(_res_ptr);
9099 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
9101 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
9104 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
9105 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
9106 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
9107 return (uint64_t)ret_conv;
9109 int64_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint32_t arg) {
9110 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
9111 int64_t ret_val = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
9115 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint32_t orig) {
9116 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
9117 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
9118 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
9119 return (uint64_t)ret_conv;
9122 uint32_t __attribute__((visibility("default"))) TS_COption_NoneZ_some() {
9123 uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
9127 uint32_t __attribute__((visibility("default"))) TS_COption_NoneZ_none() {
9128 uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
9132 void __attribute__((visibility("default"))) TS_COption_NoneZ_free(uint32_t _res) {
9133 LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
9134 COption_NoneZ_free(_res_conv);
9137 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
9138 LDKCounterpartyChannelTransactionParameters o_conv;
9139 o_conv.inner = (void*)(o & (~1));
9140 o_conv.is_owned = (o & 1) || (o == 0);
9141 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9142 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
9143 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
9144 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
9145 return (uint64_t)ret_conv;
9148 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
9149 LDKDecodeError e_conv;
9150 e_conv.inner = (void*)(e & (~1));
9151 e_conv.is_owned = (e & 1) || (e == 0);
9152 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9153 e_conv = DecodeError_clone(&e_conv);
9154 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
9155 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
9156 return (uint64_t)ret_conv;
9159 jboolean __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint32_t o) {
9160 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(o & ~1);
9161 jboolean ret_val = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
9165 void __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
9166 if ((_res & 1) != 0) return;
9167 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9168 CHECK_ACCESS(_res_ptr);
9169 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
9171 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
9174 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
9175 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
9176 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
9177 return (uint64_t)ret_conv;
9179 int64_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
9180 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
9181 int64_t ret_val = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
9185 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
9186 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
9187 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
9188 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
9189 return (uint64_t)ret_conv;
9192 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
9193 LDKChannelTransactionParameters o_conv;
9194 o_conv.inner = (void*)(o & (~1));
9195 o_conv.is_owned = (o & 1) || (o == 0);
9196 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9197 o_conv = ChannelTransactionParameters_clone(&o_conv);
9198 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
9199 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
9200 return (uint64_t)ret_conv;
9203 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
9204 LDKDecodeError e_conv;
9205 e_conv.inner = (void*)(e & (~1));
9206 e_conv.is_owned = (e & 1) || (e == 0);
9207 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9208 e_conv = DecodeError_clone(&e_conv);
9209 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
9210 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
9211 return (uint64_t)ret_conv;
9214 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint32_t o) {
9215 LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(o & ~1);
9216 jboolean ret_val = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
9220 void __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
9221 if ((_res & 1) != 0) return;
9222 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9223 CHECK_ACCESS(_res_ptr);
9224 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
9226 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
9229 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
9230 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
9231 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
9232 return (uint64_t)ret_conv;
9234 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
9235 LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
9236 int64_t ret_val = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
9240 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
9241 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
9242 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
9243 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
9244 return (uint64_t)ret_conv;
9247 void __attribute__((visibility("default"))) TS_CVec_SignatureZ_free(ptrArray _res) {
9248 LDKCVec_SignatureZ _res_constr;
9249 _res_constr.datalen = _res->arr_len;
9250 if (_res_constr.datalen > 0)
9251 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9253 _res_constr.data = NULL;
9254 int8_tArray* _res_vals = (void*) _res->elems;
9255 for (size_t m = 0; m < _res_constr.datalen; m++) {
9256 int8_tArray _res_conv_12 = _res_vals[m];
9257 LDKSignature _res_conv_12_ref;
9258 CHECK(_res_conv_12->arr_len == 64);
9259 memcpy(_res_conv_12_ref.compact_form, _res_conv_12->elems, 64);
9260 _res_constr.data[m] = _res_conv_12_ref;
9262 CVec_SignatureZ_free(_res_constr);
9265 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
9266 LDKHolderCommitmentTransaction o_conv;
9267 o_conv.inner = (void*)(o & (~1));
9268 o_conv.is_owned = (o & 1) || (o == 0);
9269 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9270 o_conv = HolderCommitmentTransaction_clone(&o_conv);
9271 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
9272 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
9273 return (uint64_t)ret_conv;
9276 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
9277 LDKDecodeError e_conv;
9278 e_conv.inner = (void*)(e & (~1));
9279 e_conv.is_owned = (e & 1) || (e == 0);
9280 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9281 e_conv = DecodeError_clone(&e_conv);
9282 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
9283 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
9284 return (uint64_t)ret_conv;
9287 jboolean __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
9288 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(o & ~1);
9289 jboolean ret_val = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
9293 void __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
9294 if ((_res & 1) != 0) return;
9295 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9296 CHECK_ACCESS(_res_ptr);
9297 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
9299 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
9302 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
9303 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
9304 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
9305 return (uint64_t)ret_conv;
9307 int64_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
9308 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
9309 int64_t ret_val = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
9313 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
9314 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
9315 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
9316 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
9317 return (uint64_t)ret_conv;
9320 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
9321 LDKBuiltCommitmentTransaction o_conv;
9322 o_conv.inner = (void*)(o & (~1));
9323 o_conv.is_owned = (o & 1) || (o == 0);
9324 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9325 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
9326 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
9327 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
9328 return (uint64_t)ret_conv;
9331 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
9332 LDKDecodeError e_conv;
9333 e_conv.inner = (void*)(e & (~1));
9334 e_conv.is_owned = (e & 1) || (e == 0);
9335 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9336 e_conv = DecodeError_clone(&e_conv);
9337 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
9338 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
9339 return (uint64_t)ret_conv;
9342 jboolean __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
9343 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(o & ~1);
9344 jboolean ret_val = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
9348 void __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
9349 if ((_res & 1) != 0) return;
9350 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9351 CHECK_ACCESS(_res_ptr);
9352 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
9354 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
9357 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
9358 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
9359 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
9360 return (uint64_t)ret_conv;
9362 int64_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
9363 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
9364 int64_t ret_val = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
9368 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
9369 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
9370 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
9371 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
9372 return (uint64_t)ret_conv;
9375 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint32_t o) {
9376 LDKTrustedClosingTransaction o_conv;
9377 o_conv.inner = (void*)(o & (~1));
9378 o_conv.is_owned = (o & 1) || (o == 0);
9379 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9380 // Warning: we need a move here but no clone is available for LDKTrustedClosingTransaction
9381 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
9382 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
9383 return (uint64_t)ret_conv;
9386 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
9387 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
9388 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
9389 return (uint64_t)ret_conv;
9392 jboolean __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint32_t o) {
9393 LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(o & ~1);
9394 jboolean ret_val = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
9398 void __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint32_t _res) {
9399 if ((_res & 1) != 0) return;
9400 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9401 CHECK_ACCESS(_res_ptr);
9402 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
9404 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
9407 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
9408 LDKCommitmentTransaction o_conv;
9409 o_conv.inner = (void*)(o & (~1));
9410 o_conv.is_owned = (o & 1) || (o == 0);
9411 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9412 o_conv = CommitmentTransaction_clone(&o_conv);
9413 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9414 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
9415 return (uint64_t)ret_conv;
9418 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint32_t e) {
9419 LDKDecodeError e_conv;
9420 e_conv.inner = (void*)(e & (~1));
9421 e_conv.is_owned = (e & 1) || (e == 0);
9422 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9423 e_conv = DecodeError_clone(&e_conv);
9424 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9425 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
9426 return (uint64_t)ret_conv;
9429 jboolean __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
9430 LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(o & ~1);
9431 jboolean ret_val = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
9435 void __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
9436 if ((_res & 1) != 0) return;
9437 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9438 CHECK_ACCESS(_res_ptr);
9439 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
9441 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
9444 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
9445 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9446 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
9447 return (uint64_t)ret_conv;
9449 int64_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
9450 LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
9451 int64_t ret_val = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
9455 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
9456 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
9457 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9458 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
9459 return (uint64_t)ret_conv;
9462 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint32_t o) {
9463 LDKTrustedCommitmentTransaction o_conv;
9464 o_conv.inner = (void*)(o & (~1));
9465 o_conv.is_owned = (o & 1) || (o == 0);
9466 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9467 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
9468 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
9469 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
9470 return (uint64_t)ret_conv;
9473 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
9474 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
9475 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
9476 return (uint64_t)ret_conv;
9479 jboolean __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint32_t o) {
9480 LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(o & ~1);
9481 jboolean ret_val = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
9485 void __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint32_t _res) {
9486 if ((_res & 1) != 0) return;
9487 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9488 CHECK_ACCESS(_res_ptr);
9489 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
9491 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
9494 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
9495 LDKCVec_SignatureZ o_constr;
9496 o_constr.datalen = o->arr_len;
9497 if (o_constr.datalen > 0)
9498 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9500 o_constr.data = NULL;
9501 int8_tArray* o_vals = (void*) o->elems;
9502 for (size_t m = 0; m < o_constr.datalen; m++) {
9503 int8_tArray o_conv_12 = o_vals[m];
9504 LDKSignature o_conv_12_ref;
9505 CHECK(o_conv_12->arr_len == 64);
9506 memcpy(o_conv_12_ref.compact_form, o_conv_12->elems, 64);
9507 o_constr.data[m] = o_conv_12_ref;
9509 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9510 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
9511 return (uint64_t)ret_conv;
9514 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_err() {
9515 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9516 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
9517 return (uint64_t)ret_conv;
9520 jboolean __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_is_ok(uint32_t o) {
9521 LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)(o & ~1);
9522 jboolean ret_val = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
9526 void __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_free(uint32_t _res) {
9527 if ((_res & 1) != 0) return;
9528 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9529 CHECK_ACCESS(_res_ptr);
9530 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
9532 CResult_CVec_SignatureZNoneZ_free(_res_conv);
9535 static inline uint64_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
9536 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9537 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
9538 return (uint64_t)ret_conv;
9540 int64_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_clone_ptr(uint32_t arg) {
9541 LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
9542 int64_t ret_val = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
9546 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint32_t orig) {
9547 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
9548 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9549 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
9550 return (uint64_t)ret_conv;
9553 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint32_t o) {
9554 LDKShutdownScript o_conv;
9555 o_conv.inner = (void*)(o & (~1));
9556 o_conv.is_owned = (o & 1) || (o == 0);
9557 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9558 o_conv = ShutdownScript_clone(&o_conv);
9559 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
9560 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
9561 return (uint64_t)ret_conv;
9564 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint32_t e) {
9565 LDKDecodeError e_conv;
9566 e_conv.inner = (void*)(e & (~1));
9567 e_conv.is_owned = (e & 1) || (e == 0);
9568 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9569 e_conv = DecodeError_clone(&e_conv);
9570 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
9571 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
9572 return (uint64_t)ret_conv;
9575 jboolean __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint32_t o) {
9576 LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(o & ~1);
9577 jboolean ret_val = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
9581 void __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint32_t _res) {
9582 if ((_res & 1) != 0) return;
9583 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9584 CHECK_ACCESS(_res_ptr);
9585 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
9587 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
9590 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
9591 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
9592 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
9593 return (uint64_t)ret_conv;
9595 int64_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint32_t arg) {
9596 LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
9597 int64_t ret_val = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
9601 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint32_t orig) {
9602 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
9603 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
9604 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
9605 return (uint64_t)ret_conv;
9608 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint32_t o) {
9609 LDKShutdownScript o_conv;
9610 o_conv.inner = (void*)(o & (~1));
9611 o_conv.is_owned = (o & 1) || (o == 0);
9612 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9613 o_conv = ShutdownScript_clone(&o_conv);
9614 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
9615 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
9616 return (uint64_t)ret_conv;
9619 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint32_t e) {
9620 LDKInvalidShutdownScript e_conv;
9621 e_conv.inner = (void*)(e & (~1));
9622 e_conv.is_owned = (e & 1) || (e == 0);
9623 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9624 e_conv = InvalidShutdownScript_clone(&e_conv);
9625 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
9626 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
9627 return (uint64_t)ret_conv;
9630 jboolean __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint32_t o) {
9631 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(o & ~1);
9632 jboolean ret_val = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
9636 void __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint32_t _res) {
9637 if ((_res & 1) != 0) return;
9638 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9639 CHECK_ACCESS(_res_ptr);
9640 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
9642 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
9645 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
9646 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
9647 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
9648 return (uint64_t)ret_conv;
9650 int64_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint32_t arg) {
9651 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
9652 int64_t ret_val = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
9656 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint32_t orig) {
9657 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(orig & ~1);
9658 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
9659 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
9660 return (uint64_t)ret_conv;
9663 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_some(uint32_t o) {
9664 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9665 CHECK_ACCESS(o_ptr);
9666 LDKType o_conv = *(LDKType*)(o_ptr);
9667 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
9668 *ret_copy = COption_TypeZ_some(o_conv);
9669 uint64_t ret_ref = (uint64_t)ret_copy;
9673 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_none() {
9674 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
9675 *ret_copy = COption_TypeZ_none();
9676 uint64_t ret_ref = (uint64_t)ret_copy;
9680 void __attribute__((visibility("default"))) TS_COption_TypeZ_free(uint32_t _res) {
9681 if ((_res & 1) != 0) return;
9682 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9683 CHECK_ACCESS(_res_ptr);
9684 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
9686 COption_TypeZ_free(_res_conv);
9689 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
9690 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
9691 *ret_copy = COption_TypeZ_clone(arg);
9692 uint64_t ret_ref = (uint64_t)ret_copy;
9695 int64_t __attribute__((visibility("default"))) TS_COption_TypeZ_clone_ptr(uint32_t arg) {
9696 LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)arg;
9697 int64_t ret_val = COption_TypeZ_clone_ptr(arg_conv);
9701 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_clone(uint32_t orig) {
9702 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
9703 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
9704 *ret_copy = COption_TypeZ_clone(orig_conv);
9705 uint64_t ret_ref = (uint64_t)ret_copy;
9709 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint32_t o) {
9710 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9711 CHECK_ACCESS(o_ptr);
9712 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
9713 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uint64_t)o) & ~1));
9714 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9715 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
9716 return (uint64_t)ret_conv;
9719 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint32_t e) {
9720 LDKDecodeError e_conv;
9721 e_conv.inner = (void*)(e & (~1));
9722 e_conv.is_owned = (e & 1) || (e == 0);
9723 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9724 e_conv = DecodeError_clone(&e_conv);
9725 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9726 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
9727 return (uint64_t)ret_conv;
9730 jboolean __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint32_t o) {
9731 LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(o & ~1);
9732 jboolean ret_val = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
9736 void __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint32_t _res) {
9737 if ((_res & 1) != 0) return;
9738 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9739 CHECK_ACCESS(_res_ptr);
9740 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
9742 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
9745 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
9746 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9747 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
9748 return (uint64_t)ret_conv;
9750 int64_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint32_t arg) {
9751 LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
9752 int64_t ret_val = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
9756 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint32_t orig) {
9757 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
9758 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9759 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
9760 return (uint64_t)ret_conv;
9763 uint32_t __attribute__((visibility("default"))) TS_CResult_StringErrorZ_ok(jstring o) {
9764 LDKStr o_conv = str_ref_to_owned_c(o);
9765 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
9766 *ret_conv = CResult_StringErrorZ_ok(o_conv);
9767 return (uint64_t)ret_conv;
9770 uint32_t __attribute__((visibility("default"))) TS_CResult_StringErrorZ_err(uint32_t e) {
9771 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
9772 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
9773 *ret_conv = CResult_StringErrorZ_err(e_conv);
9774 return (uint64_t)ret_conv;
9777 jboolean __attribute__((visibility("default"))) TS_CResult_StringErrorZ_is_ok(uint32_t o) {
9778 LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)(o & ~1);
9779 jboolean ret_val = CResult_StringErrorZ_is_ok(o_conv);
9783 void __attribute__((visibility("default"))) TS_CResult_StringErrorZ_free(uint32_t _res) {
9784 if ((_res & 1) != 0) return;
9785 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9786 CHECK_ACCESS(_res_ptr);
9787 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
9789 CResult_StringErrorZ_free(_res_conv);
9792 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint32_t o) {
9793 LDKChannelMonitorUpdate o_conv;
9794 o_conv.inner = (void*)(o & (~1));
9795 o_conv.is_owned = (o & 1) || (o == 0);
9796 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9797 o_conv = ChannelMonitorUpdate_clone(&o_conv);
9798 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
9799 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
9800 return (uint64_t)ret_conv;
9803 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint32_t e) {
9804 LDKDecodeError e_conv;
9805 e_conv.inner = (void*)(e & (~1));
9806 e_conv.is_owned = (e & 1) || (e == 0);
9807 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9808 e_conv = DecodeError_clone(&e_conv);
9809 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
9810 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
9811 return (uint64_t)ret_conv;
9814 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint32_t o) {
9815 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(o & ~1);
9816 jboolean ret_val = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
9820 void __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint32_t _res) {
9821 if ((_res & 1) != 0) return;
9822 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9823 CHECK_ACCESS(_res_ptr);
9824 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
9826 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
9829 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
9830 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
9831 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
9832 return (uint64_t)ret_conv;
9834 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
9835 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
9836 int64_t ret_val = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
9840 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint32_t orig) {
9841 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
9842 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
9843 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
9844 return (uint64_t)ret_conv;
9847 uint32_t __attribute__((visibility("default"))) TS_COption_MonitorEventZ_some(uint32_t o) {
9848 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9849 CHECK_ACCESS(o_ptr);
9850 LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
9851 o_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)o) & ~1));
9852 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
9853 *ret_copy = COption_MonitorEventZ_some(o_conv);
9854 uint64_t ret_ref = (uint64_t)ret_copy;
9858 uint32_t __attribute__((visibility("default"))) TS_COption_MonitorEventZ_none() {
9859 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
9860 *ret_copy = COption_MonitorEventZ_none();
9861 uint64_t ret_ref = (uint64_t)ret_copy;
9865 void __attribute__((visibility("default"))) TS_COption_MonitorEventZ_free(uint32_t _res) {
9866 if ((_res & 1) != 0) return;
9867 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9868 CHECK_ACCESS(_res_ptr);
9869 LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
9871 COption_MonitorEventZ_free(_res_conv);
9874 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
9875 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
9876 *ret_copy = COption_MonitorEventZ_clone(arg);
9877 uint64_t ret_ref = (uint64_t)ret_copy;
9880 int64_t __attribute__((visibility("default"))) TS_COption_MonitorEventZ_clone_ptr(uint32_t arg) {
9881 LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)arg;
9882 int64_t ret_val = COption_MonitorEventZ_clone_ptr(arg_conv);
9886 uint32_t __attribute__((visibility("default"))) TS_COption_MonitorEventZ_clone(uint32_t orig) {
9887 LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)orig;
9888 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
9889 *ret_copy = COption_MonitorEventZ_clone(orig_conv);
9890 uint64_t ret_ref = (uint64_t)ret_copy;
9894 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint32_t o) {
9895 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9896 CHECK_ACCESS(o_ptr);
9897 LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
9898 o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)(((uint64_t)o) & ~1));
9899 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
9900 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
9901 return (uint64_t)ret_conv;
9904 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint32_t e) {
9905 LDKDecodeError e_conv;
9906 e_conv.inner = (void*)(e & (~1));
9907 e_conv.is_owned = (e & 1) || (e == 0);
9908 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9909 e_conv = DecodeError_clone(&e_conv);
9910 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
9911 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
9912 return (uint64_t)ret_conv;
9915 jboolean __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint32_t o) {
9916 LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(o & ~1);
9917 jboolean ret_val = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
9921 void __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint32_t _res) {
9922 if ((_res & 1) != 0) return;
9923 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9924 CHECK_ACCESS(_res_ptr);
9925 LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
9927 CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
9930 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
9931 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
9932 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
9933 return (uint64_t)ret_conv;
9935 int64_t __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint32_t arg) {
9936 LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(arg & ~1);
9937 int64_t ret_val = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
9941 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint32_t orig) {
9942 LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(orig & ~1);
9943 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
9944 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
9945 return (uint64_t)ret_conv;
9948 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint32_t o) {
9949 LDKHTLCUpdate o_conv;
9950 o_conv.inner = (void*)(o & (~1));
9951 o_conv.is_owned = (o & 1) || (o == 0);
9952 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9953 o_conv = HTLCUpdate_clone(&o_conv);
9954 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
9955 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
9956 return (uint64_t)ret_conv;
9959 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint32_t e) {
9960 LDKDecodeError e_conv;
9961 e_conv.inner = (void*)(e & (~1));
9962 e_conv.is_owned = (e & 1) || (e == 0);
9963 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9964 e_conv = DecodeError_clone(&e_conv);
9965 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
9966 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
9967 return (uint64_t)ret_conv;
9970 jboolean __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint32_t o) {
9971 LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(o & ~1);
9972 jboolean ret_val = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
9976 void __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint32_t _res) {
9977 if ((_res & 1) != 0) return;
9978 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9979 CHECK_ACCESS(_res_ptr);
9980 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
9982 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
9985 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
9986 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
9987 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
9988 return (uint64_t)ret_conv;
9990 int64_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
9991 LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
9992 int64_t ret_val = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
9996 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint32_t orig) {
9997 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
9998 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
9999 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
10000 return (uint64_t)ret_conv;
10003 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_ok() {
10004 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10005 *ret_conv = CResult_NoneNoneZ_ok();
10006 return (uint64_t)ret_conv;
10009 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_err() {
10010 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10011 *ret_conv = CResult_NoneNoneZ_err();
10012 return (uint64_t)ret_conv;
10015 jboolean __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_is_ok(uint32_t o) {
10016 LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)(o & ~1);
10017 jboolean ret_val = CResult_NoneNoneZ_is_ok(o_conv);
10021 void __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_free(uint32_t _res) {
10022 if ((_res & 1) != 0) return;
10023 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10024 CHECK_ACCESS(_res_ptr);
10025 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
10027 CResult_NoneNoneZ_free(_res_conv);
10030 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
10031 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10032 *ret_conv = CResult_NoneNoneZ_clone(arg);
10033 return (uint64_t)ret_conv;
10035 int64_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_clone_ptr(uint32_t arg) {
10036 LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)(arg & ~1);
10037 int64_t ret_val = CResult_NoneNoneZ_clone_ptr(arg_conv);
10041 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_clone(uint32_t orig) {
10042 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
10043 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10044 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
10045 return (uint64_t)ret_conv;
10048 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
10049 LDKOutPoint a_conv;
10050 a_conv.inner = (void*)(a & (~1));
10051 a_conv.is_owned = (a & 1) || (a == 0);
10052 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
10053 a_conv = OutPoint_clone(&a_conv);
10055 b_ref.datalen = b->arr_len;
10056 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
10057 memcpy(b_ref.data, b->elems, b_ref.datalen);
10058 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
10059 *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
10060 return ((uint64_t)ret_conv);
10063 void __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_free(uint32_t _res) {
10064 if ((_res & 1) != 0) return;
10065 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10066 CHECK_ACCESS(_res_ptr);
10067 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
10069 C2Tuple_OutPointScriptZ_free(_res_conv);
10072 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
10074 b_ref.datalen = b->arr_len;
10075 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
10076 memcpy(b_ref.data, b->elems, b_ref.datalen);
10077 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
10078 *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
10079 return ((uint64_t)ret_conv);
10082 void __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_free(uint32_t _res) {
10083 if ((_res & 1) != 0) return;
10084 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10085 CHECK_ACCESS(_res_ptr);
10086 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
10088 C2Tuple_u32ScriptZ_free(_res_conv);
10091 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint32_tArray _res) {
10092 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
10093 _res_constr.datalen = _res->arr_len;
10094 if (_res_constr.datalen > 0)
10095 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
10097 _res_constr.data = NULL;
10098 uint32_t* _res_vals = _res->elems;
10099 for (size_t v = 0; v < _res_constr.datalen; v++) {
10100 uint32_t _res_conv_21 = _res_vals[v];
10101 void* _res_conv_21_ptr = (void*)(((uint64_t)_res_conv_21) & ~1);
10102 CHECK_ACCESS(_res_conv_21_ptr);
10103 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
10104 FREE((void*)_res_conv_21);
10105 _res_constr.data[v] = _res_conv_21_conv;
10107 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
10110 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
10111 LDKThirtyTwoBytes a_ref;
10112 CHECK(a->arr_len == 32);
10113 memcpy(a_ref.data, a->elems, 32);
10114 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
10115 b_constr.datalen = b->arr_len;
10116 if (b_constr.datalen > 0)
10117 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
10119 b_constr.data = NULL;
10120 uint32_t* b_vals = b->elems;
10121 for (size_t v = 0; v < b_constr.datalen; v++) {
10122 uint32_t b_conv_21 = b_vals[v];
10123 void* b_conv_21_ptr = (void*)(((uint64_t)b_conv_21) & ~1);
10124 CHECK_ACCESS(b_conv_21_ptr);
10125 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
10126 // Warning: we may need a move here but no clone is available for LDKC2Tuple_u32ScriptZ
10127 b_constr.data[v] = b_conv_21_conv;
10129 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
10130 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
10131 return ((uint64_t)ret_conv);
10134 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint32_t _res) {
10135 if ((_res & 1) != 0) return;
10136 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10137 CHECK_ACCESS(_res_ptr);
10138 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
10140 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
10143 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint32_tArray _res) {
10144 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
10145 _res_constr.datalen = _res->arr_len;
10146 if (_res_constr.datalen > 0)
10147 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
10149 _res_constr.data = NULL;
10150 uint32_t* _res_vals = _res->elems;
10151 for (size_t o = 0; o < _res_constr.datalen; o++) {
10152 uint32_t _res_conv_40 = _res_vals[o];
10153 void* _res_conv_40_ptr = (void*)(((uint64_t)_res_conv_40) & ~1);
10154 CHECK_ACCESS(_res_conv_40_ptr);
10155 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
10156 FREE((void*)_res_conv_40);
10157 _res_constr.data[o] = _res_conv_40_conv;
10159 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
10162 void __attribute__((visibility("default"))) TS_CVec_MonitorEventZ_free(uint32_tArray _res) {
10163 LDKCVec_MonitorEventZ _res_constr;
10164 _res_constr.datalen = _res->arr_len;
10165 if (_res_constr.datalen > 0)
10166 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
10168 _res_constr.data = NULL;
10169 uint32_t* _res_vals = _res->elems;
10170 for (size_t o = 0; o < _res_constr.datalen; o++) {
10171 uint32_t _res_conv_14 = _res_vals[o];
10172 void* _res_conv_14_ptr = (void*)(((uint64_t)_res_conv_14) & ~1);
10173 CHECK_ACCESS(_res_conv_14_ptr);
10174 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
10175 FREE((void*)_res_conv_14);
10176 _res_constr.data[o] = _res_conv_14_conv;
10178 CVec_MonitorEventZ_free(_res_constr);
10181 void __attribute__((visibility("default"))) TS_CVec_EventZ_free(uint32_tArray _res) {
10182 LDKCVec_EventZ _res_constr;
10183 _res_constr.datalen = _res->arr_len;
10184 if (_res_constr.datalen > 0)
10185 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
10187 _res_constr.data = NULL;
10188 uint32_t* _res_vals = _res->elems;
10189 for (size_t h = 0; h < _res_constr.datalen; h++) {
10190 uint32_t _res_conv_7 = _res_vals[h];
10191 void* _res_conv_7_ptr = (void*)(((uint64_t)_res_conv_7) & ~1);
10192 CHECK_ACCESS(_res_conv_7_ptr);
10193 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
10194 FREE((void*)_res_conv_7);
10195 _res_constr.data[h] = _res_conv_7_conv;
10197 CVec_EventZ_free(_res_constr);
10200 void __attribute__((visibility("default"))) TS_CVec_TransactionZ_free(ptrArray _res) {
10201 LDKCVec_TransactionZ _res_constr;
10202 _res_constr.datalen = _res->arr_len;
10203 if (_res_constr.datalen > 0)
10204 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
10206 _res_constr.data = NULL;
10207 int8_tArray* _res_vals = (void*) _res->elems;
10208 for (size_t m = 0; m < _res_constr.datalen; m++) {
10209 int8_tArray _res_conv_12 = _res_vals[m];
10210 LDKTransaction _res_conv_12_ref;
10211 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
10212 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
10213 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen);
10214 _res_conv_12_ref.data_is_owned = true;
10215 _res_constr.data[m] = _res_conv_12_ref;
10217 CVec_TransactionZ_free(_res_constr);
10220 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
10221 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
10222 *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
10223 return ((uint64_t)ret_conv);
10225 int64_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint32_t arg) {
10226 LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)(arg & ~1);
10227 int64_t ret_val = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
10231 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_clone(uint32_t orig) {
10232 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
10233 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
10234 *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
10235 return ((uint64_t)ret_conv);
10238 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
10239 LDKTransaction b_ref;
10240 b_ref.datalen = b->arr_len;
10241 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
10242 memcpy(b_ref.data, b->elems, b_ref.datalen);
10243 b_ref.data_is_owned = true;
10244 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
10245 *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
10246 return ((uint64_t)ret_conv);
10249 void __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_free(uint32_t _res) {
10250 if ((_res & 1) != 0) return;
10251 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10252 CHECK_ACCESS(_res_ptr);
10253 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
10255 C2Tuple_usizeTransactionZ_free(_res_conv);
10258 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint32_tArray _res) {
10259 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
10260 _res_constr.datalen = _res->arr_len;
10261 if (_res_constr.datalen > 0)
10262 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
10264 _res_constr.data = NULL;
10265 uint32_t* _res_vals = _res->elems;
10266 for (size_t c = 0; c < _res_constr.datalen; c++) {
10267 uint32_t _res_conv_28 = _res_vals[c];
10268 void* _res_conv_28_ptr = (void*)(((uint64_t)_res_conv_28) & ~1);
10269 CHECK_ACCESS(_res_conv_28_ptr);
10270 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
10271 FREE((void*)_res_conv_28);
10272 _res_constr.data[c] = _res_conv_28_conv;
10274 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
10277 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
10278 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
10279 *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
10280 return ((uint64_t)ret_conv);
10282 int64_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint32_t arg) {
10283 LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)(arg & ~1);
10284 int64_t ret_val = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
10288 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_clone(uint32_t orig) {
10289 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
10290 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
10291 *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
10292 return ((uint64_t)ret_conv);
10295 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
10296 void* b_ptr = (void*)(((uint64_t)b) & ~1);
10297 CHECK_ACCESS(b_ptr);
10298 LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
10299 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
10300 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
10301 *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
10302 return ((uint64_t)ret_conv);
10305 void __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_free(uint32_t _res) {
10306 if ((_res & 1) != 0) return;
10307 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10308 CHECK_ACCESS(_res_ptr);
10309 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
10311 C2Tuple_u32TxOutZ_free(_res_conv);
10314 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint32_tArray _res) {
10315 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
10316 _res_constr.datalen = _res->arr_len;
10317 if (_res_constr.datalen > 0)
10318 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
10320 _res_constr.data = NULL;
10321 uint32_t* _res_vals = _res->elems;
10322 for (size_t u = 0; u < _res_constr.datalen; u++) {
10323 uint32_t _res_conv_20 = _res_vals[u];
10324 void* _res_conv_20_ptr = (void*)(((uint64_t)_res_conv_20) & ~1);
10325 CHECK_ACCESS(_res_conv_20_ptr);
10326 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
10327 FREE((void*)_res_conv_20);
10328 _res_constr.data[u] = _res_conv_20_conv;
10330 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
10333 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
10334 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
10335 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
10336 return ((uint64_t)ret_conv);
10338 int64_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint32_t arg) {
10339 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(arg & ~1);
10340 int64_t ret_val = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
10344 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint32_t orig) {
10345 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
10346 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
10347 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
10348 return ((uint64_t)ret_conv);
10351 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
10352 LDKThirtyTwoBytes a_ref;
10353 CHECK(a->arr_len == 32);
10354 memcpy(a_ref.data, a->elems, 32);
10355 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
10356 b_constr.datalen = b->arr_len;
10357 if (b_constr.datalen > 0)
10358 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
10360 b_constr.data = NULL;
10361 uint32_t* b_vals = b->elems;
10362 for (size_t u = 0; u < b_constr.datalen; u++) {
10363 uint32_t b_conv_20 = b_vals[u];
10364 void* b_conv_20_ptr = (void*)(((uint64_t)b_conv_20) & ~1);
10365 CHECK_ACCESS(b_conv_20_ptr);
10366 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
10367 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_20) & ~1));
10368 b_constr.data[u] = b_conv_20_conv;
10370 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
10371 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
10372 return ((uint64_t)ret_conv);
10375 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint32_t _res) {
10376 if ((_res & 1) != 0) return;
10377 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10378 CHECK_ACCESS(_res_ptr);
10379 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
10381 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
10384 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint32_tArray _res) {
10385 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
10386 _res_constr.datalen = _res->arr_len;
10387 if (_res_constr.datalen > 0)
10388 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
10390 _res_constr.data = NULL;
10391 uint32_t* _res_vals = _res->elems;
10392 for (size_t n = 0; n < _res_constr.datalen; n++) {
10393 uint32_t _res_conv_39 = _res_vals[n];
10394 void* _res_conv_39_ptr = (void*)(((uint64_t)_res_conv_39) & ~1);
10395 CHECK_ACCESS(_res_conv_39_ptr);
10396 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
10397 FREE((void*)_res_conv_39);
10398 _res_constr.data[n] = _res_conv_39_conv;
10400 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
10403 void __attribute__((visibility("default"))) TS_CVec_TxidZ_free(ptrArray _res) {
10404 LDKCVec_TxidZ _res_constr;
10405 _res_constr.datalen = _res->arr_len;
10406 if (_res_constr.datalen > 0)
10407 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
10409 _res_constr.data = NULL;
10410 int8_tArray* _res_vals = (void*) _res->elems;
10411 for (size_t m = 0; m < _res_constr.datalen; m++) {
10412 int8_tArray _res_conv_12 = _res_vals[m];
10413 LDKThirtyTwoBytes _res_conv_12_ref;
10414 CHECK(_res_conv_12->arr_len == 32);
10415 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32);
10416 _res_constr.data[m] = _res_conv_12_ref;
10418 CVec_TxidZ_free(_res_constr);
10421 void __attribute__((visibility("default"))) TS_CVec_BalanceZ_free(uint32_tArray _res) {
10422 LDKCVec_BalanceZ _res_constr;
10423 _res_constr.datalen = _res->arr_len;
10424 if (_res_constr.datalen > 0)
10425 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
10427 _res_constr.data = NULL;
10428 uint32_t* _res_vals = _res->elems;
10429 for (size_t j = 0; j < _res_constr.datalen; j++) {
10430 uint32_t _res_conv_9 = _res_vals[j];
10431 void* _res_conv_9_ptr = (void*)(((uint64_t)_res_conv_9) & ~1);
10432 CHECK_ACCESS(_res_conv_9_ptr);
10433 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
10434 FREE((void*)_res_conv_9);
10435 _res_constr.data[j] = _res_conv_9_conv;
10437 CVec_BalanceZ_free(_res_constr);
10440 static inline uint64_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
10441 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
10442 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
10443 return ((uint64_t)ret_conv);
10445 int64_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr(uint32_t arg) {
10446 LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(arg & ~1);
10447 int64_t ret_val = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
10451 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint32_t orig) {
10452 LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(orig & ~1);
10453 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
10454 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
10455 return ((uint64_t)ret_conv);
10458 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
10459 LDKThirtyTwoBytes a_ref;
10460 CHECK(a->arr_len == 32);
10461 memcpy(a_ref.data, a->elems, 32);
10462 LDKChannelMonitor b_conv;
10463 b_conv.inner = (void*)(b & (~1));
10464 b_conv.is_owned = (b & 1) || (b == 0);
10465 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
10466 b_conv = ChannelMonitor_clone(&b_conv);
10467 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
10468 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
10469 return ((uint64_t)ret_conv);
10472 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint32_t _res) {
10473 if ((_res & 1) != 0) return;
10474 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10475 CHECK_ACCESS(_res_ptr);
10476 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
10478 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
10481 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint32_t o) {
10482 void* o_ptr = (void*)(((uint64_t)o) & ~1);
10483 CHECK_ACCESS(o_ptr);
10484 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
10485 o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1));
10486 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10487 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
10488 return (uint64_t)ret_conv;
10491 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint32_t e) {
10492 LDKDecodeError e_conv;
10493 e_conv.inner = (void*)(e & (~1));
10494 e_conv.is_owned = (e & 1) || (e == 0);
10495 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10496 e_conv = DecodeError_clone(&e_conv);
10497 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10498 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
10499 return (uint64_t)ret_conv;
10502 jboolean __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(uint32_t o) {
10503 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(o & ~1);
10504 jboolean ret_val = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
10508 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint32_t _res) {
10509 if ((_res & 1) != 0) return;
10510 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10511 CHECK_ACCESS(_res_ptr);
10512 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
10514 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
10517 static inline uint64_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
10518 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10519 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
10520 return (uint64_t)ret_conv;
10522 int64_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(uint32_t arg) {
10523 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
10524 int64_t ret_val = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
10528 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint32_t orig) {
10529 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(orig & ~1);
10530 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10531 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
10532 return (uint64_t)ret_conv;
10535 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint32_t o) {
10536 LDKRouteHop o_conv;
10537 o_conv.inner = (void*)(o & (~1));
10538 o_conv.is_owned = (o & 1) || (o == 0);
10539 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10540 o_conv = RouteHop_clone(&o_conv);
10541 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
10542 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
10543 return (uint64_t)ret_conv;
10546 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_err(uint32_t e) {
10547 LDKDecodeError e_conv;
10548 e_conv.inner = (void*)(e & (~1));
10549 e_conv.is_owned = (e & 1) || (e == 0);
10550 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10551 e_conv = DecodeError_clone(&e_conv);
10552 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
10553 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
10554 return (uint64_t)ret_conv;
10557 jboolean __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint32_t o) {
10558 LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)(o & ~1);
10559 jboolean ret_val = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
10563 void __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_free(uint32_t _res) {
10564 if ((_res & 1) != 0) return;
10565 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10566 CHECK_ACCESS(_res_ptr);
10567 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
10569 CResult_RouteHopDecodeErrorZ_free(_res_conv);
10572 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
10573 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
10574 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
10575 return (uint64_t)ret_conv;
10577 int64_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint32_t arg) {
10578 LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
10579 int64_t ret_val = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
10583 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint32_t orig) {
10584 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
10585 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
10586 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
10587 return (uint64_t)ret_conv;
10590 void __attribute__((visibility("default"))) TS_CVec_RouteHopZ_free(uint32_tArray _res) {
10591 LDKCVec_RouteHopZ _res_constr;
10592 _res_constr.datalen = _res->arr_len;
10593 if (_res_constr.datalen > 0)
10594 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10596 _res_constr.data = NULL;
10597 uint32_t* _res_vals = _res->elems;
10598 for (size_t k = 0; k < _res_constr.datalen; k++) {
10599 uint32_t _res_conv_10 = _res_vals[k];
10600 LDKRouteHop _res_conv_10_conv;
10601 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
10602 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
10603 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
10604 _res_constr.data[k] = _res_conv_10_conv;
10606 CVec_RouteHopZ_free(_res_constr);
10609 void __attribute__((visibility("default"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
10610 LDKCVec_CVec_RouteHopZZ _res_constr;
10611 _res_constr.datalen = _res->arr_len;
10612 if (_res_constr.datalen > 0)
10613 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
10615 _res_constr.data = NULL;
10616 uint32_tArray* _res_vals = (void*) _res->elems;
10617 for (size_t m = 0; m < _res_constr.datalen; m++) {
10618 uint32_tArray _res_conv_12 = _res_vals[m];
10619 LDKCVec_RouteHopZ _res_conv_12_constr;
10620 _res_conv_12_constr.datalen = _res_conv_12->arr_len;
10621 if (_res_conv_12_constr.datalen > 0)
10622 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10624 _res_conv_12_constr.data = NULL;
10625 uint32_t* _res_conv_12_vals = _res_conv_12->elems;
10626 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
10627 uint32_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
10628 LDKRouteHop _res_conv_12_conv_10_conv;
10629 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
10630 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
10631 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
10632 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
10634 _res_constr.data[m] = _res_conv_12_constr;
10636 CVec_CVec_RouteHopZZ_free(_res_constr);
10639 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_ok(uint32_t o) {
10641 o_conv.inner = (void*)(o & (~1));
10642 o_conv.is_owned = (o & 1) || (o == 0);
10643 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10644 o_conv = Route_clone(&o_conv);
10645 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
10646 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
10647 return (uint64_t)ret_conv;
10650 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_err(uint32_t e) {
10651 LDKDecodeError e_conv;
10652 e_conv.inner = (void*)(e & (~1));
10653 e_conv.is_owned = (e & 1) || (e == 0);
10654 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10655 e_conv = DecodeError_clone(&e_conv);
10656 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
10657 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
10658 return (uint64_t)ret_conv;
10661 jboolean __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint32_t o) {
10662 LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)(o & ~1);
10663 jboolean ret_val = CResult_RouteDecodeErrorZ_is_ok(o_conv);
10667 void __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_free(uint32_t _res) {
10668 if ((_res & 1) != 0) return;
10669 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10670 CHECK_ACCESS(_res_ptr);
10671 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
10673 CResult_RouteDecodeErrorZ_free(_res_conv);
10676 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
10677 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
10678 *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
10679 return (uint64_t)ret_conv;
10681 int64_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint32_t arg) {
10682 LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
10683 int64_t ret_val = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
10687 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_clone(uint32_t orig) {
10688 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
10689 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
10690 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
10691 return (uint64_t)ret_conv;
10694 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint32_t o) {
10695 LDKRouteParameters o_conv;
10696 o_conv.inner = (void*)(o & (~1));
10697 o_conv.is_owned = (o & 1) || (o == 0);
10698 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10699 o_conv = RouteParameters_clone(&o_conv);
10700 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
10701 *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
10702 return (uint64_t)ret_conv;
10705 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint32_t e) {
10706 LDKDecodeError e_conv;
10707 e_conv.inner = (void*)(e & (~1));
10708 e_conv.is_owned = (e & 1) || (e == 0);
10709 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10710 e_conv = DecodeError_clone(&e_conv);
10711 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
10712 *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
10713 return (uint64_t)ret_conv;
10716 jboolean __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint32_t o) {
10717 LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(o & ~1);
10718 jboolean ret_val = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
10722 void __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint32_t _res) {
10723 if ((_res & 1) != 0) return;
10724 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10725 CHECK_ACCESS(_res_ptr);
10726 LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
10728 CResult_RouteParametersDecodeErrorZ_free(_res_conv);
10731 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
10732 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
10733 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
10734 return (uint64_t)ret_conv;
10736 int64_t __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
10737 LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
10738 int64_t ret_val = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
10742 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint32_t orig) {
10743 LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(orig & ~1);
10744 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
10745 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
10746 return (uint64_t)ret_conv;
10749 void __attribute__((visibility("default"))) TS_CVec_RouteHintZ_free(uint32_tArray _res) {
10750 LDKCVec_RouteHintZ _res_constr;
10751 _res_constr.datalen = _res->arr_len;
10752 if (_res_constr.datalen > 0)
10753 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
10755 _res_constr.data = NULL;
10756 uint32_t* _res_vals = _res->elems;
10757 for (size_t l = 0; l < _res_constr.datalen; l++) {
10758 uint32_t _res_conv_11 = _res_vals[l];
10759 LDKRouteHint _res_conv_11_conv;
10760 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
10761 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
10762 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
10763 _res_constr.data[l] = _res_conv_11_conv;
10765 CVec_RouteHintZ_free(_res_constr);
10768 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_some(int64_t o) {
10769 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
10770 *ret_copy = COption_u64Z_some(o);
10771 uint64_t ret_ref = (uint64_t)ret_copy;
10775 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_none() {
10776 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
10777 *ret_copy = COption_u64Z_none();
10778 uint64_t ret_ref = (uint64_t)ret_copy;
10782 void __attribute__((visibility("default"))) TS_COption_u64Z_free(uint32_t _res) {
10783 if ((_res & 1) != 0) return;
10784 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10785 CHECK_ACCESS(_res_ptr);
10786 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
10788 COption_u64Z_free(_res_conv);
10791 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
10792 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
10793 *ret_copy = COption_u64Z_clone(arg);
10794 uint64_t ret_ref = (uint64_t)ret_copy;
10797 int64_t __attribute__((visibility("default"))) TS_COption_u64Z_clone_ptr(uint32_t arg) {
10798 LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)arg;
10799 int64_t ret_val = COption_u64Z_clone_ptr(arg_conv);
10803 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_clone(uint32_t orig) {
10804 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
10805 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
10806 *ret_copy = COption_u64Z_clone(orig_conv);
10807 uint64_t ret_ref = (uint64_t)ret_copy;
10811 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_ok(uint32_t o) {
10813 o_conv.inner = (void*)(o & (~1));
10814 o_conv.is_owned = (o & 1) || (o == 0);
10815 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10816 o_conv = Payee_clone(&o_conv);
10817 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
10818 *ret_conv = CResult_PayeeDecodeErrorZ_ok(o_conv);
10819 return (uint64_t)ret_conv;
10822 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_err(uint32_t e) {
10823 LDKDecodeError e_conv;
10824 e_conv.inner = (void*)(e & (~1));
10825 e_conv.is_owned = (e & 1) || (e == 0);
10826 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10827 e_conv = DecodeError_clone(&e_conv);
10828 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
10829 *ret_conv = CResult_PayeeDecodeErrorZ_err(e_conv);
10830 return (uint64_t)ret_conv;
10833 jboolean __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_is_ok(uint32_t o) {
10834 LDKCResult_PayeeDecodeErrorZ* o_conv = (LDKCResult_PayeeDecodeErrorZ*)(o & ~1);
10835 jboolean ret_val = CResult_PayeeDecodeErrorZ_is_ok(o_conv);
10839 void __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_free(uint32_t _res) {
10840 if ((_res & 1) != 0) return;
10841 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10842 CHECK_ACCESS(_res_ptr);
10843 LDKCResult_PayeeDecodeErrorZ _res_conv = *(LDKCResult_PayeeDecodeErrorZ*)(_res_ptr);
10845 CResult_PayeeDecodeErrorZ_free(_res_conv);
10848 static inline uint64_t CResult_PayeeDecodeErrorZ_clone_ptr(LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR arg) {
10849 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
10850 *ret_conv = CResult_PayeeDecodeErrorZ_clone(arg);
10851 return (uint64_t)ret_conv;
10853 int64_t __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_clone_ptr(uint32_t arg) {
10854 LDKCResult_PayeeDecodeErrorZ* arg_conv = (LDKCResult_PayeeDecodeErrorZ*)(arg & ~1);
10855 int64_t ret_val = CResult_PayeeDecodeErrorZ_clone_ptr(arg_conv);
10859 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_clone(uint32_t orig) {
10860 LDKCResult_PayeeDecodeErrorZ* orig_conv = (LDKCResult_PayeeDecodeErrorZ*)(orig & ~1);
10861 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
10862 *ret_conv = CResult_PayeeDecodeErrorZ_clone(orig_conv);
10863 return (uint64_t)ret_conv;
10866 void __attribute__((visibility("default"))) TS_CVec_RouteHintHopZ_free(uint32_tArray _res) {
10867 LDKCVec_RouteHintHopZ _res_constr;
10868 _res_constr.datalen = _res->arr_len;
10869 if (_res_constr.datalen > 0)
10870 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
10872 _res_constr.data = NULL;
10873 uint32_t* _res_vals = _res->elems;
10874 for (size_t o = 0; o < _res_constr.datalen; o++) {
10875 uint32_t _res_conv_14 = _res_vals[o];
10876 LDKRouteHintHop _res_conv_14_conv;
10877 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
10878 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
10879 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
10880 _res_constr.data[o] = _res_conv_14_conv;
10882 CVec_RouteHintHopZ_free(_res_constr);
10885 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint32_t o) {
10886 LDKRouteHint o_conv;
10887 o_conv.inner = (void*)(o & (~1));
10888 o_conv.is_owned = (o & 1) || (o == 0);
10889 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10890 o_conv = RouteHint_clone(&o_conv);
10891 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
10892 *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
10893 return (uint64_t)ret_conv;
10896 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_err(uint32_t e) {
10897 LDKDecodeError e_conv;
10898 e_conv.inner = (void*)(e & (~1));
10899 e_conv.is_owned = (e & 1) || (e == 0);
10900 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10901 e_conv = DecodeError_clone(&e_conv);
10902 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
10903 *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
10904 return (uint64_t)ret_conv;
10907 jboolean __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint32_t o) {
10908 LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)(o & ~1);
10909 jboolean ret_val = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
10913 void __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_free(uint32_t _res) {
10914 if ((_res & 1) != 0) return;
10915 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10916 CHECK_ACCESS(_res_ptr);
10917 LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
10919 CResult_RouteHintDecodeErrorZ_free(_res_conv);
10922 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
10923 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
10924 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
10925 return (uint64_t)ret_conv;
10927 int64_t __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint32_t arg) {
10928 LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
10929 int64_t ret_val = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
10933 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint32_t orig) {
10934 LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)(orig & ~1);
10935 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
10936 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
10937 return (uint64_t)ret_conv;
10940 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint32_t o) {
10941 LDKRouteHintHop o_conv;
10942 o_conv.inner = (void*)(o & (~1));
10943 o_conv.is_owned = (o & 1) || (o == 0);
10944 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10945 o_conv = RouteHintHop_clone(&o_conv);
10946 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
10947 *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
10948 return (uint64_t)ret_conv;
10951 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint32_t e) {
10952 LDKDecodeError e_conv;
10953 e_conv.inner = (void*)(e & (~1));
10954 e_conv.is_owned = (e & 1) || (e == 0);
10955 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10956 e_conv = DecodeError_clone(&e_conv);
10957 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
10958 *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
10959 return (uint64_t)ret_conv;
10962 jboolean __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint32_t o) {
10963 LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(o & ~1);
10964 jboolean ret_val = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
10968 void __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint32_t _res) {
10969 if ((_res & 1) != 0) return;
10970 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10971 CHECK_ACCESS(_res_ptr);
10972 LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
10974 CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
10977 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
10978 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
10979 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
10980 return (uint64_t)ret_conv;
10982 int64_t __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint32_t arg) {
10983 LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
10984 int64_t ret_val = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
10988 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint32_t orig) {
10989 LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(orig & ~1);
10990 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
10991 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
10992 return (uint64_t)ret_conv;
10995 void __attribute__((visibility("default"))) TS_CVec_ChannelDetailsZ_free(uint32_tArray _res) {
10996 LDKCVec_ChannelDetailsZ _res_constr;
10997 _res_constr.datalen = _res->arr_len;
10998 if (_res_constr.datalen > 0)
10999 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
11001 _res_constr.data = NULL;
11002 uint32_t* _res_vals = _res->elems;
11003 for (size_t q = 0; q < _res_constr.datalen; q++) {
11004 uint32_t _res_conv_16 = _res_vals[q];
11005 LDKChannelDetails _res_conv_16_conv;
11006 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
11007 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
11008 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
11009 _res_constr.data[q] = _res_conv_16_conv;
11011 CVec_ChannelDetailsZ_free(_res_constr);
11014 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_ok(uint32_t o) {
11016 o_conv.inner = (void*)(o & (~1));
11017 o_conv.is_owned = (o & 1) || (o == 0);
11018 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11019 o_conv = Route_clone(&o_conv);
11020 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11021 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
11022 return (uint64_t)ret_conv;
11025 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_err(uint32_t e) {
11026 LDKLightningError e_conv;
11027 e_conv.inner = (void*)(e & (~1));
11028 e_conv.is_owned = (e & 1) || (e == 0);
11029 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11030 e_conv = LightningError_clone(&e_conv);
11031 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11032 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
11033 return (uint64_t)ret_conv;
11036 jboolean __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_is_ok(uint32_t o) {
11037 LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)(o & ~1);
11038 jboolean ret_val = CResult_RouteLightningErrorZ_is_ok(o_conv);
11042 void __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_free(uint32_t _res) {
11043 if ((_res & 1) != 0) return;
11044 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11045 CHECK_ACCESS(_res_ptr);
11046 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
11048 CResult_RouteLightningErrorZ_free(_res_conv);
11051 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
11052 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11053 *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
11054 return (uint64_t)ret_conv;
11056 int64_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint32_t arg) {
11057 LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
11058 int64_t ret_val = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
11062 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_clone(uint32_t orig) {
11063 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
11064 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11065 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
11066 return (uint64_t)ret_conv;
11069 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_ok() {
11070 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11071 *ret_conv = CResult_NoneLightningErrorZ_ok();
11072 return (uint64_t)ret_conv;
11075 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
11076 LDKLightningError e_conv;
11077 e_conv.inner = (void*)(e & (~1));
11078 e_conv.is_owned = (e & 1) || (e == 0);
11079 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11080 e_conv = LightningError_clone(&e_conv);
11081 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11082 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
11083 return (uint64_t)ret_conv;
11086 jboolean __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_is_ok(uint32_t o) {
11087 LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)(o & ~1);
11088 jboolean ret_val = CResult_NoneLightningErrorZ_is_ok(o_conv);
11092 void __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
11093 if ((_res & 1) != 0) return;
11094 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11095 CHECK_ACCESS(_res_ptr);
11096 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
11098 CResult_NoneLightningErrorZ_free(_res_conv);
11101 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
11102 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11103 *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
11104 return (uint64_t)ret_conv;
11106 int64_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint32_t arg) {
11107 LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
11108 int64_t ret_val = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
11112 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
11113 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
11114 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11115 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
11116 return (uint64_t)ret_conv;
11119 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
11120 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
11121 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
11122 return ((uint64_t)ret_conv);
11124 int64_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint32_t arg) {
11125 LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)(arg & ~1);
11126 int64_t ret_val = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
11130 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint32_t orig) {
11131 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
11132 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
11133 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
11134 return ((uint64_t)ret_conv);
11137 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint32_t b) {
11138 LDKPublicKey a_ref;
11139 CHECK(a->arr_len == 33);
11140 memcpy(a_ref.compressed_form, a->elems, 33);
11141 void* b_ptr = (void*)(((uint64_t)b) & ~1);
11142 CHECK_ACCESS(b_ptr);
11143 LDKType b_conv = *(LDKType*)(b_ptr);
11144 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
11145 *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
11146 return ((uint64_t)ret_conv);
11149 void __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_free(uint32_t _res) {
11150 if ((_res & 1) != 0) return;
11151 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11152 CHECK_ACCESS(_res_ptr);
11153 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
11155 C2Tuple_PublicKeyTypeZ_free(_res_conv);
11158 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint32_tArray _res) {
11159 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
11160 _res_constr.datalen = _res->arr_len;
11161 if (_res_constr.datalen > 0)
11162 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
11164 _res_constr.data = NULL;
11165 uint32_t* _res_vals = _res->elems;
11166 for (size_t z = 0; z < _res_constr.datalen; z++) {
11167 uint32_t _res_conv_25 = _res_vals[z];
11168 void* _res_conv_25_ptr = (void*)(((uint64_t)_res_conv_25) & ~1);
11169 CHECK_ACCESS(_res_conv_25_ptr);
11170 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
11171 FREE((void*)_res_conv_25);
11172 _res_constr.data[z] = _res_conv_25_conv;
11174 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
11177 void __attribute__((visibility("default"))) TS_CVec_MessageSendEventZ_free(uint32_tArray _res) {
11178 LDKCVec_MessageSendEventZ _res_constr;
11179 _res_constr.datalen = _res->arr_len;
11180 if (_res_constr.datalen > 0)
11181 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
11183 _res_constr.data = NULL;
11184 uint32_t* _res_vals = _res->elems;
11185 for (size_t s = 0; s < _res_constr.datalen; s++) {
11186 uint32_t _res_conv_18 = _res_vals[s];
11187 void* _res_conv_18_ptr = (void*)(((uint64_t)_res_conv_18) & ~1);
11188 CHECK_ACCESS(_res_conv_18_ptr);
11189 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
11190 FREE((void*)_res_conv_18);
11191 _res_constr.data[s] = _res_conv_18_conv;
11193 CVec_MessageSendEventZ_free(_res_constr);
11196 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
11197 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11198 *ret_conv = CResult_boolLightningErrorZ_ok(o);
11199 return (uint64_t)ret_conv;
11202 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
11203 LDKLightningError e_conv;
11204 e_conv.inner = (void*)(e & (~1));
11205 e_conv.is_owned = (e & 1) || (e == 0);
11206 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11207 e_conv = LightningError_clone(&e_conv);
11208 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11209 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
11210 return (uint64_t)ret_conv;
11213 jboolean __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_is_ok(uint32_t o) {
11214 LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)(o & ~1);
11215 jboolean ret_val = CResult_boolLightningErrorZ_is_ok(o_conv);
11219 void __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_free(uint32_t _res) {
11220 if ((_res & 1) != 0) return;
11221 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11222 CHECK_ACCESS(_res_ptr);
11223 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
11225 CResult_boolLightningErrorZ_free(_res_conv);
11228 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
11229 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11230 *ret_conv = CResult_boolLightningErrorZ_clone(arg);
11231 return (uint64_t)ret_conv;
11233 int64_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint32_t arg) {
11234 LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
11235 int64_t ret_val = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
11239 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
11240 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
11241 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11242 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
11243 return (uint64_t)ret_conv;
11246 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
11247 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11248 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
11249 return ((uint64_t)ret_conv);
11251 int64_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint32_t arg) {
11252 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(arg & ~1);
11253 int64_t ret_val = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
11257 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
11258 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
11259 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11260 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
11261 return ((uint64_t)ret_conv);
11264 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
11265 LDKChannelAnnouncement a_conv;
11266 a_conv.inner = (void*)(a & (~1));
11267 a_conv.is_owned = (a & 1) || (a == 0);
11268 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
11269 a_conv = ChannelAnnouncement_clone(&a_conv);
11270 LDKChannelUpdate b_conv;
11271 b_conv.inner = (void*)(b & (~1));
11272 b_conv.is_owned = (b & 1) || (b == 0);
11273 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
11274 b_conv = ChannelUpdate_clone(&b_conv);
11275 LDKChannelUpdate c_conv;
11276 c_conv.inner = (void*)(c & (~1));
11277 c_conv.is_owned = (c & 1) || (c == 0);
11278 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
11279 c_conv = ChannelUpdate_clone(&c_conv);
11280 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11281 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
11282 return ((uint64_t)ret_conv);
11285 void __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint32_t _res) {
11286 if ((_res & 1) != 0) return;
11287 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11288 CHECK_ACCESS(_res_ptr);
11289 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
11291 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
11294 void __attribute__((visibility("default"))) TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint32_tArray _res) {
11295 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
11296 _res_constr.datalen = _res->arr_len;
11297 if (_res_constr.datalen > 0)
11298 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
11300 _res_constr.data = NULL;
11301 uint32_t* _res_vals = _res->elems;
11302 for (size_t h = 0; h < _res_constr.datalen; h++) {
11303 uint32_t _res_conv_59 = _res_vals[h];
11304 void* _res_conv_59_ptr = (void*)(((uint64_t)_res_conv_59) & ~1);
11305 CHECK_ACCESS(_res_conv_59_ptr);
11306 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_conv_59_ptr);
11307 FREE((void*)_res_conv_59);
11308 _res_constr.data[h] = _res_conv_59_conv;
11310 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
11313 void __attribute__((visibility("default"))) TS_CVec_NodeAnnouncementZ_free(uint32_tArray _res) {
11314 LDKCVec_NodeAnnouncementZ _res_constr;
11315 _res_constr.datalen = _res->arr_len;
11316 if (_res_constr.datalen > 0)
11317 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
11319 _res_constr.data = NULL;
11320 uint32_t* _res_vals = _res->elems;
11321 for (size_t s = 0; s < _res_constr.datalen; s++) {
11322 uint32_t _res_conv_18 = _res_vals[s];
11323 LDKNodeAnnouncement _res_conv_18_conv;
11324 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
11325 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
11326 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_18_conv);
11327 _res_constr.data[s] = _res_conv_18_conv;
11329 CVec_NodeAnnouncementZ_free(_res_constr);
11332 void __attribute__((visibility("default"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
11333 LDKCVec_PublicKeyZ _res_constr;
11334 _res_constr.datalen = _res->arr_len;
11335 if (_res_constr.datalen > 0)
11336 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
11338 _res_constr.data = NULL;
11339 int8_tArray* _res_vals = (void*) _res->elems;
11340 for (size_t m = 0; m < _res_constr.datalen; m++) {
11341 int8_tArray _res_conv_12 = _res_vals[m];
11342 LDKPublicKey _res_conv_12_ref;
11343 CHECK(_res_conv_12->arr_len == 33);
11344 memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33);
11345 _res_constr.data[m] = _res_conv_12_ref;
11347 CVec_PublicKeyZ_free(_res_constr);
11350 void __attribute__((visibility("default"))) TS_CVec_u8Z_free(int8_tArray _res) {
11351 LDKCVec_u8Z _res_ref;
11352 _res_ref.datalen = _res->arr_len;
11353 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
11354 memcpy(_res_ref.data, _res->elems, _res_ref.datalen);
11355 CVec_u8Z_free(_res_ref);
11358 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
11360 o_ref.datalen = o->arr_len;
11361 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
11362 memcpy(o_ref.data, o->elems, o_ref.datalen);
11363 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11364 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
11365 return (uint64_t)ret_conv;
11368 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint32_t e) {
11369 LDKPeerHandleError e_conv;
11370 e_conv.inner = (void*)(e & (~1));
11371 e_conv.is_owned = (e & 1) || (e == 0);
11372 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11373 e_conv = PeerHandleError_clone(&e_conv);
11374 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11375 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
11376 return (uint64_t)ret_conv;
11379 jboolean __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint32_t o) {
11380 LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(o & ~1);
11381 jboolean ret_val = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
11385 void __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint32_t _res) {
11386 if ((_res & 1) != 0) return;
11387 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11388 CHECK_ACCESS(_res_ptr);
11389 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
11391 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
11394 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
11395 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11396 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
11397 return (uint64_t)ret_conv;
11399 int64_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint32_t arg) {
11400 LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
11401 int64_t ret_val = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
11405 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint32_t orig) {
11406 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
11407 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11408 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
11409 return (uint64_t)ret_conv;
11412 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_ok() {
11413 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11414 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
11415 return (uint64_t)ret_conv;
11418 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_err(uint32_t e) {
11419 LDKPeerHandleError e_conv;
11420 e_conv.inner = (void*)(e & (~1));
11421 e_conv.is_owned = (e & 1) || (e == 0);
11422 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11423 e_conv = PeerHandleError_clone(&e_conv);
11424 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11425 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
11426 return (uint64_t)ret_conv;
11429 jboolean __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint32_t o) {
11430 LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)(o & ~1);
11431 jboolean ret_val = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
11435 void __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_free(uint32_t _res) {
11436 if ((_res & 1) != 0) return;
11437 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11438 CHECK_ACCESS(_res_ptr);
11439 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
11441 CResult_NonePeerHandleErrorZ_free(_res_conv);
11444 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
11445 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11446 *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
11447 return (uint64_t)ret_conv;
11449 int64_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint32_t arg) {
11450 LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
11451 int64_t ret_val = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
11455 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_clone(uint32_t orig) {
11456 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
11457 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11458 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
11459 return (uint64_t)ret_conv;
11462 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
11463 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11464 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
11465 return (uint64_t)ret_conv;
11468 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_err(uint32_t e) {
11469 LDKPeerHandleError e_conv;
11470 e_conv.inner = (void*)(e & (~1));
11471 e_conv.is_owned = (e & 1) || (e == 0);
11472 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11473 e_conv = PeerHandleError_clone(&e_conv);
11474 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11475 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
11476 return (uint64_t)ret_conv;
11479 jboolean __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint32_t o) {
11480 LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)(o & ~1);
11481 jboolean ret_val = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
11485 void __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_free(uint32_t _res) {
11486 if ((_res & 1) != 0) return;
11487 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11488 CHECK_ACCESS(_res_ptr);
11489 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
11491 CResult_boolPeerHandleErrorZ_free(_res_conv);
11494 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
11495 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11496 *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
11497 return (uint64_t)ret_conv;
11499 int64_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint32_t arg) {
11500 LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
11501 int64_t ret_val = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
11505 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_clone(uint32_t orig) {
11506 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
11507 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11508 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
11509 return (uint64_t)ret_conv;
11512 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_ok(uint32_t o) {
11513 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11514 CHECK_ACCESS(o_ptr);
11515 LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
11516 o_conv = TxOut_clone((LDKTxOut*)(((uint64_t)o) & ~1));
11517 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
11518 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
11519 return (uint64_t)ret_conv;
11522 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
11523 LDKAccessError e_conv = LDKAccessError_from_js(e);
11524 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
11525 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
11526 return (uint64_t)ret_conv;
11529 jboolean __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_is_ok(uint32_t o) {
11530 LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)(o & ~1);
11531 jboolean ret_val = CResult_TxOutAccessErrorZ_is_ok(o_conv);
11535 void __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_free(uint32_t _res) {
11536 if ((_res & 1) != 0) return;
11537 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11538 CHECK_ACCESS(_res_ptr);
11539 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
11541 CResult_TxOutAccessErrorZ_free(_res_conv);
11544 static inline uint64_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
11545 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
11546 *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
11547 return (uint64_t)ret_conv;
11549 int64_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_clone_ptr(uint32_t arg) {
11550 LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
11551 int64_t ret_val = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
11555 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_clone(uint32_t orig) {
11556 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
11557 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
11558 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
11559 return (uint64_t)ret_conv;
11562 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
11563 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11564 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
11565 return (uint64_t)ret_conv;
11568 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
11569 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
11570 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11571 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
11572 return (uint64_t)ret_conv;
11575 jboolean __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_is_ok(uint32_t o) {
11576 LDKCResult_NoneChannelMonitorUpdateErrZ* o_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(o & ~1);
11577 jboolean ret_val = CResult_NoneChannelMonitorUpdateErrZ_is_ok(o_conv);
11581 void __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint32_t _res) {
11582 if ((_res & 1) != 0) return;
11583 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11584 CHECK_ACCESS(_res_ptr);
11585 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
11587 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
11590 static inline uint64_t CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR arg) {
11591 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11592 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(arg);
11593 return (uint64_t)ret_conv;
11595 int64_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(uint32_t arg) {
11596 LDKCResult_NoneChannelMonitorUpdateErrZ* arg_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
11597 int64_t ret_val = CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(arg_conv);
11601 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint32_t orig) {
11602 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
11603 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11604 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
11605 return (uint64_t)ret_conv;
11608 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_some(uint32_t o) {
11609 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11610 CHECK_ACCESS(o_ptr);
11611 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(o_ptr);
11612 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1));
11613 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
11614 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
11615 uint64_t ret_ref = (uint64_t)ret_copy;
11619 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_none() {
11620 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
11621 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
11622 uint64_t ret_ref = (uint64_t)ret_copy;
11626 void __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_free(uint32_t _res) {
11627 if ((_res & 1) != 0) return;
11628 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11629 CHECK_ACCESS(_res_ptr);
11630 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(_res_ptr);
11632 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
11635 static inline uint64_t COption_C2Tuple_usizeTransactionZZ_clone_ptr(LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR arg) {
11636 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
11637 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(arg);
11638 uint64_t ret_ref = (uint64_t)ret_copy;
11641 int64_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_clone_ptr(uint32_t arg) {
11642 LDKCOption_C2Tuple_usizeTransactionZZ* arg_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)arg;
11643 int64_t ret_val = COption_C2Tuple_usizeTransactionZZ_clone_ptr(arg_conv);
11647 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_clone(uint32_t orig) {
11648 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
11649 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
11650 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
11651 uint64_t ret_ref = (uint64_t)ret_copy;
11655 uint32_t __attribute__((visibility("default"))) TS_COption_ClosureReasonZ_some(uint32_t o) {
11656 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11657 CHECK_ACCESS(o_ptr);
11658 LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
11659 o_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)o) & ~1));
11660 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
11661 *ret_copy = COption_ClosureReasonZ_some(o_conv);
11662 uint64_t ret_ref = (uint64_t)ret_copy;
11666 uint32_t __attribute__((visibility("default"))) TS_COption_ClosureReasonZ_none() {
11667 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
11668 *ret_copy = COption_ClosureReasonZ_none();
11669 uint64_t ret_ref = (uint64_t)ret_copy;
11673 void __attribute__((visibility("default"))) TS_COption_ClosureReasonZ_free(uint32_t _res) {
11674 if ((_res & 1) != 0) return;
11675 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11676 CHECK_ACCESS(_res_ptr);
11677 LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
11679 COption_ClosureReasonZ_free(_res_conv);
11682 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
11683 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
11684 *ret_copy = COption_ClosureReasonZ_clone(arg);
11685 uint64_t ret_ref = (uint64_t)ret_copy;
11688 int64_t __attribute__((visibility("default"))) TS_COption_ClosureReasonZ_clone_ptr(uint32_t arg) {
11689 LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)arg;
11690 int64_t ret_val = COption_ClosureReasonZ_clone_ptr(arg_conv);
11694 uint32_t __attribute__((visibility("default"))) TS_COption_ClosureReasonZ_clone(uint32_t orig) {
11695 LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)orig;
11696 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
11697 *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
11698 uint64_t ret_ref = (uint64_t)ret_copy;
11702 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint32_t o) {
11703 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11704 CHECK_ACCESS(o_ptr);
11705 LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
11706 o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)(((uint64_t)o) & ~1));
11707 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
11708 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
11709 return (uint64_t)ret_conv;
11712 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint32_t e) {
11713 LDKDecodeError e_conv;
11714 e_conv.inner = (void*)(e & (~1));
11715 e_conv.is_owned = (e & 1) || (e == 0);
11716 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11717 e_conv = DecodeError_clone(&e_conv);
11718 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
11719 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
11720 return (uint64_t)ret_conv;
11723 jboolean __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint32_t o) {
11724 LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(o & ~1);
11725 jboolean ret_val = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
11729 void __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint32_t _res) {
11730 if ((_res & 1) != 0) return;
11731 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11732 CHECK_ACCESS(_res_ptr);
11733 LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
11735 CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
11738 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
11739 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
11740 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
11741 return (uint64_t)ret_conv;
11743 int64_t __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint32_t arg) {
11744 LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(arg & ~1);
11745 int64_t ret_val = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
11749 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint32_t orig) {
11750 LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(orig & ~1);
11751 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
11752 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
11753 return (uint64_t)ret_conv;
11756 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_some(uint32_t o) {
11757 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11758 CHECK_ACCESS(o_ptr);
11759 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
11760 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uint64_t)o) & ~1));
11761 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
11762 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
11763 uint64_t ret_ref = (uint64_t)ret_copy;
11767 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_none() {
11768 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
11769 *ret_copy = COption_NetworkUpdateZ_none();
11770 uint64_t ret_ref = (uint64_t)ret_copy;
11774 void __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_free(uint32_t _res) {
11775 if ((_res & 1) != 0) return;
11776 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11777 CHECK_ACCESS(_res_ptr);
11778 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
11780 COption_NetworkUpdateZ_free(_res_conv);
11783 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
11784 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
11785 *ret_copy = COption_NetworkUpdateZ_clone(arg);
11786 uint64_t ret_ref = (uint64_t)ret_copy;
11789 int64_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_clone_ptr(uint32_t arg) {
11790 LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)arg;
11791 int64_t ret_val = COption_NetworkUpdateZ_clone_ptr(arg_conv);
11795 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_clone(uint32_t orig) {
11796 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
11797 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
11798 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
11799 uint64_t ret_ref = (uint64_t)ret_copy;
11803 void __attribute__((visibility("default"))) TS_CVec_SpendableOutputDescriptorZ_free(uint32_tArray _res) {
11804 LDKCVec_SpendableOutputDescriptorZ _res_constr;
11805 _res_constr.datalen = _res->arr_len;
11806 if (_res_constr.datalen > 0)
11807 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
11809 _res_constr.data = NULL;
11810 uint32_t* _res_vals = _res->elems;
11811 for (size_t b = 0; b < _res_constr.datalen; b++) {
11812 uint32_t _res_conv_27 = _res_vals[b];
11813 void* _res_conv_27_ptr = (void*)(((uint64_t)_res_conv_27) & ~1);
11814 CHECK_ACCESS(_res_conv_27_ptr);
11815 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
11816 FREE((void*)_res_conv_27);
11817 _res_constr.data[b] = _res_conv_27_conv;
11819 CVec_SpendableOutputDescriptorZ_free(_res_constr);
11822 uint32_t __attribute__((visibility("default"))) TS_COption_EventZ_some(uint32_t o) {
11823 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11824 CHECK_ACCESS(o_ptr);
11825 LDKEvent o_conv = *(LDKEvent*)(o_ptr);
11826 o_conv = Event_clone((LDKEvent*)(((uint64_t)o) & ~1));
11827 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
11828 *ret_copy = COption_EventZ_some(o_conv);
11829 uint64_t ret_ref = (uint64_t)ret_copy;
11833 uint32_t __attribute__((visibility("default"))) TS_COption_EventZ_none() {
11834 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
11835 *ret_copy = COption_EventZ_none();
11836 uint64_t ret_ref = (uint64_t)ret_copy;
11840 void __attribute__((visibility("default"))) TS_COption_EventZ_free(uint32_t _res) {
11841 if ((_res & 1) != 0) return;
11842 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11843 CHECK_ACCESS(_res_ptr);
11844 LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
11846 COption_EventZ_free(_res_conv);
11849 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
11850 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
11851 *ret_copy = COption_EventZ_clone(arg);
11852 uint64_t ret_ref = (uint64_t)ret_copy;
11855 int64_t __attribute__((visibility("default"))) TS_COption_EventZ_clone_ptr(uint32_t arg) {
11856 LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)arg;
11857 int64_t ret_val = COption_EventZ_clone_ptr(arg_conv);
11861 uint32_t __attribute__((visibility("default"))) TS_COption_EventZ_clone(uint32_t orig) {
11862 LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)orig;
11863 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
11864 *ret_copy = COption_EventZ_clone(orig_conv);
11865 uint64_t ret_ref = (uint64_t)ret_copy;
11869 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint32_t o) {
11870 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11871 CHECK_ACCESS(o_ptr);
11872 LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
11873 o_conv = COption_EventZ_clone((LDKCOption_EventZ*)(((uint64_t)o) & ~1));
11874 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
11875 *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
11876 return (uint64_t)ret_conv;
11879 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint32_t e) {
11880 LDKDecodeError e_conv;
11881 e_conv.inner = (void*)(e & (~1));
11882 e_conv.is_owned = (e & 1) || (e == 0);
11883 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11884 e_conv = DecodeError_clone(&e_conv);
11885 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
11886 *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
11887 return (uint64_t)ret_conv;
11890 jboolean __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint32_t o) {
11891 LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(o & ~1);
11892 jboolean ret_val = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
11896 void __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint32_t _res) {
11897 if ((_res & 1) != 0) return;
11898 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11899 CHECK_ACCESS(_res_ptr);
11900 LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
11902 CResult_COption_EventZDecodeErrorZ_free(_res_conv);
11905 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
11906 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
11907 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
11908 return (uint64_t)ret_conv;
11910 int64_t __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint32_t arg) {
11911 LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(arg & ~1);
11912 int64_t ret_val = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
11916 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint32_t orig) {
11917 LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(orig & ~1);
11918 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
11919 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
11920 return (uint64_t)ret_conv;
11923 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint32_t o) {
11925 o_conv.inner = (void*)(o & (~1));
11926 o_conv.is_owned = (o & 1) || (o == 0);
11927 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11928 o_conv = NodeId_clone(&o_conv);
11929 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
11930 *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
11931 return (uint64_t)ret_conv;
11934 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_err(uint32_t e) {
11935 LDKDecodeError e_conv;
11936 e_conv.inner = (void*)(e & (~1));
11937 e_conv.is_owned = (e & 1) || (e == 0);
11938 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11939 e_conv = DecodeError_clone(&e_conv);
11940 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
11941 *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
11942 return (uint64_t)ret_conv;
11945 jboolean __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint32_t o) {
11946 LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)(o & ~1);
11947 jboolean ret_val = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
11951 void __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_free(uint32_t _res) {
11952 if ((_res & 1) != 0) return;
11953 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11954 CHECK_ACCESS(_res_ptr);
11955 LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
11957 CResult_NodeIdDecodeErrorZ_free(_res_conv);
11960 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
11961 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
11962 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
11963 return (uint64_t)ret_conv;
11965 int64_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint32_t arg) {
11966 LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
11967 int64_t ret_val = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
11971 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint32_t orig) {
11972 LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1);
11973 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
11974 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
11975 return (uint64_t)ret_conv;
11978 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint32_t o) {
11979 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11980 CHECK_ACCESS(o_ptr);
11981 LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
11982 o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uint64_t)o) & ~1));
11983 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
11984 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
11985 return (uint64_t)ret_conv;
11988 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint32_t e) {
11989 LDKDecodeError e_conv;
11990 e_conv.inner = (void*)(e & (~1));
11991 e_conv.is_owned = (e & 1) || (e == 0);
11992 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11993 e_conv = DecodeError_clone(&e_conv);
11994 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
11995 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
11996 return (uint64_t)ret_conv;
11999 jboolean __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint32_t o) {
12000 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(o & ~1);
12001 jboolean ret_val = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
12005 void __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint32_t _res) {
12006 if ((_res & 1) != 0) return;
12007 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12008 CHECK_ACCESS(_res_ptr);
12009 LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
12011 CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
12014 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
12015 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
12016 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
12017 return (uint64_t)ret_conv;
12019 int64_t __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint32_t arg) {
12020 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(arg & ~1);
12021 int64_t ret_val = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
12025 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint32_t orig) {
12026 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(orig & ~1);
12027 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
12028 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
12029 return (uint64_t)ret_conv;
12032 uint32_t __attribute__((visibility("default"))) TS_COption_AccessZ_some(uint32_t o) {
12033 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12034 CHECK_ACCESS(o_ptr);
12035 LDKAccess o_conv = *(LDKAccess*)(o_ptr);
12036 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
12037 *ret_copy = COption_AccessZ_some(o_conv);
12038 uint64_t ret_ref = (uint64_t)ret_copy;
12042 uint32_t __attribute__((visibility("default"))) TS_COption_AccessZ_none() {
12043 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
12044 *ret_copy = COption_AccessZ_none();
12045 uint64_t ret_ref = (uint64_t)ret_copy;
12049 void __attribute__((visibility("default"))) TS_COption_AccessZ_free(uint32_t _res) {
12050 if ((_res & 1) != 0) return;
12051 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12052 CHECK_ACCESS(_res_ptr);
12053 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
12055 COption_AccessZ_free(_res_conv);
12058 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_ok(uint32_t o) {
12059 LDKDirectionalChannelInfo o_conv;
12060 o_conv.inner = (void*)(o & (~1));
12061 o_conv.is_owned = (o & 1) || (o == 0);
12062 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12063 o_conv = DirectionalChannelInfo_clone(&o_conv);
12064 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
12065 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
12066 return (uint64_t)ret_conv;
12069 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_err(uint32_t e) {
12070 LDKDecodeError e_conv;
12071 e_conv.inner = (void*)(e & (~1));
12072 e_conv.is_owned = (e & 1) || (e == 0);
12073 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12074 e_conv = DecodeError_clone(&e_conv);
12075 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
12076 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
12077 return (uint64_t)ret_conv;
12080 jboolean __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(uint32_t o) {
12081 LDKCResult_DirectionalChannelInfoDecodeErrorZ* o_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(o & ~1);
12082 jboolean ret_val = CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(o_conv);
12086 void __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_free(uint32_t _res) {
12087 if ((_res & 1) != 0) return;
12088 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12089 CHECK_ACCESS(_res_ptr);
12090 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(_res_ptr);
12092 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
12095 static inline uint64_t CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
12096 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
12097 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(arg);
12098 return (uint64_t)ret_conv;
12100 int64_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
12101 LDKCResult_DirectionalChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
12102 int64_t ret_val = CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
12106 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone(uint32_t orig) {
12107 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
12108 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
12109 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
12110 return (uint64_t)ret_conv;
12113 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint32_t o) {
12114 LDKChannelInfo o_conv;
12115 o_conv.inner = (void*)(o & (~1));
12116 o_conv.is_owned = (o & 1) || (o == 0);
12117 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12118 o_conv = ChannelInfo_clone(&o_conv);
12119 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
12120 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
12121 return (uint64_t)ret_conv;
12124 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint32_t e) {
12125 LDKDecodeError e_conv;
12126 e_conv.inner = (void*)(e & (~1));
12127 e_conv.is_owned = (e & 1) || (e == 0);
12128 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12129 e_conv = DecodeError_clone(&e_conv);
12130 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
12131 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
12132 return (uint64_t)ret_conv;
12135 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint32_t o) {
12136 LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(o & ~1);
12137 jboolean ret_val = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
12141 void __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint32_t _res) {
12142 if ((_res & 1) != 0) return;
12143 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12144 CHECK_ACCESS(_res_ptr);
12145 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
12147 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
12150 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
12151 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
12152 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
12153 return (uint64_t)ret_conv;
12155 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
12156 LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
12157 int64_t ret_val = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
12161 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint32_t orig) {
12162 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
12163 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
12164 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
12165 return (uint64_t)ret_conv;
12168 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint32_t o) {
12169 LDKRoutingFees o_conv;
12170 o_conv.inner = (void*)(o & (~1));
12171 o_conv.is_owned = (o & 1) || (o == 0);
12172 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12173 o_conv = RoutingFees_clone(&o_conv);
12174 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
12175 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
12176 return (uint64_t)ret_conv;
12179 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint32_t e) {
12180 LDKDecodeError e_conv;
12181 e_conv.inner = (void*)(e & (~1));
12182 e_conv.is_owned = (e & 1) || (e == 0);
12183 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12184 e_conv = DecodeError_clone(&e_conv);
12185 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
12186 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
12187 return (uint64_t)ret_conv;
12190 jboolean __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint32_t o) {
12191 LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(o & ~1);
12192 jboolean ret_val = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
12196 void __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint32_t _res) {
12197 if ((_res & 1) != 0) return;
12198 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12199 CHECK_ACCESS(_res_ptr);
12200 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
12202 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
12205 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
12206 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
12207 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
12208 return (uint64_t)ret_conv;
12210 int64_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint32_t arg) {
12211 LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
12212 int64_t ret_val = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
12216 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint32_t orig) {
12217 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
12218 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
12219 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
12220 return (uint64_t)ret_conv;
12223 void __attribute__((visibility("default"))) TS_CVec_NetAddressZ_free(uint32_tArray _res) {
12224 LDKCVec_NetAddressZ _res_constr;
12225 _res_constr.datalen = _res->arr_len;
12226 if (_res_constr.datalen > 0)
12227 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
12229 _res_constr.data = NULL;
12230 uint32_t* _res_vals = _res->elems;
12231 for (size_t m = 0; m < _res_constr.datalen; m++) {
12232 uint32_t _res_conv_12 = _res_vals[m];
12233 void* _res_conv_12_ptr = (void*)(((uint64_t)_res_conv_12) & ~1);
12234 CHECK_ACCESS(_res_conv_12_ptr);
12235 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
12236 FREE((void*)_res_conv_12);
12237 _res_constr.data[m] = _res_conv_12_conv;
12239 CVec_NetAddressZ_free(_res_constr);
12242 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint32_t o) {
12243 LDKNodeAnnouncementInfo o_conv;
12244 o_conv.inner = (void*)(o & (~1));
12245 o_conv.is_owned = (o & 1) || (o == 0);
12246 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12247 o_conv = NodeAnnouncementInfo_clone(&o_conv);
12248 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
12249 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
12250 return (uint64_t)ret_conv;
12253 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint32_t e) {
12254 LDKDecodeError e_conv;
12255 e_conv.inner = (void*)(e & (~1));
12256 e_conv.is_owned = (e & 1) || (e == 0);
12257 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12258 e_conv = DecodeError_clone(&e_conv);
12259 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
12260 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
12261 return (uint64_t)ret_conv;
12264 jboolean __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint32_t o) {
12265 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(o & ~1);
12266 jboolean ret_val = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
12270 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint32_t _res) {
12271 if ((_res & 1) != 0) return;
12272 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12273 CHECK_ACCESS(_res_ptr);
12274 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
12276 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
12279 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
12280 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
12281 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
12282 return (uint64_t)ret_conv;
12284 int64_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
12285 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
12286 int64_t ret_val = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
12290 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint32_t orig) {
12291 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
12292 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
12293 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
12294 return (uint64_t)ret_conv;
12297 void __attribute__((visibility("default"))) TS_CVec_u64Z_free(int64_tArray _res) {
12298 LDKCVec_u64Z _res_constr;
12299 _res_constr.datalen = _res->arr_len;
12300 if (_res_constr.datalen > 0)
12301 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
12303 _res_constr.data = NULL;
12304 int64_t* _res_vals = _res->elems;
12305 for (size_t i = 0; i < _res_constr.datalen; i++) {
12306 int64_t _res_conv_8 = _res_vals[i];
12307 _res_constr.data[i] = _res_conv_8;
12309 CVec_u64Z_free(_res_constr);
12312 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint32_t o) {
12313 LDKNodeInfo o_conv;
12314 o_conv.inner = (void*)(o & (~1));
12315 o_conv.is_owned = (o & 1) || (o == 0);
12316 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12317 o_conv = NodeInfo_clone(&o_conv);
12318 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
12319 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
12320 return (uint64_t)ret_conv;
12323 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint32_t e) {
12324 LDKDecodeError e_conv;
12325 e_conv.inner = (void*)(e & (~1));
12326 e_conv.is_owned = (e & 1) || (e == 0);
12327 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12328 e_conv = DecodeError_clone(&e_conv);
12329 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
12330 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
12331 return (uint64_t)ret_conv;
12334 jboolean __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint32_t o) {
12335 LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(o & ~1);
12336 jboolean ret_val = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
12340 void __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint32_t _res) {
12341 if ((_res & 1) != 0) return;
12342 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12343 CHECK_ACCESS(_res_ptr);
12344 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
12346 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
12349 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
12350 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
12351 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
12352 return (uint64_t)ret_conv;
12354 int64_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
12355 LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
12356 int64_t ret_val = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
12360 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint32_t orig) {
12361 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
12362 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
12363 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
12364 return (uint64_t)ret_conv;
12367 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint32_t o) {
12368 LDKNetworkGraph 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 = NetworkGraph_clone(&o_conv);
12373 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
12374 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
12375 return (uint64_t)ret_conv;
12378 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_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_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
12385 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
12386 return (uint64_t)ret_conv;
12389 jboolean __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint32_t o) {
12390 LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(o & ~1);
12391 jboolean ret_val = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
12395 void __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_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_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
12401 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
12404 static inline uint64_t CResult_NetworkGraphDecodeErrorZ_clone_ptr(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR arg) {
12405 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
12406 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(arg);
12407 return (uint64_t)ret_conv;
12409 int64_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_clone_ptr(uint32_t arg) {
12410 LDKCResult_NetworkGraphDecodeErrorZ* arg_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
12411 int64_t ret_val = CResult_NetworkGraphDecodeErrorZ_clone_ptr(arg_conv);
12415 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_clone(uint32_t orig) {
12416 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
12417 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
12418 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
12419 return (uint64_t)ret_conv;
12422 uint32_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_some(uint32_tArray o) {
12423 LDKCVec_NetAddressZ o_constr;
12424 o_constr.datalen = o->arr_len;
12425 if (o_constr.datalen > 0)
12426 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
12428 o_constr.data = NULL;
12429 uint32_t* o_vals = o->elems;
12430 for (size_t m = 0; m < o_constr.datalen; m++) {
12431 uint32_t o_conv_12 = o_vals[m];
12432 void* o_conv_12_ptr = (void*)(((uint64_t)o_conv_12) & ~1);
12433 CHECK_ACCESS(o_conv_12_ptr);
12434 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
12435 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o_conv_12) & ~1));
12436 o_constr.data[m] = o_conv_12_conv;
12438 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
12439 *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
12440 uint64_t ret_ref = (uint64_t)ret_copy;
12444 uint32_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_none() {
12445 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
12446 *ret_copy = COption_CVec_NetAddressZZ_none();
12447 uint64_t ret_ref = (uint64_t)ret_copy;
12451 void __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_free(uint32_t _res) {
12452 if ((_res & 1) != 0) return;
12453 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12454 CHECK_ACCESS(_res_ptr);
12455 LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
12457 COption_CVec_NetAddressZZ_free(_res_conv);
12460 static inline uint64_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
12461 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
12462 *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
12463 uint64_t ret_ref = (uint64_t)ret_copy;
12466 int64_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_clone_ptr(uint32_t arg) {
12467 LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)arg;
12468 int64_t ret_val = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
12472 uint32_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_clone(uint32_t orig) {
12473 LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig;
12474 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
12475 *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
12476 uint64_t ret_ref = (uint64_t)ret_copy;
12480 uint32_t __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_ok(uint32_t o) {
12481 LDKScoringParameters o_conv;
12482 o_conv.inner = (void*)(o & (~1));
12483 o_conv.is_owned = (o & 1) || (o == 0);
12484 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12485 // Warning: we need a move here but no clone is available for LDKScoringParameters
12486 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
12487 *ret_conv = CResult_ScoringParametersDecodeErrorZ_ok(o_conv);
12488 return (uint64_t)ret_conv;
12491 uint32_t __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_err(uint32_t e) {
12492 LDKDecodeError e_conv;
12493 e_conv.inner = (void*)(e & (~1));
12494 e_conv.is_owned = (e & 1) || (e == 0);
12495 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12496 e_conv = DecodeError_clone(&e_conv);
12497 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
12498 *ret_conv = CResult_ScoringParametersDecodeErrorZ_err(e_conv);
12499 return (uint64_t)ret_conv;
12502 jboolean __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_is_ok(uint32_t o) {
12503 LDKCResult_ScoringParametersDecodeErrorZ* o_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(o & ~1);
12504 jboolean ret_val = CResult_ScoringParametersDecodeErrorZ_is_ok(o_conv);
12508 void __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_free(uint32_t _res) {
12509 if ((_res & 1) != 0) return;
12510 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12511 CHECK_ACCESS(_res_ptr);
12512 LDKCResult_ScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ScoringParametersDecodeErrorZ*)(_res_ptr);
12514 CResult_ScoringParametersDecodeErrorZ_free(_res_conv);
12517 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) {
12518 LDKInitFeatures o_conv;
12519 o_conv.inner = (void*)(o & (~1));
12520 o_conv.is_owned = (o & 1) || (o == 0);
12521 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12522 o_conv = InitFeatures_clone(&o_conv);
12523 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
12524 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
12525 return (uint64_t)ret_conv;
12528 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) {
12529 LDKDecodeError e_conv;
12530 e_conv.inner = (void*)(e & (~1));
12531 e_conv.is_owned = (e & 1) || (e == 0);
12532 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12533 e_conv = DecodeError_clone(&e_conv);
12534 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
12535 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
12536 return (uint64_t)ret_conv;
12539 jboolean __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint32_t o) {
12540 LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(o & ~1);
12541 jboolean ret_val = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
12545 void __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) {
12546 if ((_res & 1) != 0) return;
12547 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12548 CHECK_ACCESS(_res_ptr);
12549 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
12551 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
12554 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint32_t o) {
12555 LDKChannelFeatures o_conv;
12556 o_conv.inner = (void*)(o & (~1));
12557 o_conv.is_owned = (o & 1) || (o == 0);
12558 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12559 o_conv = ChannelFeatures_clone(&o_conv);
12560 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
12561 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
12562 return (uint64_t)ret_conv;
12565 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint32_t e) {
12566 LDKDecodeError e_conv;
12567 e_conv.inner = (void*)(e & (~1));
12568 e_conv.is_owned = (e & 1) || (e == 0);
12569 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12570 e_conv = DecodeError_clone(&e_conv);
12571 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
12572 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
12573 return (uint64_t)ret_conv;
12576 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint32_t o) {
12577 LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(o & ~1);
12578 jboolean ret_val = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
12582 void __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint32_t _res) {
12583 if ((_res & 1) != 0) return;
12584 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12585 CHECK_ACCESS(_res_ptr);
12586 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
12588 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
12591 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) {
12592 LDKNodeFeatures o_conv;
12593 o_conv.inner = (void*)(o & (~1));
12594 o_conv.is_owned = (o & 1) || (o == 0);
12595 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12596 o_conv = NodeFeatures_clone(&o_conv);
12597 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
12598 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
12599 return (uint64_t)ret_conv;
12602 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) {
12603 LDKDecodeError e_conv;
12604 e_conv.inner = (void*)(e & (~1));
12605 e_conv.is_owned = (e & 1) || (e == 0);
12606 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12607 e_conv = DecodeError_clone(&e_conv);
12608 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
12609 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
12610 return (uint64_t)ret_conv;
12613 jboolean __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint32_t o) {
12614 LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(o & ~1);
12615 jboolean ret_val = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
12619 void __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) {
12620 if ((_res & 1) != 0) return;
12621 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12622 CHECK_ACCESS(_res_ptr);
12623 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
12625 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
12628 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint32_t o) {
12629 LDKInvoiceFeatures o_conv;
12630 o_conv.inner = (void*)(o & (~1));
12631 o_conv.is_owned = (o & 1) || (o == 0);
12632 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12633 o_conv = InvoiceFeatures_clone(&o_conv);
12634 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
12635 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
12636 return (uint64_t)ret_conv;
12639 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint32_t e) {
12640 LDKDecodeError e_conv;
12641 e_conv.inner = (void*)(e & (~1));
12642 e_conv.is_owned = (e & 1) || (e == 0);
12643 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12644 e_conv = DecodeError_clone(&e_conv);
12645 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
12646 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
12647 return (uint64_t)ret_conv;
12650 jboolean __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok(uint32_t o) {
12651 LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(o & ~1);
12652 jboolean ret_val = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
12656 void __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint32_t _res) {
12657 if ((_res & 1) != 0) return;
12658 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12659 CHECK_ACCESS(_res_ptr);
12660 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
12662 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
12665 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint32_t o) {
12666 LDKChannelTypeFeatures o_conv;
12667 o_conv.inner = (void*)(o & (~1));
12668 o_conv.is_owned = (o & 1) || (o == 0);
12669 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12670 o_conv = ChannelTypeFeatures_clone(&o_conv);
12671 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
12672 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
12673 return (uint64_t)ret_conv;
12676 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint32_t e) {
12677 LDKDecodeError e_conv;
12678 e_conv.inner = (void*)(e & (~1));
12679 e_conv.is_owned = (e & 1) || (e == 0);
12680 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12681 e_conv = DecodeError_clone(&e_conv);
12682 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
12683 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
12684 return (uint64_t)ret_conv;
12687 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint32_t o) {
12688 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(o & ~1);
12689 jboolean ret_val = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
12693 void __attribute__((visibility("default"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint32_t _res) {
12694 if ((_res & 1) != 0) return;
12695 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12696 CHECK_ACCESS(_res_ptr);
12697 LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
12699 CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
12702 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint32_t o) {
12703 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12704 CHECK_ACCESS(o_ptr);
12705 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
12706 o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
12707 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
12708 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
12709 return (uint64_t)ret_conv;
12712 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_err(uint32_t e) {
12713 LDKDecodeError e_conv;
12714 e_conv.inner = (void*)(e & (~1));
12715 e_conv.is_owned = (e & 1) || (e == 0);
12716 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12717 e_conv = DecodeError_clone(&e_conv);
12718 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
12719 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
12720 return (uint64_t)ret_conv;
12723 jboolean __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_is_ok(uint32_t o) {
12724 LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)(o & ~1);
12725 jboolean ret_val = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
12729 void __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_free(uint32_t _res) {
12730 if ((_res & 1) != 0) return;
12731 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12732 CHECK_ACCESS(_res_ptr);
12733 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
12735 CResult_NetAddressDecodeErrorZ_free(_res_conv);
12738 static inline uint64_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
12739 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
12740 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
12741 return (uint64_t)ret_conv;
12743 int64_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_clone_ptr(uint32_t arg) {
12744 LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
12745 int64_t ret_val = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
12749 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint32_t orig) {
12750 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
12751 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
12752 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
12753 return (uint64_t)ret_conv;
12756 void __attribute__((visibility("default"))) TS_CVec_UpdateAddHTLCZ_free(uint32_tArray _res) {
12757 LDKCVec_UpdateAddHTLCZ _res_constr;
12758 _res_constr.datalen = _res->arr_len;
12759 if (_res_constr.datalen > 0)
12760 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
12762 _res_constr.data = NULL;
12763 uint32_t* _res_vals = _res->elems;
12764 for (size_t p = 0; p < _res_constr.datalen; p++) {
12765 uint32_t _res_conv_15 = _res_vals[p];
12766 LDKUpdateAddHTLC _res_conv_15_conv;
12767 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
12768 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
12769 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
12770 _res_constr.data[p] = _res_conv_15_conv;
12772 CVec_UpdateAddHTLCZ_free(_res_constr);
12775 void __attribute__((visibility("default"))) TS_CVec_UpdateFulfillHTLCZ_free(uint32_tArray _res) {
12776 LDKCVec_UpdateFulfillHTLCZ _res_constr;
12777 _res_constr.datalen = _res->arr_len;
12778 if (_res_constr.datalen > 0)
12779 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
12781 _res_constr.data = NULL;
12782 uint32_t* _res_vals = _res->elems;
12783 for (size_t t = 0; t < _res_constr.datalen; t++) {
12784 uint32_t _res_conv_19 = _res_vals[t];
12785 LDKUpdateFulfillHTLC _res_conv_19_conv;
12786 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
12787 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
12788 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
12789 _res_constr.data[t] = _res_conv_19_conv;
12791 CVec_UpdateFulfillHTLCZ_free(_res_constr);
12794 void __attribute__((visibility("default"))) TS_CVec_UpdateFailHTLCZ_free(uint32_tArray _res) {
12795 LDKCVec_UpdateFailHTLCZ _res_constr;
12796 _res_constr.datalen = _res->arr_len;
12797 if (_res_constr.datalen > 0)
12798 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
12800 _res_constr.data = NULL;
12801 uint32_t* _res_vals = _res->elems;
12802 for (size_t q = 0; q < _res_constr.datalen; q++) {
12803 uint32_t _res_conv_16 = _res_vals[q];
12804 LDKUpdateFailHTLC _res_conv_16_conv;
12805 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
12806 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
12807 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
12808 _res_constr.data[q] = _res_conv_16_conv;
12810 CVec_UpdateFailHTLCZ_free(_res_constr);
12813 void __attribute__((visibility("default"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint32_tArray _res) {
12814 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
12815 _res_constr.datalen = _res->arr_len;
12816 if (_res_constr.datalen > 0)
12817 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
12819 _res_constr.data = NULL;
12820 uint32_t* _res_vals = _res->elems;
12821 for (size_t z = 0; z < _res_constr.datalen; z++) {
12822 uint32_t _res_conv_25 = _res_vals[z];
12823 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
12824 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
12825 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
12826 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
12827 _res_constr.data[z] = _res_conv_25_conv;
12829 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
12832 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint32_t o) {
12833 LDKAcceptChannel o_conv;
12834 o_conv.inner = (void*)(o & (~1));
12835 o_conv.is_owned = (o & 1) || (o == 0);
12836 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12837 o_conv = AcceptChannel_clone(&o_conv);
12838 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
12839 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
12840 return (uint64_t)ret_conv;
12843 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint32_t e) {
12844 LDKDecodeError e_conv;
12845 e_conv.inner = (void*)(e & (~1));
12846 e_conv.is_owned = (e & 1) || (e == 0);
12847 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12848 e_conv = DecodeError_clone(&e_conv);
12849 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
12850 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
12851 return (uint64_t)ret_conv;
12854 jboolean __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint32_t o) {
12855 LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(o & ~1);
12856 jboolean ret_val = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
12860 void __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint32_t _res) {
12861 if ((_res & 1) != 0) return;
12862 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12863 CHECK_ACCESS(_res_ptr);
12864 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
12866 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
12869 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
12870 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
12871 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
12872 return (uint64_t)ret_conv;
12874 int64_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint32_t arg) {
12875 LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
12876 int64_t ret_val = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
12880 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint32_t orig) {
12881 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
12882 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
12883 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
12884 return (uint64_t)ret_conv;
12887 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint32_t o) {
12888 LDKAnnouncementSignatures o_conv;
12889 o_conv.inner = (void*)(o & (~1));
12890 o_conv.is_owned = (o & 1) || (o == 0);
12891 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12892 o_conv = AnnouncementSignatures_clone(&o_conv);
12893 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
12894 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
12895 return (uint64_t)ret_conv;
12898 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint32_t e) {
12899 LDKDecodeError e_conv;
12900 e_conv.inner = (void*)(e & (~1));
12901 e_conv.is_owned = (e & 1) || (e == 0);
12902 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12903 e_conv = DecodeError_clone(&e_conv);
12904 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
12905 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
12906 return (uint64_t)ret_conv;
12909 jboolean __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint32_t o) {
12910 LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(o & ~1);
12911 jboolean ret_val = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
12915 void __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint32_t _res) {
12916 if ((_res & 1) != 0) return;
12917 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12918 CHECK_ACCESS(_res_ptr);
12919 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
12921 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
12924 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
12925 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
12926 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
12927 return (uint64_t)ret_conv;
12929 int64_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint32_t arg) {
12930 LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
12931 int64_t ret_val = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
12935 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint32_t orig) {
12936 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
12937 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
12938 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
12939 return (uint64_t)ret_conv;
12942 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint32_t o) {
12943 LDKChannelReestablish o_conv;
12944 o_conv.inner = (void*)(o & (~1));
12945 o_conv.is_owned = (o & 1) || (o == 0);
12946 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12947 o_conv = ChannelReestablish_clone(&o_conv);
12948 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
12949 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
12950 return (uint64_t)ret_conv;
12953 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint32_t e) {
12954 LDKDecodeError e_conv;
12955 e_conv.inner = (void*)(e & (~1));
12956 e_conv.is_owned = (e & 1) || (e == 0);
12957 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12958 e_conv = DecodeError_clone(&e_conv);
12959 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
12960 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
12961 return (uint64_t)ret_conv;
12964 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint32_t o) {
12965 LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(o & ~1);
12966 jboolean ret_val = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
12970 void __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint32_t _res) {
12971 if ((_res & 1) != 0) return;
12972 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12973 CHECK_ACCESS(_res_ptr);
12974 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
12976 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
12979 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
12980 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
12981 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
12982 return (uint64_t)ret_conv;
12984 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint32_t arg) {
12985 LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
12986 int64_t ret_val = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
12990 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint32_t orig) {
12991 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
12992 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
12993 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
12994 return (uint64_t)ret_conv;
12997 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint32_t o) {
12998 LDKClosingSigned o_conv;
12999 o_conv.inner = (void*)(o & (~1));
13000 o_conv.is_owned = (o & 1) || (o == 0);
13001 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13002 o_conv = ClosingSigned_clone(&o_conv);
13003 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
13004 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
13005 return (uint64_t)ret_conv;
13008 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint32_t e) {
13009 LDKDecodeError e_conv;
13010 e_conv.inner = (void*)(e & (~1));
13011 e_conv.is_owned = (e & 1) || (e == 0);
13012 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13013 e_conv = DecodeError_clone(&e_conv);
13014 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
13015 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
13016 return (uint64_t)ret_conv;
13019 jboolean __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint32_t o) {
13020 LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(o & ~1);
13021 jboolean ret_val = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
13025 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint32_t _res) {
13026 if ((_res & 1) != 0) return;
13027 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13028 CHECK_ACCESS(_res_ptr);
13029 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
13031 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
13034 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
13035 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
13036 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
13037 return (uint64_t)ret_conv;
13039 int64_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
13040 LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
13041 int64_t ret_val = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
13045 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint32_t orig) {
13046 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
13047 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
13048 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
13049 return (uint64_t)ret_conv;
13052 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint32_t o) {
13053 LDKClosingSignedFeeRange o_conv;
13054 o_conv.inner = (void*)(o & (~1));
13055 o_conv.is_owned = (o & 1) || (o == 0);
13056 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13057 o_conv = ClosingSignedFeeRange_clone(&o_conv);
13058 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
13059 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
13060 return (uint64_t)ret_conv;
13063 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint32_t e) {
13064 LDKDecodeError e_conv;
13065 e_conv.inner = (void*)(e & (~1));
13066 e_conv.is_owned = (e & 1) || (e == 0);
13067 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13068 e_conv = DecodeError_clone(&e_conv);
13069 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
13070 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
13071 return (uint64_t)ret_conv;
13074 jboolean __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint32_t o) {
13075 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(o & ~1);
13076 jboolean ret_val = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
13080 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint32_t _res) {
13081 if ((_res & 1) != 0) return;
13082 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13083 CHECK_ACCESS(_res_ptr);
13084 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
13086 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
13089 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
13090 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
13091 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
13092 return (uint64_t)ret_conv;
13094 int64_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
13095 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
13096 int64_t ret_val = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
13100 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint32_t orig) {
13101 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
13102 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
13103 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
13104 return (uint64_t)ret_conv;
13107 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint32_t o) {
13108 LDKCommitmentSigned o_conv;
13109 o_conv.inner = (void*)(o & (~1));
13110 o_conv.is_owned = (o & 1) || (o == 0);
13111 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13112 o_conv = CommitmentSigned_clone(&o_conv);
13113 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
13114 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
13115 return (uint64_t)ret_conv;
13118 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint32_t e) {
13119 LDKDecodeError e_conv;
13120 e_conv.inner = (void*)(e & (~1));
13121 e_conv.is_owned = (e & 1) || (e == 0);
13122 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13123 e_conv = DecodeError_clone(&e_conv);
13124 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
13125 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
13126 return (uint64_t)ret_conv;
13129 jboolean __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint32_t o) {
13130 LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(o & ~1);
13131 jboolean ret_val = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
13135 void __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint32_t _res) {
13136 if ((_res & 1) != 0) return;
13137 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13138 CHECK_ACCESS(_res_ptr);
13139 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
13141 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
13144 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
13145 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
13146 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
13147 return (uint64_t)ret_conv;
13149 int64_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
13150 LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
13151 int64_t ret_val = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
13155 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint32_t orig) {
13156 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
13157 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
13158 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
13159 return (uint64_t)ret_conv;
13162 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint32_t o) {
13163 LDKFundingCreated o_conv;
13164 o_conv.inner = (void*)(o & (~1));
13165 o_conv.is_owned = (o & 1) || (o == 0);
13166 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13167 o_conv = FundingCreated_clone(&o_conv);
13168 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
13169 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
13170 return (uint64_t)ret_conv;
13173 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint32_t e) {
13174 LDKDecodeError e_conv;
13175 e_conv.inner = (void*)(e & (~1));
13176 e_conv.is_owned = (e & 1) || (e == 0);
13177 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13178 e_conv = DecodeError_clone(&e_conv);
13179 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
13180 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
13181 return (uint64_t)ret_conv;
13184 jboolean __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint32_t o) {
13185 LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(o & ~1);
13186 jboolean ret_val = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
13190 void __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint32_t _res) {
13191 if ((_res & 1) != 0) return;
13192 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13193 CHECK_ACCESS(_res_ptr);
13194 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
13196 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
13199 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
13200 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
13201 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
13202 return (uint64_t)ret_conv;
13204 int64_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint32_t arg) {
13205 LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
13206 int64_t ret_val = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
13210 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint32_t orig) {
13211 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
13212 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
13213 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
13214 return (uint64_t)ret_conv;
13217 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint32_t o) {
13218 LDKFundingSigned o_conv;
13219 o_conv.inner = (void*)(o & (~1));
13220 o_conv.is_owned = (o & 1) || (o == 0);
13221 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13222 o_conv = FundingSigned_clone(&o_conv);
13223 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
13224 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
13225 return (uint64_t)ret_conv;
13228 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint32_t e) {
13229 LDKDecodeError e_conv;
13230 e_conv.inner = (void*)(e & (~1));
13231 e_conv.is_owned = (e & 1) || (e == 0);
13232 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13233 e_conv = DecodeError_clone(&e_conv);
13234 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
13235 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
13236 return (uint64_t)ret_conv;
13239 jboolean __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint32_t o) {
13240 LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(o & ~1);
13241 jboolean ret_val = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
13245 void __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint32_t _res) {
13246 if ((_res & 1) != 0) return;
13247 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13248 CHECK_ACCESS(_res_ptr);
13249 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
13251 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
13254 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
13255 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
13256 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
13257 return (uint64_t)ret_conv;
13259 int64_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
13260 LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
13261 int64_t ret_val = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
13265 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint32_t orig) {
13266 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
13267 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
13268 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
13269 return (uint64_t)ret_conv;
13272 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_ok(uint32_t o) {
13273 LDKFundingLocked o_conv;
13274 o_conv.inner = (void*)(o & (~1));
13275 o_conv.is_owned = (o & 1) || (o == 0);
13276 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13277 o_conv = FundingLocked_clone(&o_conv);
13278 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
13279 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
13280 return (uint64_t)ret_conv;
13283 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_err(uint32_t e) {
13284 LDKDecodeError e_conv;
13285 e_conv.inner = (void*)(e & (~1));
13286 e_conv.is_owned = (e & 1) || (e == 0);
13287 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13288 e_conv = DecodeError_clone(&e_conv);
13289 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
13290 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
13291 return (uint64_t)ret_conv;
13294 jboolean __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_is_ok(uint32_t o) {
13295 LDKCResult_FundingLockedDecodeErrorZ* o_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(o & ~1);
13296 jboolean ret_val = CResult_FundingLockedDecodeErrorZ_is_ok(o_conv);
13300 void __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_free(uint32_t _res) {
13301 if ((_res & 1) != 0) return;
13302 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13303 CHECK_ACCESS(_res_ptr);
13304 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(_res_ptr);
13306 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
13309 static inline uint64_t CResult_FundingLockedDecodeErrorZ_clone_ptr(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR arg) {
13310 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
13311 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(arg);
13312 return (uint64_t)ret_conv;
13314 int64_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_clone_ptr(uint32_t arg) {
13315 LDKCResult_FundingLockedDecodeErrorZ* arg_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
13316 int64_t ret_val = CResult_FundingLockedDecodeErrorZ_clone_ptr(arg_conv);
13320 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_clone(uint32_t orig) {
13321 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
13322 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
13323 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
13324 return (uint64_t)ret_conv;
13327 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_ok(uint32_t o) {
13329 o_conv.inner = (void*)(o & (~1));
13330 o_conv.is_owned = (o & 1) || (o == 0);
13331 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13332 o_conv = Init_clone(&o_conv);
13333 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
13334 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
13335 return (uint64_t)ret_conv;
13338 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_err(uint32_t e) {
13339 LDKDecodeError e_conv;
13340 e_conv.inner = (void*)(e & (~1));
13341 e_conv.is_owned = (e & 1) || (e == 0);
13342 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13343 e_conv = DecodeError_clone(&e_conv);
13344 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
13345 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
13346 return (uint64_t)ret_conv;
13349 jboolean __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_is_ok(uint32_t o) {
13350 LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)(o & ~1);
13351 jboolean ret_val = CResult_InitDecodeErrorZ_is_ok(o_conv);
13355 void __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_free(uint32_t _res) {
13356 if ((_res & 1) != 0) return;
13357 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13358 CHECK_ACCESS(_res_ptr);
13359 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
13361 CResult_InitDecodeErrorZ_free(_res_conv);
13364 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
13365 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
13366 *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
13367 return (uint64_t)ret_conv;
13369 int64_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint32_t arg) {
13370 LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
13371 int64_t ret_val = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
13375 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_clone(uint32_t orig) {
13376 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
13377 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
13378 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
13379 return (uint64_t)ret_conv;
13382 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint32_t o) {
13383 LDKOpenChannel o_conv;
13384 o_conv.inner = (void*)(o & (~1));
13385 o_conv.is_owned = (o & 1) || (o == 0);
13386 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13387 o_conv = OpenChannel_clone(&o_conv);
13388 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
13389 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
13390 return (uint64_t)ret_conv;
13393 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint32_t e) {
13394 LDKDecodeError e_conv;
13395 e_conv.inner = (void*)(e & (~1));
13396 e_conv.is_owned = (e & 1) || (e == 0);
13397 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13398 e_conv = DecodeError_clone(&e_conv);
13399 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
13400 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
13401 return (uint64_t)ret_conv;
13404 jboolean __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint32_t o) {
13405 LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(o & ~1);
13406 jboolean ret_val = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
13410 void __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint32_t _res) {
13411 if ((_res & 1) != 0) return;
13412 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13413 CHECK_ACCESS(_res_ptr);
13414 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
13416 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
13419 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
13420 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
13421 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
13422 return (uint64_t)ret_conv;
13424 int64_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint32_t arg) {
13425 LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
13426 int64_t ret_val = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
13430 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint32_t orig) {
13431 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
13432 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
13433 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
13434 return (uint64_t)ret_conv;
13437 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint32_t o) {
13438 LDKRevokeAndACK o_conv;
13439 o_conv.inner = (void*)(o & (~1));
13440 o_conv.is_owned = (o & 1) || (o == 0);
13441 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13442 o_conv = RevokeAndACK_clone(&o_conv);
13443 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
13444 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
13445 return (uint64_t)ret_conv;
13448 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint32_t e) {
13449 LDKDecodeError e_conv;
13450 e_conv.inner = (void*)(e & (~1));
13451 e_conv.is_owned = (e & 1) || (e == 0);
13452 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13453 e_conv = DecodeError_clone(&e_conv);
13454 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
13455 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
13456 return (uint64_t)ret_conv;
13459 jboolean __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint32_t o) {
13460 LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(o & ~1);
13461 jboolean ret_val = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
13465 void __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint32_t _res) {
13466 if ((_res & 1) != 0) return;
13467 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13468 CHECK_ACCESS(_res_ptr);
13469 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
13471 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
13474 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
13475 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
13476 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
13477 return (uint64_t)ret_conv;
13479 int64_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint32_t arg) {
13480 LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
13481 int64_t ret_val = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
13485 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint32_t orig) {
13486 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
13487 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
13488 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
13489 return (uint64_t)ret_conv;
13492 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint32_t o) {
13493 LDKShutdown o_conv;
13494 o_conv.inner = (void*)(o & (~1));
13495 o_conv.is_owned = (o & 1) || (o == 0);
13496 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13497 o_conv = Shutdown_clone(&o_conv);
13498 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
13499 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
13500 return (uint64_t)ret_conv;
13503 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_err(uint32_t e) {
13504 LDKDecodeError e_conv;
13505 e_conv.inner = (void*)(e & (~1));
13506 e_conv.is_owned = (e & 1) || (e == 0);
13507 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13508 e_conv = DecodeError_clone(&e_conv);
13509 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
13510 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
13511 return (uint64_t)ret_conv;
13514 jboolean __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint32_t o) {
13515 LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)(o & ~1);
13516 jboolean ret_val = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
13520 void __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_free(uint32_t _res) {
13521 if ((_res & 1) != 0) return;
13522 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13523 CHECK_ACCESS(_res_ptr);
13524 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
13526 CResult_ShutdownDecodeErrorZ_free(_res_conv);
13529 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
13530 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
13531 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
13532 return (uint64_t)ret_conv;
13534 int64_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint32_t arg) {
13535 LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
13536 int64_t ret_val = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
13540 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint32_t orig) {
13541 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
13542 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
13543 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
13544 return (uint64_t)ret_conv;
13547 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint32_t o) {
13548 LDKUpdateFailHTLC o_conv;
13549 o_conv.inner = (void*)(o & (~1));
13550 o_conv.is_owned = (o & 1) || (o == 0);
13551 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13552 o_conv = UpdateFailHTLC_clone(&o_conv);
13553 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
13554 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
13555 return (uint64_t)ret_conv;
13558 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint32_t e) {
13559 LDKDecodeError e_conv;
13560 e_conv.inner = (void*)(e & (~1));
13561 e_conv.is_owned = (e & 1) || (e == 0);
13562 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13563 e_conv = DecodeError_clone(&e_conv);
13564 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
13565 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
13566 return (uint64_t)ret_conv;
13569 jboolean __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint32_t o) {
13570 LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(o & ~1);
13571 jboolean ret_val = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
13575 void __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint32_t _res) {
13576 if ((_res & 1) != 0) return;
13577 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13578 CHECK_ACCESS(_res_ptr);
13579 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
13581 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
13584 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
13585 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
13586 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
13587 return (uint64_t)ret_conv;
13589 int64_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
13590 LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
13591 int64_t ret_val = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
13595 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint32_t orig) {
13596 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
13597 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
13598 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
13599 return (uint64_t)ret_conv;
13602 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint32_t o) {
13603 LDKUpdateFailMalformedHTLC o_conv;
13604 o_conv.inner = (void*)(o & (~1));
13605 o_conv.is_owned = (o & 1) || (o == 0);
13606 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13607 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
13608 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
13609 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
13610 return (uint64_t)ret_conv;
13613 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint32_t e) {
13614 LDKDecodeError e_conv;
13615 e_conv.inner = (void*)(e & (~1));
13616 e_conv.is_owned = (e & 1) || (e == 0);
13617 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13618 e_conv = DecodeError_clone(&e_conv);
13619 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
13620 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
13621 return (uint64_t)ret_conv;
13624 jboolean __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint32_t o) {
13625 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(o & ~1);
13626 jboolean ret_val = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
13630 void __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint32_t _res) {
13631 if ((_res & 1) != 0) return;
13632 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13633 CHECK_ACCESS(_res_ptr);
13634 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
13636 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
13639 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
13640 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
13641 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
13642 return (uint64_t)ret_conv;
13644 int64_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
13645 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
13646 int64_t ret_val = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
13650 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint32_t orig) {
13651 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
13652 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
13653 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
13654 return (uint64_t)ret_conv;
13657 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint32_t o) {
13658 LDKUpdateFee o_conv;
13659 o_conv.inner = (void*)(o & (~1));
13660 o_conv.is_owned = (o & 1) || (o == 0);
13661 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13662 o_conv = UpdateFee_clone(&o_conv);
13663 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
13664 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
13665 return (uint64_t)ret_conv;
13668 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint32_t e) {
13669 LDKDecodeError e_conv;
13670 e_conv.inner = (void*)(e & (~1));
13671 e_conv.is_owned = (e & 1) || (e == 0);
13672 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13673 e_conv = DecodeError_clone(&e_conv);
13674 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
13675 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
13676 return (uint64_t)ret_conv;
13679 jboolean __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint32_t o) {
13680 LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(o & ~1);
13681 jboolean ret_val = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
13685 void __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint32_t _res) {
13686 if ((_res & 1) != 0) return;
13687 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13688 CHECK_ACCESS(_res_ptr);
13689 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
13691 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
13694 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
13695 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
13696 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
13697 return (uint64_t)ret_conv;
13699 int64_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint32_t arg) {
13700 LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
13701 int64_t ret_val = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
13705 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint32_t orig) {
13706 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
13707 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
13708 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
13709 return (uint64_t)ret_conv;
13712 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint32_t o) {
13713 LDKUpdateFulfillHTLC o_conv;
13714 o_conv.inner = (void*)(o & (~1));
13715 o_conv.is_owned = (o & 1) || (o == 0);
13716 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13717 o_conv = UpdateFulfillHTLC_clone(&o_conv);
13718 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
13719 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
13720 return (uint64_t)ret_conv;
13723 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint32_t e) {
13724 LDKDecodeError e_conv;
13725 e_conv.inner = (void*)(e & (~1));
13726 e_conv.is_owned = (e & 1) || (e == 0);
13727 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13728 e_conv = DecodeError_clone(&e_conv);
13729 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
13730 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
13731 return (uint64_t)ret_conv;
13734 jboolean __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint32_t o) {
13735 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(o & ~1);
13736 jboolean ret_val = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
13740 void __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint32_t _res) {
13741 if ((_res & 1) != 0) return;
13742 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13743 CHECK_ACCESS(_res_ptr);
13744 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
13746 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
13749 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
13750 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
13751 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
13752 return (uint64_t)ret_conv;
13754 int64_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
13755 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
13756 int64_t ret_val = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
13760 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint32_t orig) {
13761 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
13762 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
13763 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
13764 return (uint64_t)ret_conv;
13767 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint32_t o) {
13768 LDKUpdateAddHTLC o_conv;
13769 o_conv.inner = (void*)(o & (~1));
13770 o_conv.is_owned = (o & 1) || (o == 0);
13771 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13772 o_conv = UpdateAddHTLC_clone(&o_conv);
13773 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
13774 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
13775 return (uint64_t)ret_conv;
13778 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint32_t e) {
13779 LDKDecodeError e_conv;
13780 e_conv.inner = (void*)(e & (~1));
13781 e_conv.is_owned = (e & 1) || (e == 0);
13782 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13783 e_conv = DecodeError_clone(&e_conv);
13784 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
13785 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
13786 return (uint64_t)ret_conv;
13789 jboolean __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint32_t o) {
13790 LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(o & ~1);
13791 jboolean ret_val = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
13795 void __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint32_t _res) {
13796 if ((_res & 1) != 0) return;
13797 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13798 CHECK_ACCESS(_res_ptr);
13799 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
13801 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
13804 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
13805 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
13806 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
13807 return (uint64_t)ret_conv;
13809 int64_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
13810 LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
13811 int64_t ret_val = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
13815 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint32_t orig) {
13816 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
13817 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
13818 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
13819 return (uint64_t)ret_conv;
13822 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_ok(uint32_t o) {
13824 o_conv.inner = (void*)(o & (~1));
13825 o_conv.is_owned = (o & 1) || (o == 0);
13826 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13827 o_conv = Ping_clone(&o_conv);
13828 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
13829 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
13830 return (uint64_t)ret_conv;
13833 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_err(uint32_t e) {
13834 LDKDecodeError e_conv;
13835 e_conv.inner = (void*)(e & (~1));
13836 e_conv.is_owned = (e & 1) || (e == 0);
13837 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13838 e_conv = DecodeError_clone(&e_conv);
13839 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
13840 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
13841 return (uint64_t)ret_conv;
13844 jboolean __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_is_ok(uint32_t o) {
13845 LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)(o & ~1);
13846 jboolean ret_val = CResult_PingDecodeErrorZ_is_ok(o_conv);
13850 void __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_free(uint32_t _res) {
13851 if ((_res & 1) != 0) return;
13852 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13853 CHECK_ACCESS(_res_ptr);
13854 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
13856 CResult_PingDecodeErrorZ_free(_res_conv);
13859 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
13860 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
13861 *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
13862 return (uint64_t)ret_conv;
13864 int64_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint32_t arg) {
13865 LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
13866 int64_t ret_val = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
13870 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_clone(uint32_t orig) {
13871 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
13872 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
13873 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
13874 return (uint64_t)ret_conv;
13877 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_ok(uint32_t o) {
13879 o_conv.inner = (void*)(o & (~1));
13880 o_conv.is_owned = (o & 1) || (o == 0);
13881 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13882 o_conv = Pong_clone(&o_conv);
13883 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
13884 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
13885 return (uint64_t)ret_conv;
13888 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_err(uint32_t e) {
13889 LDKDecodeError e_conv;
13890 e_conv.inner = (void*)(e & (~1));
13891 e_conv.is_owned = (e & 1) || (e == 0);
13892 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13893 e_conv = DecodeError_clone(&e_conv);
13894 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
13895 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
13896 return (uint64_t)ret_conv;
13899 jboolean __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_is_ok(uint32_t o) {
13900 LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)(o & ~1);
13901 jboolean ret_val = CResult_PongDecodeErrorZ_is_ok(o_conv);
13905 void __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_free(uint32_t _res) {
13906 if ((_res & 1) != 0) return;
13907 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13908 CHECK_ACCESS(_res_ptr);
13909 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
13911 CResult_PongDecodeErrorZ_free(_res_conv);
13914 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
13915 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
13916 *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
13917 return (uint64_t)ret_conv;
13919 int64_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint32_t arg) {
13920 LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
13921 int64_t ret_val = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
13925 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_clone(uint32_t orig) {
13926 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
13927 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
13928 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
13929 return (uint64_t)ret_conv;
13932 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
13933 LDKUnsignedChannelAnnouncement o_conv;
13934 o_conv.inner = (void*)(o & (~1));
13935 o_conv.is_owned = (o & 1) || (o == 0);
13936 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13937 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
13938 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
13939 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
13940 return (uint64_t)ret_conv;
13943 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
13944 LDKDecodeError e_conv;
13945 e_conv.inner = (void*)(e & (~1));
13946 e_conv.is_owned = (e & 1) || (e == 0);
13947 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13948 e_conv = DecodeError_clone(&e_conv);
13949 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
13950 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
13951 return (uint64_t)ret_conv;
13954 jboolean __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
13955 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(o & ~1);
13956 jboolean ret_val = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
13960 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
13961 if ((_res & 1) != 0) return;
13962 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13963 CHECK_ACCESS(_res_ptr);
13964 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
13966 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
13969 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
13970 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
13971 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
13972 return (uint64_t)ret_conv;
13974 int64_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
13975 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
13976 int64_t ret_val = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
13980 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
13981 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
13982 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
13983 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
13984 return (uint64_t)ret_conv;
13987 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
13988 LDKChannelAnnouncement o_conv;
13989 o_conv.inner = (void*)(o & (~1));
13990 o_conv.is_owned = (o & 1) || (o == 0);
13991 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13992 o_conv = ChannelAnnouncement_clone(&o_conv);
13993 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
13994 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
13995 return (uint64_t)ret_conv;
13998 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
13999 LDKDecodeError e_conv;
14000 e_conv.inner = (void*)(e & (~1));
14001 e_conv.is_owned = (e & 1) || (e == 0);
14002 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14003 e_conv = DecodeError_clone(&e_conv);
14004 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
14005 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
14006 return (uint64_t)ret_conv;
14009 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
14010 LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(o & ~1);
14011 jboolean ret_val = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
14015 void __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
14016 if ((_res & 1) != 0) return;
14017 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14018 CHECK_ACCESS(_res_ptr);
14019 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
14021 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
14024 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
14025 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
14026 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
14027 return (uint64_t)ret_conv;
14029 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
14030 LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
14031 int64_t ret_val = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
14035 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
14036 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
14037 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
14038 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
14039 return (uint64_t)ret_conv;
14042 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint32_t o) {
14043 LDKUnsignedChannelUpdate o_conv;
14044 o_conv.inner = (void*)(o & (~1));
14045 o_conv.is_owned = (o & 1) || (o == 0);
14046 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14047 o_conv = UnsignedChannelUpdate_clone(&o_conv);
14048 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
14049 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
14050 return (uint64_t)ret_conv;
14053 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint32_t e) {
14054 LDKDecodeError e_conv;
14055 e_conv.inner = (void*)(e & (~1));
14056 e_conv.is_owned = (e & 1) || (e == 0);
14057 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14058 e_conv = DecodeError_clone(&e_conv);
14059 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
14060 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
14061 return (uint64_t)ret_conv;
14064 jboolean __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint32_t o) {
14065 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(o & ~1);
14066 jboolean ret_val = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
14070 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint32_t _res) {
14071 if ((_res & 1) != 0) return;
14072 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14073 CHECK_ACCESS(_res_ptr);
14074 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
14076 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
14079 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
14080 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
14081 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
14082 return (uint64_t)ret_conv;
14084 int64_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
14085 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
14086 int64_t ret_val = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
14090 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
14091 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
14092 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
14093 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
14094 return (uint64_t)ret_conv;
14097 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint32_t o) {
14098 LDKChannelUpdate o_conv;
14099 o_conv.inner = (void*)(o & (~1));
14100 o_conv.is_owned = (o & 1) || (o == 0);
14101 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14102 o_conv = ChannelUpdate_clone(&o_conv);
14103 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
14104 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
14105 return (uint64_t)ret_conv;
14108 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint32_t e) {
14109 LDKDecodeError e_conv;
14110 e_conv.inner = (void*)(e & (~1));
14111 e_conv.is_owned = (e & 1) || (e == 0);
14112 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14113 e_conv = DecodeError_clone(&e_conv);
14114 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
14115 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
14116 return (uint64_t)ret_conv;
14119 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint32_t o) {
14120 LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(o & ~1);
14121 jboolean ret_val = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
14125 void __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint32_t _res) {
14126 if ((_res & 1) != 0) return;
14127 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14128 CHECK_ACCESS(_res_ptr);
14129 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
14131 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
14134 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
14135 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
14136 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
14137 return (uint64_t)ret_conv;
14139 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
14140 LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
14141 int64_t ret_val = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
14145 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
14146 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
14147 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
14148 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
14149 return (uint64_t)ret_conv;
14152 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint32_t o) {
14153 LDKErrorMessage o_conv;
14154 o_conv.inner = (void*)(o & (~1));
14155 o_conv.is_owned = (o & 1) || (o == 0);
14156 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14157 o_conv = ErrorMessage_clone(&o_conv);
14158 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
14159 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
14160 return (uint64_t)ret_conv;
14163 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint32_t e) {
14164 LDKDecodeError e_conv;
14165 e_conv.inner = (void*)(e & (~1));
14166 e_conv.is_owned = (e & 1) || (e == 0);
14167 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14168 e_conv = DecodeError_clone(&e_conv);
14169 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
14170 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
14171 return (uint64_t)ret_conv;
14174 jboolean __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint32_t o) {
14175 LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(o & ~1);
14176 jboolean ret_val = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
14180 void __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint32_t _res) {
14181 if ((_res & 1) != 0) return;
14182 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14183 CHECK_ACCESS(_res_ptr);
14184 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
14186 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
14189 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
14190 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
14191 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
14192 return (uint64_t)ret_conv;
14194 int64_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint32_t arg) {
14195 LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
14196 int64_t ret_val = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
14200 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint32_t orig) {
14201 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
14202 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
14203 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
14204 return (uint64_t)ret_conv;
14207 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
14208 LDKUnsignedNodeAnnouncement o_conv;
14209 o_conv.inner = (void*)(o & (~1));
14210 o_conv.is_owned = (o & 1) || (o == 0);
14211 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14212 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
14213 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
14214 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
14215 return (uint64_t)ret_conv;
14218 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint32_t e) {
14219 LDKDecodeError e_conv;
14220 e_conv.inner = (void*)(e & (~1));
14221 e_conv.is_owned = (e & 1) || (e == 0);
14222 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14223 e_conv = DecodeError_clone(&e_conv);
14224 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
14225 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
14226 return (uint64_t)ret_conv;
14229 jboolean __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
14230 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(o & ~1);
14231 jboolean ret_val = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
14235 void __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
14236 if ((_res & 1) != 0) return;
14237 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14238 CHECK_ACCESS(_res_ptr);
14239 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
14241 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
14244 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
14245 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
14246 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
14247 return (uint64_t)ret_conv;
14249 int64_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
14250 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
14251 int64_t ret_val = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
14255 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
14256 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
14257 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
14258 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
14259 return (uint64_t)ret_conv;
14262 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
14263 LDKNodeAnnouncement o_conv;
14264 o_conv.inner = (void*)(o & (~1));
14265 o_conv.is_owned = (o & 1) || (o == 0);
14266 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14267 o_conv = NodeAnnouncement_clone(&o_conv);
14268 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
14269 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
14270 return (uint64_t)ret_conv;
14273 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint32_t e) {
14274 LDKDecodeError e_conv;
14275 e_conv.inner = (void*)(e & (~1));
14276 e_conv.is_owned = (e & 1) || (e == 0);
14277 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14278 e_conv = DecodeError_clone(&e_conv);
14279 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
14280 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
14281 return (uint64_t)ret_conv;
14284 jboolean __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
14285 LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(o & ~1);
14286 jboolean ret_val = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
14290 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
14291 if ((_res & 1) != 0) return;
14292 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14293 CHECK_ACCESS(_res_ptr);
14294 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
14296 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
14299 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
14300 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
14301 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
14302 return (uint64_t)ret_conv;
14304 int64_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
14305 LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
14306 int64_t ret_val = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
14310 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
14311 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
14312 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
14313 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
14314 return (uint64_t)ret_conv;
14317 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint32_t o) {
14318 LDKQueryShortChannelIds o_conv;
14319 o_conv.inner = (void*)(o & (~1));
14320 o_conv.is_owned = (o & 1) || (o == 0);
14321 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14322 o_conv = QueryShortChannelIds_clone(&o_conv);
14323 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
14324 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
14325 return (uint64_t)ret_conv;
14328 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint32_t e) {
14329 LDKDecodeError e_conv;
14330 e_conv.inner = (void*)(e & (~1));
14331 e_conv.is_owned = (e & 1) || (e == 0);
14332 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14333 e_conv = DecodeError_clone(&e_conv);
14334 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
14335 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
14336 return (uint64_t)ret_conv;
14339 jboolean __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint32_t o) {
14340 LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(o & ~1);
14341 jboolean ret_val = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
14345 void __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint32_t _res) {
14346 if ((_res & 1) != 0) return;
14347 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14348 CHECK_ACCESS(_res_ptr);
14349 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
14351 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
14354 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
14355 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
14356 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
14357 return (uint64_t)ret_conv;
14359 int64_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint32_t arg) {
14360 LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
14361 int64_t ret_val = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
14365 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint32_t orig) {
14366 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
14367 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
14368 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
14369 return (uint64_t)ret_conv;
14372 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint32_t o) {
14373 LDKReplyShortChannelIdsEnd o_conv;
14374 o_conv.inner = (void*)(o & (~1));
14375 o_conv.is_owned = (o & 1) || (o == 0);
14376 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14377 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
14378 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
14379 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
14380 return (uint64_t)ret_conv;
14383 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint32_t e) {
14384 LDKDecodeError e_conv;
14385 e_conv.inner = (void*)(e & (~1));
14386 e_conv.is_owned = (e & 1) || (e == 0);
14387 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14388 e_conv = DecodeError_clone(&e_conv);
14389 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
14390 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
14391 return (uint64_t)ret_conv;
14394 jboolean __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint32_t o) {
14395 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(o & ~1);
14396 jboolean ret_val = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
14400 void __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint32_t _res) {
14401 if ((_res & 1) != 0) return;
14402 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14403 CHECK_ACCESS(_res_ptr);
14404 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
14406 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
14409 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
14410 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
14411 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
14412 return (uint64_t)ret_conv;
14414 int64_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint32_t arg) {
14415 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
14416 int64_t ret_val = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
14420 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint32_t orig) {
14421 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
14422 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
14423 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
14424 return (uint64_t)ret_conv;
14427 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint32_t o) {
14428 LDKQueryChannelRange o_conv;
14429 o_conv.inner = (void*)(o & (~1));
14430 o_conv.is_owned = (o & 1) || (o == 0);
14431 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14432 o_conv = QueryChannelRange_clone(&o_conv);
14433 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
14434 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
14435 return (uint64_t)ret_conv;
14438 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint32_t e) {
14439 LDKDecodeError e_conv;
14440 e_conv.inner = (void*)(e & (~1));
14441 e_conv.is_owned = (e & 1) || (e == 0);
14442 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14443 e_conv = DecodeError_clone(&e_conv);
14444 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
14445 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
14446 return (uint64_t)ret_conv;
14449 jboolean __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint32_t o) {
14450 LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(o & ~1);
14451 jboolean ret_val = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
14455 void __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint32_t _res) {
14456 if ((_res & 1) != 0) return;
14457 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14458 CHECK_ACCESS(_res_ptr);
14459 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
14461 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
14464 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
14465 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
14466 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
14467 return (uint64_t)ret_conv;
14469 int64_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
14470 LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
14471 int64_t ret_val = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
14475 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint32_t orig) {
14476 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
14477 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
14478 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
14479 return (uint64_t)ret_conv;
14482 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint32_t o) {
14483 LDKReplyChannelRange o_conv;
14484 o_conv.inner = (void*)(o & (~1));
14485 o_conv.is_owned = (o & 1) || (o == 0);
14486 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14487 o_conv = ReplyChannelRange_clone(&o_conv);
14488 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
14489 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
14490 return (uint64_t)ret_conv;
14493 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint32_t e) {
14494 LDKDecodeError e_conv;
14495 e_conv.inner = (void*)(e & (~1));
14496 e_conv.is_owned = (e & 1) || (e == 0);
14497 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14498 e_conv = DecodeError_clone(&e_conv);
14499 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
14500 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
14501 return (uint64_t)ret_conv;
14504 jboolean __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint32_t o) {
14505 LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(o & ~1);
14506 jboolean ret_val = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
14510 void __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint32_t _res) {
14511 if ((_res & 1) != 0) return;
14512 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14513 CHECK_ACCESS(_res_ptr);
14514 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
14516 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
14519 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
14520 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
14521 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
14522 return (uint64_t)ret_conv;
14524 int64_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
14525 LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
14526 int64_t ret_val = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
14530 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint32_t orig) {
14531 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
14532 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
14533 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
14534 return (uint64_t)ret_conv;
14537 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint32_t o) {
14538 LDKGossipTimestampFilter o_conv;
14539 o_conv.inner = (void*)(o & (~1));
14540 o_conv.is_owned = (o & 1) || (o == 0);
14541 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14542 o_conv = GossipTimestampFilter_clone(&o_conv);
14543 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
14544 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
14545 return (uint64_t)ret_conv;
14548 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint32_t e) {
14549 LDKDecodeError e_conv;
14550 e_conv.inner = (void*)(e & (~1));
14551 e_conv.is_owned = (e & 1) || (e == 0);
14552 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14553 e_conv = DecodeError_clone(&e_conv);
14554 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
14555 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
14556 return (uint64_t)ret_conv;
14559 jboolean __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint32_t o) {
14560 LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(o & ~1);
14561 jboolean ret_val = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
14565 void __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint32_t _res) {
14566 if ((_res & 1) != 0) return;
14567 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14568 CHECK_ACCESS(_res_ptr);
14569 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
14571 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
14574 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
14575 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
14576 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
14577 return (uint64_t)ret_conv;
14579 int64_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint32_t arg) {
14580 LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
14581 int64_t ret_val = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
14585 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint32_t orig) {
14586 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
14587 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
14588 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
14589 return (uint64_t)ret_conv;
14592 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
14593 LDKDelayedPaymentOutputDescriptor o_conv;
14594 o_conv.inner = (void*)(o & (~1));
14595 o_conv.is_owned = (o & 1) || (o == 0);
14596 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14597 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
14598 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14599 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
14600 return (uint64_t)ret_conv;
14603 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
14604 LDKDecodeError e_conv;
14605 e_conv.inner = (void*)(e & (~1));
14606 e_conv.is_owned = (e & 1) || (e == 0);
14607 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14608 e_conv = DecodeError_clone(&e_conv);
14609 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14610 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
14611 return (uint64_t)ret_conv;
14614 jboolean __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
14615 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
14616 jboolean ret_val = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
14620 void __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
14621 if ((_res & 1) != 0) return;
14622 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14623 CHECK_ACCESS(_res_ptr);
14624 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
14626 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
14629 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14630 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14631 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
14632 return (uint64_t)ret_conv;
14634 int64_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
14635 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
14636 int64_t ret_val = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
14640 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
14641 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
14642 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14643 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
14644 return (uint64_t)ret_conv;
14647 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
14648 LDKStaticPaymentOutputDescriptor o_conv;
14649 o_conv.inner = (void*)(o & (~1));
14650 o_conv.is_owned = (o & 1) || (o == 0);
14651 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14652 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
14653 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14654 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
14655 return (uint64_t)ret_conv;
14658 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
14659 LDKDecodeError e_conv;
14660 e_conv.inner = (void*)(e & (~1));
14661 e_conv.is_owned = (e & 1) || (e == 0);
14662 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14663 e_conv = DecodeError_clone(&e_conv);
14664 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14665 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
14666 return (uint64_t)ret_conv;
14669 jboolean __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
14670 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
14671 jboolean ret_val = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
14675 void __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
14676 if ((_res & 1) != 0) return;
14677 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14678 CHECK_ACCESS(_res_ptr);
14679 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
14681 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
14684 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14685 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14686 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
14687 return (uint64_t)ret_conv;
14689 int64_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
14690 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
14691 int64_t ret_val = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
14695 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
14696 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
14697 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14698 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
14699 return (uint64_t)ret_conv;
14702 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
14703 void* o_ptr = (void*)(((uint64_t)o) & ~1);
14704 CHECK_ACCESS(o_ptr);
14705 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
14706 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1));
14707 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14708 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
14709 return (uint64_t)ret_conv;
14712 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint32_t e) {
14713 LDKDecodeError e_conv;
14714 e_conv.inner = (void*)(e & (~1));
14715 e_conv.is_owned = (e & 1) || (e == 0);
14716 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14717 e_conv = DecodeError_clone(&e_conv);
14718 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14719 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
14720 return (uint64_t)ret_conv;
14723 jboolean __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
14724 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(o & ~1);
14725 jboolean ret_val = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
14729 void __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
14730 if ((_res & 1) != 0) return;
14731 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14732 CHECK_ACCESS(_res_ptr);
14733 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
14735 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
14738 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14739 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14740 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
14741 return (uint64_t)ret_conv;
14743 int64_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
14744 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
14745 int64_t ret_val = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
14749 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
14750 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
14751 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14752 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
14753 return (uint64_t)ret_conv;
14756 static inline uint64_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
14757 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
14758 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
14759 return ((uint64_t)ret_conv);
14761 int64_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(uint32_t arg) {
14762 LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(arg & ~1);
14763 int64_t ret_val = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
14767 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint32_t orig) {
14768 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
14769 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
14770 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
14771 return ((uint64_t)ret_conv);
14774 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
14775 LDKSignature a_ref;
14776 CHECK(a->arr_len == 64);
14777 memcpy(a_ref.compact_form, a->elems, 64);
14778 LDKCVec_SignatureZ b_constr;
14779 b_constr.datalen = b->arr_len;
14780 if (b_constr.datalen > 0)
14781 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
14783 b_constr.data = NULL;
14784 int8_tArray* b_vals = (void*) b->elems;
14785 for (size_t m = 0; m < b_constr.datalen; m++) {
14786 int8_tArray b_conv_12 = b_vals[m];
14787 LDKSignature b_conv_12_ref;
14788 CHECK(b_conv_12->arr_len == 64);
14789 memcpy(b_conv_12_ref.compact_form, b_conv_12->elems, 64);
14790 b_constr.data[m] = b_conv_12_ref;
14792 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
14793 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
14794 return ((uint64_t)ret_conv);
14797 void __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint32_t _res) {
14798 if ((_res & 1) != 0) return;
14799 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14800 CHECK_ACCESS(_res_ptr);
14801 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
14803 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
14806 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint32_t o) {
14807 void* o_ptr = (void*)(((uint64_t)o) & ~1);
14808 CHECK_ACCESS(o_ptr);
14809 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
14810 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1));
14811 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
14812 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
14813 return (uint64_t)ret_conv;
14816 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
14817 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
14818 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
14819 return (uint64_t)ret_conv;
14822 jboolean __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(uint32_t o) {
14823 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(o & ~1);
14824 jboolean ret_val = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
14828 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint32_t _res) {
14829 if ((_res & 1) != 0) return;
14830 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14831 CHECK_ACCESS(_res_ptr);
14832 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
14834 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
14837 static inline uint64_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
14838 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
14839 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
14840 return (uint64_t)ret_conv;
14842 int64_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(uint32_t arg) {
14843 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
14844 int64_t ret_val = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
14848 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint32_t orig) {
14849 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
14850 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
14851 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
14852 return (uint64_t)ret_conv;
14855 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
14856 LDKSignature o_ref;
14857 CHECK(o->arr_len == 64);
14858 memcpy(o_ref.compact_form, o->elems, 64);
14859 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
14860 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
14861 return (uint64_t)ret_conv;
14864 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_err() {
14865 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
14866 *ret_conv = CResult_SignatureNoneZ_err();
14867 return (uint64_t)ret_conv;
14870 jboolean __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_is_ok(uint32_t o) {
14871 LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)(o & ~1);
14872 jboolean ret_val = CResult_SignatureNoneZ_is_ok(o_conv);
14876 void __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_free(uint32_t _res) {
14877 if ((_res & 1) != 0) return;
14878 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14879 CHECK_ACCESS(_res_ptr);
14880 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
14882 CResult_SignatureNoneZ_free(_res_conv);
14885 static inline uint64_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
14886 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
14887 *ret_conv = CResult_SignatureNoneZ_clone(arg);
14888 return (uint64_t)ret_conv;
14890 int64_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_clone_ptr(uint32_t arg) {
14891 LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)(arg & ~1);
14892 int64_t ret_val = CResult_SignatureNoneZ_clone_ptr(arg_conv);
14896 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_clone(uint32_t orig) {
14897 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
14898 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
14899 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
14900 return (uint64_t)ret_conv;
14903 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_ok(uint32_t o) {
14904 void* o_ptr = (void*)(((uint64_t)o) & ~1);
14905 CHECK_ACCESS(o_ptr);
14906 LDKSign o_conv = *(LDKSign*)(o_ptr);
14907 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
14908 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
14909 return (uint64_t)ret_conv;
14912 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_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_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
14919 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
14920 return (uint64_t)ret_conv;
14923 jboolean __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_is_ok(uint32_t o) {
14924 LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)(o & ~1);
14925 jboolean ret_val = CResult_SignDecodeErrorZ_is_ok(o_conv);
14929 void __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_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_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
14935 CResult_SignDecodeErrorZ_free(_res_conv);
14938 static inline uint64_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
14939 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
14940 *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
14941 return (uint64_t)ret_conv;
14943 int64_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_clone_ptr(uint32_t arg) {
14944 LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
14945 int64_t ret_val = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
14949 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_clone(uint32_t orig) {
14950 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
14951 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
14952 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
14953 return (uint64_t)ret_conv;
14956 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray arg) {
14957 LDKRecoverableSignature arg_ref;
14958 CHECK(arg->arr_len == 68);
14959 memcpy(arg_ref.serialized_form, arg->elems, 68);
14960 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
14961 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(arg_ref);
14962 return (uint64_t)ret_conv;
14965 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_err() {
14966 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
14967 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
14968 return (uint64_t)ret_conv;
14971 jboolean __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint32_t o) {
14972 LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)(o & ~1);
14973 jboolean ret_val = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
14977 void __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_free(uint32_t _res) {
14978 if ((_res & 1) != 0) return;
14979 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14980 CHECK_ACCESS(_res_ptr);
14981 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
14983 CResult_RecoverableSignatureNoneZ_free(_res_conv);
14986 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
14987 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
14988 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
14989 return (uint64_t)ret_conv;
14991 int64_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint32_t arg) {
14992 LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
14993 int64_t ret_val = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
14997 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint32_t orig) {
14998 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
14999 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
15000 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
15001 return (uint64_t)ret_conv;
15004 void __attribute__((visibility("default"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
15005 LDKCVec_CVec_u8ZZ _res_constr;
15006 _res_constr.datalen = _res->arr_len;
15007 if (_res_constr.datalen > 0)
15008 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
15010 _res_constr.data = NULL;
15011 int8_tArray* _res_vals = (void*) _res->elems;
15012 for (size_t m = 0; m < _res_constr.datalen; m++) {
15013 int8_tArray _res_conv_12 = _res_vals[m];
15014 LDKCVec_u8Z _res_conv_12_ref;
15015 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
15016 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
15017 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen);
15018 _res_constr.data[m] = _res_conv_12_ref;
15020 CVec_CVec_u8ZZ_free(_res_constr);
15023 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
15024 LDKCVec_CVec_u8ZZ o_constr;
15025 o_constr.datalen = o->arr_len;
15026 if (o_constr.datalen > 0)
15027 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
15029 o_constr.data = NULL;
15030 int8_tArray* o_vals = (void*) o->elems;
15031 for (size_t m = 0; m < o_constr.datalen; m++) {
15032 int8_tArray o_conv_12 = o_vals[m];
15033 LDKCVec_u8Z o_conv_12_ref;
15034 o_conv_12_ref.datalen = o_conv_12->arr_len;
15035 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
15036 memcpy(o_conv_12_ref.data, o_conv_12->elems, o_conv_12_ref.datalen);
15037 o_constr.data[m] = o_conv_12_ref;
15039 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15040 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
15041 return (uint64_t)ret_conv;
15044 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
15045 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15046 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
15047 return (uint64_t)ret_conv;
15050 jboolean __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok(uint32_t o) {
15051 LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(o & ~1);
15052 jboolean ret_val = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
15056 void __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint32_t _res) {
15057 if ((_res & 1) != 0) return;
15058 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15059 CHECK_ACCESS(_res_ptr);
15060 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
15062 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
15065 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
15066 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15067 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
15068 return (uint64_t)ret_conv;
15070 int64_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(uint32_t arg) {
15071 LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
15072 int64_t ret_val = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
15076 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint32_t orig) {
15077 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
15078 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15079 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
15080 return (uint64_t)ret_conv;
15083 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint32_t o) {
15084 LDKInMemorySigner o_conv;
15085 o_conv.inner = (void*)(o & (~1));
15086 o_conv.is_owned = (o & 1) || (o == 0);
15087 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15088 o_conv = InMemorySigner_clone(&o_conv);
15089 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15090 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
15091 return (uint64_t)ret_conv;
15094 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint32_t e) {
15095 LDKDecodeError e_conv;
15096 e_conv.inner = (void*)(e & (~1));
15097 e_conv.is_owned = (e & 1) || (e == 0);
15098 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15099 e_conv = DecodeError_clone(&e_conv);
15100 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15101 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
15102 return (uint64_t)ret_conv;
15105 jboolean __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint32_t o) {
15106 LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(o & ~1);
15107 jboolean ret_val = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
15111 void __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint32_t _res) {
15112 if ((_res & 1) != 0) return;
15113 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15114 CHECK_ACCESS(_res_ptr);
15115 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
15117 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
15120 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
15121 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15122 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
15123 return (uint64_t)ret_conv;
15125 int64_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint32_t arg) {
15126 LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
15127 int64_t ret_val = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
15131 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint32_t orig) {
15132 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
15133 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15134 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
15135 return (uint64_t)ret_conv;
15138 void __attribute__((visibility("default"))) TS_CVec_TxOutZ_free(uint32_tArray _res) {
15139 LDKCVec_TxOutZ _res_constr;
15140 _res_constr.datalen = _res->arr_len;
15141 if (_res_constr.datalen > 0)
15142 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
15144 _res_constr.data = NULL;
15145 uint32_t* _res_vals = _res->elems;
15146 for (size_t h = 0; h < _res_constr.datalen; h++) {
15147 uint32_t _res_conv_7 = _res_vals[h];
15148 void* _res_conv_7_ptr = (void*)(((uint64_t)_res_conv_7) & ~1);
15149 CHECK_ACCESS(_res_conv_7_ptr);
15150 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
15151 FREE((void*)_res_conv_7);
15152 _res_constr.data[h] = _res_conv_7_conv;
15154 CVec_TxOutZ_free(_res_constr);
15157 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
15158 LDKTransaction o_ref;
15159 o_ref.datalen = o->arr_len;
15160 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
15161 memcpy(o_ref.data, o->elems, o_ref.datalen);
15162 o_ref.data_is_owned = true;
15163 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15164 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
15165 return (uint64_t)ret_conv;
15168 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_err() {
15169 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15170 *ret_conv = CResult_TransactionNoneZ_err();
15171 return (uint64_t)ret_conv;
15174 jboolean __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_is_ok(uint32_t o) {
15175 LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)(o & ~1);
15176 jboolean ret_val = CResult_TransactionNoneZ_is_ok(o_conv);
15180 void __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_free(uint32_t _res) {
15181 if ((_res & 1) != 0) return;
15182 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15183 CHECK_ACCESS(_res_ptr);
15184 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
15186 CResult_TransactionNoneZ_free(_res_conv);
15189 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
15190 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15191 *ret_conv = CResult_TransactionNoneZ_clone(arg);
15192 return (uint64_t)ret_conv;
15194 int64_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_clone_ptr(uint32_t arg) {
15195 LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)(arg & ~1);
15196 int64_t ret_val = CResult_TransactionNoneZ_clone_ptr(arg_conv);
15200 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_clone(uint32_t orig) {
15201 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
15202 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15203 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
15204 return (uint64_t)ret_conv;
15207 uint32_t __attribute__((visibility("default"))) TS_COption_FilterZ_some(uint32_t o) {
15208 void* o_ptr = (void*)(((uint64_t)o) & ~1);
15209 CHECK_ACCESS(o_ptr);
15210 LDKFilter o_conv = *(LDKFilter*)(o_ptr);
15211 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
15212 *ret_copy = COption_FilterZ_some(o_conv);
15213 uint64_t ret_ref = (uint64_t)ret_copy;
15217 uint32_t __attribute__((visibility("default"))) TS_COption_FilterZ_none() {
15218 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
15219 *ret_copy = COption_FilterZ_none();
15220 uint64_t ret_ref = (uint64_t)ret_copy;
15224 void __attribute__((visibility("default"))) TS_COption_FilterZ_free(uint32_t _res) {
15225 if ((_res & 1) != 0) return;
15226 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15227 CHECK_ACCESS(_res_ptr);
15228 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
15230 COption_FilterZ_free(_res_conv);
15233 uint32_t __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint32_t o) {
15234 LDKLockedChannelMonitor o_conv;
15235 o_conv.inner = (void*)(o & (~1));
15236 o_conv.is_owned = (o & 1) || (o == 0);
15237 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15238 // Warning: we need a move here but no clone is available for LDKLockedChannelMonitor
15239 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
15240 *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
15241 return (uint64_t)ret_conv;
15244 uint32_t __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
15245 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
15246 *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
15247 return (uint64_t)ret_conv;
15250 jboolean __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint32_t o) {
15251 LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(o & ~1);
15252 jboolean ret_val = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
15256 void __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint32_t _res) {
15257 if ((_res & 1) != 0) return;
15258 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15259 CHECK_ACCESS(_res_ptr);
15260 LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
15262 CResult_LockedChannelMonitorNoneZ_free(_res_conv);
15265 void __attribute__((visibility("default"))) TS_CVec_OutPointZ_free(uint32_tArray _res) {
15266 LDKCVec_OutPointZ _res_constr;
15267 _res_constr.datalen = _res->arr_len;
15268 if (_res_constr.datalen > 0)
15269 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
15271 _res_constr.data = NULL;
15272 uint32_t* _res_vals = _res->elems;
15273 for (size_t k = 0; k < _res_constr.datalen; k++) {
15274 uint32_t _res_conv_10 = _res_vals[k];
15275 LDKOutPoint _res_conv_10_conv;
15276 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
15277 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
15278 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
15279 _res_constr.data[k] = _res_conv_10_conv;
15281 CVec_OutPointZ_free(_res_constr);
15284 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_ok() {
15285 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15286 *ret_conv = CResult_NoneAPIErrorZ_ok();
15287 return (uint64_t)ret_conv;
15290 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_err(uint32_t e) {
15291 void* e_ptr = (void*)(((uint64_t)e) & ~1);
15292 CHECK_ACCESS(e_ptr);
15293 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15294 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
15295 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15296 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
15297 return (uint64_t)ret_conv;
15300 jboolean __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_is_ok(uint32_t o) {
15301 LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)(o & ~1);
15302 jboolean ret_val = CResult_NoneAPIErrorZ_is_ok(o_conv);
15306 void __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_free(uint32_t _res) {
15307 if ((_res & 1) != 0) return;
15308 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15309 CHECK_ACCESS(_res_ptr);
15310 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
15312 CResult_NoneAPIErrorZ_free(_res_conv);
15315 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
15316 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15317 *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
15318 return (uint64_t)ret_conv;
15320 int64_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint32_t arg) {
15321 LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
15322 int64_t ret_val = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
15326 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_clone(uint32_t orig) {
15327 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
15328 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15329 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
15330 return (uint64_t)ret_conv;
15333 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_some(int16_t o) {
15334 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15335 *ret_copy = COption_u16Z_some(o);
15336 uint64_t ret_ref = (uint64_t)ret_copy;
15340 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_none() {
15341 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15342 *ret_copy = COption_u16Z_none();
15343 uint64_t ret_ref = (uint64_t)ret_copy;
15347 void __attribute__((visibility("default"))) TS_COption_u16Z_free(uint32_t _res) {
15348 if ((_res & 1) != 0) return;
15349 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15350 CHECK_ACCESS(_res_ptr);
15351 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
15353 COption_u16Z_free(_res_conv);
15356 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
15357 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15358 *ret_copy = COption_u16Z_clone(arg);
15359 uint64_t ret_ref = (uint64_t)ret_copy;
15362 int64_t __attribute__((visibility("default"))) TS_COption_u16Z_clone_ptr(uint32_t arg) {
15363 LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)arg;
15364 int64_t ret_val = COption_u16Z_clone_ptr(arg_conv);
15368 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_clone(uint32_t orig) {
15369 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
15370 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15371 *ret_copy = COption_u16Z_clone(orig_conv);
15372 uint64_t ret_ref = (uint64_t)ret_copy;
15376 void __attribute__((visibility("default"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint32_tArray _res) {
15377 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
15378 _res_constr.datalen = _res->arr_len;
15379 if (_res_constr.datalen > 0)
15380 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
15382 _res_constr.data = NULL;
15383 uint32_t* _res_vals = _res->elems;
15384 for (size_t w = 0; w < _res_constr.datalen; w++) {
15385 uint32_t _res_conv_22 = _res_vals[w];
15386 void* _res_conv_22_ptr = (void*)(((uint64_t)_res_conv_22) & ~1);
15387 CHECK_ACCESS(_res_conv_22_ptr);
15388 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
15389 FREE((void*)_res_conv_22);
15390 _res_constr.data[w] = _res_conv_22_conv;
15392 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
15395 void __attribute__((visibility("default"))) TS_CVec_APIErrorZ_free(uint32_tArray _res) {
15396 LDKCVec_APIErrorZ _res_constr;
15397 _res_constr.datalen = _res->arr_len;
15398 if (_res_constr.datalen > 0)
15399 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
15401 _res_constr.data = NULL;
15402 uint32_t* _res_vals = _res->elems;
15403 for (size_t k = 0; k < _res_constr.datalen; k++) {
15404 uint32_t _res_conv_10 = _res_vals[k];
15405 void* _res_conv_10_ptr = (void*)(((uint64_t)_res_conv_10) & ~1);
15406 CHECK_ACCESS(_res_conv_10_ptr);
15407 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
15408 FREE((void*)_res_conv_10);
15409 _res_constr.data[k] = _res_conv_10_conv;
15411 CVec_APIErrorZ_free(_res_constr);
15414 uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) {
15415 LDKThirtyTwoBytes o_ref;
15416 CHECK(o->arr_len == 32);
15417 memcpy(o_ref.data, o->elems, 32);
15418 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15419 *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
15420 return (uint64_t)ret_conv;
15423 uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_err(uint32_t e) {
15424 void* e_ptr = (void*)(((uint64_t)e) & ~1);
15425 CHECK_ACCESS(e_ptr);
15426 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15427 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
15428 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15429 *ret_conv = CResult__u832APIErrorZ_err(e_conv);
15430 return (uint64_t)ret_conv;
15433 jboolean __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_is_ok(uint32_t o) {
15434 LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)(o & ~1);
15435 jboolean ret_val = CResult__u832APIErrorZ_is_ok(o_conv);
15439 void __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_free(uint32_t _res) {
15440 if ((_res & 1) != 0) return;
15441 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15442 CHECK_ACCESS(_res_ptr);
15443 LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
15445 CResult__u832APIErrorZ_free(_res_conv);
15448 static inline uint64_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
15449 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15450 *ret_conv = CResult__u832APIErrorZ_clone(arg);
15451 return (uint64_t)ret_conv;
15453 int64_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_clone_ptr(uint32_t arg) {
15454 LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)(arg & ~1);
15455 int64_t ret_val = CResult__u832APIErrorZ_clone_ptr(arg_conv);
15459 uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_clone(uint32_t orig) {
15460 LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1);
15461 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15462 *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
15463 return (uint64_t)ret_conv;
15466 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_ok(int8_tArray o) {
15467 LDKThirtyTwoBytes o_ref;
15468 CHECK(o->arr_len == 32);
15469 memcpy(o_ref.data, o->elems, 32);
15470 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15471 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
15472 return (uint64_t)ret_conv;
15475 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_err(uint32_t e) {
15476 void* e_ptr = (void*)(((uint64_t)e) & ~1);
15477 CHECK_ACCESS(e_ptr);
15478 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
15479 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
15480 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15481 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
15482 return (uint64_t)ret_conv;
15485 jboolean __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_is_ok(uint32_t o) {
15486 LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(o & ~1);
15487 jboolean ret_val = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv);
15491 void __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_free(uint32_t _res) {
15492 if ((_res & 1) != 0) return;
15493 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15494 CHECK_ACCESS(_res_ptr);
15495 LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
15497 CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
15500 static inline uint64_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) {
15501 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15502 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg);
15503 return (uint64_t)ret_conv;
15505 int64_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr(uint32_t arg) {
15506 LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
15507 int64_t ret_val = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv);
15511 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone(uint32_t orig) {
15512 LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1);
15513 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15514 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
15515 return (uint64_t)ret_conv;
15518 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_ok() {
15519 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15520 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
15521 return (uint64_t)ret_conv;
15524 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_err(uint32_t e) {
15525 void* e_ptr = (void*)(((uint64_t)e) & ~1);
15526 CHECK_ACCESS(e_ptr);
15527 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
15528 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
15529 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15530 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
15531 return (uint64_t)ret_conv;
15534 jboolean __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint32_t o) {
15535 LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)(o & ~1);
15536 jboolean ret_val = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
15540 void __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_free(uint32_t _res) {
15541 if ((_res & 1) != 0) return;
15542 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15543 CHECK_ACCESS(_res_ptr);
15544 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
15546 CResult_NonePaymentSendFailureZ_free(_res_conv);
15549 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
15550 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15551 *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
15552 return (uint64_t)ret_conv;
15554 int64_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint32_t arg) {
15555 LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
15556 int64_t ret_val = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
15560 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_clone(uint32_t orig) {
15561 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
15562 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15563 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
15564 return (uint64_t)ret_conv;
15567 static inline uint64_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
15568 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
15569 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
15570 return ((uint64_t)ret_conv);
15572 int64_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr(uint32_t arg) {
15573 LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(arg & ~1);
15574 int64_t ret_val = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
15578 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint32_t orig) {
15579 LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1);
15580 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
15581 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
15582 return ((uint64_t)ret_conv);
15585 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, int8_tArray b) {
15586 LDKThirtyTwoBytes a_ref;
15587 CHECK(a->arr_len == 32);
15588 memcpy(a_ref.data, a->elems, 32);
15589 LDKThirtyTwoBytes b_ref;
15590 CHECK(b->arr_len == 32);
15591 memcpy(b_ref.data, b->elems, 32);
15592 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
15593 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
15594 return ((uint64_t)ret_conv);
15597 void __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint32_t _res) {
15598 if ((_res & 1) != 0) return;
15599 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15600 CHECK_ACCESS(_res_ptr);
15601 LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
15603 C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
15606 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint32_t o) {
15607 void* o_ptr = (void*)(((uint64_t)o) & ~1);
15608 CHECK_ACCESS(o_ptr);
15609 LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
15610 o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uint64_t)o) & ~1));
15611 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15612 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
15613 return (uint64_t)ret_conv;
15616 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint32_t e) {
15617 void* e_ptr = (void*)(((uint64_t)e) & ~1);
15618 CHECK_ACCESS(e_ptr);
15619 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
15620 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
15621 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15622 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
15623 return (uint64_t)ret_conv;
15626 jboolean __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(uint32_t o) {
15627 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(o & ~1);
15628 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
15632 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint32_t _res) {
15633 if ((_res & 1) != 0) return;
15634 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15635 CHECK_ACCESS(_res_ptr);
15636 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
15638 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
15641 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
15642 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15643 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
15644 return (uint64_t)ret_conv;
15646 int64_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(uint32_t arg) {
15647 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
15648 int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
15652 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint32_t orig) {
15653 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1);
15654 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15655 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
15656 return (uint64_t)ret_conv;
15659 static inline uint64_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
15660 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15661 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
15662 return ((uint64_t)ret_conv);
15664 int64_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(uint32_t arg) {
15665 LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(arg & ~1);
15666 int64_t ret_val = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
15670 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint32_t orig) {
15671 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
15672 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15673 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
15674 return ((uint64_t)ret_conv);
15677 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
15678 LDKThirtyTwoBytes a_ref;
15679 CHECK(a->arr_len == 32);
15680 memcpy(a_ref.data, a->elems, 32);
15681 LDKThirtyTwoBytes b_ref;
15682 CHECK(b->arr_len == 32);
15683 memcpy(b_ref.data, b->elems, 32);
15684 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15685 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
15686 return ((uint64_t)ret_conv);
15689 void __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint32_t _res) {
15690 if ((_res & 1) != 0) return;
15691 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15692 CHECK_ACCESS(_res_ptr);
15693 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
15695 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
15698 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(uint32_t o) {
15699 void* o_ptr = (void*)(((uint64_t)o) & ~1);
15700 CHECK_ACCESS(o_ptr);
15701 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
15702 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)o) & ~1));
15703 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
15704 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
15705 return (uint64_t)ret_conv;
15708 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() {
15709 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
15710 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
15711 return (uint64_t)ret_conv;
15714 jboolean __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(uint32_t o) {
15715 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(o & ~1);
15716 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
15720 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(uint32_t _res) {
15721 if ((_res & 1) != 0) return;
15722 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15723 CHECK_ACCESS(_res_ptr);
15724 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
15726 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
15729 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
15730 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
15731 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
15732 return (uint64_t)ret_conv;
15734 int64_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(uint32_t arg) {
15735 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1);
15736 int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
15740 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(uint32_t orig) {
15741 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(orig & ~1);
15742 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
15743 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
15744 return (uint64_t)ret_conv;
15747 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(uint32_t o) {
15748 void* o_ptr = (void*)(((uint64_t)o) & ~1);
15749 CHECK_ACCESS(o_ptr);
15750 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
15751 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)o) & ~1));
15752 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
15753 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
15754 return (uint64_t)ret_conv;
15757 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(uint32_t e) {
15758 void* e_ptr = (void*)(((uint64_t)e) & ~1);
15759 CHECK_ACCESS(e_ptr);
15760 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15761 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
15762 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
15763 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
15764 return (uint64_t)ret_conv;
15767 jboolean __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(uint32_t o) {
15768 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(o & ~1);
15769 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
15773 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(uint32_t _res) {
15774 if ((_res & 1) != 0) return;
15775 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15776 CHECK_ACCESS(_res_ptr);
15777 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
15779 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
15782 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
15783 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
15784 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
15785 return (uint64_t)ret_conv;
15787 int64_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(uint32_t arg) {
15788 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1);
15789 int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
15793 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(uint32_t orig) {
15794 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(orig & ~1);
15795 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
15796 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
15797 return (uint64_t)ret_conv;
15800 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_ok(int8_tArray o) {
15801 LDKThirtyTwoBytes o_ref;
15802 CHECK(o->arr_len == 32);
15803 memcpy(o_ref.data, o->elems, 32);
15804 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
15805 *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
15806 return (uint64_t)ret_conv;
15809 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_err() {
15810 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
15811 *ret_conv = CResult_PaymentSecretNoneZ_err();
15812 return (uint64_t)ret_conv;
15815 jboolean __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_is_ok(uint32_t o) {
15816 LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)(o & ~1);
15817 jboolean ret_val = CResult_PaymentSecretNoneZ_is_ok(o_conv);
15821 void __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_free(uint32_t _res) {
15822 if ((_res & 1) != 0) return;
15823 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15824 CHECK_ACCESS(_res_ptr);
15825 LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
15827 CResult_PaymentSecretNoneZ_free(_res_conv);
15830 static inline uint64_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
15831 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
15832 *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
15833 return (uint64_t)ret_conv;
15835 int64_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_clone_ptr(uint32_t arg) {
15836 LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1);
15837 int64_t ret_val = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
15841 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_clone(uint32_t orig) {
15842 LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)(orig & ~1);
15843 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
15844 *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
15845 return (uint64_t)ret_conv;
15848 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
15849 LDKThirtyTwoBytes o_ref;
15850 CHECK(o->arr_len == 32);
15851 memcpy(o_ref.data, o->elems, 32);
15852 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15853 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
15854 return (uint64_t)ret_conv;
15857 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint32_t e) {
15858 void* e_ptr = (void*)(((uint64_t)e) & ~1);
15859 CHECK_ACCESS(e_ptr);
15860 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15861 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
15862 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15863 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
15864 return (uint64_t)ret_conv;
15867 jboolean __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_is_ok(uint32_t o) {
15868 LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(o & ~1);
15869 jboolean ret_val = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
15873 void __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint32_t _res) {
15874 if ((_res & 1) != 0) return;
15875 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15876 CHECK_ACCESS(_res_ptr);
15877 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
15879 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
15882 static inline uint64_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
15883 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15884 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
15885 return (uint64_t)ret_conv;
15887 int64_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_clone_ptr(uint32_t arg) {
15888 LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
15889 int64_t ret_val = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
15893 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint32_t orig) {
15894 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
15895 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15896 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
15897 return (uint64_t)ret_conv;
15900 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_ok(int8_tArray o) {
15901 LDKThirtyTwoBytes o_ref;
15902 CHECK(o->arr_len == 32);
15903 memcpy(o_ref.data, o->elems, 32);
15904 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
15905 *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
15906 return (uint64_t)ret_conv;
15909 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_err(uint32_t e) {
15910 void* e_ptr = (void*)(((uint64_t)e) & ~1);
15911 CHECK_ACCESS(e_ptr);
15912 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15913 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
15914 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
15915 *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
15916 return (uint64_t)ret_conv;
15919 jboolean __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_is_ok(uint32_t o) {
15920 LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(o & ~1);
15921 jboolean ret_val = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
15925 void __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_free(uint32_t _res) {
15926 if ((_res & 1) != 0) return;
15927 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15928 CHECK_ACCESS(_res_ptr);
15929 LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
15931 CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
15934 static inline uint64_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
15935 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
15936 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
15937 return (uint64_t)ret_conv;
15939 int64_t __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr(uint32_t arg) {
15940 LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1);
15941 int64_t ret_val = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
15945 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_clone(uint32_t orig) {
15946 LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(orig & ~1);
15947 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
15948 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
15949 return (uint64_t)ret_conv;
15952 void __attribute__((visibility("default"))) TS_CVec_ChannelMonitorZ_free(uint32_tArray _res) {
15953 LDKCVec_ChannelMonitorZ _res_constr;
15954 _res_constr.datalen = _res->arr_len;
15955 if (_res_constr.datalen > 0)
15956 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
15958 _res_constr.data = NULL;
15959 uint32_t* _res_vals = _res->elems;
15960 for (size_t q = 0; q < _res_constr.datalen; q++) {
15961 uint32_t _res_conv_16 = _res_vals[q];
15962 LDKChannelMonitor _res_conv_16_conv;
15963 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
15964 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
15965 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
15966 _res_constr.data[q] = _res_conv_16_conv;
15968 CVec_ChannelMonitorZ_free(_res_constr);
15971 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
15972 LDKThirtyTwoBytes a_ref;
15973 CHECK(a->arr_len == 32);
15974 memcpy(a_ref.data, a->elems, 32);
15975 LDKChannelManager b_conv;
15976 b_conv.inner = (void*)(b & (~1));
15977 b_conv.is_owned = (b & 1) || (b == 0);
15978 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
15979 // Warning: we need a move here but no clone is available for LDKChannelManager
15980 LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
15981 *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
15982 return ((uint64_t)ret_conv);
15985 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint32_t _res) {
15986 if ((_res & 1) != 0) return;
15987 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15988 CHECK_ACCESS(_res_ptr);
15989 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
15991 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
15994 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint32_t o) {
15995 void* o_ptr = (void*)(((uint64_t)o) & ~1);
15996 CHECK_ACCESS(o_ptr);
15997 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
15998 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
15999 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16000 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
16001 return (uint64_t)ret_conv;
16004 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint32_t e) {
16005 LDKDecodeError e_conv;
16006 e_conv.inner = (void*)(e & (~1));
16007 e_conv.is_owned = (e & 1) || (e == 0);
16008 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16009 e_conv = DecodeError_clone(&e_conv);
16010 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16011 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
16012 return (uint64_t)ret_conv;
16015 jboolean __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(uint32_t o) {
16016 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(o & ~1);
16017 jboolean ret_val = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
16021 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint32_t _res) {
16022 if ((_res & 1) != 0) return;
16023 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16024 CHECK_ACCESS(_res_ptr);
16025 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
16027 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
16030 void __attribute__((visibility("default"))) TS_PaymentPurpose_free(uint32_t this_ptr) {
16031 if ((this_ptr & 1) != 0) return;
16032 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16033 CHECK_ACCESS(this_ptr_ptr);
16034 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
16035 FREE((void*)this_ptr);
16036 PaymentPurpose_free(this_ptr_conv);
16039 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
16040 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
16041 *ret_copy = PaymentPurpose_clone(arg);
16042 uint64_t ret_ref = (uint64_t)ret_copy;
16045 int64_t __attribute__((visibility("default"))) TS_PaymentPurpose_clone_ptr(uint32_t arg) {
16046 LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)arg;
16047 int64_t ret_val = PaymentPurpose_clone_ptr(arg_conv);
16051 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_clone(uint32_t orig) {
16052 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
16053 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
16054 *ret_copy = PaymentPurpose_clone(orig_conv);
16055 uint64_t ret_ref = (uint64_t)ret_copy;
16059 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret) {
16060 LDKThirtyTwoBytes payment_preimage_ref;
16061 CHECK(payment_preimage->arr_len == 32);
16062 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32);
16063 LDKThirtyTwoBytes payment_secret_ref;
16064 CHECK(payment_secret->arr_len == 32);
16065 memcpy(payment_secret_ref.data, payment_secret->elems, 32);
16066 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
16067 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
16068 uint64_t ret_ref = (uint64_t)ret_copy;
16072 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
16073 LDKThirtyTwoBytes a_ref;
16074 CHECK(a->arr_len == 32);
16075 memcpy(a_ref.data, a->elems, 32);
16076 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
16077 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
16078 uint64_t ret_ref = (uint64_t)ret_copy;
16082 void __attribute__((visibility("default"))) TS_ClosureReason_free(uint32_t this_ptr) {
16083 if ((this_ptr & 1) != 0) return;
16084 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16085 CHECK_ACCESS(this_ptr_ptr);
16086 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
16087 FREE((void*)this_ptr);
16088 ClosureReason_free(this_ptr_conv);
16091 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
16092 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16093 *ret_copy = ClosureReason_clone(arg);
16094 uint64_t ret_ref = (uint64_t)ret_copy;
16097 int64_t __attribute__((visibility("default"))) TS_ClosureReason_clone_ptr(uint32_t arg) {
16098 LDKClosureReason* arg_conv = (LDKClosureReason*)arg;
16099 int64_t ret_val = ClosureReason_clone_ptr(arg_conv);
16103 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_clone(uint32_t orig) {
16104 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
16105 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16106 *ret_copy = ClosureReason_clone(orig_conv);
16107 uint64_t ret_ref = (uint64_t)ret_copy;
16111 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_counterparty_force_closed(jstring peer_msg) {
16112 LDKStr peer_msg_conv = str_ref_to_owned_c(peer_msg);
16113 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16114 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
16115 uint64_t ret_ref = (uint64_t)ret_copy;
16119 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_holder_force_closed() {
16120 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16121 *ret_copy = ClosureReason_holder_force_closed();
16122 uint64_t ret_ref = (uint64_t)ret_copy;
16126 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_cooperative_closure() {
16127 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16128 *ret_copy = ClosureReason_cooperative_closure();
16129 uint64_t ret_ref = (uint64_t)ret_copy;
16133 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_commitment_tx_confirmed() {
16134 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16135 *ret_copy = ClosureReason_commitment_tx_confirmed();
16136 uint64_t ret_ref = (uint64_t)ret_copy;
16140 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_funding_timed_out() {
16141 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16142 *ret_copy = ClosureReason_funding_timed_out();
16143 uint64_t ret_ref = (uint64_t)ret_copy;
16147 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_processing_error(jstring err) {
16148 LDKStr err_conv = str_ref_to_owned_c(err);
16149 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16150 *ret_copy = ClosureReason_processing_error(err_conv);
16151 uint64_t ret_ref = (uint64_t)ret_copy;
16155 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_disconnected_peer() {
16156 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16157 *ret_copy = ClosureReason_disconnected_peer();
16158 uint64_t ret_ref = (uint64_t)ret_copy;
16162 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_outdated_channel_manager() {
16163 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16164 *ret_copy = ClosureReason_outdated_channel_manager();
16165 uint64_t ret_ref = (uint64_t)ret_copy;
16169 int8_tArray __attribute__((visibility("default"))) TS_ClosureReason_write(uint32_t obj) {
16170 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
16171 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
16172 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
16173 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
16174 CVec_u8Z_free(ret_var);
16178 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_read(int8_tArray ser) {
16179 LDKu8slice ser_ref;
16180 ser_ref.datalen = ser->arr_len;
16181 ser_ref.data = ser->elems;
16182 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
16183 *ret_conv = ClosureReason_read(ser_ref);
16184 return (uint64_t)ret_conv;
16187 void __attribute__((visibility("default"))) TS_Event_free(uint32_t this_ptr) {
16188 if ((this_ptr & 1) != 0) return;
16189 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16190 CHECK_ACCESS(this_ptr_ptr);
16191 LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
16192 FREE((void*)this_ptr);
16193 Event_free(this_ptr_conv);
16196 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
16197 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16198 *ret_copy = Event_clone(arg);
16199 uint64_t ret_ref = (uint64_t)ret_copy;
16202 int64_t __attribute__((visibility("default"))) TS_Event_clone_ptr(uint32_t arg) {
16203 LDKEvent* arg_conv = (LDKEvent*)arg;
16204 int64_t ret_val = Event_clone_ptr(arg_conv);
16208 uint32_t __attribute__((visibility("default"))) TS_Event_clone(uint32_t orig) {
16209 LDKEvent* orig_conv = (LDKEvent*)orig;
16210 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16211 *ret_copy = Event_clone(orig_conv);
16212 uint64_t ret_ref = (uint64_t)ret_copy;
16216 uint32_t __attribute__((visibility("default"))) TS_Event_funding_generation_ready(int8_tArray temporary_channel_id, int64_t channel_value_satoshis, int8_tArray output_script, int64_t user_channel_id) {
16217 LDKThirtyTwoBytes temporary_channel_id_ref;
16218 CHECK(temporary_channel_id->arr_len == 32);
16219 memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32);
16220 LDKCVec_u8Z output_script_ref;
16221 output_script_ref.datalen = output_script->arr_len;
16222 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
16223 memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen);
16224 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16225 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
16226 uint64_t ret_ref = (uint64_t)ret_copy;
16230 uint32_t __attribute__((visibility("default"))) TS_Event_payment_received(int8_tArray payment_hash, int64_t amt, uint32_t purpose) {
16231 LDKThirtyTwoBytes payment_hash_ref;
16232 CHECK(payment_hash->arr_len == 32);
16233 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
16234 void* purpose_ptr = (void*)(((uint64_t)purpose) & ~1);
16235 CHECK_ACCESS(purpose_ptr);
16236 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
16237 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uint64_t)purpose) & ~1));
16238 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16239 *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
16240 uint64_t ret_ref = (uint64_t)ret_copy;
16244 uint32_t __attribute__((visibility("default"))) TS_Event_payment_sent(int8_tArray payment_id, int8_tArray payment_preimage, int8_tArray payment_hash, uint32_t fee_paid_msat) {
16245 LDKThirtyTwoBytes payment_id_ref;
16246 CHECK(payment_id->arr_len == 32);
16247 memcpy(payment_id_ref.data, payment_id->elems, 32);
16248 LDKThirtyTwoBytes payment_preimage_ref;
16249 CHECK(payment_preimage->arr_len == 32);
16250 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32);
16251 LDKThirtyTwoBytes payment_hash_ref;
16252 CHECK(payment_hash->arr_len == 32);
16253 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
16254 void* fee_paid_msat_ptr = (void*)(((uint64_t)fee_paid_msat) & ~1);
16255 CHECK_ACCESS(fee_paid_msat_ptr);
16256 LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
16257 fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_paid_msat) & ~1));
16258 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16259 *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
16260 uint64_t ret_ref = (uint64_t)ret_copy;
16264 uint32_t __attribute__((visibility("default"))) 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) {
16265 LDKThirtyTwoBytes payment_id_ref;
16266 CHECK(payment_id->arr_len == 32);
16267 memcpy(payment_id_ref.data, payment_id->elems, 32);
16268 LDKThirtyTwoBytes payment_hash_ref;
16269 CHECK(payment_hash->arr_len == 32);
16270 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
16271 void* network_update_ptr = (void*)(((uint64_t)network_update) & ~1);
16272 CHECK_ACCESS(network_update_ptr);
16273 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
16274 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1));
16275 LDKCVec_RouteHopZ path_constr;
16276 path_constr.datalen = path->arr_len;
16277 if (path_constr.datalen > 0)
16278 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
16280 path_constr.data = NULL;
16281 uint32_t* path_vals = path->elems;
16282 for (size_t k = 0; k < path_constr.datalen; k++) {
16283 uint32_t path_conv_10 = path_vals[k];
16284 LDKRouteHop path_conv_10_conv;
16285 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
16286 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
16287 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
16288 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
16289 path_constr.data[k] = path_conv_10_conv;
16291 void* short_channel_id_ptr = (void*)(((uint64_t)short_channel_id) & ~1);
16292 CHECK_ACCESS(short_channel_id_ptr);
16293 LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
16294 short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id) & ~1));
16295 LDKRouteParameters retry_conv;
16296 retry_conv.inner = (void*)(retry & (~1));
16297 retry_conv.is_owned = (retry & 1) || (retry == 0);
16298 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
16299 retry_conv = RouteParameters_clone(&retry_conv);
16300 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16301 *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);
16302 uint64_t ret_ref = (uint64_t)ret_copy;
16306 uint32_t __attribute__((visibility("default"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash) {
16307 LDKThirtyTwoBytes payment_id_ref;
16308 CHECK(payment_id->arr_len == 32);
16309 memcpy(payment_id_ref.data, payment_id->elems, 32);
16310 LDKThirtyTwoBytes payment_hash_ref;
16311 CHECK(payment_hash->arr_len == 32);
16312 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
16313 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16314 *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
16315 uint64_t ret_ref = (uint64_t)ret_copy;
16319 uint32_t __attribute__((visibility("default"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
16320 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16321 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
16322 uint64_t ret_ref = (uint64_t)ret_copy;
16326 uint32_t __attribute__((visibility("default"))) TS_Event_spendable_outputs(uint32_tArray outputs) {
16327 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
16328 outputs_constr.datalen = outputs->arr_len;
16329 if (outputs_constr.datalen > 0)
16330 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
16332 outputs_constr.data = NULL;
16333 uint32_t* outputs_vals = outputs->elems;
16334 for (size_t b = 0; b < outputs_constr.datalen; b++) {
16335 uint32_t outputs_conv_27 = outputs_vals[b];
16336 void* outputs_conv_27_ptr = (void*)(((uint64_t)outputs_conv_27) & ~1);
16337 CHECK_ACCESS(outputs_conv_27_ptr);
16338 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
16339 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1));
16340 outputs_constr.data[b] = outputs_conv_27_conv;
16342 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16343 *ret_copy = Event_spendable_outputs(outputs_constr);
16344 uint64_t ret_ref = (uint64_t)ret_copy;
16348 uint32_t __attribute__((visibility("default"))) TS_Event_payment_forwarded(uint32_t fee_earned_msat, jboolean claim_from_onchain_tx) {
16349 void* fee_earned_msat_ptr = (void*)(((uint64_t)fee_earned_msat) & ~1);
16350 CHECK_ACCESS(fee_earned_msat_ptr);
16351 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
16352 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1));
16353 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16354 *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
16355 uint64_t ret_ref = (uint64_t)ret_copy;
16359 uint32_t __attribute__((visibility("default"))) TS_Event_channel_closed(int8_tArray channel_id, int64_t user_channel_id, uint32_t reason) {
16360 LDKThirtyTwoBytes channel_id_ref;
16361 CHECK(channel_id->arr_len == 32);
16362 memcpy(channel_id_ref.data, channel_id->elems, 32);
16363 void* reason_ptr = (void*)(((uint64_t)reason) & ~1);
16364 CHECK_ACCESS(reason_ptr);
16365 LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
16366 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)reason) & ~1));
16367 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16368 *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
16369 uint64_t ret_ref = (uint64_t)ret_copy;
16373 uint32_t __attribute__((visibility("default"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
16374 LDKThirtyTwoBytes channel_id_ref;
16375 CHECK(channel_id->arr_len == 32);
16376 memcpy(channel_id_ref.data, channel_id->elems, 32);
16377 LDKTransaction transaction_ref;
16378 transaction_ref.datalen = transaction->arr_len;
16379 transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
16380 memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen);
16381 transaction_ref.data_is_owned = true;
16382 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16383 *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
16384 uint64_t ret_ref = (uint64_t)ret_copy;
16388 uint32_t __attribute__((visibility("default"))) TS_Event_payment_path_successful(int8_tArray payment_id, int8_tArray payment_hash, uint32_tArray path) {
16389 LDKThirtyTwoBytes payment_id_ref;
16390 CHECK(payment_id->arr_len == 32);
16391 memcpy(payment_id_ref.data, payment_id->elems, 32);
16392 LDKThirtyTwoBytes payment_hash_ref;
16393 CHECK(payment_hash->arr_len == 32);
16394 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
16395 LDKCVec_RouteHopZ path_constr;
16396 path_constr.datalen = path->arr_len;
16397 if (path_constr.datalen > 0)
16398 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
16400 path_constr.data = NULL;
16401 uint32_t* path_vals = path->elems;
16402 for (size_t k = 0; k < path_constr.datalen; k++) {
16403 uint32_t path_conv_10 = path_vals[k];
16404 LDKRouteHop path_conv_10_conv;
16405 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
16406 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
16407 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
16408 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
16409 path_constr.data[k] = path_conv_10_conv;
16411 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16412 *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
16413 uint64_t ret_ref = (uint64_t)ret_copy;
16417 int8_tArray __attribute__((visibility("default"))) TS_Event_write(uint32_t obj) {
16418 LDKEvent* obj_conv = (LDKEvent*)obj;
16419 LDKCVec_u8Z ret_var = Event_write(obj_conv);
16420 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
16421 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
16422 CVec_u8Z_free(ret_var);
16426 uint32_t __attribute__((visibility("default"))) TS_Event_read(int8_tArray ser) {
16427 LDKu8slice ser_ref;
16428 ser_ref.datalen = ser->arr_len;
16429 ser_ref.data = ser->elems;
16430 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
16431 *ret_conv = Event_read(ser_ref);
16432 return (uint64_t)ret_conv;
16435 void __attribute__((visibility("default"))) TS_MessageSendEvent_free(uint32_t this_ptr) {
16436 if ((this_ptr & 1) != 0) return;
16437 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16438 CHECK_ACCESS(this_ptr_ptr);
16439 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
16440 FREE((void*)this_ptr);
16441 MessageSendEvent_free(this_ptr_conv);
16444 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
16445 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16446 *ret_copy = MessageSendEvent_clone(arg);
16447 uint64_t ret_ref = (uint64_t)ret_copy;
16450 int64_t __attribute__((visibility("default"))) TS_MessageSendEvent_clone_ptr(uint32_t arg) {
16451 LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)arg;
16452 int64_t ret_val = MessageSendEvent_clone_ptr(arg_conv);
16456 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_clone(uint32_t orig) {
16457 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
16458 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16459 *ret_copy = MessageSendEvent_clone(orig_conv);
16460 uint64_t ret_ref = (uint64_t)ret_copy;
16464 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint32_t msg) {
16465 LDKPublicKey node_id_ref;
16466 CHECK(node_id->arr_len == 33);
16467 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16468 LDKAcceptChannel msg_conv;
16469 msg_conv.inner = (void*)(msg & (~1));
16470 msg_conv.is_owned = (msg & 1) || (msg == 0);
16471 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16472 msg_conv = AcceptChannel_clone(&msg_conv);
16473 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16474 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
16475 uint64_t ret_ref = (uint64_t)ret_copy;
16479 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint32_t msg) {
16480 LDKPublicKey node_id_ref;
16481 CHECK(node_id->arr_len == 33);
16482 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16483 LDKOpenChannel msg_conv;
16484 msg_conv.inner = (void*)(msg & (~1));
16485 msg_conv.is_owned = (msg & 1) || (msg == 0);
16486 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16487 msg_conv = OpenChannel_clone(&msg_conv);
16488 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16489 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
16490 uint64_t ret_ref = (uint64_t)ret_copy;
16494 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint32_t msg) {
16495 LDKPublicKey node_id_ref;
16496 CHECK(node_id->arr_len == 33);
16497 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16498 LDKFundingCreated msg_conv;
16499 msg_conv.inner = (void*)(msg & (~1));
16500 msg_conv.is_owned = (msg & 1) || (msg == 0);
16501 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16502 msg_conv = FundingCreated_clone(&msg_conv);
16503 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16504 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
16505 uint64_t ret_ref = (uint64_t)ret_copy;
16509 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint32_t msg) {
16510 LDKPublicKey node_id_ref;
16511 CHECK(node_id->arr_len == 33);
16512 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16513 LDKFundingSigned msg_conv;
16514 msg_conv.inner = (void*)(msg & (~1));
16515 msg_conv.is_owned = (msg & 1) || (msg == 0);
16516 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16517 msg_conv = FundingSigned_clone(&msg_conv);
16518 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16519 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
16520 uint64_t ret_ref = (uint64_t)ret_copy;
16524 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_locked(int8_tArray node_id, uint32_t msg) {
16525 LDKPublicKey node_id_ref;
16526 CHECK(node_id->arr_len == 33);
16527 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16528 LDKFundingLocked msg_conv;
16529 msg_conv.inner = (void*)(msg & (~1));
16530 msg_conv.is_owned = (msg & 1) || (msg == 0);
16531 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16532 msg_conv = FundingLocked_clone(&msg_conv);
16533 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16534 *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
16535 uint64_t ret_ref = (uint64_t)ret_copy;
16539 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint32_t msg) {
16540 LDKPublicKey node_id_ref;
16541 CHECK(node_id->arr_len == 33);
16542 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16543 LDKAnnouncementSignatures msg_conv;
16544 msg_conv.inner = (void*)(msg & (~1));
16545 msg_conv.is_owned = (msg & 1) || (msg == 0);
16546 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16547 msg_conv = AnnouncementSignatures_clone(&msg_conv);
16548 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16549 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
16550 uint64_t ret_ref = (uint64_t)ret_copy;
16554 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint32_t updates) {
16555 LDKPublicKey node_id_ref;
16556 CHECK(node_id->arr_len == 33);
16557 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16558 LDKCommitmentUpdate updates_conv;
16559 updates_conv.inner = (void*)(updates & (~1));
16560 updates_conv.is_owned = (updates & 1) || (updates == 0);
16561 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
16562 updates_conv = CommitmentUpdate_clone(&updates_conv);
16563 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16564 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
16565 uint64_t ret_ref = (uint64_t)ret_copy;
16569 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint32_t msg) {
16570 LDKPublicKey node_id_ref;
16571 CHECK(node_id->arr_len == 33);
16572 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16573 LDKRevokeAndACK msg_conv;
16574 msg_conv.inner = (void*)(msg & (~1));
16575 msg_conv.is_owned = (msg & 1) || (msg == 0);
16576 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16577 msg_conv = RevokeAndACK_clone(&msg_conv);
16578 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16579 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
16580 uint64_t ret_ref = (uint64_t)ret_copy;
16584 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint32_t msg) {
16585 LDKPublicKey node_id_ref;
16586 CHECK(node_id->arr_len == 33);
16587 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16588 LDKClosingSigned msg_conv;
16589 msg_conv.inner = (void*)(msg & (~1));
16590 msg_conv.is_owned = (msg & 1) || (msg == 0);
16591 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16592 msg_conv = ClosingSigned_clone(&msg_conv);
16593 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16594 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
16595 uint64_t ret_ref = (uint64_t)ret_copy;
16599 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint32_t msg) {
16600 LDKPublicKey node_id_ref;
16601 CHECK(node_id->arr_len == 33);
16602 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16603 LDKShutdown msg_conv;
16604 msg_conv.inner = (void*)(msg & (~1));
16605 msg_conv.is_owned = (msg & 1) || (msg == 0);
16606 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16607 msg_conv = Shutdown_clone(&msg_conv);
16608 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16609 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
16610 uint64_t ret_ref = (uint64_t)ret_copy;
16614 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint32_t msg) {
16615 LDKPublicKey node_id_ref;
16616 CHECK(node_id->arr_len == 33);
16617 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16618 LDKChannelReestablish msg_conv;
16619 msg_conv.inner = (void*)(msg & (~1));
16620 msg_conv.is_owned = (msg & 1) || (msg == 0);
16621 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16622 msg_conv = ChannelReestablish_clone(&msg_conv);
16623 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16624 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
16625 uint64_t ret_ref = (uint64_t)ret_copy;
16629 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_channel_announcement(uint32_t msg, uint32_t update_msg) {
16630 LDKChannelAnnouncement msg_conv;
16631 msg_conv.inner = (void*)(msg & (~1));
16632 msg_conv.is_owned = (msg & 1) || (msg == 0);
16633 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16634 msg_conv = ChannelAnnouncement_clone(&msg_conv);
16635 LDKChannelUpdate update_msg_conv;
16636 update_msg_conv.inner = (void*)(update_msg & (~1));
16637 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
16638 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
16639 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
16640 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16641 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
16642 uint64_t ret_ref = (uint64_t)ret_copy;
16646 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_node_announcement(uint32_t msg) {
16647 LDKNodeAnnouncement msg_conv;
16648 msg_conv.inner = (void*)(msg & (~1));
16649 msg_conv.is_owned = (msg & 1) || (msg == 0);
16650 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16651 msg_conv = NodeAnnouncement_clone(&msg_conv);
16652 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16653 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
16654 uint64_t ret_ref = (uint64_t)ret_copy;
16658 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_channel_update(uint32_t msg) {
16659 LDKChannelUpdate msg_conv;
16660 msg_conv.inner = (void*)(msg & (~1));
16661 msg_conv.is_owned = (msg & 1) || (msg == 0);
16662 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16663 msg_conv = ChannelUpdate_clone(&msg_conv);
16664 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16665 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
16666 uint64_t ret_ref = (uint64_t)ret_copy;
16670 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint32_t msg) {
16671 LDKPublicKey node_id_ref;
16672 CHECK(node_id->arr_len == 33);
16673 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16674 LDKChannelUpdate msg_conv;
16675 msg_conv.inner = (void*)(msg & (~1));
16676 msg_conv.is_owned = (msg & 1) || (msg == 0);
16677 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16678 msg_conv = ChannelUpdate_clone(&msg_conv);
16679 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16680 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
16681 uint64_t ret_ref = (uint64_t)ret_copy;
16685 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint32_t action) {
16686 LDKPublicKey node_id_ref;
16687 CHECK(node_id->arr_len == 33);
16688 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16689 void* action_ptr = (void*)(((uint64_t)action) & ~1);
16690 CHECK_ACCESS(action_ptr);
16691 LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
16692 action_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action) & ~1));
16693 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16694 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
16695 uint64_t ret_ref = (uint64_t)ret_copy;
16699 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint32_t msg) {
16700 LDKPublicKey node_id_ref;
16701 CHECK(node_id->arr_len == 33);
16702 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16703 LDKQueryChannelRange msg_conv;
16704 msg_conv.inner = (void*)(msg & (~1));
16705 msg_conv.is_owned = (msg & 1) || (msg == 0);
16706 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16707 msg_conv = QueryChannelRange_clone(&msg_conv);
16708 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16709 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
16710 uint64_t ret_ref = (uint64_t)ret_copy;
16714 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint32_t msg) {
16715 LDKPublicKey node_id_ref;
16716 CHECK(node_id->arr_len == 33);
16717 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16718 LDKQueryShortChannelIds msg_conv;
16719 msg_conv.inner = (void*)(msg & (~1));
16720 msg_conv.is_owned = (msg & 1) || (msg == 0);
16721 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16722 msg_conv = QueryShortChannelIds_clone(&msg_conv);
16723 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16724 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
16725 uint64_t ret_ref = (uint64_t)ret_copy;
16729 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint32_t msg) {
16730 LDKPublicKey node_id_ref;
16731 CHECK(node_id->arr_len == 33);
16732 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16733 LDKReplyChannelRange msg_conv;
16734 msg_conv.inner = (void*)(msg & (~1));
16735 msg_conv.is_owned = (msg & 1) || (msg == 0);
16736 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16737 msg_conv = ReplyChannelRange_clone(&msg_conv);
16738 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16739 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
16740 uint64_t ret_ref = (uint64_t)ret_copy;
16744 void __attribute__((visibility("default"))) TS_MessageSendEventsProvider_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 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
16749 FREE((void*)this_ptr);
16750 MessageSendEventsProvider_free(this_ptr_conv);
16753 void __attribute__((visibility("default"))) TS_EventsProvider_free(uint32_t this_ptr) {
16754 if ((this_ptr & 1) != 0) return;
16755 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16756 CHECK_ACCESS(this_ptr_ptr);
16757 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
16758 FREE((void*)this_ptr);
16759 EventsProvider_free(this_ptr_conv);
16762 void __attribute__((visibility("default"))) TS_EventHandler_free(uint32_t this_ptr) {
16763 if ((this_ptr & 1) != 0) return;
16764 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16765 CHECK_ACCESS(this_ptr_ptr);
16766 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
16767 FREE((void*)this_ptr);
16768 EventHandler_free(this_ptr_conv);
16771 void __attribute__((visibility("default"))) TS_APIError_free(uint32_t this_ptr) {
16772 if ((this_ptr & 1) != 0) return;
16773 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16774 CHECK_ACCESS(this_ptr_ptr);
16775 LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
16776 FREE((void*)this_ptr);
16777 APIError_free(this_ptr_conv);
16780 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
16781 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16782 *ret_copy = APIError_clone(arg);
16783 uint64_t ret_ref = (uint64_t)ret_copy;
16786 int64_t __attribute__((visibility("default"))) TS_APIError_clone_ptr(uint32_t arg) {
16787 LDKAPIError* arg_conv = (LDKAPIError*)arg;
16788 int64_t ret_val = APIError_clone_ptr(arg_conv);
16792 uint32_t __attribute__((visibility("default"))) TS_APIError_clone(uint32_t orig) {
16793 LDKAPIError* orig_conv = (LDKAPIError*)orig;
16794 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16795 *ret_copy = APIError_clone(orig_conv);
16796 uint64_t ret_ref = (uint64_t)ret_copy;
16800 uint32_t __attribute__((visibility("default"))) TS_APIError_apimisuse_error(jstring err) {
16801 LDKStr err_conv = str_ref_to_owned_c(err);
16802 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16803 *ret_copy = APIError_apimisuse_error(err_conv);
16804 uint64_t ret_ref = (uint64_t)ret_copy;
16808 uint32_t __attribute__((visibility("default"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
16809 LDKStr err_conv = str_ref_to_owned_c(err);
16810 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16811 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
16812 uint64_t ret_ref = (uint64_t)ret_copy;
16816 uint32_t __attribute__((visibility("default"))) TS_APIError_route_error(jstring err) {
16817 LDKStr err_conv = str_ref_to_owned_c(err);
16818 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16819 *ret_copy = APIError_route_error(err_conv);
16820 uint64_t ret_ref = (uint64_t)ret_copy;
16824 uint32_t __attribute__((visibility("default"))) TS_APIError_channel_unavailable(jstring err) {
16825 LDKStr err_conv = str_ref_to_owned_c(err);
16826 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16827 *ret_copy = APIError_channel_unavailable(err_conv);
16828 uint64_t ret_ref = (uint64_t)ret_copy;
16832 uint32_t __attribute__((visibility("default"))) TS_APIError_monitor_update_failed() {
16833 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16834 *ret_copy = APIError_monitor_update_failed();
16835 uint64_t ret_ref = (uint64_t)ret_copy;
16839 uint32_t __attribute__((visibility("default"))) TS_APIError_incompatible_shutdown_script(uint32_t script) {
16840 LDKShutdownScript script_conv;
16841 script_conv.inner = (void*)(script & (~1));
16842 script_conv.is_owned = (script & 1) || (script == 0);
16843 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
16844 script_conv = ShutdownScript_clone(&script_conv);
16845 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16846 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
16847 uint64_t ret_ref = (uint64_t)ret_copy;
16851 uint32_t __attribute__((visibility("default"))) TS_sign(int8_tArray msg, int8_tArray sk) {
16852 LDKu8slice msg_ref;
16853 msg_ref.datalen = msg->arr_len;
16854 msg_ref.data = msg->elems;
16855 unsigned char sk_arr[32];
16856 CHECK(sk->arr_len == 32);
16857 memcpy(sk_arr, sk->elems, 32);
16858 unsigned char (*sk_ref)[32] = &sk_arr;
16859 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
16860 *ret_conv = sign(msg_ref, sk_ref);
16861 return (uint64_t)ret_conv;
16864 uint32_t __attribute__((visibility("default"))) TS_recover_pk(int8_tArray msg, jstring sig) {
16865 LDKu8slice msg_ref;
16866 msg_ref.datalen = msg->arr_len;
16867 msg_ref.data = msg->elems;
16868 LDKStr sig_conv = str_ref_to_owned_c(sig);
16869 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
16870 *ret_conv = recover_pk(msg_ref, sig_conv);
16871 return (uint64_t)ret_conv;
16874 jboolean __attribute__((visibility("default"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
16875 LDKu8slice msg_ref;
16876 msg_ref.datalen = msg->arr_len;
16877 msg_ref.data = msg->elems;
16878 LDKStr sig_conv = str_ref_to_owned_c(sig);
16879 LDKPublicKey pk_ref;
16880 CHECK(pk->arr_len == 33);
16881 memcpy(pk_ref.compressed_form, pk->elems, 33);
16882 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
16886 uint32_t __attribute__((visibility("default"))) TS_Level_clone(uint32_t orig) {
16887 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
16888 uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
16892 uint32_t __attribute__((visibility("default"))) TS_Level_gossip() {
16893 uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
16897 uint32_t __attribute__((visibility("default"))) TS_Level_trace() {
16898 uint32_t ret_conv = LDKLevel_to_js(Level_trace());
16902 uint32_t __attribute__((visibility("default"))) TS_Level_debug() {
16903 uint32_t ret_conv = LDKLevel_to_js(Level_debug());
16907 uint32_t __attribute__((visibility("default"))) TS_Level_info() {
16908 uint32_t ret_conv = LDKLevel_to_js(Level_info());
16912 uint32_t __attribute__((visibility("default"))) TS_Level_warn() {
16913 uint32_t ret_conv = LDKLevel_to_js(Level_warn());
16917 uint32_t __attribute__((visibility("default"))) TS_Level_error() {
16918 uint32_t ret_conv = LDKLevel_to_js(Level_error());
16922 jboolean __attribute__((visibility("default"))) TS_Level_eq(uint32_t a, uint32_t b) {
16923 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
16924 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
16925 jboolean ret_val = Level_eq(a_conv, b_conv);
16929 int64_t __attribute__((visibility("default"))) TS_Level_hash(uint32_t o) {
16930 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
16931 int64_t ret_val = Level_hash(o_conv);
16935 uint32_t __attribute__((visibility("default"))) TS_Level_max() {
16936 uint32_t ret_conv = LDKLevel_to_js(Level_max());
16940 void __attribute__((visibility("default"))) TS_Record_free(uint32_t this_obj) {
16941 LDKRecord this_obj_conv;
16942 this_obj_conv.inner = (void*)(this_obj & (~1));
16943 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16944 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
16945 Record_free(this_obj_conv);
16948 uint32_t __attribute__((visibility("default"))) TS_Record_get_level(uint32_t this_ptr) {
16949 LDKRecord this_ptr_conv;
16950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16951 this_ptr_conv.is_owned = false;
16952 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16953 uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
16957 void __attribute__((visibility("default"))) TS_Record_set_level(uint32_t this_ptr, uint32_t val) {
16958 LDKRecord this_ptr_conv;
16959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16960 this_ptr_conv.is_owned = false;
16961 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16962 LDKLevel val_conv = LDKLevel_from_js(val);
16963 Record_set_level(&this_ptr_conv, val_conv);
16966 jstring __attribute__((visibility("default"))) TS_Record_get_args(uint32_t this_ptr) {
16967 LDKRecord this_ptr_conv;
16968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16969 this_ptr_conv.is_owned = false;
16970 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16971 LDKStr ret_str = Record_get_args(&this_ptr_conv);
16972 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
16977 void __attribute__((visibility("default"))) TS_Record_set_args(uint32_t this_ptr, jstring val) {
16978 LDKRecord this_ptr_conv;
16979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16980 this_ptr_conv.is_owned = false;
16981 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16982 LDKStr val_conv = str_ref_to_owned_c(val);
16983 Record_set_args(&this_ptr_conv, val_conv);
16986 jstring __attribute__((visibility("default"))) TS_Record_get_module_path(uint32_t this_ptr) {
16987 LDKRecord this_ptr_conv;
16988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16989 this_ptr_conv.is_owned = false;
16990 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16991 LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
16992 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
16997 void __attribute__((visibility("default"))) TS_Record_set_module_path(uint32_t this_ptr, jstring val) {
16998 LDKRecord this_ptr_conv;
16999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17000 this_ptr_conv.is_owned = false;
17001 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17002 LDKStr val_conv = str_ref_to_owned_c(val);
17003 Record_set_module_path(&this_ptr_conv, val_conv);
17006 jstring __attribute__((visibility("default"))) TS_Record_get_file(uint32_t this_ptr) {
17007 LDKRecord this_ptr_conv;
17008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17009 this_ptr_conv.is_owned = false;
17010 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17011 LDKStr ret_str = Record_get_file(&this_ptr_conv);
17012 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
17017 void __attribute__((visibility("default"))) TS_Record_set_file(uint32_t this_ptr, jstring val) {
17018 LDKRecord this_ptr_conv;
17019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17020 this_ptr_conv.is_owned = false;
17021 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17022 LDKStr val_conv = str_ref_to_owned_c(val);
17023 Record_set_file(&this_ptr_conv, val_conv);
17026 int32_t __attribute__((visibility("default"))) TS_Record_get_line(uint32_t this_ptr) {
17027 LDKRecord this_ptr_conv;
17028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17029 this_ptr_conv.is_owned = false;
17030 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17031 int32_t ret_val = Record_get_line(&this_ptr_conv);
17035 void __attribute__((visibility("default"))) TS_Record_set_line(uint32_t this_ptr, int32_t val) {
17036 LDKRecord this_ptr_conv;
17037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17038 this_ptr_conv.is_owned = false;
17039 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17040 Record_set_line(&this_ptr_conv, val);
17043 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
17044 LDKRecord ret_var = Record_clone(arg);
17045 uint64_t ret_ref = 0;
17046 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17047 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17048 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17049 ret_ref = (uint64_t)ret_var.inner;
17050 if (ret_var.is_owned) {
17055 int64_t __attribute__((visibility("default"))) TS_Record_clone_ptr(uint32_t arg) {
17056 LDKRecord arg_conv;
17057 arg_conv.inner = (void*)(arg & (~1));
17058 arg_conv.is_owned = false;
17059 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
17060 int64_t ret_val = Record_clone_ptr(&arg_conv);
17064 uint32_t __attribute__((visibility("default"))) TS_Record_clone(uint32_t orig) {
17065 LDKRecord orig_conv;
17066 orig_conv.inner = (void*)(orig & (~1));
17067 orig_conv.is_owned = false;
17068 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
17069 LDKRecord ret_var = Record_clone(&orig_conv);
17070 uint64_t ret_ref = 0;
17071 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17072 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17073 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17074 ret_ref = (uint64_t)ret_var.inner;
17075 if (ret_var.is_owned) {
17081 void __attribute__((visibility("default"))) TS_Logger_free(uint32_t this_ptr) {
17082 if ((this_ptr & 1) != 0) return;
17083 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17084 CHECK_ACCESS(this_ptr_ptr);
17085 LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
17086 FREE((void*)this_ptr);
17087 Logger_free(this_ptr_conv);
17090 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_free(uint32_t this_obj) {
17091 LDKChannelHandshakeConfig this_obj_conv;
17092 this_obj_conv.inner = (void*)(this_obj & (~1));
17093 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17094 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17095 ChannelHandshakeConfig_free(this_obj_conv);
17098 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint32_t this_ptr) {
17099 LDKChannelHandshakeConfig this_ptr_conv;
17100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17101 this_ptr_conv.is_owned = false;
17102 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17103 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
17107 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint32_t this_ptr, int32_t val) {
17108 LDKChannelHandshakeConfig this_ptr_conv;
17109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17110 this_ptr_conv.is_owned = false;
17111 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17112 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
17115 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint32_t this_ptr) {
17116 LDKChannelHandshakeConfig this_ptr_conv;
17117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17118 this_ptr_conv.is_owned = false;
17119 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17120 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
17124 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_to_self_delay(uint32_t this_ptr, int16_t val) {
17125 LDKChannelHandshakeConfig this_ptr_conv;
17126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17127 this_ptr_conv.is_owned = false;
17128 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17129 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
17132 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint32_t this_ptr) {
17133 LDKChannelHandshakeConfig this_ptr_conv;
17134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17135 this_ptr_conv.is_owned = false;
17136 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17137 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
17141 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
17142 LDKChannelHandshakeConfig this_ptr_conv;
17143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17144 this_ptr_conv.is_owned = false;
17145 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17146 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
17149 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_new(int32_t minimum_depth_arg, int16_t our_to_self_delay_arg, int64_t our_htlc_minimum_msat_arg) {
17150 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
17151 uint64_t ret_ref = 0;
17152 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17153 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17154 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17155 ret_ref = (uint64_t)ret_var.inner;
17156 if (ret_var.is_owned) {
17162 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
17163 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
17164 uint64_t ret_ref = 0;
17165 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17166 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17167 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17168 ret_ref = (uint64_t)ret_var.inner;
17169 if (ret_var.is_owned) {
17174 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_clone_ptr(uint32_t arg) {
17175 LDKChannelHandshakeConfig arg_conv;
17176 arg_conv.inner = (void*)(arg & (~1));
17177 arg_conv.is_owned = false;
17178 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
17179 int64_t ret_val = ChannelHandshakeConfig_clone_ptr(&arg_conv);
17183 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_clone(uint32_t orig) {
17184 LDKChannelHandshakeConfig orig_conv;
17185 orig_conv.inner = (void*)(orig & (~1));
17186 orig_conv.is_owned = false;
17187 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
17188 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
17189 uint64_t ret_ref = 0;
17190 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17191 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17192 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17193 ret_ref = (uint64_t)ret_var.inner;
17194 if (ret_var.is_owned) {
17200 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_default() {
17201 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
17202 uint64_t ret_ref = 0;
17203 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17204 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17205 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17206 ret_ref = (uint64_t)ret_var.inner;
17207 if (ret_var.is_owned) {
17213 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_free(uint32_t this_obj) {
17214 LDKChannelHandshakeLimits this_obj_conv;
17215 this_obj_conv.inner = (void*)(this_obj & (~1));
17216 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17217 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17218 ChannelHandshakeLimits_free(this_obj_conv);
17221 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint32_t this_ptr) {
17222 LDKChannelHandshakeLimits this_ptr_conv;
17223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17224 this_ptr_conv.is_owned = false;
17225 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17226 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
17230 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint32_t this_ptr, int64_t val) {
17231 LDKChannelHandshakeLimits this_ptr_conv;
17232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17233 this_ptr_conv.is_owned = false;
17234 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17235 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
17238 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint32_t this_ptr) {
17239 LDKChannelHandshakeLimits this_ptr_conv;
17240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17241 this_ptr_conv.is_owned = false;
17242 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17243 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
17247 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
17248 LDKChannelHandshakeLimits this_ptr_conv;
17249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17250 this_ptr_conv.is_owned = false;
17251 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17252 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
17255 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
17256 LDKChannelHandshakeLimits this_ptr_conv;
17257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17258 this_ptr_conv.is_owned = false;
17259 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17260 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
17264 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
17265 LDKChannelHandshakeLimits this_ptr_conv;
17266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17267 this_ptr_conv.is_owned = false;
17268 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17269 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
17272 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint32_t this_ptr) {
17273 LDKChannelHandshakeLimits this_ptr_conv;
17274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17275 this_ptr_conv.is_owned = false;
17276 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17277 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
17281 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
17282 LDKChannelHandshakeLimits this_ptr_conv;
17283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17284 this_ptr_conv.is_owned = false;
17285 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17286 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
17289 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint32_t this_ptr) {
17290 LDKChannelHandshakeLimits this_ptr_conv;
17291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17292 this_ptr_conv.is_owned = false;
17293 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17294 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
17298 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
17299 LDKChannelHandshakeLimits this_ptr_conv;
17300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17301 this_ptr_conv.is_owned = false;
17302 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17303 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
17306 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint32_t this_ptr) {
17307 LDKChannelHandshakeLimits 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 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
17315 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint32_t this_ptr, int32_t val) {
17316 LDKChannelHandshakeLimits 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 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
17323 jboolean __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint32_t this_ptr) {
17324 LDKChannelHandshakeLimits this_ptr_conv;
17325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17326 this_ptr_conv.is_owned = false;
17327 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17328 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
17332 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint32_t this_ptr, jboolean val) {
17333 LDKChannelHandshakeLimits this_ptr_conv;
17334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17335 this_ptr_conv.is_owned = false;
17336 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17337 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
17340 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint32_t this_ptr) {
17341 LDKChannelHandshakeLimits this_ptr_conv;
17342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17343 this_ptr_conv.is_owned = false;
17344 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17345 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
17349 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_their_to_self_delay(uint32_t this_ptr, int16_t val) {
17350 LDKChannelHandshakeLimits this_ptr_conv;
17351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17352 this_ptr_conv.is_owned = false;
17353 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17354 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
17357 uint32_t __attribute__((visibility("default"))) 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) {
17358 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);
17359 uint64_t ret_ref = 0;
17360 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17361 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17362 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17363 ret_ref = (uint64_t)ret_var.inner;
17364 if (ret_var.is_owned) {
17370 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
17371 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
17372 uint64_t ret_ref = 0;
17373 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17374 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17375 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17376 ret_ref = (uint64_t)ret_var.inner;
17377 if (ret_var.is_owned) {
17382 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_clone_ptr(uint32_t arg) {
17383 LDKChannelHandshakeLimits arg_conv;
17384 arg_conv.inner = (void*)(arg & (~1));
17385 arg_conv.is_owned = false;
17386 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
17387 int64_t ret_val = ChannelHandshakeLimits_clone_ptr(&arg_conv);
17391 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_clone(uint32_t orig) {
17392 LDKChannelHandshakeLimits orig_conv;
17393 orig_conv.inner = (void*)(orig & (~1));
17394 orig_conv.is_owned = false;
17395 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
17396 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
17397 uint64_t ret_ref = 0;
17398 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17399 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17400 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17401 ret_ref = (uint64_t)ret_var.inner;
17402 if (ret_var.is_owned) {
17408 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_default() {
17409 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
17410 uint64_t ret_ref = 0;
17411 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17412 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17413 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17414 ret_ref = (uint64_t)ret_var.inner;
17415 if (ret_var.is_owned) {
17421 void __attribute__((visibility("default"))) TS_ChannelConfig_free(uint32_t this_obj) {
17422 LDKChannelConfig this_obj_conv;
17423 this_obj_conv.inner = (void*)(this_obj & (~1));
17424 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17425 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17426 ChannelConfig_free(this_obj_conv);
17429 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint32_t this_ptr) {
17430 LDKChannelConfig this_ptr_conv;
17431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17432 this_ptr_conv.is_owned = false;
17433 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17434 int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
17438 void __attribute__((visibility("default"))) TS_ChannelConfig_set_forwarding_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
17439 LDKChannelConfig this_ptr_conv;
17440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17441 this_ptr_conv.is_owned = false;
17442 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17443 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
17446 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint32_t this_ptr) {
17447 LDKChannelConfig this_ptr_conv;
17448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17449 this_ptr_conv.is_owned = false;
17450 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17451 int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
17455 void __attribute__((visibility("default"))) TS_ChannelConfig_set_forwarding_fee_base_msat(uint32_t this_ptr, int32_t val) {
17456 LDKChannelConfig this_ptr_conv;
17457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17458 this_ptr_conv.is_owned = false;
17459 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17460 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
17463 int16_t __attribute__((visibility("default"))) TS_ChannelConfig_get_cltv_expiry_delta(uint32_t this_ptr) {
17464 LDKChannelConfig this_ptr_conv;
17465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17466 this_ptr_conv.is_owned = false;
17467 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17468 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
17472 void __attribute__((visibility("default"))) TS_ChannelConfig_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
17473 LDKChannelConfig this_ptr_conv;
17474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17475 this_ptr_conv.is_owned = false;
17476 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17477 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
17480 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_announced_channel(uint32_t this_ptr) {
17481 LDKChannelConfig this_ptr_conv;
17482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17483 this_ptr_conv.is_owned = false;
17484 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17485 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
17489 void __attribute__((visibility("default"))) TS_ChannelConfig_set_announced_channel(uint32_t this_ptr, jboolean val) {
17490 LDKChannelConfig this_ptr_conv;
17491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17492 this_ptr_conv.is_owned = false;
17493 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17494 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
17497 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_commit_upfront_shutdown_pubkey(uint32_t this_ptr) {
17498 LDKChannelConfig this_ptr_conv;
17499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17500 this_ptr_conv.is_owned = false;
17501 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17502 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
17506 void __attribute__((visibility("default"))) TS_ChannelConfig_set_commit_upfront_shutdown_pubkey(uint32_t this_ptr, jboolean val) {
17507 LDKChannelConfig this_ptr_conv;
17508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17509 this_ptr_conv.is_owned = false;
17510 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17511 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
17514 int64_t __attribute__((visibility("default"))) TS_ChannelConfig_get_max_dust_htlc_exposure_msat(uint32_t this_ptr) {
17515 LDKChannelConfig this_ptr_conv;
17516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17517 this_ptr_conv.is_owned = false;
17518 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17519 int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
17523 void __attribute__((visibility("default"))) TS_ChannelConfig_set_max_dust_htlc_exposure_msat(uint32_t this_ptr, int64_t val) {
17524 LDKChannelConfig this_ptr_conv;
17525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17526 this_ptr_conv.is_owned = false;
17527 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17528 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
17531 int64_t __attribute__((visibility("default"))) TS_ChannelConfig_get_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr) {
17532 LDKChannelConfig this_ptr_conv;
17533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17534 this_ptr_conv.is_owned = false;
17535 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17536 int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
17540 void __attribute__((visibility("default"))) TS_ChannelConfig_set_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
17541 LDKChannelConfig this_ptr_conv;
17542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17543 this_ptr_conv.is_owned = false;
17544 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17545 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
17548 uint32_t __attribute__((visibility("default"))) 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) {
17549 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);
17550 uint64_t ret_ref = 0;
17551 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17552 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17553 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17554 ret_ref = (uint64_t)ret_var.inner;
17555 if (ret_var.is_owned) {
17561 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
17562 LDKChannelConfig ret_var = ChannelConfig_clone(arg);
17563 uint64_t ret_ref = 0;
17564 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17565 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17566 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17567 ret_ref = (uint64_t)ret_var.inner;
17568 if (ret_var.is_owned) {
17573 int64_t __attribute__((visibility("default"))) TS_ChannelConfig_clone_ptr(uint32_t arg) {
17574 LDKChannelConfig arg_conv;
17575 arg_conv.inner = (void*)(arg & (~1));
17576 arg_conv.is_owned = false;
17577 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
17578 int64_t ret_val = ChannelConfig_clone_ptr(&arg_conv);
17582 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_clone(uint32_t orig) {
17583 LDKChannelConfig orig_conv;
17584 orig_conv.inner = (void*)(orig & (~1));
17585 orig_conv.is_owned = false;
17586 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
17587 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
17588 uint64_t ret_ref = 0;
17589 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17590 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17591 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17592 ret_ref = (uint64_t)ret_var.inner;
17593 if (ret_var.is_owned) {
17599 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_default() {
17600 LDKChannelConfig ret_var = ChannelConfig_default();
17601 uint64_t ret_ref = 0;
17602 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17603 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17604 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17605 ret_ref = (uint64_t)ret_var.inner;
17606 if (ret_var.is_owned) {
17612 int8_tArray __attribute__((visibility("default"))) TS_ChannelConfig_write(uint32_t obj) {
17613 LDKChannelConfig obj_conv;
17614 obj_conv.inner = (void*)(obj & (~1));
17615 obj_conv.is_owned = false;
17616 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
17617 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
17618 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
17619 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
17620 CVec_u8Z_free(ret_var);
17624 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_read(int8_tArray ser) {
17625 LDKu8slice ser_ref;
17626 ser_ref.datalen = ser->arr_len;
17627 ser_ref.data = ser->elems;
17628 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
17629 *ret_conv = ChannelConfig_read(ser_ref);
17630 return (uint64_t)ret_conv;
17633 void __attribute__((visibility("default"))) TS_UserConfig_free(uint32_t this_obj) {
17634 LDKUserConfig this_obj_conv;
17635 this_obj_conv.inner = (void*)(this_obj & (~1));
17636 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17637 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17638 UserConfig_free(this_obj_conv);
17641 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_own_channel_config(uint32_t this_ptr) {
17642 LDKUserConfig 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 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
17647 uint64_t ret_ref = 0;
17648 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17649 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17650 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17651 ret_ref = (uint64_t)ret_var.inner;
17652 if (ret_var.is_owned) {
17658 void __attribute__((visibility("default"))) TS_UserConfig_set_own_channel_config(uint32_t this_ptr, uint32_t val) {
17659 LDKUserConfig 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 LDKChannelHandshakeConfig val_conv;
17664 val_conv.inner = (void*)(val & (~1));
17665 val_conv.is_owned = (val & 1) || (val == 0);
17666 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
17667 val_conv = ChannelHandshakeConfig_clone(&val_conv);
17668 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
17671 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_peer_channel_config_limits(uint32_t this_ptr) {
17672 LDKUserConfig this_ptr_conv;
17673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17674 this_ptr_conv.is_owned = false;
17675 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17676 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
17677 uint64_t ret_ref = 0;
17678 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17679 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17680 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17681 ret_ref = (uint64_t)ret_var.inner;
17682 if (ret_var.is_owned) {
17688 void __attribute__((visibility("default"))) TS_UserConfig_set_peer_channel_config_limits(uint32_t this_ptr, uint32_t val) {
17689 LDKUserConfig this_ptr_conv;
17690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17691 this_ptr_conv.is_owned = false;
17692 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17693 LDKChannelHandshakeLimits val_conv;
17694 val_conv.inner = (void*)(val & (~1));
17695 val_conv.is_owned = (val & 1) || (val == 0);
17696 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
17697 val_conv = ChannelHandshakeLimits_clone(&val_conv);
17698 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
17701 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_channel_options(uint32_t this_ptr) {
17702 LDKUserConfig this_ptr_conv;
17703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17704 this_ptr_conv.is_owned = false;
17705 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17706 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
17707 uint64_t ret_ref = 0;
17708 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17709 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17710 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17711 ret_ref = (uint64_t)ret_var.inner;
17712 if (ret_var.is_owned) {
17718 void __attribute__((visibility("default"))) TS_UserConfig_set_channel_options(uint32_t this_ptr, uint32_t val) {
17719 LDKUserConfig this_ptr_conv;
17720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17721 this_ptr_conv.is_owned = false;
17722 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17723 LDKChannelConfig val_conv;
17724 val_conv.inner = (void*)(val & (~1));
17725 val_conv.is_owned = (val & 1) || (val == 0);
17726 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
17727 val_conv = ChannelConfig_clone(&val_conv);
17728 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
17731 jboolean __attribute__((visibility("default"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint32_t this_ptr) {
17732 LDKUserConfig this_ptr_conv;
17733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17734 this_ptr_conv.is_owned = false;
17735 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17736 jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
17740 void __attribute__((visibility("default"))) TS_UserConfig_set_accept_forwards_to_priv_channels(uint32_t this_ptr, jboolean val) {
17741 LDKUserConfig this_ptr_conv;
17742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17743 this_ptr_conv.is_owned = false;
17744 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17745 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
17748 jboolean __attribute__((visibility("default"))) TS_UserConfig_get_accept_inbound_channels(uint32_t this_ptr) {
17749 LDKUserConfig this_ptr_conv;
17750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17751 this_ptr_conv.is_owned = false;
17752 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17753 jboolean ret_val = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
17757 void __attribute__((visibility("default"))) TS_UserConfig_set_accept_inbound_channels(uint32_t this_ptr, jboolean val) {
17758 LDKUserConfig this_ptr_conv;
17759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17760 this_ptr_conv.is_owned = false;
17761 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17762 UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
17765 uint32_t __attribute__((visibility("default"))) 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) {
17766 LDKChannelHandshakeConfig own_channel_config_arg_conv;
17767 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
17768 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
17769 CHECK_INNER_FIELD_ACCESS_OR_NULL(own_channel_config_arg_conv);
17770 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
17771 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
17772 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
17773 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
17774 CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_channel_config_limits_arg_conv);
17775 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
17776 LDKChannelConfig channel_options_arg_conv;
17777 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
17778 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
17779 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_options_arg_conv);
17780 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
17781 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);
17782 uint64_t ret_ref = 0;
17783 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17784 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17785 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17786 ret_ref = (uint64_t)ret_var.inner;
17787 if (ret_var.is_owned) {
17793 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
17794 LDKUserConfig ret_var = UserConfig_clone(arg);
17795 uint64_t ret_ref = 0;
17796 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17797 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17798 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17799 ret_ref = (uint64_t)ret_var.inner;
17800 if (ret_var.is_owned) {
17805 int64_t __attribute__((visibility("default"))) TS_UserConfig_clone_ptr(uint32_t arg) {
17806 LDKUserConfig arg_conv;
17807 arg_conv.inner = (void*)(arg & (~1));
17808 arg_conv.is_owned = false;
17809 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
17810 int64_t ret_val = UserConfig_clone_ptr(&arg_conv);
17814 uint32_t __attribute__((visibility("default"))) TS_UserConfig_clone(uint32_t orig) {
17815 LDKUserConfig orig_conv;
17816 orig_conv.inner = (void*)(orig & (~1));
17817 orig_conv.is_owned = false;
17818 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
17819 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
17820 uint64_t ret_ref = 0;
17821 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17822 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17823 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17824 ret_ref = (uint64_t)ret_var.inner;
17825 if (ret_var.is_owned) {
17831 uint32_t __attribute__((visibility("default"))) TS_UserConfig_default() {
17832 LDKUserConfig ret_var = UserConfig_default();
17833 uint64_t ret_ref = 0;
17834 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17835 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17836 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17837 ret_ref = (uint64_t)ret_var.inner;
17838 if (ret_var.is_owned) {
17844 void __attribute__((visibility("default"))) TS_BestBlock_free(uint32_t this_obj) {
17845 LDKBestBlock this_obj_conv;
17846 this_obj_conv.inner = (void*)(this_obj & (~1));
17847 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17848 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17849 BestBlock_free(this_obj_conv);
17852 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
17853 LDKBestBlock ret_var = BestBlock_clone(arg);
17854 uint64_t ret_ref = 0;
17855 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17856 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17857 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17858 ret_ref = (uint64_t)ret_var.inner;
17859 if (ret_var.is_owned) {
17864 int64_t __attribute__((visibility("default"))) TS_BestBlock_clone_ptr(uint32_t arg) {
17865 LDKBestBlock arg_conv;
17866 arg_conv.inner = (void*)(arg & (~1));
17867 arg_conv.is_owned = false;
17868 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
17869 int64_t ret_val = BestBlock_clone_ptr(&arg_conv);
17873 uint32_t __attribute__((visibility("default"))) TS_BestBlock_clone(uint32_t orig) {
17874 LDKBestBlock orig_conv;
17875 orig_conv.inner = (void*)(orig & (~1));
17876 orig_conv.is_owned = false;
17877 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
17878 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
17879 uint64_t ret_ref = 0;
17880 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17881 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17882 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17883 ret_ref = (uint64_t)ret_var.inner;
17884 if (ret_var.is_owned) {
17890 uint32_t __attribute__((visibility("default"))) TS_BestBlock_from_genesis(uint32_t network) {
17891 LDKNetwork network_conv = LDKNetwork_from_js(network);
17892 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
17893 uint64_t ret_ref = 0;
17894 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17895 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17896 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17897 ret_ref = (uint64_t)ret_var.inner;
17898 if (ret_var.is_owned) {
17904 uint32_t __attribute__((visibility("default"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
17905 LDKThirtyTwoBytes block_hash_ref;
17906 CHECK(block_hash->arr_len == 32);
17907 memcpy(block_hash_ref.data, block_hash->elems, 32);
17908 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
17909 uint64_t ret_ref = 0;
17910 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17911 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17912 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17913 ret_ref = (uint64_t)ret_var.inner;
17914 if (ret_var.is_owned) {
17920 int8_tArray __attribute__((visibility("default"))) TS_BestBlock_block_hash(uint32_t this_arg) {
17921 LDKBestBlock this_arg_conv;
17922 this_arg_conv.inner = (void*)(this_arg & (~1));
17923 this_arg_conv.is_owned = false;
17924 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
17925 int8_tArray ret_arr = init_int8_tArray(32);
17926 memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
17930 int32_t __attribute__((visibility("default"))) TS_BestBlock_height(uint32_t this_arg) {
17931 LDKBestBlock this_arg_conv;
17932 this_arg_conv.inner = (void*)(this_arg & (~1));
17933 this_arg_conv.is_owned = false;
17934 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
17935 int32_t ret_val = BestBlock_height(&this_arg_conv);
17939 uint32_t __attribute__((visibility("default"))) TS_AccessError_clone(uint32_t orig) {
17940 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
17941 uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
17945 uint32_t __attribute__((visibility("default"))) TS_AccessError_unknown_chain() {
17946 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_chain());
17950 uint32_t __attribute__((visibility("default"))) TS_AccessError_unknown_tx() {
17951 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_tx());
17955 void __attribute__((visibility("default"))) TS_Access_free(uint32_t this_ptr) {
17956 if ((this_ptr & 1) != 0) return;
17957 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17958 CHECK_ACCESS(this_ptr_ptr);
17959 LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
17960 FREE((void*)this_ptr);
17961 Access_free(this_ptr_conv);
17964 void __attribute__((visibility("default"))) TS_Listen_free(uint32_t this_ptr) {
17965 if ((this_ptr & 1) != 0) return;
17966 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17967 CHECK_ACCESS(this_ptr_ptr);
17968 LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
17969 FREE((void*)this_ptr);
17970 Listen_free(this_ptr_conv);
17973 void __attribute__((visibility("default"))) TS_Confirm_free(uint32_t this_ptr) {
17974 if ((this_ptr & 1) != 0) return;
17975 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17976 CHECK_ACCESS(this_ptr_ptr);
17977 LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
17978 FREE((void*)this_ptr);
17979 Confirm_free(this_ptr_conv);
17982 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) {
17983 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
17984 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
17988 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_temporary_failure() {
17989 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_temporary_failure());
17993 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_permanent_failure() {
17994 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_permanent_failure());
17998 void __attribute__((visibility("default"))) TS_Watch_free(uint32_t this_ptr) {
17999 if ((this_ptr & 1) != 0) return;
18000 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18001 CHECK_ACCESS(this_ptr_ptr);
18002 LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
18003 FREE((void*)this_ptr);
18004 Watch_free(this_ptr_conv);
18007 void __attribute__((visibility("default"))) TS_Filter_free(uint32_t this_ptr) {
18008 if ((this_ptr & 1) != 0) return;
18009 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18010 CHECK_ACCESS(this_ptr_ptr);
18011 LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
18012 FREE((void*)this_ptr);
18013 Filter_free(this_ptr_conv);
18016 void __attribute__((visibility("default"))) TS_WatchedOutput_free(uint32_t this_obj) {
18017 LDKWatchedOutput this_obj_conv;
18018 this_obj_conv.inner = (void*)(this_obj & (~1));
18019 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18020 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18021 WatchedOutput_free(this_obj_conv);
18024 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_block_hash(uint32_t this_ptr) {
18025 LDKWatchedOutput this_ptr_conv;
18026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18027 this_ptr_conv.is_owned = false;
18028 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18029 int8_tArray ret_arr = init_int8_tArray(32);
18030 memcpy(ret_arr->elems, WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
18034 void __attribute__((visibility("default"))) TS_WatchedOutput_set_block_hash(uint32_t this_ptr, int8_tArray val) {
18035 LDKWatchedOutput this_ptr_conv;
18036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18037 this_ptr_conv.is_owned = false;
18038 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18039 LDKThirtyTwoBytes val_ref;
18040 CHECK(val->arr_len == 32);
18041 memcpy(val_ref.data, val->elems, 32);
18042 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
18045 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_get_outpoint(uint32_t this_ptr) {
18046 LDKWatchedOutput this_ptr_conv;
18047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18048 this_ptr_conv.is_owned = false;
18049 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18050 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
18051 uint64_t ret_ref = 0;
18052 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18053 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18054 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18055 ret_ref = (uint64_t)ret_var.inner;
18056 if (ret_var.is_owned) {
18062 void __attribute__((visibility("default"))) TS_WatchedOutput_set_outpoint(uint32_t this_ptr, uint32_t val) {
18063 LDKWatchedOutput this_ptr_conv;
18064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18065 this_ptr_conv.is_owned = false;
18066 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18067 LDKOutPoint val_conv;
18068 val_conv.inner = (void*)(val & (~1));
18069 val_conv.is_owned = (val & 1) || (val == 0);
18070 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
18071 val_conv = OutPoint_clone(&val_conv);
18072 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
18075 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_script_pubkey(uint32_t this_ptr) {
18076 LDKWatchedOutput this_ptr_conv;
18077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18078 this_ptr_conv.is_owned = false;
18079 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18080 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
18081 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
18082 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
18086 void __attribute__((visibility("default"))) TS_WatchedOutput_set_script_pubkey(uint32_t this_ptr, int8_tArray val) {
18087 LDKWatchedOutput this_ptr_conv;
18088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18089 this_ptr_conv.is_owned = false;
18090 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18091 LDKCVec_u8Z val_ref;
18092 val_ref.datalen = val->arr_len;
18093 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
18094 memcpy(val_ref.data, val->elems, val_ref.datalen);
18095 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
18098 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_new(int8_tArray block_hash_arg, uint32_t outpoint_arg, int8_tArray script_pubkey_arg) {
18099 LDKThirtyTwoBytes block_hash_arg_ref;
18100 CHECK(block_hash_arg->arr_len == 32);
18101 memcpy(block_hash_arg_ref.data, block_hash_arg->elems, 32);
18102 LDKOutPoint outpoint_arg_conv;
18103 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
18104 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
18105 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
18106 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
18107 LDKCVec_u8Z script_pubkey_arg_ref;
18108 script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
18109 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
18110 memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen);
18111 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
18112 uint64_t ret_ref = 0;
18113 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18114 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18115 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18116 ret_ref = (uint64_t)ret_var.inner;
18117 if (ret_var.is_owned) {
18123 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
18124 LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
18125 uint64_t ret_ref = 0;
18126 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18127 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18128 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18129 ret_ref = (uint64_t)ret_var.inner;
18130 if (ret_var.is_owned) {
18135 int64_t __attribute__((visibility("default"))) TS_WatchedOutput_clone_ptr(uint32_t arg) {
18136 LDKWatchedOutput arg_conv;
18137 arg_conv.inner = (void*)(arg & (~1));
18138 arg_conv.is_owned = false;
18139 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18140 int64_t ret_val = WatchedOutput_clone_ptr(&arg_conv);
18144 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_clone(uint32_t orig) {
18145 LDKWatchedOutput orig_conv;
18146 orig_conv.inner = (void*)(orig & (~1));
18147 orig_conv.is_owned = false;
18148 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18149 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
18150 uint64_t ret_ref = 0;
18151 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18152 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18153 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18154 ret_ref = (uint64_t)ret_var.inner;
18155 if (ret_var.is_owned) {
18161 int64_t __attribute__((visibility("default"))) TS_WatchedOutput_hash(uint32_t o) {
18162 LDKWatchedOutput o_conv;
18163 o_conv.inner = (void*)(o & (~1));
18164 o_conv.is_owned = false;
18165 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18166 int64_t ret_val = WatchedOutput_hash(&o_conv);
18170 void __attribute__((visibility("default"))) TS_BroadcasterInterface_free(uint32_t this_ptr) {
18171 if ((this_ptr & 1) != 0) return;
18172 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18173 CHECK_ACCESS(this_ptr_ptr);
18174 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
18175 FREE((void*)this_ptr);
18176 BroadcasterInterface_free(this_ptr_conv);
18179 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_clone(uint32_t orig) {
18180 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
18181 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
18185 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_background() {
18186 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
18190 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_normal() {
18191 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
18195 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_high_priority() {
18196 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
18200 jboolean __attribute__((visibility("default"))) TS_ConfirmationTarget_eq(uint32_t a, uint32_t b) {
18201 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
18202 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
18203 jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
18207 void __attribute__((visibility("default"))) TS_FeeEstimator_free(uint32_t this_ptr) {
18208 if ((this_ptr & 1) != 0) return;
18209 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18210 CHECK_ACCESS(this_ptr_ptr);
18211 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
18212 FREE((void*)this_ptr);
18213 FeeEstimator_free(this_ptr_conv);
18216 void __attribute__((visibility("default"))) TS_MonitorUpdateId_free(uint32_t this_obj) {
18217 LDKMonitorUpdateId this_obj_conv;
18218 this_obj_conv.inner = (void*)(this_obj & (~1));
18219 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18220 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18221 MonitorUpdateId_free(this_obj_conv);
18224 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
18225 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
18226 uint64_t ret_ref = 0;
18227 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18228 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18229 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18230 ret_ref = (uint64_t)ret_var.inner;
18231 if (ret_var.is_owned) {
18236 int64_t __attribute__((visibility("default"))) TS_MonitorUpdateId_clone_ptr(uint32_t arg) {
18237 LDKMonitorUpdateId arg_conv;
18238 arg_conv.inner = (void*)(arg & (~1));
18239 arg_conv.is_owned = false;
18240 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18241 int64_t ret_val = MonitorUpdateId_clone_ptr(&arg_conv);
18245 uint32_t __attribute__((visibility("default"))) TS_MonitorUpdateId_clone(uint32_t orig) {
18246 LDKMonitorUpdateId orig_conv;
18247 orig_conv.inner = (void*)(orig & (~1));
18248 orig_conv.is_owned = false;
18249 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18250 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
18251 uint64_t ret_ref = 0;
18252 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18253 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18254 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18255 ret_ref = (uint64_t)ret_var.inner;
18256 if (ret_var.is_owned) {
18262 int64_t __attribute__((visibility("default"))) TS_MonitorUpdateId_hash(uint32_t o) {
18263 LDKMonitorUpdateId o_conv;
18264 o_conv.inner = (void*)(o & (~1));
18265 o_conv.is_owned = false;
18266 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18267 int64_t ret_val = MonitorUpdateId_hash(&o_conv);
18271 jboolean __attribute__((visibility("default"))) TS_MonitorUpdateId_eq(uint32_t a, uint32_t b) {
18272 LDKMonitorUpdateId a_conv;
18273 a_conv.inner = (void*)(a & (~1));
18274 a_conv.is_owned = false;
18275 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18276 LDKMonitorUpdateId b_conv;
18277 b_conv.inner = (void*)(b & (~1));
18278 b_conv.is_owned = false;
18279 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
18280 jboolean ret_val = MonitorUpdateId_eq(&a_conv, &b_conv);
18284 void __attribute__((visibility("default"))) TS_Persist_free(uint32_t this_ptr) {
18285 if ((this_ptr & 1) != 0) return;
18286 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18287 CHECK_ACCESS(this_ptr_ptr);
18288 LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
18289 FREE((void*)this_ptr);
18290 Persist_free(this_ptr_conv);
18293 void __attribute__((visibility("default"))) TS_LockedChannelMonitor_free(uint32_t this_obj) {
18294 LDKLockedChannelMonitor this_obj_conv;
18295 this_obj_conv.inner = (void*)(this_obj & (~1));
18296 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18297 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18298 LockedChannelMonitor_free(this_obj_conv);
18301 void __attribute__((visibility("default"))) TS_ChainMonitor_free(uint32_t this_obj) {
18302 LDKChainMonitor this_obj_conv;
18303 this_obj_conv.inner = (void*)(this_obj & (~1));
18304 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18305 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18306 ChainMonitor_free(this_obj_conv);
18309 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_new(uint32_t chain_source, uint32_t broadcaster, uint32_t logger, uint32_t feeest, uint32_t persister) {
18310 void* chain_source_ptr = (void*)(((uint64_t)chain_source) & ~1);
18311 CHECK_ACCESS(chain_source_ptr);
18312 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
18313 // Warning: we may need a move here but no clone is available for LDKCOption_FilterZ
18314 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
18315 // Manually implement clone for Java trait instances
18317 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
18318 CHECK_ACCESS(broadcaster_ptr);
18319 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
18320 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
18321 CHECK_ACCESS(logger_ptr);
18322 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
18323 void* feeest_ptr = (void*)(((uint64_t)feeest) & ~1);
18324 CHECK_ACCESS(feeest_ptr);
18325 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
18326 void* persister_ptr = (void*)(((uint64_t)persister) & ~1);
18327 CHECK_ACCESS(persister_ptr);
18328 LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
18329 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
18330 uint64_t ret_ref = 0;
18331 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18332 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18333 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18334 ret_ref = (uint64_t)ret_var.inner;
18335 if (ret_var.is_owned) {
18341 uint32_tArray __attribute__((visibility("default"))) TS_ChainMonitor_get_claimable_balances(uint32_t this_arg, uint32_tArray ignored_channels) {
18342 LDKChainMonitor this_arg_conv;
18343 this_arg_conv.inner = (void*)(this_arg & (~1));
18344 this_arg_conv.is_owned = false;
18345 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18346 LDKCVec_ChannelDetailsZ ignored_channels_constr;
18347 ignored_channels_constr.datalen = ignored_channels->arr_len;
18348 if (ignored_channels_constr.datalen > 0)
18349 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
18351 ignored_channels_constr.data = NULL;
18352 uint32_t* ignored_channels_vals = ignored_channels->elems;
18353 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
18354 uint32_t ignored_channels_conv_16 = ignored_channels_vals[q];
18355 LDKChannelDetails ignored_channels_conv_16_conv;
18356 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
18357 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
18358 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
18359 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
18360 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
18362 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
18363 uint32_tArray ret_arr = NULL;
18364 ret_arr = init_uint32_tArray(ret_var.datalen);
18365 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
18366 for (size_t j = 0; j < ret_var.datalen; j++) {
18367 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
18368 *ret_conv_9_copy = ret_var.data[j];
18369 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
18370 ret_arr_ptr[j] = ret_conv_9_ref;
18373 FREE(ret_var.data);
18377 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_get_monitor(uint32_t this_arg, uint32_t funding_txo) {
18378 LDKChainMonitor this_arg_conv;
18379 this_arg_conv.inner = (void*)(this_arg & (~1));
18380 this_arg_conv.is_owned = false;
18381 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18382 LDKOutPoint funding_txo_conv;
18383 funding_txo_conv.inner = (void*)(funding_txo & (~1));
18384 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
18385 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
18386 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
18387 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
18388 *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
18389 return (uint64_t)ret_conv;
18392 uint32_tArray __attribute__((visibility("default"))) TS_ChainMonitor_list_monitors(uint32_t this_arg) {
18393 LDKChainMonitor this_arg_conv;
18394 this_arg_conv.inner = (void*)(this_arg & (~1));
18395 this_arg_conv.is_owned = false;
18396 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18397 LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
18398 uint32_tArray ret_arr = NULL;
18399 ret_arr = init_uint32_tArray(ret_var.datalen);
18400 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
18401 for (size_t k = 0; k < ret_var.datalen; k++) {
18402 LDKOutPoint ret_conv_10_var = ret_var.data[k];
18403 uint64_t ret_conv_10_ref = 0;
18404 CHECK((((uint64_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18405 CHECK((((uint64_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18406 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
18407 ret_conv_10_ref = (uint64_t)ret_conv_10_var.inner;
18408 if (ret_conv_10_var.is_owned) {
18409 ret_conv_10_ref |= 1;
18411 ret_arr_ptr[k] = ret_conv_10_ref;
18414 FREE(ret_var.data);
18418 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_channel_monitor_updated(uint32_t this_arg, uint32_t funding_txo, uint32_t completed_update_id) {
18419 LDKChainMonitor this_arg_conv;
18420 this_arg_conv.inner = (void*)(this_arg & (~1));
18421 this_arg_conv.is_owned = false;
18422 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18423 LDKOutPoint funding_txo_conv;
18424 funding_txo_conv.inner = (void*)(funding_txo & (~1));
18425 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
18426 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
18427 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
18428 LDKMonitorUpdateId completed_update_id_conv;
18429 completed_update_id_conv.inner = (void*)(completed_update_id & (~1));
18430 completed_update_id_conv.is_owned = (completed_update_id & 1) || (completed_update_id == 0);
18431 CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
18432 completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
18433 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18434 *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
18435 return (uint64_t)ret_conv;
18438 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Listen(uint32_t this_arg) {
18439 LDKChainMonitor this_arg_conv;
18440 this_arg_conv.inner = (void*)(this_arg & (~1));
18441 this_arg_conv.is_owned = false;
18442 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18443 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
18444 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
18445 return (uint64_t)ret_ret;
18448 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Confirm(uint32_t this_arg) {
18449 LDKChainMonitor this_arg_conv;
18450 this_arg_conv.inner = (void*)(this_arg & (~1));
18451 this_arg_conv.is_owned = false;
18452 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18453 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
18454 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
18455 return (uint64_t)ret_ret;
18458 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Watch(uint32_t this_arg) {
18459 LDKChainMonitor this_arg_conv;
18460 this_arg_conv.inner = (void*)(this_arg & (~1));
18461 this_arg_conv.is_owned = false;
18462 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18463 LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
18464 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
18465 return (uint64_t)ret_ret;
18468 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_EventsProvider(uint32_t this_arg) {
18469 LDKChainMonitor this_arg_conv;
18470 this_arg_conv.inner = (void*)(this_arg & (~1));
18471 this_arg_conv.is_owned = false;
18472 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18473 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
18474 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
18475 return (uint64_t)ret_ret;
18478 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_free(uint32_t this_obj) {
18479 LDKChannelMonitorUpdate this_obj_conv;
18480 this_obj_conv.inner = (void*)(this_obj & (~1));
18481 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18482 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18483 ChannelMonitorUpdate_free(this_obj_conv);
18486 int64_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_get_update_id(uint32_t this_ptr) {
18487 LDKChannelMonitorUpdate this_ptr_conv;
18488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18489 this_ptr_conv.is_owned = false;
18490 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18491 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
18495 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_set_update_id(uint32_t this_ptr, int64_t val) {
18496 LDKChannelMonitorUpdate this_ptr_conv;
18497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18498 this_ptr_conv.is_owned = false;
18499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18500 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
18503 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
18504 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
18505 uint64_t ret_ref = 0;
18506 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18507 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18508 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18509 ret_ref = (uint64_t)ret_var.inner;
18510 if (ret_var.is_owned) {
18515 int64_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_clone_ptr(uint32_t arg) {
18516 LDKChannelMonitorUpdate arg_conv;
18517 arg_conv.inner = (void*)(arg & (~1));
18518 arg_conv.is_owned = false;
18519 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18520 int64_t ret_val = ChannelMonitorUpdate_clone_ptr(&arg_conv);
18524 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_clone(uint32_t orig) {
18525 LDKChannelMonitorUpdate orig_conv;
18526 orig_conv.inner = (void*)(orig & (~1));
18527 orig_conv.is_owned = false;
18528 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18529 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
18530 uint64_t ret_ref = 0;
18531 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18532 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18533 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18534 ret_ref = (uint64_t)ret_var.inner;
18535 if (ret_var.is_owned) {
18541 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_write(uint32_t obj) {
18542 LDKChannelMonitorUpdate obj_conv;
18543 obj_conv.inner = (void*)(obj & (~1));
18544 obj_conv.is_owned = false;
18545 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
18546 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
18547 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
18548 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
18549 CVec_u8Z_free(ret_var);
18553 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
18554 LDKu8slice ser_ref;
18555 ser_ref.datalen = ser->arr_len;
18556 ser_ref.data = ser->elems;
18557 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
18558 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
18559 return (uint64_t)ret_conv;
18562 void __attribute__((visibility("default"))) TS_MonitorEvent_free(uint32_t this_ptr) {
18563 if ((this_ptr & 1) != 0) return;
18564 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18565 CHECK_ACCESS(this_ptr_ptr);
18566 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
18567 FREE((void*)this_ptr);
18568 MonitorEvent_free(this_ptr_conv);
18571 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
18572 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18573 *ret_copy = MonitorEvent_clone(arg);
18574 uint64_t ret_ref = (uint64_t)ret_copy;
18577 int64_t __attribute__((visibility("default"))) TS_MonitorEvent_clone_ptr(uint32_t arg) {
18578 LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)arg;
18579 int64_t ret_val = MonitorEvent_clone_ptr(arg_conv);
18583 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_clone(uint32_t orig) {
18584 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
18585 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18586 *ret_copy = MonitorEvent_clone(orig_conv);
18587 uint64_t ret_ref = (uint64_t)ret_copy;
18591 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_htlcevent(uint32_t a) {
18592 LDKHTLCUpdate a_conv;
18593 a_conv.inner = (void*)(a & (~1));
18594 a_conv.is_owned = (a & 1) || (a == 0);
18595 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18596 a_conv = HTLCUpdate_clone(&a_conv);
18597 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18598 *ret_copy = MonitorEvent_htlcevent(a_conv);
18599 uint64_t ret_ref = (uint64_t)ret_copy;
18603 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_commitment_tx_confirmed(uint32_t a) {
18604 LDKOutPoint a_conv;
18605 a_conv.inner = (void*)(a & (~1));
18606 a_conv.is_owned = (a & 1) || (a == 0);
18607 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18608 a_conv = OutPoint_clone(&a_conv);
18609 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18610 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
18611 uint64_t ret_ref = (uint64_t)ret_copy;
18615 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_update_completed(uint32_t funding_txo, int64_t monitor_update_id) {
18616 LDKOutPoint funding_txo_conv;
18617 funding_txo_conv.inner = (void*)(funding_txo & (~1));
18618 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
18619 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
18620 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
18621 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18622 *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id);
18623 uint64_t ret_ref = (uint64_t)ret_copy;
18627 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_update_failed(uint32_t a) {
18628 LDKOutPoint a_conv;
18629 a_conv.inner = (void*)(a & (~1));
18630 a_conv.is_owned = (a & 1) || (a == 0);
18631 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18632 a_conv = OutPoint_clone(&a_conv);
18633 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18634 *ret_copy = MonitorEvent_update_failed(a_conv);
18635 uint64_t ret_ref = (uint64_t)ret_copy;
18639 int8_tArray __attribute__((visibility("default"))) TS_MonitorEvent_write(uint32_t obj) {
18640 LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)obj;
18641 LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
18642 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
18643 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
18644 CVec_u8Z_free(ret_var);
18648 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_read(int8_tArray ser) {
18649 LDKu8slice ser_ref;
18650 ser_ref.datalen = ser->arr_len;
18651 ser_ref.data = ser->elems;
18652 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
18653 *ret_conv = MonitorEvent_read(ser_ref);
18654 return (uint64_t)ret_conv;
18657 void __attribute__((visibility("default"))) TS_HTLCUpdate_free(uint32_t this_obj) {
18658 LDKHTLCUpdate this_obj_conv;
18659 this_obj_conv.inner = (void*)(this_obj & (~1));
18660 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18661 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18662 HTLCUpdate_free(this_obj_conv);
18665 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
18666 LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
18667 uint64_t ret_ref = 0;
18668 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18669 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18670 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18671 ret_ref = (uint64_t)ret_var.inner;
18672 if (ret_var.is_owned) {
18677 int64_t __attribute__((visibility("default"))) TS_HTLCUpdate_clone_ptr(uint32_t arg) {
18678 LDKHTLCUpdate arg_conv;
18679 arg_conv.inner = (void*)(arg & (~1));
18680 arg_conv.is_owned = false;
18681 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18682 int64_t ret_val = HTLCUpdate_clone_ptr(&arg_conv);
18686 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_clone(uint32_t orig) {
18687 LDKHTLCUpdate orig_conv;
18688 orig_conv.inner = (void*)(orig & (~1));
18689 orig_conv.is_owned = false;
18690 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18691 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
18692 uint64_t ret_ref = 0;
18693 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18694 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18695 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18696 ret_ref = (uint64_t)ret_var.inner;
18697 if (ret_var.is_owned) {
18703 int8_tArray __attribute__((visibility("default"))) TS_HTLCUpdate_write(uint32_t obj) {
18704 LDKHTLCUpdate obj_conv;
18705 obj_conv.inner = (void*)(obj & (~1));
18706 obj_conv.is_owned = false;
18707 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
18708 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
18709 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
18710 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
18711 CVec_u8Z_free(ret_var);
18715 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_read(int8_tArray ser) {
18716 LDKu8slice ser_ref;
18717 ser_ref.datalen = ser->arr_len;
18718 ser_ref.data = ser->elems;
18719 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
18720 *ret_conv = HTLCUpdate_read(ser_ref);
18721 return (uint64_t)ret_conv;
18724 void __attribute__((visibility("default"))) TS_Balance_free(uint32_t this_ptr) {
18725 if ((this_ptr & 1) != 0) return;
18726 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18727 CHECK_ACCESS(this_ptr_ptr);
18728 LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
18729 FREE((void*)this_ptr);
18730 Balance_free(this_ptr_conv);
18733 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
18734 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
18735 *ret_copy = Balance_clone(arg);
18736 uint64_t ret_ref = (uint64_t)ret_copy;
18739 int64_t __attribute__((visibility("default"))) TS_Balance_clone_ptr(uint32_t arg) {
18740 LDKBalance* arg_conv = (LDKBalance*)arg;
18741 int64_t ret_val = Balance_clone_ptr(arg_conv);
18745 uint32_t __attribute__((visibility("default"))) TS_Balance_clone(uint32_t orig) {
18746 LDKBalance* orig_conv = (LDKBalance*)orig;
18747 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
18748 *ret_copy = Balance_clone(orig_conv);
18749 uint64_t ret_ref = (uint64_t)ret_copy;
18753 uint32_t __attribute__((visibility("default"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
18754 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
18755 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
18756 uint64_t ret_ref = (uint64_t)ret_copy;
18760 uint32_t __attribute__((visibility("default"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
18761 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
18762 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
18763 uint64_t ret_ref = (uint64_t)ret_copy;
18767 uint32_t __attribute__((visibility("default"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
18768 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
18769 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
18770 uint64_t ret_ref = (uint64_t)ret_copy;
18774 uint32_t __attribute__((visibility("default"))) TS_Balance_maybe_claimable_htlcawaiting_timeout(int64_t claimable_amount_satoshis, int32_t claimable_height) {
18775 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
18776 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
18777 uint64_t ret_ref = (uint64_t)ret_copy;
18781 jboolean __attribute__((visibility("default"))) TS_Balance_eq(uint32_t a, uint32_t b) {
18782 LDKBalance* a_conv = (LDKBalance*)a;
18783 LDKBalance* b_conv = (LDKBalance*)b;
18784 jboolean ret_val = Balance_eq(a_conv, b_conv);
18788 void __attribute__((visibility("default"))) TS_ChannelMonitor_free(uint32_t this_obj) {
18789 LDKChannelMonitor this_obj_conv;
18790 this_obj_conv.inner = (void*)(this_obj & (~1));
18791 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18792 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18793 ChannelMonitor_free(this_obj_conv);
18796 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
18797 LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
18798 uint64_t ret_ref = 0;
18799 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18800 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18801 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18802 ret_ref = (uint64_t)ret_var.inner;
18803 if (ret_var.is_owned) {
18808 int64_t __attribute__((visibility("default"))) TS_ChannelMonitor_clone_ptr(uint32_t arg) {
18809 LDKChannelMonitor arg_conv;
18810 arg_conv.inner = (void*)(arg & (~1));
18811 arg_conv.is_owned = false;
18812 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18813 int64_t ret_val = ChannelMonitor_clone_ptr(&arg_conv);
18817 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_clone(uint32_t orig) {
18818 LDKChannelMonitor orig_conv;
18819 orig_conv.inner = (void*)(orig & (~1));
18820 orig_conv.is_owned = false;
18821 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18822 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
18823 uint64_t ret_ref = 0;
18824 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18825 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18826 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18827 ret_ref = (uint64_t)ret_var.inner;
18828 if (ret_var.is_owned) {
18834 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_write(uint32_t obj) {
18835 LDKChannelMonitor obj_conv;
18836 obj_conv.inner = (void*)(obj & (~1));
18837 obj_conv.is_owned = false;
18838 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
18839 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
18840 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
18841 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
18842 CVec_u8Z_free(ret_var);
18846 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_update_monitor(uint32_t this_arg, uint32_t updates, uint32_t broadcaster, uint32_t fee_estimator, uint32_t logger) {
18847 LDKChannelMonitor this_arg_conv;
18848 this_arg_conv.inner = (void*)(this_arg & (~1));
18849 this_arg_conv.is_owned = false;
18850 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18851 LDKChannelMonitorUpdate updates_conv;
18852 updates_conv.inner = (void*)(updates & (~1));
18853 updates_conv.is_owned = false;
18854 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
18855 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
18856 if (!(broadcaster & 1)) { CHECK_ACCESS(broadcaster_ptr); }
18857 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
18858 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
18859 if (!(fee_estimator & 1)) { CHECK_ACCESS(fee_estimator_ptr); }
18860 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
18861 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
18862 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
18863 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
18864 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
18865 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
18866 return (uint64_t)ret_conv;
18869 int64_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_update_id(uint32_t this_arg) {
18870 LDKChannelMonitor this_arg_conv;
18871 this_arg_conv.inner = (void*)(this_arg & (~1));
18872 this_arg_conv.is_owned = false;
18873 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18874 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
18878 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_funding_txo(uint32_t this_arg) {
18879 LDKChannelMonitor this_arg_conv;
18880 this_arg_conv.inner = (void*)(this_arg & (~1));
18881 this_arg_conv.is_owned = false;
18882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18883 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
18884 *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
18885 return ((uint64_t)ret_conv);
18888 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_outputs_to_watch(uint32_t this_arg) {
18889 LDKChannelMonitor this_arg_conv;
18890 this_arg_conv.inner = (void*)(this_arg & (~1));
18891 this_arg_conv.is_owned = false;
18892 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18893 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
18894 uint32_tArray ret_arr = NULL;
18895 ret_arr = init_uint32_tArray(ret_var.datalen);
18896 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
18897 for (size_t o = 0; o < ret_var.datalen; o++) {
18898 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
18899 *ret_conv_40_conv = ret_var.data[o];
18900 ret_arr_ptr[o] = ((uint64_t)ret_conv_40_conv);
18903 FREE(ret_var.data);
18907 void __attribute__((visibility("default"))) TS_ChannelMonitor_load_outputs_to_watch(uint32_t this_arg, uint32_t filter) {
18908 LDKChannelMonitor this_arg_conv;
18909 this_arg_conv.inner = (void*)(this_arg & (~1));
18910 this_arg_conv.is_owned = false;
18911 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18912 void* filter_ptr = (void*)(((uint64_t)filter) & ~1);
18913 if (!(filter & 1)) { CHECK_ACCESS(filter_ptr); }
18914 LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
18915 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
18918 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_monitor_events(uint32_t this_arg) {
18919 LDKChannelMonitor this_arg_conv;
18920 this_arg_conv.inner = (void*)(this_arg & (~1));
18921 this_arg_conv.is_owned = false;
18922 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18923 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
18924 uint32_tArray ret_arr = NULL;
18925 ret_arr = init_uint32_tArray(ret_var.datalen);
18926 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
18927 for (size_t o = 0; o < ret_var.datalen; o++) {
18928 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18929 *ret_conv_14_copy = ret_var.data[o];
18930 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
18931 ret_arr_ptr[o] = ret_conv_14_ref;
18934 FREE(ret_var.data);
18938 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_events(uint32_t this_arg) {
18939 LDKChannelMonitor this_arg_conv;
18940 this_arg_conv.inner = (void*)(this_arg & (~1));
18941 this_arg_conv.is_owned = false;
18942 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18943 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
18944 uint32_tArray ret_arr = NULL;
18945 ret_arr = init_uint32_tArray(ret_var.datalen);
18946 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
18947 for (size_t h = 0; h < ret_var.datalen; h++) {
18948 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
18949 *ret_conv_7_copy = ret_var.data[h];
18950 uint64_t ret_conv_7_ref = (uint64_t)ret_conv_7_copy;
18951 ret_arr_ptr[h] = ret_conv_7_ref;
18954 FREE(ret_var.data);
18958 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_holder_commitment_txn(uint32_t this_arg, uint32_t logger) {
18959 LDKChannelMonitor this_arg_conv;
18960 this_arg_conv.inner = (void*)(this_arg & (~1));
18961 this_arg_conv.is_owned = false;
18962 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18963 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
18964 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
18965 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
18966 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
18967 ptrArray ret_arr = NULL;
18968 ret_arr = init_ptrArray(ret_var.datalen);
18969 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
18970 for (size_t m = 0; m < ret_var.datalen; m++) {
18971 LDKTransaction ret_conv_12_var = ret_var.data[m];
18972 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen);
18973 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
18974 Transaction_free(ret_conv_12_var);
18975 ret_arr_ptr[m] = ret_conv_12_arr;
18978 FREE(ret_var.data);
18982 uint32_tArray __attribute__((visibility("default"))) 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) {
18983 LDKChannelMonitor this_arg_conv;
18984 this_arg_conv.inner = (void*)(this_arg & (~1));
18985 this_arg_conv.is_owned = false;
18986 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18987 unsigned char header_arr[80];
18988 CHECK(header->arr_len == 80);
18989 memcpy(header_arr, header->elems, 80);
18990 unsigned char (*header_ref)[80] = &header_arr;
18991 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
18992 txdata_constr.datalen = txdata->arr_len;
18993 if (txdata_constr.datalen > 0)
18994 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
18996 txdata_constr.data = NULL;
18997 uint32_t* txdata_vals = txdata->elems;
18998 for (size_t c = 0; c < txdata_constr.datalen; c++) {
18999 uint32_t txdata_conv_28 = txdata_vals[c];
19000 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
19001 CHECK_ACCESS(txdata_conv_28_ptr);
19002 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
19003 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
19004 txdata_constr.data[c] = txdata_conv_28_conv;
19006 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19007 CHECK_ACCESS(broadcaster_ptr);
19008 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19009 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19010 CHECK_ACCESS(fee_estimator_ptr);
19011 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19012 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19013 CHECK_ACCESS(logger_ptr);
19014 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19015 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);
19016 uint32_tArray ret_arr = NULL;
19017 ret_arr = init_uint32_tArray(ret_var.datalen);
19018 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
19019 for (size_t n = 0; n < ret_var.datalen; n++) {
19020 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19021 *ret_conv_39_conv = ret_var.data[n];
19022 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
19025 FREE(ret_var.data);
19029 void __attribute__((visibility("default"))) TS_ChannelMonitor_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height, uint32_t broadcaster, uint32_t fee_estimator, uint32_t logger) {
19030 LDKChannelMonitor this_arg_conv;
19031 this_arg_conv.inner = (void*)(this_arg & (~1));
19032 this_arg_conv.is_owned = false;
19033 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19034 unsigned char header_arr[80];
19035 CHECK(header->arr_len == 80);
19036 memcpy(header_arr, header->elems, 80);
19037 unsigned char (*header_ref)[80] = &header_arr;
19038 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19039 CHECK_ACCESS(broadcaster_ptr);
19040 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19041 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19042 CHECK_ACCESS(fee_estimator_ptr);
19043 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19044 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19045 CHECK_ACCESS(logger_ptr);
19046 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19047 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
19050 uint32_tArray __attribute__((visibility("default"))) 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) {
19051 LDKChannelMonitor this_arg_conv;
19052 this_arg_conv.inner = (void*)(this_arg & (~1));
19053 this_arg_conv.is_owned = false;
19054 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19055 unsigned char header_arr[80];
19056 CHECK(header->arr_len == 80);
19057 memcpy(header_arr, header->elems, 80);
19058 unsigned char (*header_ref)[80] = &header_arr;
19059 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
19060 txdata_constr.datalen = txdata->arr_len;
19061 if (txdata_constr.datalen > 0)
19062 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
19064 txdata_constr.data = NULL;
19065 uint32_t* txdata_vals = txdata->elems;
19066 for (size_t c = 0; c < txdata_constr.datalen; c++) {
19067 uint32_t txdata_conv_28 = txdata_vals[c];
19068 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
19069 CHECK_ACCESS(txdata_conv_28_ptr);
19070 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
19071 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
19072 txdata_constr.data[c] = txdata_conv_28_conv;
19074 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19075 CHECK_ACCESS(broadcaster_ptr);
19076 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19077 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19078 CHECK_ACCESS(fee_estimator_ptr);
19079 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19080 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19081 CHECK_ACCESS(logger_ptr);
19082 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19083 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);
19084 uint32_tArray ret_arr = NULL;
19085 ret_arr = init_uint32_tArray(ret_var.datalen);
19086 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
19087 for (size_t n = 0; n < ret_var.datalen; n++) {
19088 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19089 *ret_conv_39_conv = ret_var.data[n];
19090 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
19093 FREE(ret_var.data);
19097 void __attribute__((visibility("default"))) TS_ChannelMonitor_transaction_unconfirmed(uint32_t this_arg, int8_tArray txid, uint32_t broadcaster, uint32_t fee_estimator, uint32_t logger) {
19098 LDKChannelMonitor this_arg_conv;
19099 this_arg_conv.inner = (void*)(this_arg & (~1));
19100 this_arg_conv.is_owned = false;
19101 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19102 unsigned char txid_arr[32];
19103 CHECK(txid->arr_len == 32);
19104 memcpy(txid_arr, txid->elems, 32);
19105 unsigned char (*txid_ref)[32] = &txid_arr;
19106 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19107 CHECK_ACCESS(broadcaster_ptr);
19108 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19109 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19110 CHECK_ACCESS(fee_estimator_ptr);
19111 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19112 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19113 CHECK_ACCESS(logger_ptr);
19114 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19115 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
19118 uint32_tArray __attribute__((visibility("default"))) 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) {
19119 LDKChannelMonitor this_arg_conv;
19120 this_arg_conv.inner = (void*)(this_arg & (~1));
19121 this_arg_conv.is_owned = false;
19122 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19123 unsigned char header_arr[80];
19124 CHECK(header->arr_len == 80);
19125 memcpy(header_arr, header->elems, 80);
19126 unsigned char (*header_ref)[80] = &header_arr;
19127 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19128 CHECK_ACCESS(broadcaster_ptr);
19129 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19130 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19131 CHECK_ACCESS(fee_estimator_ptr);
19132 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19133 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19134 CHECK_ACCESS(logger_ptr);
19135 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19136 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
19137 uint32_tArray ret_arr = NULL;
19138 ret_arr = init_uint32_tArray(ret_var.datalen);
19139 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
19140 for (size_t n = 0; n < ret_var.datalen; n++) {
19141 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19142 *ret_conv_39_conv = ret_var.data[n];
19143 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
19146 FREE(ret_var.data);
19150 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_relevant_txids(uint32_t this_arg) {
19151 LDKChannelMonitor this_arg_conv;
19152 this_arg_conv.inner = (void*)(this_arg & (~1));
19153 this_arg_conv.is_owned = false;
19154 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19155 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
19156 ptrArray ret_arr = NULL;
19157 ret_arr = init_ptrArray(ret_var.datalen);
19158 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
19159 for (size_t m = 0; m < ret_var.datalen; m++) {
19160 int8_tArray ret_conv_12_arr = init_int8_tArray(32);
19161 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
19162 ret_arr_ptr[m] = ret_conv_12_arr;
19165 FREE(ret_var.data);
19169 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_current_best_block(uint32_t this_arg) {
19170 LDKChannelMonitor this_arg_conv;
19171 this_arg_conv.inner = (void*)(this_arg & (~1));
19172 this_arg_conv.is_owned = false;
19173 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19174 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
19175 uint64_t ret_ref = 0;
19176 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19177 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19178 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19179 ret_ref = (uint64_t)ret_var.inner;
19180 if (ret_var.is_owned) {
19186 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_claimable_balances(uint32_t this_arg) {
19187 LDKChannelMonitor this_arg_conv;
19188 this_arg_conv.inner = (void*)(this_arg & (~1));
19189 this_arg_conv.is_owned = false;
19190 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19191 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
19192 uint32_tArray ret_arr = NULL;
19193 ret_arr = init_uint32_tArray(ret_var.datalen);
19194 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
19195 for (size_t j = 0; j < ret_var.datalen; j++) {
19196 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
19197 *ret_conv_9_copy = ret_var.data[j];
19198 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
19199 ret_arr_ptr[j] = ret_conv_9_ref;
19202 FREE(ret_var.data);
19206 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint32_t arg) {
19207 LDKu8slice ser_ref;
19208 ser_ref.datalen = ser->arr_len;
19209 ser_ref.data = ser->elems;
19210 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
19211 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
19212 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
19213 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19214 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
19215 return (uint64_t)ret_conv;
19218 void __attribute__((visibility("default"))) TS_OutPoint_free(uint32_t this_obj) {
19219 LDKOutPoint this_obj_conv;
19220 this_obj_conv.inner = (void*)(this_obj & (~1));
19221 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19222 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
19223 OutPoint_free(this_obj_conv);
19226 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_get_txid(uint32_t this_ptr) {
19227 LDKOutPoint this_ptr_conv;
19228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19229 this_ptr_conv.is_owned = false;
19230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19231 int8_tArray ret_arr = init_int8_tArray(32);
19232 memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
19236 void __attribute__((visibility("default"))) TS_OutPoint_set_txid(uint32_t this_ptr, int8_tArray val) {
19237 LDKOutPoint this_ptr_conv;
19238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19239 this_ptr_conv.is_owned = false;
19240 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19241 LDKThirtyTwoBytes val_ref;
19242 CHECK(val->arr_len == 32);
19243 memcpy(val_ref.data, val->elems, 32);
19244 OutPoint_set_txid(&this_ptr_conv, val_ref);
19247 int16_t __attribute__((visibility("default"))) TS_OutPoint_get_index(uint32_t this_ptr) {
19248 LDKOutPoint this_ptr_conv;
19249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19250 this_ptr_conv.is_owned = false;
19251 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19252 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
19256 void __attribute__((visibility("default"))) TS_OutPoint_set_index(uint32_t this_ptr, int16_t val) {
19257 LDKOutPoint this_ptr_conv;
19258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19259 this_ptr_conv.is_owned = false;
19260 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19261 OutPoint_set_index(&this_ptr_conv, val);
19264 uint32_t __attribute__((visibility("default"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
19265 LDKThirtyTwoBytes txid_arg_ref;
19266 CHECK(txid_arg->arr_len == 32);
19267 memcpy(txid_arg_ref.data, txid_arg->elems, 32);
19268 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
19269 uint64_t ret_ref = 0;
19270 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19271 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19272 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19273 ret_ref = (uint64_t)ret_var.inner;
19274 if (ret_var.is_owned) {
19280 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
19281 LDKOutPoint ret_var = OutPoint_clone(arg);
19282 uint64_t ret_ref = 0;
19283 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19284 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19285 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19286 ret_ref = (uint64_t)ret_var.inner;
19287 if (ret_var.is_owned) {
19292 int64_t __attribute__((visibility("default"))) TS_OutPoint_clone_ptr(uint32_t arg) {
19293 LDKOutPoint arg_conv;
19294 arg_conv.inner = (void*)(arg & (~1));
19295 arg_conv.is_owned = false;
19296 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
19297 int64_t ret_val = OutPoint_clone_ptr(&arg_conv);
19301 uint32_t __attribute__((visibility("default"))) TS_OutPoint_clone(uint32_t orig) {
19302 LDKOutPoint orig_conv;
19303 orig_conv.inner = (void*)(orig & (~1));
19304 orig_conv.is_owned = false;
19305 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
19306 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
19307 uint64_t ret_ref = 0;
19308 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19309 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19310 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19311 ret_ref = (uint64_t)ret_var.inner;
19312 if (ret_var.is_owned) {
19318 jboolean __attribute__((visibility("default"))) TS_OutPoint_eq(uint32_t a, uint32_t b) {
19319 LDKOutPoint a_conv;
19320 a_conv.inner = (void*)(a & (~1));
19321 a_conv.is_owned = false;
19322 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19323 LDKOutPoint b_conv;
19324 b_conv.inner = (void*)(b & (~1));
19325 b_conv.is_owned = false;
19326 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
19327 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
19331 int64_t __attribute__((visibility("default"))) TS_OutPoint_hash(uint32_t o) {
19332 LDKOutPoint o_conv;
19333 o_conv.inner = (void*)(o & (~1));
19334 o_conv.is_owned = false;
19335 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19336 int64_t ret_val = OutPoint_hash(&o_conv);
19340 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_to_channel_id(uint32_t this_arg) {
19341 LDKOutPoint this_arg_conv;
19342 this_arg_conv.inner = (void*)(this_arg & (~1));
19343 this_arg_conv.is_owned = false;
19344 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19345 int8_tArray ret_arr = init_int8_tArray(32);
19346 memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
19350 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_write(uint32_t obj) {
19351 LDKOutPoint obj_conv;
19352 obj_conv.inner = (void*)(obj & (~1));
19353 obj_conv.is_owned = false;
19354 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
19355 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
19356 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
19357 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
19358 CVec_u8Z_free(ret_var);
19362 uint32_t __attribute__((visibility("default"))) TS_OutPoint_read(int8_tArray ser) {
19363 LDKu8slice ser_ref;
19364 ser_ref.datalen = ser->arr_len;
19365 ser_ref.data = ser->elems;
19366 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
19367 *ret_conv = OutPoint_read(ser_ref);
19368 return (uint64_t)ret_conv;
19371 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_free(uint32_t this_obj) {
19372 LDKDelayedPaymentOutputDescriptor this_obj_conv;
19373 this_obj_conv.inner = (void*)(this_obj & (~1));
19374 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19375 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
19376 DelayedPaymentOutputDescriptor_free(this_obj_conv);
19379 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
19380 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19382 this_ptr_conv.is_owned = false;
19383 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19384 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
19385 uint64_t ret_ref = 0;
19386 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19387 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19388 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19389 ret_ref = (uint64_t)ret_var.inner;
19390 if (ret_var.is_owned) {
19396 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
19397 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19399 this_ptr_conv.is_owned = false;
19400 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19401 LDKOutPoint val_conv;
19402 val_conv.inner = (void*)(val & (~1));
19403 val_conv.is_owned = (val & 1) || (val == 0);
19404 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
19405 val_conv = OutPoint_clone(&val_conv);
19406 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
19409 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint32_t this_ptr) {
19410 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19412 this_ptr_conv.is_owned = false;
19413 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19414 int8_tArray ret_arr = init_int8_tArray(33);
19415 memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
19419 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
19420 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19422 this_ptr_conv.is_owned = false;
19423 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19424 LDKPublicKey val_ref;
19425 CHECK(val->arr_len == 33);
19426 memcpy(val_ref.compressed_form, val->elems, 33);
19427 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
19430 int16_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint32_t this_ptr) {
19431 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19433 this_ptr_conv.is_owned = false;
19434 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19435 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
19439 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint32_t this_ptr, int16_t val) {
19440 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19442 this_ptr_conv.is_owned = false;
19443 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19444 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
19447 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
19448 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19450 this_ptr_conv.is_owned = false;
19451 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19452 void* val_ptr = (void*)(((uint64_t)val) & ~1);
19453 CHECK_ACCESS(val_ptr);
19454 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
19455 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
19456 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
19459 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint32_t this_ptr) {
19460 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19462 this_ptr_conv.is_owned = false;
19463 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19464 int8_tArray ret_arr = init_int8_tArray(33);
19465 memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
19469 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint32_t this_ptr, int8_tArray val) {
19470 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19472 this_ptr_conv.is_owned = false;
19473 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19474 LDKPublicKey val_ref;
19475 CHECK(val->arr_len == 33);
19476 memcpy(val_ref.compressed_form, val->elems, 33);
19477 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
19480 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
19481 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19483 this_ptr_conv.is_owned = false;
19484 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19485 int8_tArray ret_arr = init_int8_tArray(32);
19486 memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
19490 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
19491 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19493 this_ptr_conv.is_owned = false;
19494 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19495 LDKThirtyTwoBytes val_ref;
19496 CHECK(val->arr_len == 32);
19497 memcpy(val_ref.data, val->elems, 32);
19498 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
19501 int64_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
19502 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19504 this_ptr_conv.is_owned = false;
19505 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19506 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
19510 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
19511 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19513 this_ptr_conv.is_owned = false;
19514 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19515 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
19518 uint32_t __attribute__((visibility("default"))) 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) {
19519 LDKOutPoint outpoint_arg_conv;
19520 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
19521 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
19522 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
19523 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
19524 LDKPublicKey per_commitment_point_arg_ref;
19525 CHECK(per_commitment_point_arg->arr_len == 33);
19526 memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33);
19527 void* output_arg_ptr = (void*)(((uint64_t)output_arg) & ~1);
19528 CHECK_ACCESS(output_arg_ptr);
19529 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
19530 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
19531 LDKPublicKey revocation_pubkey_arg_ref;
19532 CHECK(revocation_pubkey_arg->arr_len == 33);
19533 memcpy(revocation_pubkey_arg_ref.compressed_form, revocation_pubkey_arg->elems, 33);
19534 LDKThirtyTwoBytes channel_keys_id_arg_ref;
19535 CHECK(channel_keys_id_arg->arr_len == 32);
19536 memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32);
19537 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);
19538 uint64_t ret_ref = 0;
19539 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19540 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19541 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19542 ret_ref = (uint64_t)ret_var.inner;
19543 if (ret_var.is_owned) {
19549 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
19550 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
19551 uint64_t ret_ref = 0;
19552 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19553 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19554 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19555 ret_ref = (uint64_t)ret_var.inner;
19556 if (ret_var.is_owned) {
19561 int64_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint32_t arg) {
19562 LDKDelayedPaymentOutputDescriptor arg_conv;
19563 arg_conv.inner = (void*)(arg & (~1));
19564 arg_conv.is_owned = false;
19565 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
19566 int64_t ret_val = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
19570 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_clone(uint32_t orig) {
19571 LDKDelayedPaymentOutputDescriptor orig_conv;
19572 orig_conv.inner = (void*)(orig & (~1));
19573 orig_conv.is_owned = false;
19574 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
19575 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
19576 uint64_t ret_ref = 0;
19577 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19578 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19579 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19580 ret_ref = (uint64_t)ret_var.inner;
19581 if (ret_var.is_owned) {
19587 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_write(uint32_t obj) {
19588 LDKDelayedPaymentOutputDescriptor obj_conv;
19589 obj_conv.inner = (void*)(obj & (~1));
19590 obj_conv.is_owned = false;
19591 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
19592 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
19593 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
19594 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
19595 CVec_u8Z_free(ret_var);
19599 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
19600 LDKu8slice ser_ref;
19601 ser_ref.datalen = ser->arr_len;
19602 ser_ref.data = ser->elems;
19603 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19604 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
19605 return (uint64_t)ret_conv;
19608 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_free(uint32_t this_obj) {
19609 LDKStaticPaymentOutputDescriptor this_obj_conv;
19610 this_obj_conv.inner = (void*)(this_obj & (~1));
19611 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19612 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
19613 StaticPaymentOutputDescriptor_free(this_obj_conv);
19616 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
19617 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19619 this_ptr_conv.is_owned = false;
19620 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19621 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
19622 uint64_t ret_ref = 0;
19623 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19624 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19625 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19626 ret_ref = (uint64_t)ret_var.inner;
19627 if (ret_var.is_owned) {
19633 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
19634 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19636 this_ptr_conv.is_owned = false;
19637 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19638 LDKOutPoint val_conv;
19639 val_conv.inner = (void*)(val & (~1));
19640 val_conv.is_owned = (val & 1) || (val == 0);
19641 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
19642 val_conv = OutPoint_clone(&val_conv);
19643 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
19646 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
19647 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19649 this_ptr_conv.is_owned = false;
19650 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19651 void* val_ptr = (void*)(((uint64_t)val) & ~1);
19652 CHECK_ACCESS(val_ptr);
19653 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
19654 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
19655 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
19658 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
19659 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19661 this_ptr_conv.is_owned = false;
19662 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19663 int8_tArray ret_arr = init_int8_tArray(32);
19664 memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
19668 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
19669 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19671 this_ptr_conv.is_owned = false;
19672 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19673 LDKThirtyTwoBytes val_ref;
19674 CHECK(val->arr_len == 32);
19675 memcpy(val_ref.data, val->elems, 32);
19676 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
19679 int64_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
19680 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19682 this_ptr_conv.is_owned = false;
19683 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19684 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
19688 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
19689 LDKStaticPaymentOutputDescriptor 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 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
19696 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_new(uint32_t outpoint_arg, uint32_t output_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) {
19697 LDKOutPoint outpoint_arg_conv;
19698 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
19699 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
19700 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
19701 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
19702 void* output_arg_ptr = (void*)(((uint64_t)output_arg) & ~1);
19703 CHECK_ACCESS(output_arg_ptr);
19704 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
19705 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
19706 LDKThirtyTwoBytes channel_keys_id_arg_ref;
19707 CHECK(channel_keys_id_arg->arr_len == 32);
19708 memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32);
19709 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
19710 uint64_t ret_ref = 0;
19711 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19712 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19713 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19714 ret_ref = (uint64_t)ret_var.inner;
19715 if (ret_var.is_owned) {
19721 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
19722 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
19723 uint64_t ret_ref = 0;
19724 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19725 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19726 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19727 ret_ref = (uint64_t)ret_var.inner;
19728 if (ret_var.is_owned) {
19733 int64_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint32_t arg) {
19734 LDKStaticPaymentOutputDescriptor arg_conv;
19735 arg_conv.inner = (void*)(arg & (~1));
19736 arg_conv.is_owned = false;
19737 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
19738 int64_t ret_val = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
19742 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_clone(uint32_t orig) {
19743 LDKStaticPaymentOutputDescriptor orig_conv;
19744 orig_conv.inner = (void*)(orig & (~1));
19745 orig_conv.is_owned = false;
19746 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
19747 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
19748 uint64_t ret_ref = 0;
19749 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19750 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19751 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19752 ret_ref = (uint64_t)ret_var.inner;
19753 if (ret_var.is_owned) {
19759 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_write(uint32_t obj) {
19760 LDKStaticPaymentOutputDescriptor obj_conv;
19761 obj_conv.inner = (void*)(obj & (~1));
19762 obj_conv.is_owned = false;
19763 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
19764 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
19765 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
19766 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
19767 CVec_u8Z_free(ret_var);
19771 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
19772 LDKu8slice ser_ref;
19773 ser_ref.datalen = ser->arr_len;
19774 ser_ref.data = ser->elems;
19775 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19776 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
19777 return (uint64_t)ret_conv;
19780 void __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_free(uint32_t this_ptr) {
19781 if ((this_ptr & 1) != 0) return;
19782 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
19783 CHECK_ACCESS(this_ptr_ptr);
19784 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
19785 FREE((void*)this_ptr);
19786 SpendableOutputDescriptor_free(this_ptr_conv);
19789 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
19790 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
19791 *ret_copy = SpendableOutputDescriptor_clone(arg);
19792 uint64_t ret_ref = (uint64_t)ret_copy;
19795 int64_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_clone_ptr(uint32_t arg) {
19796 LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)arg;
19797 int64_t ret_val = SpendableOutputDescriptor_clone_ptr(arg_conv);
19801 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_clone(uint32_t orig) {
19802 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
19803 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
19804 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
19805 uint64_t ret_ref = (uint64_t)ret_copy;
19809 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_static_output(uint32_t outpoint, uint32_t output) {
19810 LDKOutPoint outpoint_conv;
19811 outpoint_conv.inner = (void*)(outpoint & (~1));
19812 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
19813 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
19814 outpoint_conv = OutPoint_clone(&outpoint_conv);
19815 void* output_ptr = (void*)(((uint64_t)output) & ~1);
19816 CHECK_ACCESS(output_ptr);
19817 LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
19818 output_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output) & ~1));
19819 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
19820 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
19821 uint64_t ret_ref = (uint64_t)ret_copy;
19825 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint32_t a) {
19826 LDKDelayedPaymentOutputDescriptor a_conv;
19827 a_conv.inner = (void*)(a & (~1));
19828 a_conv.is_owned = (a & 1) || (a == 0);
19829 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19830 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
19831 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
19832 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
19833 uint64_t ret_ref = (uint64_t)ret_copy;
19837 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_static_payment_output(uint32_t a) {
19838 LDKStaticPaymentOutputDescriptor a_conv;
19839 a_conv.inner = (void*)(a & (~1));
19840 a_conv.is_owned = (a & 1) || (a == 0);
19841 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19842 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
19843 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
19844 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
19845 uint64_t ret_ref = (uint64_t)ret_copy;
19849 int8_tArray __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_write(uint32_t obj) {
19850 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
19851 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
19852 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
19853 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
19854 CVec_u8Z_free(ret_var);
19858 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
19859 LDKu8slice ser_ref;
19860 ser_ref.datalen = ser->arr_len;
19861 ser_ref.data = ser->elems;
19862 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19863 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
19864 return (uint64_t)ret_conv;
19867 void __attribute__((visibility("default"))) TS_BaseSign_free(uint32_t this_ptr) {
19868 if ((this_ptr & 1) != 0) return;
19869 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
19870 CHECK_ACCESS(this_ptr_ptr);
19871 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
19872 FREE((void*)this_ptr);
19873 BaseSign_free(this_ptr_conv);
19876 static inline uint64_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
19877 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
19878 *ret_ret = Sign_clone(arg);
19879 return (uint64_t)ret_ret;
19881 int64_t __attribute__((visibility("default"))) TS_Sign_clone_ptr(uint32_t arg) {
19882 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
19883 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
19884 LDKSign* arg_conv = (LDKSign*)arg_ptr;
19885 int64_t ret_val = Sign_clone_ptr(arg_conv);
19889 uint32_t __attribute__((visibility("default"))) TS_Sign_clone(uint32_t orig) {
19890 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
19891 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
19892 LDKSign* orig_conv = (LDKSign*)orig_ptr;
19893 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
19894 *ret_ret = Sign_clone(orig_conv);
19895 return (uint64_t)ret_ret;
19898 void __attribute__((visibility("default"))) TS_Sign_free(uint32_t this_ptr) {
19899 if ((this_ptr & 1) != 0) return;
19900 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
19901 CHECK_ACCESS(this_ptr_ptr);
19902 LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
19903 FREE((void*)this_ptr);
19904 Sign_free(this_ptr_conv);
19907 void __attribute__((visibility("default"))) TS_KeysInterface_free(uint32_t this_ptr) {
19908 if ((this_ptr & 1) != 0) return;
19909 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
19910 CHECK_ACCESS(this_ptr_ptr);
19911 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
19912 FREE((void*)this_ptr);
19913 KeysInterface_free(this_ptr_conv);
19916 void __attribute__((visibility("default"))) TS_InMemorySigner_free(uint32_t this_obj) {
19917 LDKInMemorySigner this_obj_conv;
19918 this_obj_conv.inner = (void*)(this_obj & (~1));
19919 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19920 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
19921 InMemorySigner_free(this_obj_conv);
19924 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_funding_key(uint32_t this_ptr) {
19925 LDKInMemorySigner this_ptr_conv;
19926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19927 this_ptr_conv.is_owned = false;
19928 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19929 int8_tArray ret_arr = init_int8_tArray(32);
19930 memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
19934 void __attribute__((visibility("default"))) TS_InMemorySigner_set_funding_key(uint32_t this_ptr, int8_tArray val) {
19935 LDKInMemorySigner this_ptr_conv;
19936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19937 this_ptr_conv.is_owned = false;
19938 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19939 LDKSecretKey val_ref;
19940 CHECK(val->arr_len == 32);
19941 memcpy(val_ref.bytes, val->elems, 32);
19942 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
19945 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_revocation_base_key(uint32_t this_ptr) {
19946 LDKInMemorySigner this_ptr_conv;
19947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19948 this_ptr_conv.is_owned = false;
19949 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19950 int8_tArray ret_arr = init_int8_tArray(32);
19951 memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
19955 void __attribute__((visibility("default"))) TS_InMemorySigner_set_revocation_base_key(uint32_t this_ptr, int8_tArray val) {
19956 LDKInMemorySigner 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 LDKSecretKey val_ref;
19961 CHECK(val->arr_len == 32);
19962 memcpy(val_ref.bytes, val->elems, 32);
19963 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
19966 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_payment_key(uint32_t this_ptr) {
19967 LDKInMemorySigner this_ptr_conv;
19968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19969 this_ptr_conv.is_owned = false;
19970 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19971 int8_tArray ret_arr = init_int8_tArray(32);
19972 memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
19976 void __attribute__((visibility("default"))) TS_InMemorySigner_set_payment_key(uint32_t this_ptr, int8_tArray val) {
19977 LDKInMemorySigner this_ptr_conv;
19978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19979 this_ptr_conv.is_owned = false;
19980 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19981 LDKSecretKey val_ref;
19982 CHECK(val->arr_len == 32);
19983 memcpy(val_ref.bytes, val->elems, 32);
19984 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
19987 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_delayed_payment_base_key(uint32_t this_ptr) {
19988 LDKInMemorySigner this_ptr_conv;
19989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19990 this_ptr_conv.is_owned = false;
19991 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19992 int8_tArray ret_arr = init_int8_tArray(32);
19993 memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
19997 void __attribute__((visibility("default"))) TS_InMemorySigner_set_delayed_payment_base_key(uint32_t this_ptr, int8_tArray val) {
19998 LDKInMemorySigner 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 LDKSecretKey val_ref;
20003 CHECK(val->arr_len == 32);
20004 memcpy(val_ref.bytes, val->elems, 32);
20005 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
20008 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_htlc_base_key(uint32_t this_ptr) {
20009 LDKInMemorySigner this_ptr_conv;
20010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20011 this_ptr_conv.is_owned = false;
20012 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20013 int8_tArray ret_arr = init_int8_tArray(32);
20014 memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
20018 void __attribute__((visibility("default"))) TS_InMemorySigner_set_htlc_base_key(uint32_t this_ptr, int8_tArray val) {
20019 LDKInMemorySigner this_ptr_conv;
20020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20021 this_ptr_conv.is_owned = false;
20022 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20023 LDKSecretKey val_ref;
20024 CHECK(val->arr_len == 32);
20025 memcpy(val_ref.bytes, val->elems, 32);
20026 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
20029 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_commitment_seed(uint32_t this_ptr) {
20030 LDKInMemorySigner this_ptr_conv;
20031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20032 this_ptr_conv.is_owned = false;
20033 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20034 int8_tArray ret_arr = init_int8_tArray(32);
20035 memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
20039 void __attribute__((visibility("default"))) TS_InMemorySigner_set_commitment_seed(uint32_t this_ptr, int8_tArray val) {
20040 LDKInMemorySigner this_ptr_conv;
20041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20042 this_ptr_conv.is_owned = false;
20043 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20044 LDKThirtyTwoBytes val_ref;
20045 CHECK(val->arr_len == 32);
20046 memcpy(val_ref.data, val->elems, 32);
20047 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
20050 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
20051 LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
20052 uint64_t ret_ref = 0;
20053 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20054 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20055 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20056 ret_ref = (uint64_t)ret_var.inner;
20057 if (ret_var.is_owned) {
20062 int64_t __attribute__((visibility("default"))) TS_InMemorySigner_clone_ptr(uint32_t arg) {
20063 LDKInMemorySigner arg_conv;
20064 arg_conv.inner = (void*)(arg & (~1));
20065 arg_conv.is_owned = false;
20066 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20067 int64_t ret_val = InMemorySigner_clone_ptr(&arg_conv);
20071 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_clone(uint32_t orig) {
20072 LDKInMemorySigner orig_conv;
20073 orig_conv.inner = (void*)(orig & (~1));
20074 orig_conv.is_owned = false;
20075 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20076 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
20077 uint64_t ret_ref = 0;
20078 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20079 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20080 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20081 ret_ref = (uint64_t)ret_var.inner;
20082 if (ret_var.is_owned) {
20088 uint32_t __attribute__((visibility("default"))) 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) {
20089 LDKSecretKey funding_key_ref;
20090 CHECK(funding_key->arr_len == 32);
20091 memcpy(funding_key_ref.bytes, funding_key->elems, 32);
20092 LDKSecretKey revocation_base_key_ref;
20093 CHECK(revocation_base_key->arr_len == 32);
20094 memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32);
20095 LDKSecretKey payment_key_ref;
20096 CHECK(payment_key->arr_len == 32);
20097 memcpy(payment_key_ref.bytes, payment_key->elems, 32);
20098 LDKSecretKey delayed_payment_base_key_ref;
20099 CHECK(delayed_payment_base_key->arr_len == 32);
20100 memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32);
20101 LDKSecretKey htlc_base_key_ref;
20102 CHECK(htlc_base_key->arr_len == 32);
20103 memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32);
20104 LDKThirtyTwoBytes commitment_seed_ref;
20105 CHECK(commitment_seed->arr_len == 32);
20106 memcpy(commitment_seed_ref.data, commitment_seed->elems, 32);
20107 LDKThirtyTwoBytes channel_keys_id_ref;
20108 CHECK(channel_keys_id->arr_len == 32);
20109 memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32);
20110 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);
20111 uint64_t ret_ref = 0;
20112 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20113 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20114 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20115 ret_ref = (uint64_t)ret_var.inner;
20116 if (ret_var.is_owned) {
20122 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_pubkeys(uint32_t this_arg) {
20123 LDKInMemorySigner this_arg_conv;
20124 this_arg_conv.inner = (void*)(this_arg & (~1));
20125 this_arg_conv.is_owned = false;
20126 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20127 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
20128 uint64_t ret_ref = 0;
20129 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20130 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20131 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20132 ret_ref = (uint64_t)ret_var.inner;
20133 if (ret_var.is_owned) {
20139 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint32_t this_arg) {
20140 LDKInMemorySigner this_arg_conv;
20141 this_arg_conv.inner = (void*)(this_arg & (~1));
20142 this_arg_conv.is_owned = false;
20143 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20144 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
20148 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_holder_selected_contest_delay(uint32_t this_arg) {
20149 LDKInMemorySigner this_arg_conv;
20150 this_arg_conv.inner = (void*)(this_arg & (~1));
20151 this_arg_conv.is_owned = false;
20152 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20153 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
20157 jboolean __attribute__((visibility("default"))) TS_InMemorySigner_is_outbound(uint32_t this_arg) {
20158 LDKInMemorySigner this_arg_conv;
20159 this_arg_conv.inner = (void*)(this_arg & (~1));
20160 this_arg_conv.is_owned = false;
20161 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20162 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
20166 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_funding_outpoint(uint32_t this_arg) {
20167 LDKInMemorySigner this_arg_conv;
20168 this_arg_conv.inner = (void*)(this_arg & (~1));
20169 this_arg_conv.is_owned = false;
20170 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20171 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
20172 uint64_t ret_ref = 0;
20173 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20174 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20175 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20176 ret_ref = (uint64_t)ret_var.inner;
20177 if (ret_var.is_owned) {
20183 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_get_channel_parameters(uint32_t this_arg) {
20184 LDKInMemorySigner this_arg_conv;
20185 this_arg_conv.inner = (void*)(this_arg & (~1));
20186 this_arg_conv.is_owned = false;
20187 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20188 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
20189 uint64_t ret_ref = 0;
20190 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20191 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20192 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20193 ret_ref = (uint64_t)ret_var.inner;
20194 if (ret_var.is_owned) {
20200 jboolean __attribute__((visibility("default"))) TS_InMemorySigner_opt_anchors(uint32_t this_arg) {
20201 LDKInMemorySigner this_arg_conv;
20202 this_arg_conv.inner = (void*)(this_arg & (~1));
20203 this_arg_conv.is_owned = false;
20204 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20205 jboolean ret_val = InMemorySigner_opt_anchors(&this_arg_conv);
20209 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_sign_counterparty_payment_input(uint32_t this_arg, int8_tArray spend_tx, int64_t input_idx, uint32_t descriptor) {
20210 LDKInMemorySigner this_arg_conv;
20211 this_arg_conv.inner = (void*)(this_arg & (~1));
20212 this_arg_conv.is_owned = false;
20213 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20214 LDKTransaction spend_tx_ref;
20215 spend_tx_ref.datalen = spend_tx->arr_len;
20216 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
20217 memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen);
20218 spend_tx_ref.data_is_owned = true;
20219 LDKStaticPaymentOutputDescriptor descriptor_conv;
20220 descriptor_conv.inner = (void*)(descriptor & (~1));
20221 descriptor_conv.is_owned = false;
20222 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
20223 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
20224 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
20225 return (uint64_t)ret_conv;
20228 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_sign_dynamic_p2wsh_input(uint32_t this_arg, int8_tArray spend_tx, int64_t input_idx, uint32_t descriptor) {
20229 LDKInMemorySigner this_arg_conv;
20230 this_arg_conv.inner = (void*)(this_arg & (~1));
20231 this_arg_conv.is_owned = false;
20232 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20233 LDKTransaction spend_tx_ref;
20234 spend_tx_ref.datalen = spend_tx->arr_len;
20235 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
20236 memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen);
20237 spend_tx_ref.data_is_owned = true;
20238 LDKDelayedPaymentOutputDescriptor descriptor_conv;
20239 descriptor_conv.inner = (void*)(descriptor & (~1));
20240 descriptor_conv.is_owned = false;
20241 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
20242 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
20243 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
20244 return (uint64_t)ret_conv;
20247 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_BaseSign(uint32_t this_arg) {
20248 LDKInMemorySigner this_arg_conv;
20249 this_arg_conv.inner = (void*)(this_arg & (~1));
20250 this_arg_conv.is_owned = false;
20251 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20252 LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
20253 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
20254 return (uint64_t)ret_ret;
20257 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_Sign(uint32_t this_arg) {
20258 LDKInMemorySigner this_arg_conv;
20259 this_arg_conv.inner = (void*)(this_arg & (~1));
20260 this_arg_conv.is_owned = false;
20261 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20262 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
20263 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
20264 return (uint64_t)ret_ret;
20267 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_write(uint32_t obj) {
20268 LDKInMemorySigner obj_conv;
20269 obj_conv.inner = (void*)(obj & (~1));
20270 obj_conv.is_owned = false;
20271 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
20272 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
20273 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
20274 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20275 CVec_u8Z_free(ret_var);
20279 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_read(int8_tArray ser) {
20280 LDKu8slice ser_ref;
20281 ser_ref.datalen = ser->arr_len;
20282 ser_ref.data = ser->elems;
20283 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20284 *ret_conv = InMemorySigner_read(ser_ref);
20285 return (uint64_t)ret_conv;
20288 void __attribute__((visibility("default"))) TS_KeysManager_free(uint32_t this_obj) {
20289 LDKKeysManager this_obj_conv;
20290 this_obj_conv.inner = (void*)(this_obj & (~1));
20291 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20292 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20293 KeysManager_free(this_obj_conv);
20296 uint32_t __attribute__((visibility("default"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
20297 unsigned char seed_arr[32];
20298 CHECK(seed->arr_len == 32);
20299 memcpy(seed_arr, seed->elems, 32);
20300 unsigned char (*seed_ref)[32] = &seed_arr;
20301 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
20302 uint64_t ret_ref = 0;
20303 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20304 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20305 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20306 ret_ref = (uint64_t)ret_var.inner;
20307 if (ret_var.is_owned) {
20313 uint32_t __attribute__((visibility("default"))) TS_KeysManager_derive_channel_keys(uint32_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
20314 LDKKeysManager this_arg_conv;
20315 this_arg_conv.inner = (void*)(this_arg & (~1));
20316 this_arg_conv.is_owned = false;
20317 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20318 unsigned char params_arr[32];
20319 CHECK(params->arr_len == 32);
20320 memcpy(params_arr, params->elems, 32);
20321 unsigned char (*params_ref)[32] = ¶ms_arr;
20322 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
20323 uint64_t ret_ref = 0;
20324 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20325 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20326 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20327 ret_ref = (uint64_t)ret_var.inner;
20328 if (ret_var.is_owned) {
20334 uint32_t __attribute__((visibility("default"))) 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) {
20335 LDKKeysManager this_arg_conv;
20336 this_arg_conv.inner = (void*)(this_arg & (~1));
20337 this_arg_conv.is_owned = false;
20338 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20339 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
20340 descriptors_constr.datalen = descriptors->arr_len;
20341 if (descriptors_constr.datalen > 0)
20342 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
20344 descriptors_constr.data = NULL;
20345 uint32_t* descriptors_vals = descriptors->elems;
20346 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
20347 uint32_t descriptors_conv_27 = descriptors_vals[b];
20348 void* descriptors_conv_27_ptr = (void*)(((uint64_t)descriptors_conv_27) & ~1);
20349 CHECK_ACCESS(descriptors_conv_27_ptr);
20350 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
20351 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
20352 descriptors_constr.data[b] = descriptors_conv_27_conv;
20354 LDKCVec_TxOutZ outputs_constr;
20355 outputs_constr.datalen = outputs->arr_len;
20356 if (outputs_constr.datalen > 0)
20357 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
20359 outputs_constr.data = NULL;
20360 uint32_t* outputs_vals = outputs->elems;
20361 for (size_t h = 0; h < outputs_constr.datalen; h++) {
20362 uint32_t outputs_conv_7 = outputs_vals[h];
20363 void* outputs_conv_7_ptr = (void*)(((uint64_t)outputs_conv_7) & ~1);
20364 CHECK_ACCESS(outputs_conv_7_ptr);
20365 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
20366 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
20367 outputs_constr.data[h] = outputs_conv_7_conv;
20369 LDKCVec_u8Z change_destination_script_ref;
20370 change_destination_script_ref.datalen = change_destination_script->arr_len;
20371 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
20372 memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen);
20373 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20374 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
20375 return (uint64_t)ret_conv;
20378 uint32_t __attribute__((visibility("default"))) TS_KeysManager_as_KeysInterface(uint32_t this_arg) {
20379 LDKKeysManager this_arg_conv;
20380 this_arg_conv.inner = (void*)(this_arg & (~1));
20381 this_arg_conv.is_owned = false;
20382 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20383 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
20384 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
20385 return (uint64_t)ret_ret;
20388 void __attribute__((visibility("default"))) TS_ChannelManager_free(uint32_t this_obj) {
20389 LDKChannelManager this_obj_conv;
20390 this_obj_conv.inner = (void*)(this_obj & (~1));
20391 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20392 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20393 ChannelManager_free(this_obj_conv);
20396 void __attribute__((visibility("default"))) TS_ChainParameters_free(uint32_t this_obj) {
20397 LDKChainParameters this_obj_conv;
20398 this_obj_conv.inner = (void*)(this_obj & (~1));
20399 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20400 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20401 ChainParameters_free(this_obj_conv);
20404 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_network(uint32_t this_ptr) {
20405 LDKChainParameters this_ptr_conv;
20406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20407 this_ptr_conv.is_owned = false;
20408 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20409 uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
20413 void __attribute__((visibility("default"))) TS_ChainParameters_set_network(uint32_t this_ptr, uint32_t val) {
20414 LDKChainParameters this_ptr_conv;
20415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20416 this_ptr_conv.is_owned = false;
20417 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20418 LDKNetwork val_conv = LDKNetwork_from_js(val);
20419 ChainParameters_set_network(&this_ptr_conv, val_conv);
20422 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_best_block(uint32_t this_ptr) {
20423 LDKChainParameters this_ptr_conv;
20424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20425 this_ptr_conv.is_owned = false;
20426 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20427 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
20428 uint64_t ret_ref = 0;
20429 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20430 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20431 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20432 ret_ref = (uint64_t)ret_var.inner;
20433 if (ret_var.is_owned) {
20439 void __attribute__((visibility("default"))) TS_ChainParameters_set_best_block(uint32_t this_ptr, uint32_t val) {
20440 LDKChainParameters this_ptr_conv;
20441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20442 this_ptr_conv.is_owned = false;
20443 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20444 LDKBestBlock val_conv;
20445 val_conv.inner = (void*)(val & (~1));
20446 val_conv.is_owned = (val & 1) || (val == 0);
20447 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
20448 val_conv = BestBlock_clone(&val_conv);
20449 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
20452 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_new(uint32_t network_arg, uint32_t best_block_arg) {
20453 LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
20454 LDKBestBlock best_block_arg_conv;
20455 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
20456 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
20457 CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
20458 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
20459 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
20460 uint64_t ret_ref = 0;
20461 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20462 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20463 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20464 ret_ref = (uint64_t)ret_var.inner;
20465 if (ret_var.is_owned) {
20471 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
20472 LDKChainParameters ret_var = ChainParameters_clone(arg);
20473 uint64_t ret_ref = 0;
20474 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20475 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20476 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20477 ret_ref = (uint64_t)ret_var.inner;
20478 if (ret_var.is_owned) {
20483 int64_t __attribute__((visibility("default"))) TS_ChainParameters_clone_ptr(uint32_t arg) {
20484 LDKChainParameters arg_conv;
20485 arg_conv.inner = (void*)(arg & (~1));
20486 arg_conv.is_owned = false;
20487 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20488 int64_t ret_val = ChainParameters_clone_ptr(&arg_conv);
20492 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_clone(uint32_t orig) {
20493 LDKChainParameters orig_conv;
20494 orig_conv.inner = (void*)(orig & (~1));
20495 orig_conv.is_owned = false;
20496 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20497 LDKChainParameters ret_var = ChainParameters_clone(&orig_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 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_free(uint32_t this_obj) {
20510 LDKCounterpartyForwardingInfo this_obj_conv;
20511 this_obj_conv.inner = (void*)(this_obj & (~1));
20512 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20513 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20514 CounterpartyForwardingInfo_free(this_obj_conv);
20517 int32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint32_t this_ptr) {
20518 LDKCounterpartyForwardingInfo this_ptr_conv;
20519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20520 this_ptr_conv.is_owned = false;
20521 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20522 int32_t ret_val = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
20526 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
20527 LDKCounterpartyForwardingInfo this_ptr_conv;
20528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20529 this_ptr_conv.is_owned = false;
20530 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20531 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
20534 int32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint32_t this_ptr) {
20535 LDKCounterpartyForwardingInfo this_ptr_conv;
20536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20537 this_ptr_conv.is_owned = false;
20538 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20539 int32_t ret_val = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
20543 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
20544 LDKCounterpartyForwardingInfo this_ptr_conv;
20545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20546 this_ptr_conv.is_owned = false;
20547 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20548 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
20551 int16_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
20552 LDKCounterpartyForwardingInfo this_ptr_conv;
20553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20554 this_ptr_conv.is_owned = false;
20555 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20556 int16_t ret_val = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
20560 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
20561 LDKCounterpartyForwardingInfo this_ptr_conv;
20562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20563 this_ptr_conv.is_owned = false;
20564 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20565 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
20568 uint32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_new(int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg) {
20569 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
20570 uint64_t ret_ref = 0;
20571 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20572 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20573 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20574 ret_ref = (uint64_t)ret_var.inner;
20575 if (ret_var.is_owned) {
20581 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
20582 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
20583 uint64_t ret_ref = 0;
20584 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20585 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20586 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20587 ret_ref = (uint64_t)ret_var.inner;
20588 if (ret_var.is_owned) {
20593 int64_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_clone_ptr(uint32_t arg) {
20594 LDKCounterpartyForwardingInfo arg_conv;
20595 arg_conv.inner = (void*)(arg & (~1));
20596 arg_conv.is_owned = false;
20597 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20598 int64_t ret_val = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
20602 uint32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_clone(uint32_t orig) {
20603 LDKCounterpartyForwardingInfo orig_conv;
20604 orig_conv.inner = (void*)(orig & (~1));
20605 orig_conv.is_owned = false;
20606 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20607 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
20608 uint64_t ret_ref = 0;
20609 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20610 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20611 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20612 ret_ref = (uint64_t)ret_var.inner;
20613 if (ret_var.is_owned) {
20619 void __attribute__((visibility("default"))) TS_ChannelCounterparty_free(uint32_t this_obj) {
20620 LDKChannelCounterparty this_obj_conv;
20621 this_obj_conv.inner = (void*)(this_obj & (~1));
20622 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20623 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20624 ChannelCounterparty_free(this_obj_conv);
20627 int8_tArray __attribute__((visibility("default"))) TS_ChannelCounterparty_get_node_id(uint32_t this_ptr) {
20628 LDKChannelCounterparty this_ptr_conv;
20629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20630 this_ptr_conv.is_owned = false;
20631 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20632 int8_tArray ret_arr = init_int8_tArray(33);
20633 memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
20637 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_node_id(uint32_t this_ptr, int8_tArray val) {
20638 LDKChannelCounterparty this_ptr_conv;
20639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20640 this_ptr_conv.is_owned = false;
20641 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20642 LDKPublicKey val_ref;
20643 CHECK(val->arr_len == 33);
20644 memcpy(val_ref.compressed_form, val->elems, 33);
20645 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
20648 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_features(uint32_t this_ptr) {
20649 LDKChannelCounterparty this_ptr_conv;
20650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20651 this_ptr_conv.is_owned = false;
20652 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20653 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
20654 uint64_t ret_ref = 0;
20655 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20656 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20657 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20658 ret_ref = (uint64_t)ret_var.inner;
20659 if (ret_var.is_owned) {
20665 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_features(uint32_t this_ptr, uint32_t val) {
20666 LDKChannelCounterparty this_ptr_conv;
20667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20668 this_ptr_conv.is_owned = false;
20669 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20670 LDKInitFeatures val_conv;
20671 val_conv.inner = (void*)(val & (~1));
20672 val_conv.is_owned = (val & 1) || (val == 0);
20673 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
20674 val_conv = InitFeatures_clone(&val_conv);
20675 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
20678 int64_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint32_t this_ptr) {
20679 LDKChannelCounterparty this_ptr_conv;
20680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20681 this_ptr_conv.is_owned = false;
20682 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20683 int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
20687 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint32_t this_ptr, int64_t val) {
20688 LDKChannelCounterparty this_ptr_conv;
20689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20690 this_ptr_conv.is_owned = false;
20691 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20692 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
20695 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_forwarding_info(uint32_t this_ptr) {
20696 LDKChannelCounterparty this_ptr_conv;
20697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20698 this_ptr_conv.is_owned = false;
20699 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20700 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
20701 uint64_t ret_ref = 0;
20702 if ((uint64_t)ret_var.inner > 4096) {
20703 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20704 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20705 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20706 ret_ref = (uint64_t)ret_var.inner;
20707 if (ret_var.is_owned) {
20714 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_forwarding_info(uint32_t this_ptr, uint32_t val) {
20715 LDKChannelCounterparty this_ptr_conv;
20716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20717 this_ptr_conv.is_owned = false;
20718 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20719 LDKCounterpartyForwardingInfo val_conv;
20720 val_conv.inner = (void*)(val & (~1));
20721 val_conv.is_owned = (val & 1) || (val == 0);
20722 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
20723 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
20724 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
20727 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_new(int8_tArray node_id_arg, uint32_t features_arg, int64_t unspendable_punishment_reserve_arg, uint32_t forwarding_info_arg) {
20728 LDKPublicKey node_id_arg_ref;
20729 CHECK(node_id_arg->arr_len == 33);
20730 memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33);
20731 LDKInitFeatures features_arg_conv;
20732 features_arg_conv.inner = (void*)(features_arg & (~1));
20733 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
20734 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
20735 features_arg_conv = InitFeatures_clone(&features_arg_conv);
20736 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
20737 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
20738 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
20739 CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
20740 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
20741 LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv);
20742 uint64_t ret_ref = 0;
20743 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20744 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20745 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20746 ret_ref = (uint64_t)ret_var.inner;
20747 if (ret_var.is_owned) {
20753 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
20754 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
20755 uint64_t ret_ref = 0;
20756 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20757 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20758 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20759 ret_ref = (uint64_t)ret_var.inner;
20760 if (ret_var.is_owned) {
20765 int64_t __attribute__((visibility("default"))) TS_ChannelCounterparty_clone_ptr(uint32_t arg) {
20766 LDKChannelCounterparty arg_conv;
20767 arg_conv.inner = (void*)(arg & (~1));
20768 arg_conv.is_owned = false;
20769 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20770 int64_t ret_val = ChannelCounterparty_clone_ptr(&arg_conv);
20774 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_clone(uint32_t orig) {
20775 LDKChannelCounterparty orig_conv;
20776 orig_conv.inner = (void*)(orig & (~1));
20777 orig_conv.is_owned = false;
20778 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20779 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
20780 uint64_t ret_ref = 0;
20781 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20782 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20783 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20784 ret_ref = (uint64_t)ret_var.inner;
20785 if (ret_var.is_owned) {
20791 void __attribute__((visibility("default"))) TS_ChannelDetails_free(uint32_t this_obj) {
20792 LDKChannelDetails this_obj_conv;
20793 this_obj_conv.inner = (void*)(this_obj & (~1));
20794 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20795 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20796 ChannelDetails_free(this_obj_conv);
20799 int8_tArray __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_id(uint32_t this_ptr) {
20800 LDKChannelDetails this_ptr_conv;
20801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20802 this_ptr_conv.is_owned = false;
20803 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20804 int8_tArray ret_arr = init_int8_tArray(32);
20805 memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
20809 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_id(uint32_t this_ptr, int8_tArray val) {
20810 LDKChannelDetails this_ptr_conv;
20811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20812 this_ptr_conv.is_owned = false;
20813 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20814 LDKThirtyTwoBytes val_ref;
20815 CHECK(val->arr_len == 32);
20816 memcpy(val_ref.data, val->elems, 32);
20817 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
20820 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_counterparty(uint32_t this_ptr) {
20821 LDKChannelDetails this_ptr_conv;
20822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20823 this_ptr_conv.is_owned = false;
20824 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20825 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
20826 uint64_t ret_ref = 0;
20827 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20828 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20829 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20830 ret_ref = (uint64_t)ret_var.inner;
20831 if (ret_var.is_owned) {
20837 void __attribute__((visibility("default"))) TS_ChannelDetails_set_counterparty(uint32_t this_ptr, uint32_t val) {
20838 LDKChannelDetails this_ptr_conv;
20839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20840 this_ptr_conv.is_owned = false;
20841 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20842 LDKChannelCounterparty val_conv;
20843 val_conv.inner = (void*)(val & (~1));
20844 val_conv.is_owned = (val & 1) || (val == 0);
20845 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
20846 val_conv = ChannelCounterparty_clone(&val_conv);
20847 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
20850 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_funding_txo(uint32_t this_ptr) {
20851 LDKChannelDetails this_ptr_conv;
20852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20853 this_ptr_conv.is_owned = false;
20854 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20855 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
20856 uint64_t ret_ref = 0;
20857 if ((uint64_t)ret_var.inner > 4096) {
20858 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20859 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20860 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20861 ret_ref = (uint64_t)ret_var.inner;
20862 if (ret_var.is_owned) {
20869 void __attribute__((visibility("default"))) TS_ChannelDetails_set_funding_txo(uint32_t this_ptr, uint32_t val) {
20870 LDKChannelDetails 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 LDKOutPoint val_conv;
20875 val_conv.inner = (void*)(val & (~1));
20876 val_conv.is_owned = (val & 1) || (val == 0);
20877 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
20878 val_conv = OutPoint_clone(&val_conv);
20879 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
20882 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_short_channel_id(uint32_t this_ptr) {
20883 LDKChannelDetails this_ptr_conv;
20884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20885 this_ptr_conv.is_owned = false;
20886 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20887 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
20888 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
20889 uint64_t ret_ref = (uint64_t)ret_copy;
20893 void __attribute__((visibility("default"))) TS_ChannelDetails_set_short_channel_id(uint32_t this_ptr, uint32_t val) {
20894 LDKChannelDetails this_ptr_conv;
20895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20896 this_ptr_conv.is_owned = false;
20897 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20898 void* val_ptr = (void*)(((uint64_t)val) & ~1);
20899 CHECK_ACCESS(val_ptr);
20900 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
20901 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
20902 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
20905 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_value_satoshis(uint32_t this_ptr) {
20906 LDKChannelDetails this_ptr_conv;
20907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20908 this_ptr_conv.is_owned = false;
20909 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20910 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
20914 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
20915 LDKChannelDetails this_ptr_conv;
20916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20917 this_ptr_conv.is_owned = false;
20918 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20919 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
20922 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint32_t this_ptr) {
20923 LDKChannelDetails this_ptr_conv;
20924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20925 this_ptr_conv.is_owned = false;
20926 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20927 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
20928 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
20929 uint64_t ret_ref = (uint64_t)ret_copy;
20933 void __attribute__((visibility("default"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint32_t this_ptr, uint32_t val) {
20934 LDKChannelDetails this_ptr_conv;
20935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20936 this_ptr_conv.is_owned = false;
20937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20938 void* val_ptr = (void*)(((uint64_t)val) & ~1);
20939 CHECK_ACCESS(val_ptr);
20940 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
20941 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
20942 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
20945 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_user_channel_id(uint32_t this_ptr) {
20946 LDKChannelDetails this_ptr_conv;
20947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20948 this_ptr_conv.is_owned = false;
20949 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20950 int64_t ret_val = ChannelDetails_get_user_channel_id(&this_ptr_conv);
20954 void __attribute__((visibility("default"))) TS_ChannelDetails_set_user_channel_id(uint32_t this_ptr, int64_t val) {
20955 LDKChannelDetails this_ptr_conv;
20956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20957 this_ptr_conv.is_owned = false;
20958 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20959 ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
20962 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_balance_msat(uint32_t this_ptr) {
20963 LDKChannelDetails this_ptr_conv;
20964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20965 this_ptr_conv.is_owned = false;
20966 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20967 int64_t ret_val = ChannelDetails_get_balance_msat(&this_ptr_conv);
20971 void __attribute__((visibility("default"))) TS_ChannelDetails_set_balance_msat(uint32_t this_ptr, int64_t val) {
20972 LDKChannelDetails this_ptr_conv;
20973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20974 this_ptr_conv.is_owned = false;
20975 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20976 ChannelDetails_set_balance_msat(&this_ptr_conv, val);
20979 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) {
20980 LDKChannelDetails this_ptr_conv;
20981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20982 this_ptr_conv.is_owned = false;
20983 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20984 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
20988 void __attribute__((visibility("default"))) TS_ChannelDetails_set_outbound_capacity_msat(uint32_t this_ptr, int64_t val) {
20989 LDKChannelDetails this_ptr_conv;
20990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20991 this_ptr_conv.is_owned = false;
20992 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20993 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
20996 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_inbound_capacity_msat(uint32_t this_ptr) {
20997 LDKChannelDetails 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 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
21005 void __attribute__((visibility("default"))) TS_ChannelDetails_set_inbound_capacity_msat(uint32_t this_ptr, int64_t val) {
21006 LDKChannelDetails this_ptr_conv;
21007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21008 this_ptr_conv.is_owned = false;
21009 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21010 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
21013 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_confirmations_required(uint32_t this_ptr) {
21014 LDKChannelDetails this_ptr_conv;
21015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21016 this_ptr_conv.is_owned = false;
21017 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21018 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21019 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
21020 uint64_t ret_ref = (uint64_t)ret_copy;
21024 void __attribute__((visibility("default"))) TS_ChannelDetails_set_confirmations_required(uint32_t this_ptr, uint32_t val) {
21025 LDKChannelDetails this_ptr_conv;
21026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21027 this_ptr_conv.is_owned = false;
21028 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21029 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21030 CHECK_ACCESS(val_ptr);
21031 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
21032 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
21033 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
21036 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_force_close_spend_delay(uint32_t this_ptr) {
21037 LDKChannelDetails this_ptr_conv;
21038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21039 this_ptr_conv.is_owned = false;
21040 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21041 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
21042 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
21043 uint64_t ret_ref = (uint64_t)ret_copy;
21047 void __attribute__((visibility("default"))) TS_ChannelDetails_set_force_close_spend_delay(uint32_t this_ptr, uint32_t val) {
21048 LDKChannelDetails this_ptr_conv;
21049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21050 this_ptr_conv.is_owned = false;
21051 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21052 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21053 CHECK_ACCESS(val_ptr);
21054 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
21055 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)val) & ~1));
21056 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
21059 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_outbound(uint32_t this_ptr) {
21060 LDKChannelDetails this_ptr_conv;
21061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21062 this_ptr_conv.is_owned = false;
21063 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21064 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
21068 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_outbound(uint32_t this_ptr, jboolean val) {
21069 LDKChannelDetails this_ptr_conv;
21070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21071 this_ptr_conv.is_owned = false;
21072 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21073 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
21076 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_funding_locked(uint32_t this_ptr) {
21077 LDKChannelDetails this_ptr_conv;
21078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21079 this_ptr_conv.is_owned = false;
21080 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21081 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
21085 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_funding_locked(uint32_t this_ptr, jboolean val) {
21086 LDKChannelDetails this_ptr_conv;
21087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21088 this_ptr_conv.is_owned = false;
21089 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21090 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
21093 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_usable(uint32_t this_ptr) {
21094 LDKChannelDetails this_ptr_conv;
21095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21096 this_ptr_conv.is_owned = false;
21097 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21098 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
21102 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_usable(uint32_t this_ptr, jboolean val) {
21103 LDKChannelDetails this_ptr_conv;
21104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21105 this_ptr_conv.is_owned = false;
21106 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21107 ChannelDetails_set_is_usable(&this_ptr_conv, val);
21110 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_public(uint32_t this_ptr) {
21111 LDKChannelDetails this_ptr_conv;
21112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21113 this_ptr_conv.is_owned = false;
21114 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21115 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
21119 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_public(uint32_t this_ptr, jboolean val) {
21120 LDKChannelDetails this_ptr_conv;
21121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21122 this_ptr_conv.is_owned = false;
21123 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21124 ChannelDetails_set_is_public(&this_ptr_conv, val);
21127 uint32_t __attribute__((visibility("default"))) 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) {
21128 LDKThirtyTwoBytes channel_id_arg_ref;
21129 CHECK(channel_id_arg->arr_len == 32);
21130 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
21131 LDKChannelCounterparty counterparty_arg_conv;
21132 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
21133 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
21134 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
21135 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
21136 LDKOutPoint funding_txo_arg_conv;
21137 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
21138 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
21139 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
21140 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
21141 void* short_channel_id_arg_ptr = (void*)(((uint64_t)short_channel_id_arg) & ~1);
21142 CHECK_ACCESS(short_channel_id_arg_ptr);
21143 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
21144 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1));
21145 void* unspendable_punishment_reserve_arg_ptr = (void*)(((uint64_t)unspendable_punishment_reserve_arg) & ~1);
21146 CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
21147 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
21148 void* confirmations_required_arg_ptr = (void*)(((uint64_t)confirmations_required_arg) & ~1);
21149 CHECK_ACCESS(confirmations_required_arg_ptr);
21150 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
21151 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1));
21152 void* force_close_spend_delay_arg_ptr = (void*)(((uint64_t)force_close_spend_delay_arg) & ~1);
21153 CHECK_ACCESS(force_close_spend_delay_arg_ptr);
21154 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
21155 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1));
21156 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);
21157 uint64_t ret_ref = 0;
21158 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21159 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21160 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21161 ret_ref = (uint64_t)ret_var.inner;
21162 if (ret_var.is_owned) {
21168 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
21169 LDKChannelDetails ret_var = ChannelDetails_clone(arg);
21170 uint64_t ret_ref = 0;
21171 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21172 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21173 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21174 ret_ref = (uint64_t)ret_var.inner;
21175 if (ret_var.is_owned) {
21180 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_clone_ptr(uint32_t arg) {
21181 LDKChannelDetails arg_conv;
21182 arg_conv.inner = (void*)(arg & (~1));
21183 arg_conv.is_owned = false;
21184 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21185 int64_t ret_val = ChannelDetails_clone_ptr(&arg_conv);
21189 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_clone(uint32_t orig) {
21190 LDKChannelDetails orig_conv;
21191 orig_conv.inner = (void*)(orig & (~1));
21192 orig_conv.is_owned = false;
21193 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21194 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
21195 uint64_t ret_ref = 0;
21196 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21197 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21198 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21199 ret_ref = (uint64_t)ret_var.inner;
21200 if (ret_var.is_owned) {
21206 void __attribute__((visibility("default"))) TS_PaymentSendFailure_free(uint32_t this_ptr) {
21207 if ((this_ptr & 1) != 0) return;
21208 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
21209 CHECK_ACCESS(this_ptr_ptr);
21210 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
21211 FREE((void*)this_ptr);
21212 PaymentSendFailure_free(this_ptr_conv);
21215 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
21216 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21217 *ret_copy = PaymentSendFailure_clone(arg);
21218 uint64_t ret_ref = (uint64_t)ret_copy;
21221 int64_t __attribute__((visibility("default"))) TS_PaymentSendFailure_clone_ptr(uint32_t arg) {
21222 LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)arg;
21223 int64_t ret_val = PaymentSendFailure_clone_ptr(arg_conv);
21227 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_clone(uint32_t orig) {
21228 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
21229 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21230 *ret_copy = PaymentSendFailure_clone(orig_conv);
21231 uint64_t ret_ref = (uint64_t)ret_copy;
21235 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_parameter_error(uint32_t a) {
21236 void* a_ptr = (void*)(((uint64_t)a) & ~1);
21237 CHECK_ACCESS(a_ptr);
21238 LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
21239 a_conv = APIError_clone((LDKAPIError*)(((uint64_t)a) & ~1));
21240 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21241 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
21242 uint64_t ret_ref = (uint64_t)ret_copy;
21246 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_path_parameter_error(uint32_tArray a) {
21247 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
21248 a_constr.datalen = a->arr_len;
21249 if (a_constr.datalen > 0)
21250 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
21252 a_constr.data = NULL;
21253 uint32_t* a_vals = a->elems;
21254 for (size_t w = 0; w < a_constr.datalen; w++) {
21255 uint32_t a_conv_22 = a_vals[w];
21256 void* a_conv_22_ptr = (void*)(((uint64_t)a_conv_22) & ~1);
21257 CHECK_ACCESS(a_conv_22_ptr);
21258 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
21259 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
21260 a_constr.data[w] = a_conv_22_conv;
21262 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21263 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
21264 uint64_t ret_ref = (uint64_t)ret_copy;
21268 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_all_failed_retry_safe(uint32_tArray a) {
21269 LDKCVec_APIErrorZ a_constr;
21270 a_constr.datalen = a->arr_len;
21271 if (a_constr.datalen > 0)
21272 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
21274 a_constr.data = NULL;
21275 uint32_t* a_vals = a->elems;
21276 for (size_t k = 0; k < a_constr.datalen; k++) {
21277 uint32_t a_conv_10 = a_vals[k];
21278 void* a_conv_10_ptr = (void*)(((uint64_t)a_conv_10) & ~1);
21279 CHECK_ACCESS(a_conv_10_ptr);
21280 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
21281 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uint64_t)a_conv_10) & ~1));
21282 a_constr.data[k] = a_conv_10_conv;
21284 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21285 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
21286 uint64_t ret_ref = (uint64_t)ret_copy;
21290 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_partial_failure(uint32_tArray results, uint32_t failed_paths_retry, int8_tArray payment_id) {
21291 LDKCVec_CResult_NoneAPIErrorZZ results_constr;
21292 results_constr.datalen = results->arr_len;
21293 if (results_constr.datalen > 0)
21294 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
21296 results_constr.data = NULL;
21297 uint32_t* results_vals = results->elems;
21298 for (size_t w = 0; w < results_constr.datalen; w++) {
21299 uint32_t results_conv_22 = results_vals[w];
21300 void* results_conv_22_ptr = (void*)(((uint64_t)results_conv_22) & ~1);
21301 CHECK_ACCESS(results_conv_22_ptr);
21302 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
21303 results_constr.data[w] = results_conv_22_conv;
21305 LDKRouteParameters failed_paths_retry_conv;
21306 failed_paths_retry_conv.inner = (void*)(failed_paths_retry & (~1));
21307 failed_paths_retry_conv.is_owned = (failed_paths_retry & 1) || (failed_paths_retry == 0);
21308 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
21309 failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
21310 LDKThirtyTwoBytes payment_id_ref;
21311 CHECK(payment_id->arr_len == 32);
21312 memcpy(payment_id_ref.data, payment_id->elems, 32);
21313 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21314 *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
21315 uint64_t ret_ref = (uint64_t)ret_copy;
21319 uint32_t __attribute__((visibility("default"))) 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) {
21320 void* fee_est_ptr = (void*)(((uint64_t)fee_est) & ~1);
21321 CHECK_ACCESS(fee_est_ptr);
21322 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
21323 void* chain_monitor_ptr = (void*)(((uint64_t)chain_monitor) & ~1);
21324 CHECK_ACCESS(chain_monitor_ptr);
21325 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
21326 void* tx_broadcaster_ptr = (void*)(((uint64_t)tx_broadcaster) & ~1);
21327 CHECK_ACCESS(tx_broadcaster_ptr);
21328 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
21329 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
21330 CHECK_ACCESS(logger_ptr);
21331 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
21332 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
21333 CHECK_ACCESS(keys_manager_ptr);
21334 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
21335 LDKUserConfig config_conv;
21336 config_conv.inner = (void*)(config & (~1));
21337 config_conv.is_owned = (config & 1) || (config == 0);
21338 CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
21339 config_conv = UserConfig_clone(&config_conv);
21340 LDKChainParameters params_conv;
21341 params_conv.inner = (void*)(params & (~1));
21342 params_conv.is_owned = (params & 1) || (params == 0);
21343 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
21344 params_conv = ChainParameters_clone(¶ms_conv);
21345 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
21346 uint64_t ret_ref = 0;
21347 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21348 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21349 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21350 ret_ref = (uint64_t)ret_var.inner;
21351 if (ret_var.is_owned) {
21357 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_get_current_default_configuration(uint32_t this_arg) {
21358 LDKChannelManager this_arg_conv;
21359 this_arg_conv.inner = (void*)(this_arg & (~1));
21360 this_arg_conv.is_owned = false;
21361 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21362 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
21363 uint64_t ret_ref = 0;
21364 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21365 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21366 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21367 ret_ref = (uint64_t)ret_var.inner;
21368 if (ret_var.is_owned) {
21374 uint32_t __attribute__((visibility("default"))) 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) {
21375 LDKChannelManager this_arg_conv;
21376 this_arg_conv.inner = (void*)(this_arg & (~1));
21377 this_arg_conv.is_owned = false;
21378 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21379 LDKPublicKey their_network_key_ref;
21380 CHECK(their_network_key->arr_len == 33);
21381 memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33);
21382 LDKUserConfig override_config_conv;
21383 override_config_conv.inner = (void*)(override_config & (~1));
21384 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
21385 CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
21386 override_config_conv = UserConfig_clone(&override_config_conv);
21387 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
21388 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
21389 return (uint64_t)ret_conv;
21392 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_channels(uint32_t this_arg) {
21393 LDKChannelManager this_arg_conv;
21394 this_arg_conv.inner = (void*)(this_arg & (~1));
21395 this_arg_conv.is_owned = false;
21396 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21397 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
21398 uint32_tArray ret_arr = NULL;
21399 ret_arr = init_uint32_tArray(ret_var.datalen);
21400 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
21401 for (size_t q = 0; q < ret_var.datalen; q++) {
21402 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
21403 uint64_t ret_conv_16_ref = 0;
21404 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21405 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21406 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
21407 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
21408 if (ret_conv_16_var.is_owned) {
21409 ret_conv_16_ref |= 1;
21411 ret_arr_ptr[q] = ret_conv_16_ref;
21414 FREE(ret_var.data);
21418 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_usable_channels(uint32_t this_arg) {
21419 LDKChannelManager this_arg_conv;
21420 this_arg_conv.inner = (void*)(this_arg & (~1));
21421 this_arg_conv.is_owned = false;
21422 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21423 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
21424 uint32_tArray ret_arr = NULL;
21425 ret_arr = init_uint32_tArray(ret_var.datalen);
21426 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
21427 for (size_t q = 0; q < ret_var.datalen; q++) {
21428 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
21429 uint64_t ret_conv_16_ref = 0;
21430 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21431 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21432 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
21433 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
21434 if (ret_conv_16_var.is_owned) {
21435 ret_conv_16_ref |= 1;
21437 ret_arr_ptr[q] = ret_conv_16_ref;
21440 FREE(ret_var.data);
21444 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_close_channel(uint32_t this_arg, int8_tArray channel_id) {
21445 LDKChannelManager this_arg_conv;
21446 this_arg_conv.inner = (void*)(this_arg & (~1));
21447 this_arg_conv.is_owned = false;
21448 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21449 unsigned char channel_id_arr[32];
21450 CHECK(channel_id->arr_len == 32);
21451 memcpy(channel_id_arr, channel_id->elems, 32);
21452 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
21453 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
21454 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
21455 return (uint64_t)ret_conv;
21458 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_close_channel_with_target_feerate(uint32_t this_arg, int8_tArray channel_id, int32_t target_feerate_sats_per_1000_weight) {
21459 LDKChannelManager this_arg_conv;
21460 this_arg_conv.inner = (void*)(this_arg & (~1));
21461 this_arg_conv.is_owned = false;
21462 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21463 unsigned char channel_id_arr[32];
21464 CHECK(channel_id->arr_len == 32);
21465 memcpy(channel_id_arr, channel_id->elems, 32);
21466 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
21467 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
21468 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
21469 return (uint64_t)ret_conv;
21472 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_force_close_channel(uint32_t this_arg, int8_tArray channel_id) {
21473 LDKChannelManager this_arg_conv;
21474 this_arg_conv.inner = (void*)(this_arg & (~1));
21475 this_arg_conv.is_owned = false;
21476 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21477 unsigned char channel_id_arr[32];
21478 CHECK(channel_id->arr_len == 32);
21479 memcpy(channel_id_arr, channel_id->elems, 32);
21480 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
21481 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
21482 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
21483 return (uint64_t)ret_conv;
21486 void __attribute__((visibility("default"))) TS_ChannelManager_force_close_all_channels(uint32_t this_arg) {
21487 LDKChannelManager this_arg_conv;
21488 this_arg_conv.inner = (void*)(this_arg & (~1));
21489 this_arg_conv.is_owned = false;
21490 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21491 ChannelManager_force_close_all_channels(&this_arg_conv);
21494 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
21495 LDKChannelManager this_arg_conv;
21496 this_arg_conv.inner = (void*)(this_arg & (~1));
21497 this_arg_conv.is_owned = false;
21498 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21499 LDKRoute route_conv;
21500 route_conv.inner = (void*)(route & (~1));
21501 route_conv.is_owned = false;
21502 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
21503 LDKThirtyTwoBytes payment_hash_ref;
21504 CHECK(payment_hash->arr_len == 32);
21505 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
21506 LDKThirtyTwoBytes payment_secret_ref;
21507 CHECK(payment_secret->arr_len == 32);
21508 memcpy(payment_secret_ref.data, payment_secret->elems, 32);
21509 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
21510 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
21511 return (uint64_t)ret_conv;
21514 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_retry_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_id) {
21515 LDKChannelManager this_arg_conv;
21516 this_arg_conv.inner = (void*)(this_arg & (~1));
21517 this_arg_conv.is_owned = false;
21518 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21519 LDKRoute route_conv;
21520 route_conv.inner = (void*)(route & (~1));
21521 route_conv.is_owned = false;
21522 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
21523 LDKThirtyTwoBytes payment_id_ref;
21524 CHECK(payment_id->arr_len == 32);
21525 memcpy(payment_id_ref.data, payment_id->elems, 32);
21526 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
21527 *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
21528 return (uint64_t)ret_conv;
21531 void __attribute__((visibility("default"))) TS_ChannelManager_abandon_payment(uint32_t this_arg, int8_tArray payment_id) {
21532 LDKChannelManager this_arg_conv;
21533 this_arg_conv.inner = (void*)(this_arg & (~1));
21534 this_arg_conv.is_owned = false;
21535 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21536 LDKThirtyTwoBytes payment_id_ref;
21537 CHECK(payment_id->arr_len == 32);
21538 memcpy(payment_id_ref.data, payment_id->elems, 32);
21539 ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
21542 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_spontaneous_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_preimage) {
21543 LDKChannelManager this_arg_conv;
21544 this_arg_conv.inner = (void*)(this_arg & (~1));
21545 this_arg_conv.is_owned = false;
21546 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21547 LDKRoute route_conv;
21548 route_conv.inner = (void*)(route & (~1));
21549 route_conv.is_owned = false;
21550 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
21551 LDKThirtyTwoBytes payment_preimage_ref;
21552 CHECK(payment_preimage->arr_len == 32);
21553 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32);
21554 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
21555 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
21556 return (uint64_t)ret_conv;
21559 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_funding_transaction_generated(uint32_t this_arg, int8_tArray temporary_channel_id, int8_tArray funding_transaction) {
21560 LDKChannelManager this_arg_conv;
21561 this_arg_conv.inner = (void*)(this_arg & (~1));
21562 this_arg_conv.is_owned = false;
21563 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21564 unsigned char temporary_channel_id_arr[32];
21565 CHECK(temporary_channel_id->arr_len == 32);
21566 memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32);
21567 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
21568 LDKTransaction funding_transaction_ref;
21569 funding_transaction_ref.datalen = funding_transaction->arr_len;
21570 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
21571 memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen);
21572 funding_transaction_ref.data_is_owned = true;
21573 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
21574 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
21575 return (uint64_t)ret_conv;
21578 void __attribute__((visibility("default"))) TS_ChannelManager_broadcast_node_announcement(uint32_t this_arg, int8_tArray rgb, int8_tArray alias, uint32_tArray addresses) {
21579 LDKChannelManager this_arg_conv;
21580 this_arg_conv.inner = (void*)(this_arg & (~1));
21581 this_arg_conv.is_owned = false;
21582 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21583 LDKThreeBytes rgb_ref;
21584 CHECK(rgb->arr_len == 3);
21585 memcpy(rgb_ref.data, rgb->elems, 3);
21586 LDKThirtyTwoBytes alias_ref;
21587 CHECK(alias->arr_len == 32);
21588 memcpy(alias_ref.data, alias->elems, 32);
21589 LDKCVec_NetAddressZ addresses_constr;
21590 addresses_constr.datalen = addresses->arr_len;
21591 if (addresses_constr.datalen > 0)
21592 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
21594 addresses_constr.data = NULL;
21595 uint32_t* addresses_vals = addresses->elems;
21596 for (size_t m = 0; m < addresses_constr.datalen; m++) {
21597 uint32_t addresses_conv_12 = addresses_vals[m];
21598 void* addresses_conv_12_ptr = (void*)(((uint64_t)addresses_conv_12) & ~1);
21599 CHECK_ACCESS(addresses_conv_12_ptr);
21600 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
21601 addresses_constr.data[m] = addresses_conv_12_conv;
21603 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
21606 void __attribute__((visibility("default"))) TS_ChannelManager_process_pending_htlc_forwards(uint32_t this_arg) {
21607 LDKChannelManager this_arg_conv;
21608 this_arg_conv.inner = (void*)(this_arg & (~1));
21609 this_arg_conv.is_owned = false;
21610 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21611 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
21614 void __attribute__((visibility("default"))) TS_ChannelManager_timer_tick_occurred(uint32_t this_arg) {
21615 LDKChannelManager this_arg_conv;
21616 this_arg_conv.inner = (void*)(this_arg & (~1));
21617 this_arg_conv.is_owned = false;
21618 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21619 ChannelManager_timer_tick_occurred(&this_arg_conv);
21622 jboolean __attribute__((visibility("default"))) TS_ChannelManager_fail_htlc_backwards(uint32_t this_arg, int8_tArray payment_hash) {
21623 LDKChannelManager this_arg_conv;
21624 this_arg_conv.inner = (void*)(this_arg & (~1));
21625 this_arg_conv.is_owned = false;
21626 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21627 unsigned char payment_hash_arr[32];
21628 CHECK(payment_hash->arr_len == 32);
21629 memcpy(payment_hash_arr, payment_hash->elems, 32);
21630 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
21631 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
21635 jboolean __attribute__((visibility("default"))) TS_ChannelManager_claim_funds(uint32_t this_arg, int8_tArray payment_preimage) {
21636 LDKChannelManager this_arg_conv;
21637 this_arg_conv.inner = (void*)(this_arg & (~1));
21638 this_arg_conv.is_owned = false;
21639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21640 LDKThirtyTwoBytes payment_preimage_ref;
21641 CHECK(payment_preimage->arr_len == 32);
21642 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32);
21643 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
21647 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_get_our_node_id(uint32_t this_arg) {
21648 LDKChannelManager this_arg_conv;
21649 this_arg_conv.inner = (void*)(this_arg & (~1));
21650 this_arg_conv.is_owned = false;
21651 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21652 int8_tArray ret_arr = init_int8_tArray(33);
21653 memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
21657 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_inbound_payment(uint32_t this_arg, uint32_t min_value_msat, int32_t invoice_expiry_delta_secs) {
21658 LDKChannelManager this_arg_conv;
21659 this_arg_conv.inner = (void*)(this_arg & (~1));
21660 this_arg_conv.is_owned = false;
21661 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21662 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
21663 CHECK_ACCESS(min_value_msat_ptr);
21664 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
21665 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
21666 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
21667 *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
21668 return (uint64_t)ret_conv;
21671 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_inbound_payment_legacy(uint32_t this_arg, uint32_t min_value_msat, int32_t invoice_expiry_delta_secs) {
21672 LDKChannelManager this_arg_conv;
21673 this_arg_conv.inner = (void*)(this_arg & (~1));
21674 this_arg_conv.is_owned = false;
21675 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21676 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
21677 CHECK_ACCESS(min_value_msat_ptr);
21678 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
21679 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
21680 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
21681 *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
21682 return (uint64_t)ret_conv;
21685 uint32_t __attribute__((visibility("default"))) 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) {
21686 LDKChannelManager this_arg_conv;
21687 this_arg_conv.inner = (void*)(this_arg & (~1));
21688 this_arg_conv.is_owned = false;
21689 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21690 LDKThirtyTwoBytes payment_hash_ref;
21691 CHECK(payment_hash->arr_len == 32);
21692 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
21693 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
21694 CHECK_ACCESS(min_value_msat_ptr);
21695 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
21696 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
21697 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
21698 *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
21699 return (uint64_t)ret_conv;
21702 uint32_t __attribute__((visibility("default"))) 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) {
21703 LDKChannelManager this_arg_conv;
21704 this_arg_conv.inner = (void*)(this_arg & (~1));
21705 this_arg_conv.is_owned = false;
21706 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21707 LDKThirtyTwoBytes payment_hash_ref;
21708 CHECK(payment_hash->arr_len == 32);
21709 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
21710 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
21711 CHECK_ACCESS(min_value_msat_ptr);
21712 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
21713 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
21714 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
21715 *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
21716 return (uint64_t)ret_conv;
21719 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_get_payment_preimage(uint32_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret) {
21720 LDKChannelManager this_arg_conv;
21721 this_arg_conv.inner = (void*)(this_arg & (~1));
21722 this_arg_conv.is_owned = false;
21723 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21724 LDKThirtyTwoBytes payment_hash_ref;
21725 CHECK(payment_hash->arr_len == 32);
21726 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
21727 LDKThirtyTwoBytes payment_secret_ref;
21728 CHECK(payment_secret->arr_len == 32);
21729 memcpy(payment_secret_ref.data, payment_secret->elems, 32);
21730 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
21731 *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
21732 return (uint64_t)ret_conv;
21735 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_MessageSendEventsProvider(uint32_t this_arg) {
21736 LDKChannelManager this_arg_conv;
21737 this_arg_conv.inner = (void*)(this_arg & (~1));
21738 this_arg_conv.is_owned = false;
21739 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21740 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
21741 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
21742 return (uint64_t)ret_ret;
21745 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_EventsProvider(uint32_t this_arg) {
21746 LDKChannelManager this_arg_conv;
21747 this_arg_conv.inner = (void*)(this_arg & (~1));
21748 this_arg_conv.is_owned = false;
21749 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21750 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
21751 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
21752 return (uint64_t)ret_ret;
21755 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Listen(uint32_t this_arg) {
21756 LDKChannelManager this_arg_conv;
21757 this_arg_conv.inner = (void*)(this_arg & (~1));
21758 this_arg_conv.is_owned = false;
21759 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21760 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
21761 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
21762 return (uint64_t)ret_ret;
21765 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Confirm(uint32_t this_arg) {
21766 LDKChannelManager this_arg_conv;
21767 this_arg_conv.inner = (void*)(this_arg & (~1));
21768 this_arg_conv.is_owned = false;
21769 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21770 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
21771 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
21772 return (uint64_t)ret_ret;
21775 void __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update(uint32_t this_arg) {
21776 LDKChannelManager this_arg_conv;
21777 this_arg_conv.inner = (void*)(this_arg & (~1));
21778 this_arg_conv.is_owned = false;
21779 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21780 ChannelManager_await_persistable_update(&this_arg_conv);
21783 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_current_best_block(uint32_t this_arg) {
21784 LDKChannelManager this_arg_conv;
21785 this_arg_conv.inner = (void*)(this_arg & (~1));
21786 this_arg_conv.is_owned = false;
21787 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21788 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
21789 uint64_t ret_ref = 0;
21790 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21791 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21792 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21793 ret_ref = (uint64_t)ret_var.inner;
21794 if (ret_var.is_owned) {
21800 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_ChannelMessageHandler(uint32_t this_arg) {
21801 LDKChannelManager this_arg_conv;
21802 this_arg_conv.inner = (void*)(this_arg & (~1));
21803 this_arg_conv.is_owned = false;
21804 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21805 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
21806 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
21807 return (uint64_t)ret_ret;
21810 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_write(uint32_t obj) {
21811 LDKChannelManager obj_conv;
21812 obj_conv.inner = (void*)(obj & (~1));
21813 obj_conv.is_owned = false;
21814 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
21815 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
21816 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
21817 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21818 CVec_u8Z_free(ret_var);
21822 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_free(uint32_t this_obj) {
21823 LDKChannelManagerReadArgs this_obj_conv;
21824 this_obj_conv.inner = (void*)(this_obj & (~1));
21825 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21826 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21827 ChannelManagerReadArgs_free(this_obj_conv);
21830 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_keys_manager(uint32_t this_ptr) {
21831 LDKChannelManagerReadArgs this_ptr_conv;
21832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21833 this_ptr_conv.is_owned = false;
21834 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21835 // WARNING: This object doesn't live past this scope, needs clone!
21836 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv)) | 1;
21840 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_keys_manager(uint32_t this_ptr, uint32_t val) {
21841 LDKChannelManagerReadArgs this_ptr_conv;
21842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21843 this_ptr_conv.is_owned = false;
21844 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21845 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21846 CHECK_ACCESS(val_ptr);
21847 LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
21848 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
21851 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint32_t this_ptr) {
21852 LDKChannelManagerReadArgs this_ptr_conv;
21853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21854 this_ptr_conv.is_owned = false;
21855 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21856 // WARNING: This object doesn't live past this scope, needs clone!
21857 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv)) | 1;
21861 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint32_t this_ptr, uint32_t val) {
21862 LDKChannelManagerReadArgs this_ptr_conv;
21863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21864 this_ptr_conv.is_owned = false;
21865 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21866 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21867 CHECK_ACCESS(val_ptr);
21868 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
21869 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
21872 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint32_t this_ptr) {
21873 LDKChannelManagerReadArgs this_ptr_conv;
21874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21875 this_ptr_conv.is_owned = false;
21876 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21877 // WARNING: This object doesn't live past this scope, needs clone!
21878 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv)) | 1;
21882 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint32_t this_ptr, uint32_t val) {
21883 LDKChannelManagerReadArgs this_ptr_conv;
21884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21885 this_ptr_conv.is_owned = false;
21886 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21887 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21888 CHECK_ACCESS(val_ptr);
21889 LDKWatch val_conv = *(LDKWatch*)(val_ptr);
21890 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
21893 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint32_t this_ptr) {
21894 LDKChannelManagerReadArgs this_ptr_conv;
21895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21896 this_ptr_conv.is_owned = false;
21897 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21898 // WARNING: This object doesn't live past this scope, needs clone!
21899 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv)) | 1;
21903 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint32_t this_ptr, uint32_t val) {
21904 LDKChannelManagerReadArgs this_ptr_conv;
21905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21906 this_ptr_conv.is_owned = false;
21907 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21908 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21909 CHECK_ACCESS(val_ptr);
21910 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
21911 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
21914 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_logger(uint32_t this_ptr) {
21915 LDKChannelManagerReadArgs this_ptr_conv;
21916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21917 this_ptr_conv.is_owned = false;
21918 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21919 // WARNING: This object doesn't live past this scope, needs clone!
21920 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv)) | 1;
21924 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_logger(uint32_t this_ptr, uint32_t val) {
21925 LDKChannelManagerReadArgs this_ptr_conv;
21926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21927 this_ptr_conv.is_owned = false;
21928 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21929 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21930 CHECK_ACCESS(val_ptr);
21931 LDKLogger val_conv = *(LDKLogger*)(val_ptr);
21932 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
21935 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_default_config(uint32_t this_ptr) {
21936 LDKChannelManagerReadArgs this_ptr_conv;
21937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21938 this_ptr_conv.is_owned = false;
21939 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21940 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
21941 uint64_t ret_ref = 0;
21942 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21943 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21944 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21945 ret_ref = (uint64_t)ret_var.inner;
21946 if (ret_var.is_owned) {
21952 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_default_config(uint32_t this_ptr, uint32_t val) {
21953 LDKChannelManagerReadArgs this_ptr_conv;
21954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21955 this_ptr_conv.is_owned = false;
21956 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21957 LDKUserConfig val_conv;
21958 val_conv.inner = (void*)(val & (~1));
21959 val_conv.is_owned = (val & 1) || (val == 0);
21960 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21961 val_conv = UserConfig_clone(&val_conv);
21962 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
21965 uint32_t __attribute__((visibility("default"))) 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) {
21966 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
21967 CHECK_ACCESS(keys_manager_ptr);
21968 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
21969 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
21970 CHECK_ACCESS(fee_estimator_ptr);
21971 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
21972 void* chain_monitor_ptr = (void*)(((uint64_t)chain_monitor) & ~1);
21973 CHECK_ACCESS(chain_monitor_ptr);
21974 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
21975 void* tx_broadcaster_ptr = (void*)(((uint64_t)tx_broadcaster) & ~1);
21976 CHECK_ACCESS(tx_broadcaster_ptr);
21977 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
21978 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
21979 CHECK_ACCESS(logger_ptr);
21980 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
21981 LDKUserConfig default_config_conv;
21982 default_config_conv.inner = (void*)(default_config & (~1));
21983 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
21984 CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
21985 default_config_conv = UserConfig_clone(&default_config_conv);
21986 LDKCVec_ChannelMonitorZ channel_monitors_constr;
21987 channel_monitors_constr.datalen = channel_monitors->arr_len;
21988 if (channel_monitors_constr.datalen > 0)
21989 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
21991 channel_monitors_constr.data = NULL;
21992 uint32_t* channel_monitors_vals = channel_monitors->elems;
21993 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
21994 uint32_t channel_monitors_conv_16 = channel_monitors_vals[q];
21995 LDKChannelMonitor channel_monitors_conv_16_conv;
21996 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
21997 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
21998 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
21999 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
22001 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);
22002 uint64_t ret_ref = 0;
22003 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22004 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22005 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22006 ret_ref = (uint64_t)ret_var.inner;
22007 if (ret_var.is_owned) {
22013 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint32_t arg) {
22014 LDKu8slice ser_ref;
22015 ser_ref.datalen = ser->arr_len;
22016 ser_ref.data = ser->elems;
22017 LDKChannelManagerReadArgs arg_conv;
22018 arg_conv.inner = (void*)(arg & (~1));
22019 arg_conv.is_owned = (arg & 1) || (arg == 0);
22020 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22021 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
22022 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
22023 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
22024 return (uint64_t)ret_conv;
22027 void __attribute__((visibility("default"))) TS_DecodeError_free(uint32_t this_obj) {
22028 LDKDecodeError this_obj_conv;
22029 this_obj_conv.inner = (void*)(this_obj & (~1));
22030 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22031 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22032 DecodeError_free(this_obj_conv);
22035 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
22036 LDKDecodeError ret_var = DecodeError_clone(arg);
22037 uint64_t ret_ref = 0;
22038 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22039 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22040 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22041 ret_ref = (uint64_t)ret_var.inner;
22042 if (ret_var.is_owned) {
22047 int64_t __attribute__((visibility("default"))) TS_DecodeError_clone_ptr(uint32_t arg) {
22048 LDKDecodeError arg_conv;
22049 arg_conv.inner = (void*)(arg & (~1));
22050 arg_conv.is_owned = false;
22051 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22052 int64_t ret_val = DecodeError_clone_ptr(&arg_conv);
22056 uint32_t __attribute__((visibility("default"))) TS_DecodeError_clone(uint32_t orig) {
22057 LDKDecodeError orig_conv;
22058 orig_conv.inner = (void*)(orig & (~1));
22059 orig_conv.is_owned = false;
22060 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22061 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
22062 uint64_t ret_ref = 0;
22063 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22064 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22065 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22066 ret_ref = (uint64_t)ret_var.inner;
22067 if (ret_var.is_owned) {
22073 void __attribute__((visibility("default"))) TS_Init_free(uint32_t this_obj) {
22074 LDKInit this_obj_conv;
22075 this_obj_conv.inner = (void*)(this_obj & (~1));
22076 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22077 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22078 Init_free(this_obj_conv);
22081 uint32_t __attribute__((visibility("default"))) TS_Init_get_features(uint32_t this_ptr) {
22082 LDKInit this_ptr_conv;
22083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22084 this_ptr_conv.is_owned = false;
22085 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22086 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
22087 uint64_t ret_ref = 0;
22088 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22089 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22090 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22091 ret_ref = (uint64_t)ret_var.inner;
22092 if (ret_var.is_owned) {
22098 void __attribute__((visibility("default"))) TS_Init_set_features(uint32_t this_ptr, uint32_t val) {
22099 LDKInit this_ptr_conv;
22100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22101 this_ptr_conv.is_owned = false;
22102 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22103 LDKInitFeatures val_conv;
22104 val_conv.inner = (void*)(val & (~1));
22105 val_conv.is_owned = (val & 1) || (val == 0);
22106 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
22107 val_conv = InitFeatures_clone(&val_conv);
22108 Init_set_features(&this_ptr_conv, val_conv);
22111 uint32_t __attribute__((visibility("default"))) TS_Init_new(uint32_t features_arg) {
22112 LDKInitFeatures features_arg_conv;
22113 features_arg_conv.inner = (void*)(features_arg & (~1));
22114 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
22115 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
22116 features_arg_conv = InitFeatures_clone(&features_arg_conv);
22117 LDKInit ret_var = Init_new(features_arg_conv);
22118 uint64_t ret_ref = 0;
22119 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22120 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22121 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22122 ret_ref = (uint64_t)ret_var.inner;
22123 if (ret_var.is_owned) {
22129 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
22130 LDKInit ret_var = Init_clone(arg);
22131 uint64_t ret_ref = 0;
22132 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22133 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22134 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22135 ret_ref = (uint64_t)ret_var.inner;
22136 if (ret_var.is_owned) {
22141 int64_t __attribute__((visibility("default"))) TS_Init_clone_ptr(uint32_t arg) {
22143 arg_conv.inner = (void*)(arg & (~1));
22144 arg_conv.is_owned = false;
22145 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22146 int64_t ret_val = Init_clone_ptr(&arg_conv);
22150 uint32_t __attribute__((visibility("default"))) TS_Init_clone(uint32_t orig) {
22152 orig_conv.inner = (void*)(orig & (~1));
22153 orig_conv.is_owned = false;
22154 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22155 LDKInit ret_var = Init_clone(&orig_conv);
22156 uint64_t ret_ref = 0;
22157 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22158 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22159 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22160 ret_ref = (uint64_t)ret_var.inner;
22161 if (ret_var.is_owned) {
22167 void __attribute__((visibility("default"))) TS_ErrorMessage_free(uint32_t this_obj) {
22168 LDKErrorMessage this_obj_conv;
22169 this_obj_conv.inner = (void*)(this_obj & (~1));
22170 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22171 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22172 ErrorMessage_free(this_obj_conv);
22175 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_get_channel_id(uint32_t this_ptr) {
22176 LDKErrorMessage this_ptr_conv;
22177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22178 this_ptr_conv.is_owned = false;
22179 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22180 int8_tArray ret_arr = init_int8_tArray(32);
22181 memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
22185 void __attribute__((visibility("default"))) TS_ErrorMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
22186 LDKErrorMessage this_ptr_conv;
22187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22188 this_ptr_conv.is_owned = false;
22189 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22190 LDKThirtyTwoBytes val_ref;
22191 CHECK(val->arr_len == 32);
22192 memcpy(val_ref.data, val->elems, 32);
22193 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
22196 jstring __attribute__((visibility("default"))) TS_ErrorMessage_get_data(uint32_t this_ptr) {
22197 LDKErrorMessage this_ptr_conv;
22198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22199 this_ptr_conv.is_owned = false;
22200 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22201 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
22202 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
22207 void __attribute__((visibility("default"))) TS_ErrorMessage_set_data(uint32_t this_ptr, jstring val) {
22208 LDKErrorMessage this_ptr_conv;
22209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22210 this_ptr_conv.is_owned = false;
22211 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22212 LDKStr val_conv = str_ref_to_owned_c(val);
22213 ErrorMessage_set_data(&this_ptr_conv, val_conv);
22216 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
22217 LDKThirtyTwoBytes channel_id_arg_ref;
22218 CHECK(channel_id_arg->arr_len == 32);
22219 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
22220 LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
22221 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
22222 uint64_t ret_ref = 0;
22223 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22224 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22225 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22226 ret_ref = (uint64_t)ret_var.inner;
22227 if (ret_var.is_owned) {
22233 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
22234 LDKErrorMessage ret_var = ErrorMessage_clone(arg);
22235 uint64_t ret_ref = 0;
22236 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22237 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22238 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22239 ret_ref = (uint64_t)ret_var.inner;
22240 if (ret_var.is_owned) {
22245 int64_t __attribute__((visibility("default"))) TS_ErrorMessage_clone_ptr(uint32_t arg) {
22246 LDKErrorMessage arg_conv;
22247 arg_conv.inner = (void*)(arg & (~1));
22248 arg_conv.is_owned = false;
22249 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22250 int64_t ret_val = ErrorMessage_clone_ptr(&arg_conv);
22254 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_clone(uint32_t orig) {
22255 LDKErrorMessage orig_conv;
22256 orig_conv.inner = (void*)(orig & (~1));
22257 orig_conv.is_owned = false;
22258 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22259 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
22260 uint64_t ret_ref = 0;
22261 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22262 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22263 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22264 ret_ref = (uint64_t)ret_var.inner;
22265 if (ret_var.is_owned) {
22271 void __attribute__((visibility("default"))) TS_Ping_free(uint32_t this_obj) {
22272 LDKPing this_obj_conv;
22273 this_obj_conv.inner = (void*)(this_obj & (~1));
22274 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22275 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22276 Ping_free(this_obj_conv);
22279 int16_t __attribute__((visibility("default"))) TS_Ping_get_ponglen(uint32_t this_ptr) {
22280 LDKPing this_ptr_conv;
22281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22282 this_ptr_conv.is_owned = false;
22283 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22284 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
22288 void __attribute__((visibility("default"))) TS_Ping_set_ponglen(uint32_t this_ptr, int16_t val) {
22289 LDKPing this_ptr_conv;
22290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22291 this_ptr_conv.is_owned = false;
22292 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22293 Ping_set_ponglen(&this_ptr_conv, val);
22296 int16_t __attribute__((visibility("default"))) TS_Ping_get_byteslen(uint32_t this_ptr) {
22297 LDKPing this_ptr_conv;
22298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22299 this_ptr_conv.is_owned = false;
22300 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22301 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
22305 void __attribute__((visibility("default"))) TS_Ping_set_byteslen(uint32_t this_ptr, int16_t val) {
22306 LDKPing this_ptr_conv;
22307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22308 this_ptr_conv.is_owned = false;
22309 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22310 Ping_set_byteslen(&this_ptr_conv, val);
22313 uint32_t __attribute__((visibility("default"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
22314 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
22315 uint64_t ret_ref = 0;
22316 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22317 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22318 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22319 ret_ref = (uint64_t)ret_var.inner;
22320 if (ret_var.is_owned) {
22326 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
22327 LDKPing ret_var = Ping_clone(arg);
22328 uint64_t ret_ref = 0;
22329 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22330 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22331 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22332 ret_ref = (uint64_t)ret_var.inner;
22333 if (ret_var.is_owned) {
22338 int64_t __attribute__((visibility("default"))) TS_Ping_clone_ptr(uint32_t arg) {
22340 arg_conv.inner = (void*)(arg & (~1));
22341 arg_conv.is_owned = false;
22342 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22343 int64_t ret_val = Ping_clone_ptr(&arg_conv);
22347 uint32_t __attribute__((visibility("default"))) TS_Ping_clone(uint32_t orig) {
22349 orig_conv.inner = (void*)(orig & (~1));
22350 orig_conv.is_owned = false;
22351 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22352 LDKPing ret_var = Ping_clone(&orig_conv);
22353 uint64_t ret_ref = 0;
22354 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22355 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22356 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22357 ret_ref = (uint64_t)ret_var.inner;
22358 if (ret_var.is_owned) {
22364 void __attribute__((visibility("default"))) TS_Pong_free(uint32_t this_obj) {
22365 LDKPong this_obj_conv;
22366 this_obj_conv.inner = (void*)(this_obj & (~1));
22367 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22368 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22369 Pong_free(this_obj_conv);
22372 int16_t __attribute__((visibility("default"))) TS_Pong_get_byteslen(uint32_t this_ptr) {
22373 LDKPong this_ptr_conv;
22374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22375 this_ptr_conv.is_owned = false;
22376 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22377 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
22381 void __attribute__((visibility("default"))) TS_Pong_set_byteslen(uint32_t this_ptr, int16_t val) {
22382 LDKPong this_ptr_conv;
22383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22384 this_ptr_conv.is_owned = false;
22385 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22386 Pong_set_byteslen(&this_ptr_conv, val);
22389 uint32_t __attribute__((visibility("default"))) TS_Pong_new(int16_t byteslen_arg) {
22390 LDKPong ret_var = Pong_new(byteslen_arg);
22391 uint64_t ret_ref = 0;
22392 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22393 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22394 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22395 ret_ref = (uint64_t)ret_var.inner;
22396 if (ret_var.is_owned) {
22402 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
22403 LDKPong ret_var = Pong_clone(arg);
22404 uint64_t ret_ref = 0;
22405 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22406 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22407 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22408 ret_ref = (uint64_t)ret_var.inner;
22409 if (ret_var.is_owned) {
22414 int64_t __attribute__((visibility("default"))) TS_Pong_clone_ptr(uint32_t arg) {
22416 arg_conv.inner = (void*)(arg & (~1));
22417 arg_conv.is_owned = false;
22418 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22419 int64_t ret_val = Pong_clone_ptr(&arg_conv);
22423 uint32_t __attribute__((visibility("default"))) TS_Pong_clone(uint32_t orig) {
22425 orig_conv.inner = (void*)(orig & (~1));
22426 orig_conv.is_owned = false;
22427 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22428 LDKPong ret_var = Pong_clone(&orig_conv);
22429 uint64_t ret_ref = 0;
22430 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22431 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22432 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22433 ret_ref = (uint64_t)ret_var.inner;
22434 if (ret_var.is_owned) {
22440 void __attribute__((visibility("default"))) TS_OpenChannel_free(uint32_t this_obj) {
22441 LDKOpenChannel this_obj_conv;
22442 this_obj_conv.inner = (void*)(this_obj & (~1));
22443 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22444 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22445 OpenChannel_free(this_obj_conv);
22448 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_chain_hash(uint32_t this_ptr) {
22449 LDKOpenChannel this_ptr_conv;
22450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22451 this_ptr_conv.is_owned = false;
22452 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22453 int8_tArray ret_arr = init_int8_tArray(32);
22454 memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
22458 void __attribute__((visibility("default"))) TS_OpenChannel_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
22459 LDKOpenChannel this_ptr_conv;
22460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22461 this_ptr_conv.is_owned = false;
22462 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22463 LDKThirtyTwoBytes val_ref;
22464 CHECK(val->arr_len == 32);
22465 memcpy(val_ref.data, val->elems, 32);
22466 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
22469 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_temporary_channel_id(uint32_t this_ptr) {
22470 LDKOpenChannel this_ptr_conv;
22471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22472 this_ptr_conv.is_owned = false;
22473 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22474 int8_tArray ret_arr = init_int8_tArray(32);
22475 memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
22479 void __attribute__((visibility("default"))) TS_OpenChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
22480 LDKOpenChannel this_ptr_conv;
22481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22482 this_ptr_conv.is_owned = false;
22483 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22484 LDKThirtyTwoBytes val_ref;
22485 CHECK(val->arr_len == 32);
22486 memcpy(val_ref.data, val->elems, 32);
22487 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
22490 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_funding_satoshis(uint32_t this_ptr) {
22491 LDKOpenChannel this_ptr_conv;
22492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22493 this_ptr_conv.is_owned = false;
22494 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22495 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
22499 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_satoshis(uint32_t this_ptr, int64_t val) {
22500 LDKOpenChannel this_ptr_conv;
22501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22502 this_ptr_conv.is_owned = false;
22503 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22504 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
22507 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_push_msat(uint32_t this_ptr) {
22508 LDKOpenChannel this_ptr_conv;
22509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22510 this_ptr_conv.is_owned = false;
22511 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22512 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
22516 void __attribute__((visibility("default"))) TS_OpenChannel_set_push_msat(uint32_t this_ptr, int64_t val) {
22517 LDKOpenChannel 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 OpenChannel_set_push_msat(&this_ptr_conv, val);
22524 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
22525 LDKOpenChannel this_ptr_conv;
22526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22527 this_ptr_conv.is_owned = false;
22528 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22529 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
22533 void __attribute__((visibility("default"))) TS_OpenChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
22534 LDKOpenChannel this_ptr_conv;
22535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22536 this_ptr_conv.is_owned = false;
22537 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22538 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
22541 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
22542 LDKOpenChannel this_ptr_conv;
22543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22544 this_ptr_conv.is_owned = false;
22545 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22546 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
22550 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
22551 LDKOpenChannel this_ptr_conv;
22552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22553 this_ptr_conv.is_owned = false;
22554 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22555 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
22558 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
22559 LDKOpenChannel this_ptr_conv;
22560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22561 this_ptr_conv.is_owned = false;
22562 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22563 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
22567 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
22568 LDKOpenChannel this_ptr_conv;
22569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22570 this_ptr_conv.is_owned = false;
22571 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22572 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
22575 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
22576 LDKOpenChannel this_ptr_conv;
22577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22578 this_ptr_conv.is_owned = false;
22579 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22580 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
22584 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
22585 LDKOpenChannel this_ptr_conv;
22586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22587 this_ptr_conv.is_owned = false;
22588 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22589 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
22592 int32_t __attribute__((visibility("default"))) TS_OpenChannel_get_feerate_per_kw(uint32_t this_ptr) {
22593 LDKOpenChannel this_ptr_conv;
22594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22595 this_ptr_conv.is_owned = false;
22596 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22597 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
22601 void __attribute__((visibility("default"))) TS_OpenChannel_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
22602 LDKOpenChannel this_ptr_conv;
22603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22604 this_ptr_conv.is_owned = false;
22605 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22606 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
22609 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_to_self_delay(uint32_t this_ptr) {
22610 LDKOpenChannel this_ptr_conv;
22611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22612 this_ptr_conv.is_owned = false;
22613 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22614 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
22618 void __attribute__((visibility("default"))) TS_OpenChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
22619 LDKOpenChannel this_ptr_conv;
22620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22621 this_ptr_conv.is_owned = false;
22622 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22623 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
22626 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
22627 LDKOpenChannel this_ptr_conv;
22628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22629 this_ptr_conv.is_owned = false;
22630 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22631 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
22635 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
22636 LDKOpenChannel this_ptr_conv;
22637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22638 this_ptr_conv.is_owned = false;
22639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22640 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
22643 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_funding_pubkey(uint32_t this_ptr) {
22644 LDKOpenChannel this_ptr_conv;
22645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22646 this_ptr_conv.is_owned = false;
22647 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22648 int8_tArray ret_arr = init_int8_tArray(33);
22649 memcpy(ret_arr->elems, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
22653 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
22654 LDKOpenChannel this_ptr_conv;
22655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22656 this_ptr_conv.is_owned = false;
22657 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22658 LDKPublicKey val_ref;
22659 CHECK(val->arr_len == 33);
22660 memcpy(val_ref.compressed_form, val->elems, 33);
22661 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
22664 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_revocation_basepoint(uint32_t this_ptr) {
22665 LDKOpenChannel this_ptr_conv;
22666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22667 this_ptr_conv.is_owned = false;
22668 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22669 int8_tArray ret_arr = init_int8_tArray(33);
22670 memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
22674 void __attribute__((visibility("default"))) TS_OpenChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
22675 LDKOpenChannel this_ptr_conv;
22676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22677 this_ptr_conv.is_owned = false;
22678 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22679 LDKPublicKey val_ref;
22680 CHECK(val->arr_len == 33);
22681 memcpy(val_ref.compressed_form, val->elems, 33);
22682 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
22685 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_payment_point(uint32_t this_ptr) {
22686 LDKOpenChannel this_ptr_conv;
22687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22688 this_ptr_conv.is_owned = false;
22689 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22690 int8_tArray ret_arr = init_int8_tArray(33);
22691 memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
22695 void __attribute__((visibility("default"))) TS_OpenChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
22696 LDKOpenChannel this_ptr_conv;
22697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22698 this_ptr_conv.is_owned = false;
22699 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22700 LDKPublicKey val_ref;
22701 CHECK(val->arr_len == 33);
22702 memcpy(val_ref.compressed_form, val->elems, 33);
22703 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
22706 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
22707 LDKOpenChannel this_ptr_conv;
22708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22709 this_ptr_conv.is_owned = false;
22710 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22711 int8_tArray ret_arr = init_int8_tArray(33);
22712 memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
22716 void __attribute__((visibility("default"))) TS_OpenChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
22717 LDKOpenChannel this_ptr_conv;
22718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22719 this_ptr_conv.is_owned = false;
22720 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22721 LDKPublicKey val_ref;
22722 CHECK(val->arr_len == 33);
22723 memcpy(val_ref.compressed_form, val->elems, 33);
22724 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
22727 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_basepoint(uint32_t this_ptr) {
22728 LDKOpenChannel this_ptr_conv;
22729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22730 this_ptr_conv.is_owned = false;
22731 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22732 int8_tArray ret_arr = init_int8_tArray(33);
22733 memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
22737 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
22738 LDKOpenChannel this_ptr_conv;
22739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22740 this_ptr_conv.is_owned = false;
22741 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22742 LDKPublicKey val_ref;
22743 CHECK(val->arr_len == 33);
22744 memcpy(val_ref.compressed_form, val->elems, 33);
22745 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
22748 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_first_per_commitment_point(uint32_t this_ptr) {
22749 LDKOpenChannel this_ptr_conv;
22750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22751 this_ptr_conv.is_owned = false;
22752 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22753 int8_tArray ret_arr = init_int8_tArray(33);
22754 memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
22758 void __attribute__((visibility("default"))) TS_OpenChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
22759 LDKOpenChannel this_ptr_conv;
22760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22761 this_ptr_conv.is_owned = false;
22762 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22763 LDKPublicKey val_ref;
22764 CHECK(val->arr_len == 33);
22765 memcpy(val_ref.compressed_form, val->elems, 33);
22766 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
22769 int8_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_flags(uint32_t this_ptr) {
22770 LDKOpenChannel this_ptr_conv;
22771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22772 this_ptr_conv.is_owned = false;
22773 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22774 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
22778 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_flags(uint32_t this_ptr, int8_t val) {
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 OpenChannel_set_channel_flags(&this_ptr_conv, val);
22786 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_type(uint32_t this_ptr) {
22787 LDKOpenChannel this_ptr_conv;
22788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22789 this_ptr_conv.is_owned = false;
22790 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22791 LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
22792 uint64_t ret_ref = 0;
22793 if ((uint64_t)ret_var.inner > 4096) {
22794 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22795 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22796 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22797 ret_ref = (uint64_t)ret_var.inner;
22798 if (ret_var.is_owned) {
22805 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_type(uint32_t this_ptr, uint32_t val) {
22806 LDKOpenChannel this_ptr_conv;
22807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22808 this_ptr_conv.is_owned = false;
22809 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22810 LDKChannelTypeFeatures val_conv;
22811 val_conv.inner = (void*)(val & (~1));
22812 val_conv.is_owned = (val & 1) || (val == 0);
22813 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
22814 val_conv = ChannelTypeFeatures_clone(&val_conv);
22815 OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
22818 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
22819 LDKOpenChannel ret_var = OpenChannel_clone(arg);
22820 uint64_t ret_ref = 0;
22821 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22822 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22823 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22824 ret_ref = (uint64_t)ret_var.inner;
22825 if (ret_var.is_owned) {
22830 int64_t __attribute__((visibility("default"))) TS_OpenChannel_clone_ptr(uint32_t arg) {
22831 LDKOpenChannel arg_conv;
22832 arg_conv.inner = (void*)(arg & (~1));
22833 arg_conv.is_owned = false;
22834 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22835 int64_t ret_val = OpenChannel_clone_ptr(&arg_conv);
22839 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_clone(uint32_t orig) {
22840 LDKOpenChannel orig_conv;
22841 orig_conv.inner = (void*)(orig & (~1));
22842 orig_conv.is_owned = false;
22843 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22844 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
22845 uint64_t ret_ref = 0;
22846 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22847 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22848 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22849 ret_ref = (uint64_t)ret_var.inner;
22850 if (ret_var.is_owned) {
22856 void __attribute__((visibility("default"))) TS_AcceptChannel_free(uint32_t this_obj) {
22857 LDKAcceptChannel this_obj_conv;
22858 this_obj_conv.inner = (void*)(this_obj & (~1));
22859 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22860 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22861 AcceptChannel_free(this_obj_conv);
22864 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_temporary_channel_id(uint32_t this_ptr) {
22865 LDKAcceptChannel this_ptr_conv;
22866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22867 this_ptr_conv.is_owned = false;
22868 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22869 int8_tArray ret_arr = init_int8_tArray(32);
22870 memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
22874 void __attribute__((visibility("default"))) TS_AcceptChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
22875 LDKAcceptChannel this_ptr_conv;
22876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22877 this_ptr_conv.is_owned = false;
22878 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22879 LDKThirtyTwoBytes val_ref;
22880 CHECK(val->arr_len == 32);
22881 memcpy(val_ref.data, val->elems, 32);
22882 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
22885 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
22886 LDKAcceptChannel this_ptr_conv;
22887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22888 this_ptr_conv.is_owned = false;
22889 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22890 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
22894 void __attribute__((visibility("default"))) TS_AcceptChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
22895 LDKAcceptChannel this_ptr_conv;
22896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22897 this_ptr_conv.is_owned = false;
22898 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22899 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
22902 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
22903 LDKAcceptChannel this_ptr_conv;
22904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22905 this_ptr_conv.is_owned = false;
22906 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22907 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
22911 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
22912 LDKAcceptChannel this_ptr_conv;
22913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22914 this_ptr_conv.is_owned = false;
22915 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22916 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
22919 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
22920 LDKAcceptChannel this_ptr_conv;
22921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22922 this_ptr_conv.is_owned = false;
22923 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22924 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
22928 void __attribute__((visibility("default"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
22929 LDKAcceptChannel this_ptr_conv;
22930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22931 this_ptr_conv.is_owned = false;
22932 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22933 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
22936 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
22937 LDKAcceptChannel this_ptr_conv;
22938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22939 this_ptr_conv.is_owned = false;
22940 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22941 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
22945 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
22946 LDKAcceptChannel this_ptr_conv;
22947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22948 this_ptr_conv.is_owned = false;
22949 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22950 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
22953 int32_t __attribute__((visibility("default"))) TS_AcceptChannel_get_minimum_depth(uint32_t this_ptr) {
22954 LDKAcceptChannel this_ptr_conv;
22955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22956 this_ptr_conv.is_owned = false;
22957 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22958 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
22962 void __attribute__((visibility("default"))) TS_AcceptChannel_set_minimum_depth(uint32_t this_ptr, int32_t val) {
22963 LDKAcceptChannel 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 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
22970 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_to_self_delay(uint32_t this_ptr) {
22971 LDKAcceptChannel this_ptr_conv;
22972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22973 this_ptr_conv.is_owned = false;
22974 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22975 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
22979 void __attribute__((visibility("default"))) TS_AcceptChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
22980 LDKAcceptChannel this_ptr_conv;
22981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22982 this_ptr_conv.is_owned = false;
22983 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22984 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
22987 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
22988 LDKAcceptChannel this_ptr_conv;
22989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22990 this_ptr_conv.is_owned = false;
22991 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22992 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
22996 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
22997 LDKAcceptChannel this_ptr_conv;
22998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22999 this_ptr_conv.is_owned = false;
23000 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23001 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
23004 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_funding_pubkey(uint32_t this_ptr) {
23005 LDKAcceptChannel 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 int8_tArray ret_arr = init_int8_tArray(33);
23010 memcpy(ret_arr->elems, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
23014 void __attribute__((visibility("default"))) TS_AcceptChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
23015 LDKAcceptChannel this_ptr_conv;
23016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23017 this_ptr_conv.is_owned = false;
23018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23019 LDKPublicKey val_ref;
23020 CHECK(val->arr_len == 33);
23021 memcpy(val_ref.compressed_form, val->elems, 33);
23022 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
23025 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_revocation_basepoint(uint32_t this_ptr) {
23026 LDKAcceptChannel 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 int8_tArray ret_arr = init_int8_tArray(33);
23031 memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
23035 void __attribute__((visibility("default"))) TS_AcceptChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
23036 LDKAcceptChannel this_ptr_conv;
23037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23038 this_ptr_conv.is_owned = false;
23039 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23040 LDKPublicKey val_ref;
23041 CHECK(val->arr_len == 33);
23042 memcpy(val_ref.compressed_form, val->elems, 33);
23043 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
23046 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_payment_point(uint32_t this_ptr) {
23047 LDKAcceptChannel 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 int8_tArray ret_arr = init_int8_tArray(33);
23052 memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
23056 void __attribute__((visibility("default"))) TS_AcceptChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
23057 LDKAcceptChannel this_ptr_conv;
23058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23059 this_ptr_conv.is_owned = false;
23060 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23061 LDKPublicKey val_ref;
23062 CHECK(val->arr_len == 33);
23063 memcpy(val_ref.compressed_form, val->elems, 33);
23064 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
23067 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
23068 LDKAcceptChannel 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 int8_tArray ret_arr = init_int8_tArray(33);
23073 memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
23077 void __attribute__((visibility("default"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
23078 LDKAcceptChannel this_ptr_conv;
23079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23080 this_ptr_conv.is_owned = false;
23081 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23082 LDKPublicKey val_ref;
23083 CHECK(val->arr_len == 33);
23084 memcpy(val_ref.compressed_form, val->elems, 33);
23085 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
23088 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_basepoint(uint32_t this_ptr) {
23089 LDKAcceptChannel this_ptr_conv;
23090 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23091 this_ptr_conv.is_owned = false;
23092 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23093 int8_tArray ret_arr = init_int8_tArray(33);
23094 memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
23098 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
23099 LDKAcceptChannel this_ptr_conv;
23100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23101 this_ptr_conv.is_owned = false;
23102 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23103 LDKPublicKey val_ref;
23104 CHECK(val->arr_len == 33);
23105 memcpy(val_ref.compressed_form, val->elems, 33);
23106 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
23109 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_first_per_commitment_point(uint32_t this_ptr) {
23110 LDKAcceptChannel this_ptr_conv;
23111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23112 this_ptr_conv.is_owned = false;
23113 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23114 int8_tArray ret_arr = init_int8_tArray(33);
23115 memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
23119 void __attribute__((visibility("default"))) TS_AcceptChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
23120 LDKAcceptChannel this_ptr_conv;
23121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23122 this_ptr_conv.is_owned = false;
23123 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23124 LDKPublicKey val_ref;
23125 CHECK(val->arr_len == 33);
23126 memcpy(val_ref.compressed_form, val->elems, 33);
23127 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
23130 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
23131 LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
23132 uint64_t ret_ref = 0;
23133 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23134 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23135 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23136 ret_ref = (uint64_t)ret_var.inner;
23137 if (ret_var.is_owned) {
23142 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_clone_ptr(uint32_t arg) {
23143 LDKAcceptChannel arg_conv;
23144 arg_conv.inner = (void*)(arg & (~1));
23145 arg_conv.is_owned = false;
23146 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23147 int64_t ret_val = AcceptChannel_clone_ptr(&arg_conv);
23151 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_clone(uint32_t orig) {
23152 LDKAcceptChannel orig_conv;
23153 orig_conv.inner = (void*)(orig & (~1));
23154 orig_conv.is_owned = false;
23155 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23156 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
23157 uint64_t ret_ref = 0;
23158 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23159 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23160 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23161 ret_ref = (uint64_t)ret_var.inner;
23162 if (ret_var.is_owned) {
23168 void __attribute__((visibility("default"))) TS_FundingCreated_free(uint32_t this_obj) {
23169 LDKFundingCreated this_obj_conv;
23170 this_obj_conv.inner = (void*)(this_obj & (~1));
23171 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23172 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23173 FundingCreated_free(this_obj_conv);
23176 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_temporary_channel_id(uint32_t this_ptr) {
23177 LDKFundingCreated this_ptr_conv;
23178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23179 this_ptr_conv.is_owned = false;
23180 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23181 int8_tArray ret_arr = init_int8_tArray(32);
23182 memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
23186 void __attribute__((visibility("default"))) TS_FundingCreated_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
23187 LDKFundingCreated this_ptr_conv;
23188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23189 this_ptr_conv.is_owned = false;
23190 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23191 LDKThirtyTwoBytes val_ref;
23192 CHECK(val->arr_len == 32);
23193 memcpy(val_ref.data, val->elems, 32);
23194 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
23197 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_funding_txid(uint32_t this_ptr) {
23198 LDKFundingCreated this_ptr_conv;
23199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23200 this_ptr_conv.is_owned = false;
23201 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23202 int8_tArray ret_arr = init_int8_tArray(32);
23203 memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
23207 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_txid(uint32_t this_ptr, int8_tArray val) {
23208 LDKFundingCreated this_ptr_conv;
23209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23210 this_ptr_conv.is_owned = false;
23211 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23212 LDKThirtyTwoBytes val_ref;
23213 CHECK(val->arr_len == 32);
23214 memcpy(val_ref.data, val->elems, 32);
23215 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
23218 int16_t __attribute__((visibility("default"))) TS_FundingCreated_get_funding_output_index(uint32_t this_ptr) {
23219 LDKFundingCreated this_ptr_conv;
23220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23221 this_ptr_conv.is_owned = false;
23222 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23223 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
23227 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_output_index(uint32_t this_ptr, int16_t val) {
23228 LDKFundingCreated this_ptr_conv;
23229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23230 this_ptr_conv.is_owned = false;
23231 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23232 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
23235 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_signature(uint32_t this_ptr) {
23236 LDKFundingCreated this_ptr_conv;
23237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23238 this_ptr_conv.is_owned = false;
23239 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23240 int8_tArray ret_arr = init_int8_tArray(64);
23241 memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
23245 void __attribute__((visibility("default"))) TS_FundingCreated_set_signature(uint32_t this_ptr, int8_tArray val) {
23246 LDKFundingCreated 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 LDKSignature val_ref;
23251 CHECK(val->arr_len == 64);
23252 memcpy(val_ref.compact_form, val->elems, 64);
23253 FundingCreated_set_signature(&this_ptr_conv, val_ref);
23256 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_new(int8_tArray temporary_channel_id_arg, int8_tArray funding_txid_arg, int16_t funding_output_index_arg, int8_tArray signature_arg) {
23257 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
23258 CHECK(temporary_channel_id_arg->arr_len == 32);
23259 memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32);
23260 LDKThirtyTwoBytes funding_txid_arg_ref;
23261 CHECK(funding_txid_arg->arr_len == 32);
23262 memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32);
23263 LDKSignature signature_arg_ref;
23264 CHECK(signature_arg->arr_len == 64);
23265 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64);
23266 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
23267 uint64_t ret_ref = 0;
23268 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23269 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23270 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23271 ret_ref = (uint64_t)ret_var.inner;
23272 if (ret_var.is_owned) {
23278 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
23279 LDKFundingCreated ret_var = FundingCreated_clone(arg);
23280 uint64_t ret_ref = 0;
23281 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23282 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23283 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23284 ret_ref = (uint64_t)ret_var.inner;
23285 if (ret_var.is_owned) {
23290 int64_t __attribute__((visibility("default"))) TS_FundingCreated_clone_ptr(uint32_t arg) {
23291 LDKFundingCreated arg_conv;
23292 arg_conv.inner = (void*)(arg & (~1));
23293 arg_conv.is_owned = false;
23294 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23295 int64_t ret_val = FundingCreated_clone_ptr(&arg_conv);
23299 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_clone(uint32_t orig) {
23300 LDKFundingCreated orig_conv;
23301 orig_conv.inner = (void*)(orig & (~1));
23302 orig_conv.is_owned = false;
23303 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23304 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
23305 uint64_t ret_ref = 0;
23306 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23307 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23308 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23309 ret_ref = (uint64_t)ret_var.inner;
23310 if (ret_var.is_owned) {
23316 void __attribute__((visibility("default"))) TS_FundingSigned_free(uint32_t this_obj) {
23317 LDKFundingSigned this_obj_conv;
23318 this_obj_conv.inner = (void*)(this_obj & (~1));
23319 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23320 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23321 FundingSigned_free(this_obj_conv);
23324 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_channel_id(uint32_t this_ptr) {
23325 LDKFundingSigned this_ptr_conv;
23326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23327 this_ptr_conv.is_owned = false;
23328 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23329 int8_tArray ret_arr = init_int8_tArray(32);
23330 memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
23334 void __attribute__((visibility("default"))) TS_FundingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
23335 LDKFundingSigned 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 LDKThirtyTwoBytes val_ref;
23340 CHECK(val->arr_len == 32);
23341 memcpy(val_ref.data, val->elems, 32);
23342 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
23345 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_signature(uint32_t this_ptr) {
23346 LDKFundingSigned this_ptr_conv;
23347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23348 this_ptr_conv.is_owned = false;
23349 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23350 int8_tArray ret_arr = init_int8_tArray(64);
23351 memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
23355 void __attribute__((visibility("default"))) TS_FundingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
23356 LDKFundingSigned 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 LDKSignature val_ref;
23361 CHECK(val->arr_len == 64);
23362 memcpy(val_ref.compact_form, val->elems, 64);
23363 FundingSigned_set_signature(&this_ptr_conv, val_ref);
23366 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
23367 LDKThirtyTwoBytes channel_id_arg_ref;
23368 CHECK(channel_id_arg->arr_len == 32);
23369 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
23370 LDKSignature signature_arg_ref;
23371 CHECK(signature_arg->arr_len == 64);
23372 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64);
23373 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
23374 uint64_t ret_ref = 0;
23375 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23376 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23377 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23378 ret_ref = (uint64_t)ret_var.inner;
23379 if (ret_var.is_owned) {
23385 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
23386 LDKFundingSigned ret_var = FundingSigned_clone(arg);
23387 uint64_t ret_ref = 0;
23388 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23389 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23390 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23391 ret_ref = (uint64_t)ret_var.inner;
23392 if (ret_var.is_owned) {
23397 int64_t __attribute__((visibility("default"))) TS_FundingSigned_clone_ptr(uint32_t arg) {
23398 LDKFundingSigned arg_conv;
23399 arg_conv.inner = (void*)(arg & (~1));
23400 arg_conv.is_owned = false;
23401 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23402 int64_t ret_val = FundingSigned_clone_ptr(&arg_conv);
23406 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_clone(uint32_t orig) {
23407 LDKFundingSigned orig_conv;
23408 orig_conv.inner = (void*)(orig & (~1));
23409 orig_conv.is_owned = false;
23410 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23411 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
23412 uint64_t ret_ref = 0;
23413 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23414 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23415 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23416 ret_ref = (uint64_t)ret_var.inner;
23417 if (ret_var.is_owned) {
23423 void __attribute__((visibility("default"))) TS_FundingLocked_free(uint32_t this_obj) {
23424 LDKFundingLocked this_obj_conv;
23425 this_obj_conv.inner = (void*)(this_obj & (~1));
23426 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23427 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23428 FundingLocked_free(this_obj_conv);
23431 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_channel_id(uint32_t this_ptr) {
23432 LDKFundingLocked this_ptr_conv;
23433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23434 this_ptr_conv.is_owned = false;
23435 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23436 int8_tArray ret_arr = init_int8_tArray(32);
23437 memcpy(ret_arr->elems, *FundingLocked_get_channel_id(&this_ptr_conv), 32);
23441 void __attribute__((visibility("default"))) TS_FundingLocked_set_channel_id(uint32_t this_ptr, int8_tArray val) {
23442 LDKFundingLocked this_ptr_conv;
23443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23444 this_ptr_conv.is_owned = false;
23445 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23446 LDKThirtyTwoBytes val_ref;
23447 CHECK(val->arr_len == 32);
23448 memcpy(val_ref.data, val->elems, 32);
23449 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
23452 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_next_per_commitment_point(uint32_t this_ptr) {
23453 LDKFundingLocked this_ptr_conv;
23454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23455 this_ptr_conv.is_owned = false;
23456 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23457 int8_tArray ret_arr = init_int8_tArray(33);
23458 memcpy(ret_arr->elems, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
23462 void __attribute__((visibility("default"))) TS_FundingLocked_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
23463 LDKFundingLocked this_ptr_conv;
23464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23465 this_ptr_conv.is_owned = false;
23466 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23467 LDKPublicKey val_ref;
23468 CHECK(val->arr_len == 33);
23469 memcpy(val_ref.compressed_form, val->elems, 33);
23470 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
23473 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_new(int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
23474 LDKThirtyTwoBytes channel_id_arg_ref;
23475 CHECK(channel_id_arg->arr_len == 32);
23476 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
23477 LDKPublicKey next_per_commitment_point_arg_ref;
23478 CHECK(next_per_commitment_point_arg->arr_len == 33);
23479 memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33);
23480 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
23481 uint64_t ret_ref = 0;
23482 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23483 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23484 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23485 ret_ref = (uint64_t)ret_var.inner;
23486 if (ret_var.is_owned) {
23492 static inline uint64_t FundingLocked_clone_ptr(LDKFundingLocked *NONNULL_PTR arg) {
23493 LDKFundingLocked ret_var = FundingLocked_clone(arg);
23494 uint64_t ret_ref = 0;
23495 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23496 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23497 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23498 ret_ref = (uint64_t)ret_var.inner;
23499 if (ret_var.is_owned) {
23504 int64_t __attribute__((visibility("default"))) TS_FundingLocked_clone_ptr(uint32_t arg) {
23505 LDKFundingLocked arg_conv;
23506 arg_conv.inner = (void*)(arg & (~1));
23507 arg_conv.is_owned = false;
23508 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23509 int64_t ret_val = FundingLocked_clone_ptr(&arg_conv);
23513 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_clone(uint32_t orig) {
23514 LDKFundingLocked orig_conv;
23515 orig_conv.inner = (void*)(orig & (~1));
23516 orig_conv.is_owned = false;
23517 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23518 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
23519 uint64_t ret_ref = 0;
23520 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23521 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23522 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23523 ret_ref = (uint64_t)ret_var.inner;
23524 if (ret_var.is_owned) {
23530 void __attribute__((visibility("default"))) TS_Shutdown_free(uint32_t this_obj) {
23531 LDKShutdown this_obj_conv;
23532 this_obj_conv.inner = (void*)(this_obj & (~1));
23533 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23534 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23535 Shutdown_free(this_obj_conv);
23538 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_channel_id(uint32_t this_ptr) {
23539 LDKShutdown this_ptr_conv;
23540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23541 this_ptr_conv.is_owned = false;
23542 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23543 int8_tArray ret_arr = init_int8_tArray(32);
23544 memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
23548 void __attribute__((visibility("default"))) TS_Shutdown_set_channel_id(uint32_t this_ptr, int8_tArray val) {
23549 LDKShutdown this_ptr_conv;
23550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23551 this_ptr_conv.is_owned = false;
23552 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23553 LDKThirtyTwoBytes val_ref;
23554 CHECK(val->arr_len == 32);
23555 memcpy(val_ref.data, val->elems, 32);
23556 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
23559 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_scriptpubkey(uint32_t this_ptr) {
23560 LDKShutdown this_ptr_conv;
23561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23562 this_ptr_conv.is_owned = false;
23563 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23564 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
23565 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
23566 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23570 void __attribute__((visibility("default"))) TS_Shutdown_set_scriptpubkey(uint32_t this_ptr, int8_tArray val) {
23571 LDKShutdown this_ptr_conv;
23572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23573 this_ptr_conv.is_owned = false;
23574 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23575 LDKCVec_u8Z val_ref;
23576 val_ref.datalen = val->arr_len;
23577 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
23578 memcpy(val_ref.data, val->elems, val_ref.datalen);
23579 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
23582 uint32_t __attribute__((visibility("default"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
23583 LDKThirtyTwoBytes channel_id_arg_ref;
23584 CHECK(channel_id_arg->arr_len == 32);
23585 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
23586 LDKCVec_u8Z scriptpubkey_arg_ref;
23587 scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
23588 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
23589 memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen);
23590 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
23591 uint64_t ret_ref = 0;
23592 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23593 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23594 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23595 ret_ref = (uint64_t)ret_var.inner;
23596 if (ret_var.is_owned) {
23602 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
23603 LDKShutdown ret_var = Shutdown_clone(arg);
23604 uint64_t ret_ref = 0;
23605 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23606 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23607 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23608 ret_ref = (uint64_t)ret_var.inner;
23609 if (ret_var.is_owned) {
23614 int64_t __attribute__((visibility("default"))) TS_Shutdown_clone_ptr(uint32_t arg) {
23615 LDKShutdown arg_conv;
23616 arg_conv.inner = (void*)(arg & (~1));
23617 arg_conv.is_owned = false;
23618 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23619 int64_t ret_val = Shutdown_clone_ptr(&arg_conv);
23623 uint32_t __attribute__((visibility("default"))) TS_Shutdown_clone(uint32_t orig) {
23624 LDKShutdown orig_conv;
23625 orig_conv.inner = (void*)(orig & (~1));
23626 orig_conv.is_owned = false;
23627 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23628 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
23629 uint64_t ret_ref = 0;
23630 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23631 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23632 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23633 ret_ref = (uint64_t)ret_var.inner;
23634 if (ret_var.is_owned) {
23640 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_free(uint32_t this_obj) {
23641 LDKClosingSignedFeeRange this_obj_conv;
23642 this_obj_conv.inner = (void*)(this_obj & (~1));
23643 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23644 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23645 ClosingSignedFeeRange_free(this_obj_conv);
23648 int64_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint32_t this_ptr) {
23649 LDKClosingSignedFeeRange this_ptr_conv;
23650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23651 this_ptr_conv.is_owned = false;
23652 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23653 int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
23657 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint32_t this_ptr, int64_t val) {
23658 LDKClosingSignedFeeRange this_ptr_conv;
23659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23660 this_ptr_conv.is_owned = false;
23661 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23662 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
23665 int64_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint32_t this_ptr) {
23666 LDKClosingSignedFeeRange this_ptr_conv;
23667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23668 this_ptr_conv.is_owned = false;
23669 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23670 int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
23674 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
23675 LDKClosingSignedFeeRange this_ptr_conv;
23676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23677 this_ptr_conv.is_owned = false;
23678 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23679 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
23682 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
23683 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
23684 uint64_t ret_ref = 0;
23685 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23686 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23687 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23688 ret_ref = (uint64_t)ret_var.inner;
23689 if (ret_var.is_owned) {
23695 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
23696 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
23697 uint64_t ret_ref = 0;
23698 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23699 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23700 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23701 ret_ref = (uint64_t)ret_var.inner;
23702 if (ret_var.is_owned) {
23707 int64_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_clone_ptr(uint32_t arg) {
23708 LDKClosingSignedFeeRange arg_conv;
23709 arg_conv.inner = (void*)(arg & (~1));
23710 arg_conv.is_owned = false;
23711 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23712 int64_t ret_val = ClosingSignedFeeRange_clone_ptr(&arg_conv);
23716 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_clone(uint32_t orig) {
23717 LDKClosingSignedFeeRange orig_conv;
23718 orig_conv.inner = (void*)(orig & (~1));
23719 orig_conv.is_owned = false;
23720 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23721 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
23722 uint64_t ret_ref = 0;
23723 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23724 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23725 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23726 ret_ref = (uint64_t)ret_var.inner;
23727 if (ret_var.is_owned) {
23733 void __attribute__((visibility("default"))) TS_ClosingSigned_free(uint32_t this_obj) {
23734 LDKClosingSigned this_obj_conv;
23735 this_obj_conv.inner = (void*)(this_obj & (~1));
23736 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23737 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23738 ClosingSigned_free(this_obj_conv);
23741 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_channel_id(uint32_t this_ptr) {
23742 LDKClosingSigned this_ptr_conv;
23743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23744 this_ptr_conv.is_owned = false;
23745 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23746 int8_tArray ret_arr = init_int8_tArray(32);
23747 memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
23751 void __attribute__((visibility("default"))) TS_ClosingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
23752 LDKClosingSigned this_ptr_conv;
23753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23754 this_ptr_conv.is_owned = false;
23755 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23756 LDKThirtyTwoBytes val_ref;
23757 CHECK(val->arr_len == 32);
23758 memcpy(val_ref.data, val->elems, 32);
23759 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
23762 int64_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_satoshis(uint32_t this_ptr) {
23763 LDKClosingSigned this_ptr_conv;
23764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23765 this_ptr_conv.is_owned = false;
23766 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23767 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
23771 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_satoshis(uint32_t this_ptr, int64_t val) {
23772 LDKClosingSigned 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 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
23779 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_signature(uint32_t this_ptr) {
23780 LDKClosingSigned this_ptr_conv;
23781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23782 this_ptr_conv.is_owned = false;
23783 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23784 int8_tArray ret_arr = init_int8_tArray(64);
23785 memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
23789 void __attribute__((visibility("default"))) TS_ClosingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
23790 LDKClosingSigned this_ptr_conv;
23791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23792 this_ptr_conv.is_owned = false;
23793 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23794 LDKSignature val_ref;
23795 CHECK(val->arr_len == 64);
23796 memcpy(val_ref.compact_form, val->elems, 64);
23797 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
23800 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_range(uint32_t this_ptr) {
23801 LDKClosingSigned this_ptr_conv;
23802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23803 this_ptr_conv.is_owned = false;
23804 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23805 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
23806 uint64_t ret_ref = 0;
23807 if ((uint64_t)ret_var.inner > 4096) {
23808 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23809 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23810 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23811 ret_ref = (uint64_t)ret_var.inner;
23812 if (ret_var.is_owned) {
23819 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_range(uint32_t this_ptr, uint32_t val) {
23820 LDKClosingSigned this_ptr_conv;
23821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23822 this_ptr_conv.is_owned = false;
23823 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23824 LDKClosingSignedFeeRange val_conv;
23825 val_conv.inner = (void*)(val & (~1));
23826 val_conv.is_owned = (val & 1) || (val == 0);
23827 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23828 val_conv = ClosingSignedFeeRange_clone(&val_conv);
23829 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
23832 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_new(int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg, uint32_t fee_range_arg) {
23833 LDKThirtyTwoBytes channel_id_arg_ref;
23834 CHECK(channel_id_arg->arr_len == 32);
23835 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
23836 LDKSignature signature_arg_ref;
23837 CHECK(signature_arg->arr_len == 64);
23838 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64);
23839 LDKClosingSignedFeeRange fee_range_arg_conv;
23840 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
23841 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
23842 CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
23843 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
23844 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
23845 uint64_t ret_ref = 0;
23846 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23847 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23848 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23849 ret_ref = (uint64_t)ret_var.inner;
23850 if (ret_var.is_owned) {
23856 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
23857 LDKClosingSigned ret_var = ClosingSigned_clone(arg);
23858 uint64_t ret_ref = 0;
23859 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23860 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23861 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23862 ret_ref = (uint64_t)ret_var.inner;
23863 if (ret_var.is_owned) {
23868 int64_t __attribute__((visibility("default"))) TS_ClosingSigned_clone_ptr(uint32_t arg) {
23869 LDKClosingSigned arg_conv;
23870 arg_conv.inner = (void*)(arg & (~1));
23871 arg_conv.is_owned = false;
23872 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23873 int64_t ret_val = ClosingSigned_clone_ptr(&arg_conv);
23877 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_clone(uint32_t orig) {
23878 LDKClosingSigned orig_conv;
23879 orig_conv.inner = (void*)(orig & (~1));
23880 orig_conv.is_owned = false;
23881 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23882 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
23883 uint64_t ret_ref = 0;
23884 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23885 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23886 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23887 ret_ref = (uint64_t)ret_var.inner;
23888 if (ret_var.is_owned) {
23894 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_free(uint32_t this_obj) {
23895 LDKUpdateAddHTLC this_obj_conv;
23896 this_obj_conv.inner = (void*)(this_obj & (~1));
23897 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23898 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23899 UpdateAddHTLC_free(this_obj_conv);
23902 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_channel_id(uint32_t this_ptr) {
23903 LDKUpdateAddHTLC this_ptr_conv;
23904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23905 this_ptr_conv.is_owned = false;
23906 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23907 int8_tArray ret_arr = init_int8_tArray(32);
23908 memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
23912 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
23913 LDKUpdateAddHTLC this_ptr_conv;
23914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23915 this_ptr_conv.is_owned = false;
23916 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23917 LDKThirtyTwoBytes val_ref;
23918 CHECK(val->arr_len == 32);
23919 memcpy(val_ref.data, val->elems, 32);
23920 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
23923 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_htlc_id(uint32_t this_ptr) {
23924 LDKUpdateAddHTLC this_ptr_conv;
23925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23926 this_ptr_conv.is_owned = false;
23927 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23928 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
23932 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
23933 LDKUpdateAddHTLC this_ptr_conv;
23934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23935 this_ptr_conv.is_owned = false;
23936 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23937 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
23940 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_amount_msat(uint32_t this_ptr) {
23941 LDKUpdateAddHTLC this_ptr_conv;
23942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23943 this_ptr_conv.is_owned = false;
23944 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23945 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
23949 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_amount_msat(uint32_t this_ptr, int64_t val) {
23950 LDKUpdateAddHTLC this_ptr_conv;
23951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23952 this_ptr_conv.is_owned = false;
23953 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23954 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
23957 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_payment_hash(uint32_t this_ptr) {
23958 LDKUpdateAddHTLC 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 int8_tArray ret_arr = init_int8_tArray(32);
23963 memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
23967 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
23968 LDKUpdateAddHTLC this_ptr_conv;
23969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23970 this_ptr_conv.is_owned = false;
23971 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23972 LDKThirtyTwoBytes val_ref;
23973 CHECK(val->arr_len == 32);
23974 memcpy(val_ref.data, val->elems, 32);
23975 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
23978 int32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_cltv_expiry(uint32_t this_ptr) {
23979 LDKUpdateAddHTLC this_ptr_conv;
23980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23981 this_ptr_conv.is_owned = false;
23982 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23983 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
23987 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
23988 LDKUpdateAddHTLC this_ptr_conv;
23989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23990 this_ptr_conv.is_owned = false;
23991 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23992 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
23995 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
23996 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
23997 uint64_t ret_ref = 0;
23998 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23999 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24000 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24001 ret_ref = (uint64_t)ret_var.inner;
24002 if (ret_var.is_owned) {
24007 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_clone_ptr(uint32_t arg) {
24008 LDKUpdateAddHTLC arg_conv;
24009 arg_conv.inner = (void*)(arg & (~1));
24010 arg_conv.is_owned = false;
24011 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24012 int64_t ret_val = UpdateAddHTLC_clone_ptr(&arg_conv);
24016 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_clone(uint32_t orig) {
24017 LDKUpdateAddHTLC orig_conv;
24018 orig_conv.inner = (void*)(orig & (~1));
24019 orig_conv.is_owned = false;
24020 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24021 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
24022 uint64_t ret_ref = 0;
24023 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24024 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24025 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24026 ret_ref = (uint64_t)ret_var.inner;
24027 if (ret_var.is_owned) {
24033 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_free(uint32_t this_obj) {
24034 LDKUpdateFulfillHTLC this_obj_conv;
24035 this_obj_conv.inner = (void*)(this_obj & (~1));
24036 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24037 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24038 UpdateFulfillHTLC_free(this_obj_conv);
24041 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_channel_id(uint32_t this_ptr) {
24042 LDKUpdateFulfillHTLC this_ptr_conv;
24043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24044 this_ptr_conv.is_owned = false;
24045 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24046 int8_tArray ret_arr = init_int8_tArray(32);
24047 memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
24051 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24052 LDKUpdateFulfillHTLC this_ptr_conv;
24053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24054 this_ptr_conv.is_owned = false;
24055 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24056 LDKThirtyTwoBytes val_ref;
24057 CHECK(val->arr_len == 32);
24058 memcpy(val_ref.data, val->elems, 32);
24059 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
24062 int64_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_htlc_id(uint32_t this_ptr) {
24063 LDKUpdateFulfillHTLC this_ptr_conv;
24064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24065 this_ptr_conv.is_owned = false;
24066 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24067 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
24071 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
24072 LDKUpdateFulfillHTLC 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 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
24079 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint32_t this_ptr) {
24080 LDKUpdateFulfillHTLC this_ptr_conv;
24081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24082 this_ptr_conv.is_owned = false;
24083 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24084 int8_tArray ret_arr = init_int8_tArray(32);
24085 memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
24089 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint32_t this_ptr, int8_tArray val) {
24090 LDKUpdateFulfillHTLC this_ptr_conv;
24091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24092 this_ptr_conv.is_owned = false;
24093 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24094 LDKThirtyTwoBytes val_ref;
24095 CHECK(val->arr_len == 32);
24096 memcpy(val_ref.data, val->elems, 32);
24097 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
24100 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_new(int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
24101 LDKThirtyTwoBytes channel_id_arg_ref;
24102 CHECK(channel_id_arg->arr_len == 32);
24103 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
24104 LDKThirtyTwoBytes payment_preimage_arg_ref;
24105 CHECK(payment_preimage_arg->arr_len == 32);
24106 memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32);
24107 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
24108 uint64_t ret_ref = 0;
24109 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24110 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24111 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24112 ret_ref = (uint64_t)ret_var.inner;
24113 if (ret_var.is_owned) {
24119 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
24120 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
24121 uint64_t ret_ref = 0;
24122 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24123 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24124 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24125 ret_ref = (uint64_t)ret_var.inner;
24126 if (ret_var.is_owned) {
24131 int64_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_clone_ptr(uint32_t arg) {
24132 LDKUpdateFulfillHTLC arg_conv;
24133 arg_conv.inner = (void*)(arg & (~1));
24134 arg_conv.is_owned = false;
24135 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24136 int64_t ret_val = UpdateFulfillHTLC_clone_ptr(&arg_conv);
24140 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_clone(uint32_t orig) {
24141 LDKUpdateFulfillHTLC orig_conv;
24142 orig_conv.inner = (void*)(orig & (~1));
24143 orig_conv.is_owned = false;
24144 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24145 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
24146 uint64_t ret_ref = 0;
24147 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24148 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24149 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24150 ret_ref = (uint64_t)ret_var.inner;
24151 if (ret_var.is_owned) {
24157 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_free(uint32_t this_obj) {
24158 LDKUpdateFailHTLC this_obj_conv;
24159 this_obj_conv.inner = (void*)(this_obj & (~1));
24160 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24161 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24162 UpdateFailHTLC_free(this_obj_conv);
24165 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_channel_id(uint32_t this_ptr) {
24166 LDKUpdateFailHTLC this_ptr_conv;
24167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24168 this_ptr_conv.is_owned = false;
24169 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24170 int8_tArray ret_arr = init_int8_tArray(32);
24171 memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
24175 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24176 LDKUpdateFailHTLC this_ptr_conv;
24177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24178 this_ptr_conv.is_owned = false;
24179 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24180 LDKThirtyTwoBytes val_ref;
24181 CHECK(val->arr_len == 32);
24182 memcpy(val_ref.data, val->elems, 32);
24183 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
24186 int64_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_htlc_id(uint32_t this_ptr) {
24187 LDKUpdateFailHTLC this_ptr_conv;
24188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24189 this_ptr_conv.is_owned = false;
24190 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24191 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
24195 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
24196 LDKUpdateFailHTLC this_ptr_conv;
24197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24198 this_ptr_conv.is_owned = false;
24199 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24200 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
24203 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
24204 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
24205 uint64_t ret_ref = 0;
24206 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24207 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24208 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24209 ret_ref = (uint64_t)ret_var.inner;
24210 if (ret_var.is_owned) {
24215 int64_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_clone_ptr(uint32_t arg) {
24216 LDKUpdateFailHTLC arg_conv;
24217 arg_conv.inner = (void*)(arg & (~1));
24218 arg_conv.is_owned = false;
24219 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24220 int64_t ret_val = UpdateFailHTLC_clone_ptr(&arg_conv);
24224 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_clone(uint32_t orig) {
24225 LDKUpdateFailHTLC orig_conv;
24226 orig_conv.inner = (void*)(orig & (~1));
24227 orig_conv.is_owned = false;
24228 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24229 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
24230 uint64_t ret_ref = 0;
24231 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24232 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24233 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24234 ret_ref = (uint64_t)ret_var.inner;
24235 if (ret_var.is_owned) {
24241 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_free(uint32_t this_obj) {
24242 LDKUpdateFailMalformedHTLC this_obj_conv;
24243 this_obj_conv.inner = (void*)(this_obj & (~1));
24244 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24245 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24246 UpdateFailMalformedHTLC_free(this_obj_conv);
24249 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint32_t this_ptr) {
24250 LDKUpdateFailMalformedHTLC 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 int8_tArray ret_arr = init_int8_tArray(32);
24255 memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
24259 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24260 LDKUpdateFailMalformedHTLC this_ptr_conv;
24261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24262 this_ptr_conv.is_owned = false;
24263 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24264 LDKThirtyTwoBytes val_ref;
24265 CHECK(val->arr_len == 32);
24266 memcpy(val_ref.data, val->elems, 32);
24267 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
24270 int64_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint32_t this_ptr) {
24271 LDKUpdateFailMalformedHTLC this_ptr_conv;
24272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24273 this_ptr_conv.is_owned = false;
24274 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24275 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
24279 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
24280 LDKUpdateFailMalformedHTLC this_ptr_conv;
24281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24282 this_ptr_conv.is_owned = false;
24283 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24284 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
24287 int16_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint32_t this_ptr) {
24288 LDKUpdateFailMalformedHTLC 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 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
24296 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint32_t this_ptr, int16_t val) {
24297 LDKUpdateFailMalformedHTLC 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 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
24304 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
24305 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_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__((visibility("default"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint32_t arg) {
24317 LDKUpdateFailMalformedHTLC 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 = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
24325 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_clone(uint32_t orig) {
24326 LDKUpdateFailMalformedHTLC 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 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_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__((visibility("default"))) TS_CommitmentSigned_free(uint32_t this_obj) {
24343 LDKCommitmentSigned 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 CommitmentSigned_free(this_obj_conv);
24350 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_channel_id(uint32_t this_ptr) {
24351 LDKCommitmentSigned 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, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
24360 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24361 LDKCommitmentSigned 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 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
24371 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_signature(uint32_t this_ptr) {
24372 LDKCommitmentSigned 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 int8_tArray ret_arr = init_int8_tArray(64);
24377 memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
24381 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
24382 LDKCommitmentSigned this_ptr_conv;
24383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24384 this_ptr_conv.is_owned = false;
24385 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24386 LDKSignature val_ref;
24387 CHECK(val->arr_len == 64);
24388 memcpy(val_ref.compact_form, val->elems, 64);
24389 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
24392 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_htlc_signatures(uint32_t this_ptr, ptrArray val) {
24393 LDKCommitmentSigned this_ptr_conv;
24394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24395 this_ptr_conv.is_owned = false;
24396 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24397 LDKCVec_SignatureZ val_constr;
24398 val_constr.datalen = val->arr_len;
24399 if (val_constr.datalen > 0)
24400 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
24402 val_constr.data = NULL;
24403 int8_tArray* val_vals = (void*) val->elems;
24404 for (size_t m = 0; m < val_constr.datalen; m++) {
24405 int8_tArray val_conv_12 = val_vals[m];
24406 LDKSignature val_conv_12_ref;
24407 CHECK(val_conv_12->arr_len == 64);
24408 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64);
24409 val_constr.data[m] = val_conv_12_ref;
24411 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
24414 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
24415 LDKThirtyTwoBytes channel_id_arg_ref;
24416 CHECK(channel_id_arg->arr_len == 32);
24417 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
24418 LDKSignature signature_arg_ref;
24419 CHECK(signature_arg->arr_len == 64);
24420 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64);
24421 LDKCVec_SignatureZ htlc_signatures_arg_constr;
24422 htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
24423 if (htlc_signatures_arg_constr.datalen > 0)
24424 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
24426 htlc_signatures_arg_constr.data = NULL;
24427 int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
24428 for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
24429 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
24430 LDKSignature htlc_signatures_arg_conv_12_ref;
24431 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
24432 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64);
24433 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
24435 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
24436 uint64_t ret_ref = 0;
24437 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24438 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24439 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24440 ret_ref = (uint64_t)ret_var.inner;
24441 if (ret_var.is_owned) {
24447 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
24448 LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
24449 uint64_t ret_ref = 0;
24450 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24451 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24452 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24453 ret_ref = (uint64_t)ret_var.inner;
24454 if (ret_var.is_owned) {
24459 int64_t __attribute__((visibility("default"))) TS_CommitmentSigned_clone_ptr(uint32_t arg) {
24460 LDKCommitmentSigned arg_conv;
24461 arg_conv.inner = (void*)(arg & (~1));
24462 arg_conv.is_owned = false;
24463 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24464 int64_t ret_val = CommitmentSigned_clone_ptr(&arg_conv);
24468 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_clone(uint32_t orig) {
24469 LDKCommitmentSigned orig_conv;
24470 orig_conv.inner = (void*)(orig & (~1));
24471 orig_conv.is_owned = false;
24472 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24473 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
24474 uint64_t ret_ref = 0;
24475 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24476 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24477 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24478 ret_ref = (uint64_t)ret_var.inner;
24479 if (ret_var.is_owned) {
24485 void __attribute__((visibility("default"))) TS_RevokeAndACK_free(uint32_t this_obj) {
24486 LDKRevokeAndACK this_obj_conv;
24487 this_obj_conv.inner = (void*)(this_obj & (~1));
24488 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24489 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24490 RevokeAndACK_free(this_obj_conv);
24493 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_channel_id(uint32_t this_ptr) {
24494 LDKRevokeAndACK this_ptr_conv;
24495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24496 this_ptr_conv.is_owned = false;
24497 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24498 int8_tArray ret_arr = init_int8_tArray(32);
24499 memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
24503 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24504 LDKRevokeAndACK this_ptr_conv;
24505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24506 this_ptr_conv.is_owned = false;
24507 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24508 LDKThirtyTwoBytes val_ref;
24509 CHECK(val->arr_len == 32);
24510 memcpy(val_ref.data, val->elems, 32);
24511 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
24514 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_per_commitment_secret(uint32_t this_ptr) {
24515 LDKRevokeAndACK this_ptr_conv;
24516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24517 this_ptr_conv.is_owned = false;
24518 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24519 int8_tArray ret_arr = init_int8_tArray(32);
24520 memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
24524 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
24525 LDKRevokeAndACK this_ptr_conv;
24526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24527 this_ptr_conv.is_owned = false;
24528 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24529 LDKThirtyTwoBytes val_ref;
24530 CHECK(val->arr_len == 32);
24531 memcpy(val_ref.data, val->elems, 32);
24532 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
24535 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_next_per_commitment_point(uint32_t this_ptr) {
24536 LDKRevokeAndACK this_ptr_conv;
24537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24538 this_ptr_conv.is_owned = false;
24539 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24540 int8_tArray ret_arr = init_int8_tArray(33);
24541 memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
24545 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
24546 LDKRevokeAndACK this_ptr_conv;
24547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24548 this_ptr_conv.is_owned = false;
24549 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24550 LDKPublicKey val_ref;
24551 CHECK(val->arr_len == 33);
24552 memcpy(val_ref.compressed_form, val->elems, 33);
24553 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
24556 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_new(int8_tArray channel_id_arg, int8_tArray per_commitment_secret_arg, int8_tArray next_per_commitment_point_arg) {
24557 LDKThirtyTwoBytes channel_id_arg_ref;
24558 CHECK(channel_id_arg->arr_len == 32);
24559 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
24560 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
24561 CHECK(per_commitment_secret_arg->arr_len == 32);
24562 memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32);
24563 LDKPublicKey next_per_commitment_point_arg_ref;
24564 CHECK(next_per_commitment_point_arg->arr_len == 33);
24565 memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33);
24566 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
24567 uint64_t ret_ref = 0;
24568 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24569 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24570 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24571 ret_ref = (uint64_t)ret_var.inner;
24572 if (ret_var.is_owned) {
24578 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
24579 LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
24580 uint64_t ret_ref = 0;
24581 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24582 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24583 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24584 ret_ref = (uint64_t)ret_var.inner;
24585 if (ret_var.is_owned) {
24590 int64_t __attribute__((visibility("default"))) TS_RevokeAndACK_clone_ptr(uint32_t arg) {
24591 LDKRevokeAndACK arg_conv;
24592 arg_conv.inner = (void*)(arg & (~1));
24593 arg_conv.is_owned = false;
24594 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24595 int64_t ret_val = RevokeAndACK_clone_ptr(&arg_conv);
24599 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_clone(uint32_t orig) {
24600 LDKRevokeAndACK orig_conv;
24601 orig_conv.inner = (void*)(orig & (~1));
24602 orig_conv.is_owned = false;
24603 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24604 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
24605 uint64_t ret_ref = 0;
24606 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24607 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24608 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24609 ret_ref = (uint64_t)ret_var.inner;
24610 if (ret_var.is_owned) {
24616 void __attribute__((visibility("default"))) TS_UpdateFee_free(uint32_t this_obj) {
24617 LDKUpdateFee this_obj_conv;
24618 this_obj_conv.inner = (void*)(this_obj & (~1));
24619 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24620 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24621 UpdateFee_free(this_obj_conv);
24624 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_get_channel_id(uint32_t this_ptr) {
24625 LDKUpdateFee this_ptr_conv;
24626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24627 this_ptr_conv.is_owned = false;
24628 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24629 int8_tArray ret_arr = init_int8_tArray(32);
24630 memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
24634 void __attribute__((visibility("default"))) TS_UpdateFee_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24635 LDKUpdateFee this_ptr_conv;
24636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24637 this_ptr_conv.is_owned = false;
24638 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24639 LDKThirtyTwoBytes val_ref;
24640 CHECK(val->arr_len == 32);
24641 memcpy(val_ref.data, val->elems, 32);
24642 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
24645 int32_t __attribute__((visibility("default"))) TS_UpdateFee_get_feerate_per_kw(uint32_t this_ptr) {
24646 LDKUpdateFee this_ptr_conv;
24647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24648 this_ptr_conv.is_owned = false;
24649 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24650 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
24654 void __attribute__((visibility("default"))) TS_UpdateFee_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
24655 LDKUpdateFee this_ptr_conv;
24656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24657 this_ptr_conv.is_owned = false;
24658 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24659 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
24662 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
24663 LDKThirtyTwoBytes channel_id_arg_ref;
24664 CHECK(channel_id_arg->arr_len == 32);
24665 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
24666 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
24667 uint64_t ret_ref = 0;
24668 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24669 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24670 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24671 ret_ref = (uint64_t)ret_var.inner;
24672 if (ret_var.is_owned) {
24678 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
24679 LDKUpdateFee ret_var = UpdateFee_clone(arg);
24680 uint64_t ret_ref = 0;
24681 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24682 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24683 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24684 ret_ref = (uint64_t)ret_var.inner;
24685 if (ret_var.is_owned) {
24690 int64_t __attribute__((visibility("default"))) TS_UpdateFee_clone_ptr(uint32_t arg) {
24691 LDKUpdateFee arg_conv;
24692 arg_conv.inner = (void*)(arg & (~1));
24693 arg_conv.is_owned = false;
24694 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24695 int64_t ret_val = UpdateFee_clone_ptr(&arg_conv);
24699 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_clone(uint32_t orig) {
24700 LDKUpdateFee orig_conv;
24701 orig_conv.inner = (void*)(orig & (~1));
24702 orig_conv.is_owned = false;
24703 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24704 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
24705 uint64_t ret_ref = 0;
24706 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24707 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24708 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24709 ret_ref = (uint64_t)ret_var.inner;
24710 if (ret_var.is_owned) {
24716 void __attribute__((visibility("default"))) TS_DataLossProtect_free(uint32_t this_obj) {
24717 LDKDataLossProtect this_obj_conv;
24718 this_obj_conv.inner = (void*)(this_obj & (~1));
24719 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24720 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24721 DataLossProtect_free(this_obj_conv);
24724 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_your_last_per_commitment_secret(uint32_t this_ptr) {
24725 LDKDataLossProtect this_ptr_conv;
24726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24727 this_ptr_conv.is_owned = false;
24728 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24729 int8_tArray ret_arr = init_int8_tArray(32);
24730 memcpy(ret_arr->elems, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
24734 void __attribute__((visibility("default"))) TS_DataLossProtect_set_your_last_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
24735 LDKDataLossProtect this_ptr_conv;
24736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24737 this_ptr_conv.is_owned = false;
24738 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24739 LDKThirtyTwoBytes val_ref;
24740 CHECK(val->arr_len == 32);
24741 memcpy(val_ref.data, val->elems, 32);
24742 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
24745 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_my_current_per_commitment_point(uint32_t this_ptr) {
24746 LDKDataLossProtect this_ptr_conv;
24747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24748 this_ptr_conv.is_owned = false;
24749 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24750 int8_tArray ret_arr = init_int8_tArray(33);
24751 memcpy(ret_arr->elems, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
24755 void __attribute__((visibility("default"))) TS_DataLossProtect_set_my_current_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
24756 LDKDataLossProtect this_ptr_conv;
24757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24758 this_ptr_conv.is_owned = false;
24759 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24760 LDKPublicKey val_ref;
24761 CHECK(val->arr_len == 33);
24762 memcpy(val_ref.compressed_form, val->elems, 33);
24763 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
24766 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_new(int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
24767 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
24768 CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
24769 memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32);
24770 LDKPublicKey my_current_per_commitment_point_arg_ref;
24771 CHECK(my_current_per_commitment_point_arg->arr_len == 33);
24772 memcpy(my_current_per_commitment_point_arg_ref.compressed_form, my_current_per_commitment_point_arg->elems, 33);
24773 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
24774 uint64_t ret_ref = 0;
24775 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24776 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24777 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24778 ret_ref = (uint64_t)ret_var.inner;
24779 if (ret_var.is_owned) {
24785 static inline uint64_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
24786 LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
24787 uint64_t ret_ref = 0;
24788 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24789 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24790 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24791 ret_ref = (uint64_t)ret_var.inner;
24792 if (ret_var.is_owned) {
24797 int64_t __attribute__((visibility("default"))) TS_DataLossProtect_clone_ptr(uint32_t arg) {
24798 LDKDataLossProtect arg_conv;
24799 arg_conv.inner = (void*)(arg & (~1));
24800 arg_conv.is_owned = false;
24801 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24802 int64_t ret_val = DataLossProtect_clone_ptr(&arg_conv);
24806 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_clone(uint32_t orig) {
24807 LDKDataLossProtect orig_conv;
24808 orig_conv.inner = (void*)(orig & (~1));
24809 orig_conv.is_owned = false;
24810 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24811 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
24812 uint64_t ret_ref = 0;
24813 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24814 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24815 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24816 ret_ref = (uint64_t)ret_var.inner;
24817 if (ret_var.is_owned) {
24823 void __attribute__((visibility("default"))) TS_ChannelReestablish_free(uint32_t this_obj) {
24824 LDKChannelReestablish this_obj_conv;
24825 this_obj_conv.inner = (void*)(this_obj & (~1));
24826 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24827 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24828 ChannelReestablish_free(this_obj_conv);
24831 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_get_channel_id(uint32_t this_ptr) {
24832 LDKChannelReestablish this_ptr_conv;
24833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24834 this_ptr_conv.is_owned = false;
24835 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24836 int8_tArray ret_arr = init_int8_tArray(32);
24837 memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
24841 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24842 LDKChannelReestablish this_ptr_conv;
24843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24844 this_ptr_conv.is_owned = false;
24845 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24846 LDKThirtyTwoBytes val_ref;
24847 CHECK(val->arr_len == 32);
24848 memcpy(val_ref.data, val->elems, 32);
24849 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
24852 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_local_commitment_number(uint32_t this_ptr) {
24853 LDKChannelReestablish this_ptr_conv;
24854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24855 this_ptr_conv.is_owned = false;
24856 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24857 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
24861 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_local_commitment_number(uint32_t this_ptr, int64_t val) {
24862 LDKChannelReestablish this_ptr_conv;
24863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24864 this_ptr_conv.is_owned = false;
24865 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24866 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
24869 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint32_t this_ptr) {
24870 LDKChannelReestablish this_ptr_conv;
24871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24872 this_ptr_conv.is_owned = false;
24873 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24874 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
24878 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_remote_commitment_number(uint32_t this_ptr, int64_t val) {
24879 LDKChannelReestablish this_ptr_conv;
24880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24881 this_ptr_conv.is_owned = false;
24882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24883 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
24886 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
24887 LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
24888 uint64_t ret_ref = 0;
24889 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24890 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24891 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24892 ret_ref = (uint64_t)ret_var.inner;
24893 if (ret_var.is_owned) {
24898 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_clone_ptr(uint32_t arg) {
24899 LDKChannelReestablish arg_conv;
24900 arg_conv.inner = (void*)(arg & (~1));
24901 arg_conv.is_owned = false;
24902 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24903 int64_t ret_val = ChannelReestablish_clone_ptr(&arg_conv);
24907 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_clone(uint32_t orig) {
24908 LDKChannelReestablish orig_conv;
24909 orig_conv.inner = (void*)(orig & (~1));
24910 orig_conv.is_owned = false;
24911 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24912 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
24913 uint64_t ret_ref = 0;
24914 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24915 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24916 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24917 ret_ref = (uint64_t)ret_var.inner;
24918 if (ret_var.is_owned) {
24924 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_free(uint32_t this_obj) {
24925 LDKAnnouncementSignatures this_obj_conv;
24926 this_obj_conv.inner = (void*)(this_obj & (~1));
24927 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24928 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24929 AnnouncementSignatures_free(this_obj_conv);
24932 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_channel_id(uint32_t this_ptr) {
24933 LDKAnnouncementSignatures this_ptr_conv;
24934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24935 this_ptr_conv.is_owned = false;
24936 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24937 int8_tArray ret_arr = init_int8_tArray(32);
24938 memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
24942 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24943 LDKAnnouncementSignatures this_ptr_conv;
24944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24945 this_ptr_conv.is_owned = false;
24946 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24947 LDKThirtyTwoBytes val_ref;
24948 CHECK(val->arr_len == 32);
24949 memcpy(val_ref.data, val->elems, 32);
24950 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
24953 int64_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_short_channel_id(uint32_t this_ptr) {
24954 LDKAnnouncementSignatures this_ptr_conv;
24955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24956 this_ptr_conv.is_owned = false;
24957 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24958 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
24962 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_short_channel_id(uint32_t this_ptr, int64_t val) {
24963 LDKAnnouncementSignatures this_ptr_conv;
24964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24965 this_ptr_conv.is_owned = false;
24966 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24967 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
24970 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_node_signature(uint32_t this_ptr) {
24971 LDKAnnouncementSignatures this_ptr_conv;
24972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24973 this_ptr_conv.is_owned = false;
24974 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24975 int8_tArray ret_arr = init_int8_tArray(64);
24976 memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
24980 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_node_signature(uint32_t this_ptr, int8_tArray val) {
24981 LDKAnnouncementSignatures this_ptr_conv;
24982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24983 this_ptr_conv.is_owned = false;
24984 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24985 LDKSignature val_ref;
24986 CHECK(val->arr_len == 64);
24987 memcpy(val_ref.compact_form, val->elems, 64);
24988 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
24991 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint32_t this_ptr) {
24992 LDKAnnouncementSignatures this_ptr_conv;
24993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24994 this_ptr_conv.is_owned = false;
24995 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24996 int8_tArray ret_arr = init_int8_tArray(64);
24997 memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
25001 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint32_t this_ptr, int8_tArray val) {
25002 LDKAnnouncementSignatures this_ptr_conv;
25003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25004 this_ptr_conv.is_owned = false;
25005 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25006 LDKSignature val_ref;
25007 CHECK(val->arr_len == 64);
25008 memcpy(val_ref.compact_form, val->elems, 64);
25009 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
25012 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_new(int8_tArray channel_id_arg, int64_t short_channel_id_arg, int8_tArray node_signature_arg, int8_tArray bitcoin_signature_arg) {
25013 LDKThirtyTwoBytes channel_id_arg_ref;
25014 CHECK(channel_id_arg->arr_len == 32);
25015 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
25016 LDKSignature node_signature_arg_ref;
25017 CHECK(node_signature_arg->arr_len == 64);
25018 memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64);
25019 LDKSignature bitcoin_signature_arg_ref;
25020 CHECK(bitcoin_signature_arg->arr_len == 64);
25021 memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64);
25022 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
25023 uint64_t ret_ref = 0;
25024 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25025 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25026 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25027 ret_ref = (uint64_t)ret_var.inner;
25028 if (ret_var.is_owned) {
25034 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
25035 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
25036 uint64_t ret_ref = 0;
25037 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25038 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25039 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25040 ret_ref = (uint64_t)ret_var.inner;
25041 if (ret_var.is_owned) {
25046 int64_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_clone_ptr(uint32_t arg) {
25047 LDKAnnouncementSignatures arg_conv;
25048 arg_conv.inner = (void*)(arg & (~1));
25049 arg_conv.is_owned = false;
25050 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25051 int64_t ret_val = AnnouncementSignatures_clone_ptr(&arg_conv);
25055 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_clone(uint32_t orig) {
25056 LDKAnnouncementSignatures orig_conv;
25057 orig_conv.inner = (void*)(orig & (~1));
25058 orig_conv.is_owned = false;
25059 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25060 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
25061 uint64_t ret_ref = 0;
25062 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25063 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25064 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25065 ret_ref = (uint64_t)ret_var.inner;
25066 if (ret_var.is_owned) {
25072 void __attribute__((visibility("default"))) TS_NetAddress_free(uint32_t this_ptr) {
25073 if ((this_ptr & 1) != 0) return;
25074 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
25075 CHECK_ACCESS(this_ptr_ptr);
25076 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
25077 FREE((void*)this_ptr);
25078 NetAddress_free(this_ptr_conv);
25081 static inline uint64_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
25082 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
25083 *ret_copy = NetAddress_clone(arg);
25084 uint64_t ret_ref = (uint64_t)ret_copy;
25087 int64_t __attribute__((visibility("default"))) TS_NetAddress_clone_ptr(uint32_t arg) {
25088 LDKNetAddress* arg_conv = (LDKNetAddress*)arg;
25089 int64_t ret_val = NetAddress_clone_ptr(arg_conv);
25093 uint32_t __attribute__((visibility("default"))) TS_NetAddress_clone(uint32_t orig) {
25094 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
25095 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
25096 *ret_copy = NetAddress_clone(orig_conv);
25097 uint64_t ret_ref = (uint64_t)ret_copy;
25101 uint32_t __attribute__((visibility("default"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
25102 LDKFourBytes addr_ref;
25103 CHECK(addr->arr_len == 4);
25104 memcpy(addr_ref.data, addr->elems, 4);
25105 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
25106 *ret_copy = NetAddress_ipv4(addr_ref, port);
25107 uint64_t ret_ref = (uint64_t)ret_copy;
25111 uint32_t __attribute__((visibility("default"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
25112 LDKSixteenBytes addr_ref;
25113 CHECK(addr->arr_len == 16);
25114 memcpy(addr_ref.data, addr->elems, 16);
25115 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
25116 *ret_copy = NetAddress_ipv6(addr_ref, port);
25117 uint64_t ret_ref = (uint64_t)ret_copy;
25121 uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v2(int8_tArray a) {
25122 LDKTwelveBytes a_ref;
25123 CHECK(a->arr_len == 12);
25124 memcpy(a_ref.data, a->elems, 12);
25125 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
25126 *ret_copy = NetAddress_onion_v2(a_ref);
25127 uint64_t ret_ref = (uint64_t)ret_copy;
25131 uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v3(int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
25132 LDKThirtyTwoBytes ed25519_pubkey_ref;
25133 CHECK(ed25519_pubkey->arr_len == 32);
25134 memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32);
25135 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
25136 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
25137 uint64_t ret_ref = (uint64_t)ret_copy;
25141 int8_tArray __attribute__((visibility("default"))) TS_NetAddress_write(uint32_t obj) {
25142 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
25143 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
25144 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
25145 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25146 CVec_u8Z_free(ret_var);
25150 uint32_t __attribute__((visibility("default"))) TS_NetAddress_read(int8_tArray ser) {
25151 LDKu8slice ser_ref;
25152 ser_ref.datalen = ser->arr_len;
25153 ser_ref.data = ser->elems;
25154 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
25155 *ret_conv = NetAddress_read(ser_ref);
25156 return (uint64_t)ret_conv;
25159 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_free(uint32_t this_obj) {
25160 LDKUnsignedNodeAnnouncement this_obj_conv;
25161 this_obj_conv.inner = (void*)(this_obj & (~1));
25162 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25163 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25164 UnsignedNodeAnnouncement_free(this_obj_conv);
25167 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_features(uint32_t this_ptr) {
25168 LDKUnsignedNodeAnnouncement this_ptr_conv;
25169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25170 this_ptr_conv.is_owned = false;
25171 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25172 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
25173 uint64_t ret_ref = 0;
25174 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25175 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25176 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25177 ret_ref = (uint64_t)ret_var.inner;
25178 if (ret_var.is_owned) {
25184 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
25185 LDKUnsignedNodeAnnouncement this_ptr_conv;
25186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25187 this_ptr_conv.is_owned = false;
25188 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25189 LDKNodeFeatures val_conv;
25190 val_conv.inner = (void*)(val & (~1));
25191 val_conv.is_owned = (val & 1) || (val == 0);
25192 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25193 val_conv = NodeFeatures_clone(&val_conv);
25194 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
25197 int32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint32_t this_ptr) {
25198 LDKUnsignedNodeAnnouncement this_ptr_conv;
25199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25200 this_ptr_conv.is_owned = false;
25201 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25202 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
25206 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint32_t this_ptr, int32_t val) {
25207 LDKUnsignedNodeAnnouncement this_ptr_conv;
25208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25209 this_ptr_conv.is_owned = false;
25210 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25211 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
25214 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_node_id(uint32_t this_ptr) {
25215 LDKUnsignedNodeAnnouncement this_ptr_conv;
25216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25217 this_ptr_conv.is_owned = false;
25218 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25219 int8_tArray ret_arr = init_int8_tArray(33);
25220 memcpy(ret_arr->elems, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
25224 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_node_id(uint32_t this_ptr, int8_tArray val) {
25225 LDKUnsignedNodeAnnouncement this_ptr_conv;
25226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25227 this_ptr_conv.is_owned = false;
25228 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25229 LDKPublicKey val_ref;
25230 CHECK(val->arr_len == 33);
25231 memcpy(val_ref.compressed_form, val->elems, 33);
25232 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
25235 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_rgb(uint32_t this_ptr) {
25236 LDKUnsignedNodeAnnouncement this_ptr_conv;
25237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25238 this_ptr_conv.is_owned = false;
25239 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25240 int8_tArray ret_arr = init_int8_tArray(3);
25241 memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
25245 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_rgb(uint32_t this_ptr, int8_tArray val) {
25246 LDKUnsignedNodeAnnouncement this_ptr_conv;
25247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25248 this_ptr_conv.is_owned = false;
25249 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25250 LDKThreeBytes val_ref;
25251 CHECK(val->arr_len == 3);
25252 memcpy(val_ref.data, val->elems, 3);
25253 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
25256 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_alias(uint32_t this_ptr) {
25257 LDKUnsignedNodeAnnouncement this_ptr_conv;
25258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25259 this_ptr_conv.is_owned = false;
25260 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25261 int8_tArray ret_arr = init_int8_tArray(32);
25262 memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
25266 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_alias(uint32_t this_ptr, int8_tArray val) {
25267 LDKUnsignedNodeAnnouncement this_ptr_conv;
25268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25269 this_ptr_conv.is_owned = false;
25270 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25271 LDKThirtyTwoBytes val_ref;
25272 CHECK(val->arr_len == 32);
25273 memcpy(val_ref.data, val->elems, 32);
25274 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
25277 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_addresses(uint32_t this_ptr, uint32_tArray val) {
25278 LDKUnsignedNodeAnnouncement this_ptr_conv;
25279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25280 this_ptr_conv.is_owned = false;
25281 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25282 LDKCVec_NetAddressZ val_constr;
25283 val_constr.datalen = val->arr_len;
25284 if (val_constr.datalen > 0)
25285 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
25287 val_constr.data = NULL;
25288 uint32_t* val_vals = val->elems;
25289 for (size_t m = 0; m < val_constr.datalen; m++) {
25290 uint32_t val_conv_12 = val_vals[m];
25291 void* val_conv_12_ptr = (void*)(((uint64_t)val_conv_12) & ~1);
25292 CHECK_ACCESS(val_conv_12_ptr);
25293 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
25294 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
25295 val_constr.data[m] = val_conv_12_conv;
25297 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
25300 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
25301 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
25302 uint64_t ret_ref = 0;
25303 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25304 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25305 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25306 ret_ref = (uint64_t)ret_var.inner;
25307 if (ret_var.is_owned) {
25312 int64_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint32_t arg) {
25313 LDKUnsignedNodeAnnouncement arg_conv;
25314 arg_conv.inner = (void*)(arg & (~1));
25315 arg_conv.is_owned = false;
25316 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25317 int64_t ret_val = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
25321 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_clone(uint32_t orig) {
25322 LDKUnsignedNodeAnnouncement orig_conv;
25323 orig_conv.inner = (void*)(orig & (~1));
25324 orig_conv.is_owned = false;
25325 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25326 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
25327 uint64_t ret_ref = 0;
25328 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25329 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25330 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25331 ret_ref = (uint64_t)ret_var.inner;
25332 if (ret_var.is_owned) {
25338 void __attribute__((visibility("default"))) TS_NodeAnnouncement_free(uint32_t this_obj) {
25339 LDKNodeAnnouncement this_obj_conv;
25340 this_obj_conv.inner = (void*)(this_obj & (~1));
25341 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25342 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25343 NodeAnnouncement_free(this_obj_conv);
25346 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_get_signature(uint32_t this_ptr) {
25347 LDKNodeAnnouncement this_ptr_conv;
25348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25349 this_ptr_conv.is_owned = false;
25350 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25351 int8_tArray ret_arr = init_int8_tArray(64);
25352 memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
25356 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_signature(uint32_t this_ptr, int8_tArray val) {
25357 LDKNodeAnnouncement this_ptr_conv;
25358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25359 this_ptr_conv.is_owned = false;
25360 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25361 LDKSignature val_ref;
25362 CHECK(val->arr_len == 64);
25363 memcpy(val_ref.compact_form, val->elems, 64);
25364 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
25367 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_get_contents(uint32_t this_ptr) {
25368 LDKNodeAnnouncement this_ptr_conv;
25369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25370 this_ptr_conv.is_owned = false;
25371 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25372 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
25373 uint64_t ret_ref = 0;
25374 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25375 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25376 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25377 ret_ref = (uint64_t)ret_var.inner;
25378 if (ret_var.is_owned) {
25384 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
25385 LDKNodeAnnouncement this_ptr_conv;
25386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25387 this_ptr_conv.is_owned = false;
25388 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25389 LDKUnsignedNodeAnnouncement val_conv;
25390 val_conv.inner = (void*)(val & (~1));
25391 val_conv.is_owned = (val & 1) || (val == 0);
25392 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25393 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
25394 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
25397 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint32_t contents_arg) {
25398 LDKSignature signature_arg_ref;
25399 CHECK(signature_arg->arr_len == 64);
25400 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64);
25401 LDKUnsignedNodeAnnouncement contents_arg_conv;
25402 contents_arg_conv.inner = (void*)(contents_arg & (~1));
25403 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
25404 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
25405 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
25406 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
25407 uint64_t ret_ref = 0;
25408 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25409 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25410 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25411 ret_ref = (uint64_t)ret_var.inner;
25412 if (ret_var.is_owned) {
25418 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
25419 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
25420 uint64_t ret_ref = 0;
25421 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25422 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25423 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25424 ret_ref = (uint64_t)ret_var.inner;
25425 if (ret_var.is_owned) {
25430 int64_t __attribute__((visibility("default"))) TS_NodeAnnouncement_clone_ptr(uint32_t arg) {
25431 LDKNodeAnnouncement arg_conv;
25432 arg_conv.inner = (void*)(arg & (~1));
25433 arg_conv.is_owned = false;
25434 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25435 int64_t ret_val = NodeAnnouncement_clone_ptr(&arg_conv);
25439 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_clone(uint32_t orig) {
25440 LDKNodeAnnouncement orig_conv;
25441 orig_conv.inner = (void*)(orig & (~1));
25442 orig_conv.is_owned = false;
25443 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25444 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
25445 uint64_t ret_ref = 0;
25446 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25447 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25448 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25449 ret_ref = (uint64_t)ret_var.inner;
25450 if (ret_var.is_owned) {
25456 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_free(uint32_t this_obj) {
25457 LDKUnsignedChannelAnnouncement this_obj_conv;
25458 this_obj_conv.inner = (void*)(this_obj & (~1));
25459 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25460 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25461 UnsignedChannelAnnouncement_free(this_obj_conv);
25464 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_features(uint32_t this_ptr) {
25465 LDKUnsignedChannelAnnouncement this_ptr_conv;
25466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25467 this_ptr_conv.is_owned = false;
25468 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25469 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
25470 uint64_t ret_ref = 0;
25471 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25472 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25473 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25474 ret_ref = (uint64_t)ret_var.inner;
25475 if (ret_var.is_owned) {
25481 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
25482 LDKUnsignedChannelAnnouncement this_ptr_conv;
25483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25484 this_ptr_conv.is_owned = false;
25485 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25486 LDKChannelFeatures val_conv;
25487 val_conv.inner = (void*)(val & (~1));
25488 val_conv.is_owned = (val & 1) || (val == 0);
25489 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25490 val_conv = ChannelFeatures_clone(&val_conv);
25491 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
25494 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint32_t this_ptr) {
25495 LDKUnsignedChannelAnnouncement this_ptr_conv;
25496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25497 this_ptr_conv.is_owned = false;
25498 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25499 int8_tArray ret_arr = init_int8_tArray(32);
25500 memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
25504 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
25505 LDKUnsignedChannelAnnouncement this_ptr_conv;
25506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25507 this_ptr_conv.is_owned = false;
25508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25509 LDKThirtyTwoBytes val_ref;
25510 CHECK(val->arr_len == 32);
25511 memcpy(val_ref.data, val->elems, 32);
25512 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
25515 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint32_t this_ptr) {
25516 LDKUnsignedChannelAnnouncement 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 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
25524 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint32_t this_ptr, int64_t val) {
25525 LDKUnsignedChannelAnnouncement this_ptr_conv;
25526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25527 this_ptr_conv.is_owned = false;
25528 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25529 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
25532 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint32_t this_ptr) {
25533 LDKUnsignedChannelAnnouncement this_ptr_conv;
25534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25535 this_ptr_conv.is_owned = false;
25536 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25537 int8_tArray ret_arr = init_int8_tArray(33);
25538 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
25542 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint32_t this_ptr, int8_tArray val) {
25543 LDKUnsignedChannelAnnouncement this_ptr_conv;
25544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25545 this_ptr_conv.is_owned = false;
25546 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25547 LDKPublicKey val_ref;
25548 CHECK(val->arr_len == 33);
25549 memcpy(val_ref.compressed_form, val->elems, 33);
25550 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
25553 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint32_t this_ptr) {
25554 LDKUnsignedChannelAnnouncement this_ptr_conv;
25555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25556 this_ptr_conv.is_owned = false;
25557 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25558 int8_tArray ret_arr = init_int8_tArray(33);
25559 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
25563 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint32_t this_ptr, int8_tArray val) {
25564 LDKUnsignedChannelAnnouncement this_ptr_conv;
25565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25566 this_ptr_conv.is_owned = false;
25567 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25568 LDKPublicKey val_ref;
25569 CHECK(val->arr_len == 33);
25570 memcpy(val_ref.compressed_form, val->elems, 33);
25571 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
25574 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint32_t this_ptr) {
25575 LDKUnsignedChannelAnnouncement this_ptr_conv;
25576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25577 this_ptr_conv.is_owned = false;
25578 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25579 int8_tArray ret_arr = init_int8_tArray(33);
25580 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
25584 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint32_t this_ptr, int8_tArray val) {
25585 LDKUnsignedChannelAnnouncement this_ptr_conv;
25586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25587 this_ptr_conv.is_owned = false;
25588 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25589 LDKPublicKey val_ref;
25590 CHECK(val->arr_len == 33);
25591 memcpy(val_ref.compressed_form, val->elems, 33);
25592 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
25595 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint32_t this_ptr) {
25596 LDKUnsignedChannelAnnouncement this_ptr_conv;
25597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25598 this_ptr_conv.is_owned = false;
25599 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25600 int8_tArray ret_arr = init_int8_tArray(33);
25601 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
25605 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint32_t this_ptr, int8_tArray val) {
25606 LDKUnsignedChannelAnnouncement this_ptr_conv;
25607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25608 this_ptr_conv.is_owned = false;
25609 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25610 LDKPublicKey val_ref;
25611 CHECK(val->arr_len == 33);
25612 memcpy(val_ref.compressed_form, val->elems, 33);
25613 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
25616 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
25617 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
25618 uint64_t ret_ref = 0;
25619 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25620 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25621 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25622 ret_ref = (uint64_t)ret_var.inner;
25623 if (ret_var.is_owned) {
25628 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint32_t arg) {
25629 LDKUnsignedChannelAnnouncement arg_conv;
25630 arg_conv.inner = (void*)(arg & (~1));
25631 arg_conv.is_owned = false;
25632 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25633 int64_t ret_val = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
25637 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_clone(uint32_t orig) {
25638 LDKUnsignedChannelAnnouncement orig_conv;
25639 orig_conv.inner = (void*)(orig & (~1));
25640 orig_conv.is_owned = false;
25641 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25642 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
25643 uint64_t ret_ref = 0;
25644 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25645 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25646 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25647 ret_ref = (uint64_t)ret_var.inner;
25648 if (ret_var.is_owned) {
25654 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_free(uint32_t this_obj) {
25655 LDKChannelAnnouncement this_obj_conv;
25656 this_obj_conv.inner = (void*)(this_obj & (~1));
25657 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25658 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25659 ChannelAnnouncement_free(this_obj_conv);
25662 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_1(uint32_t this_ptr) {
25663 LDKChannelAnnouncement this_ptr_conv;
25664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25665 this_ptr_conv.is_owned = false;
25666 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25667 int8_tArray ret_arr = init_int8_tArray(64);
25668 memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
25672 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_1(uint32_t this_ptr, int8_tArray val) {
25673 LDKChannelAnnouncement this_ptr_conv;
25674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25675 this_ptr_conv.is_owned = false;
25676 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25677 LDKSignature val_ref;
25678 CHECK(val->arr_len == 64);
25679 memcpy(val_ref.compact_form, val->elems, 64);
25680 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
25683 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_2(uint32_t this_ptr) {
25684 LDKChannelAnnouncement this_ptr_conv;
25685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25686 this_ptr_conv.is_owned = false;
25687 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25688 int8_tArray ret_arr = init_int8_tArray(64);
25689 memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
25693 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_2(uint32_t this_ptr, int8_tArray val) {
25694 LDKChannelAnnouncement 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 LDKSignature val_ref;
25699 CHECK(val->arr_len == 64);
25700 memcpy(val_ref.compact_form, val->elems, 64);
25701 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
25704 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint32_t this_ptr) {
25705 LDKChannelAnnouncement this_ptr_conv;
25706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25707 this_ptr_conv.is_owned = false;
25708 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25709 int8_tArray ret_arr = init_int8_tArray(64);
25710 memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
25714 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint32_t this_ptr, int8_tArray val) {
25715 LDKChannelAnnouncement this_ptr_conv;
25716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25717 this_ptr_conv.is_owned = false;
25718 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25719 LDKSignature val_ref;
25720 CHECK(val->arr_len == 64);
25721 memcpy(val_ref.compact_form, val->elems, 64);
25722 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
25725 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint32_t this_ptr) {
25726 LDKChannelAnnouncement this_ptr_conv;
25727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25728 this_ptr_conv.is_owned = false;
25729 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25730 int8_tArray ret_arr = init_int8_tArray(64);
25731 memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
25735 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint32_t this_ptr, int8_tArray val) {
25736 LDKChannelAnnouncement this_ptr_conv;
25737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25738 this_ptr_conv.is_owned = false;
25739 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25740 LDKSignature val_ref;
25741 CHECK(val->arr_len == 64);
25742 memcpy(val_ref.compact_form, val->elems, 64);
25743 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
25746 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_contents(uint32_t this_ptr) {
25747 LDKChannelAnnouncement this_ptr_conv;
25748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25749 this_ptr_conv.is_owned = false;
25750 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25751 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
25752 uint64_t ret_ref = 0;
25753 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25754 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25755 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25756 ret_ref = (uint64_t)ret_var.inner;
25757 if (ret_var.is_owned) {
25763 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
25764 LDKChannelAnnouncement this_ptr_conv;
25765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25766 this_ptr_conv.is_owned = false;
25767 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25768 LDKUnsignedChannelAnnouncement val_conv;
25769 val_conv.inner = (void*)(val & (~1));
25770 val_conv.is_owned = (val & 1) || (val == 0);
25771 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25772 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
25773 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
25776 uint32_t __attribute__((visibility("default"))) 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) {
25777 LDKSignature node_signature_1_arg_ref;
25778 CHECK(node_signature_1_arg->arr_len == 64);
25779 memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64);
25780 LDKSignature node_signature_2_arg_ref;
25781 CHECK(node_signature_2_arg->arr_len == 64);
25782 memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64);
25783 LDKSignature bitcoin_signature_1_arg_ref;
25784 CHECK(bitcoin_signature_1_arg->arr_len == 64);
25785 memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64);
25786 LDKSignature bitcoin_signature_2_arg_ref;
25787 CHECK(bitcoin_signature_2_arg->arr_len == 64);
25788 memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64);
25789 LDKUnsignedChannelAnnouncement contents_arg_conv;
25790 contents_arg_conv.inner = (void*)(contents_arg & (~1));
25791 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
25792 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
25793 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
25794 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);
25795 uint64_t ret_ref = 0;
25796 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25797 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25798 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25799 ret_ref = (uint64_t)ret_var.inner;
25800 if (ret_var.is_owned) {
25806 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
25807 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
25808 uint64_t ret_ref = 0;
25809 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25810 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25811 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25812 ret_ref = (uint64_t)ret_var.inner;
25813 if (ret_var.is_owned) {
25818 int64_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_clone_ptr(uint32_t arg) {
25819 LDKChannelAnnouncement arg_conv;
25820 arg_conv.inner = (void*)(arg & (~1));
25821 arg_conv.is_owned = false;
25822 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25823 int64_t ret_val = ChannelAnnouncement_clone_ptr(&arg_conv);
25827 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_clone(uint32_t orig) {
25828 LDKChannelAnnouncement orig_conv;
25829 orig_conv.inner = (void*)(orig & (~1));
25830 orig_conv.is_owned = false;
25831 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25832 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
25833 uint64_t ret_ref = 0;
25834 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25835 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25836 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25837 ret_ref = (uint64_t)ret_var.inner;
25838 if (ret_var.is_owned) {
25844 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_free(uint32_t this_obj) {
25845 LDKUnsignedChannelUpdate this_obj_conv;
25846 this_obj_conv.inner = (void*)(this_obj & (~1));
25847 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25848 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25849 UnsignedChannelUpdate_free(this_obj_conv);
25852 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_chain_hash(uint32_t this_ptr) {
25853 LDKUnsignedChannelUpdate this_ptr_conv;
25854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25855 this_ptr_conv.is_owned = false;
25856 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25857 int8_tArray ret_arr = init_int8_tArray(32);
25858 memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
25862 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
25863 LDKUnsignedChannelUpdate 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 LDKThirtyTwoBytes val_ref;
25868 CHECK(val->arr_len == 32);
25869 memcpy(val_ref.data, val->elems, 32);
25870 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
25873 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint32_t this_ptr) {
25874 LDKUnsignedChannelUpdate this_ptr_conv;
25875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25876 this_ptr_conv.is_owned = false;
25877 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25878 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
25882 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint32_t this_ptr, int64_t val) {
25883 LDKUnsignedChannelUpdate this_ptr_conv;
25884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25885 this_ptr_conv.is_owned = false;
25886 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25887 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
25890 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_timestamp(uint32_t this_ptr) {
25891 LDKUnsignedChannelUpdate this_ptr_conv;
25892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25893 this_ptr_conv.is_owned = false;
25894 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25895 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
25899 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_timestamp(uint32_t this_ptr, int32_t val) {
25900 LDKUnsignedChannelUpdate this_ptr_conv;
25901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25902 this_ptr_conv.is_owned = false;
25903 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25904 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
25907 int8_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_flags(uint32_t this_ptr) {
25908 LDKUnsignedChannelUpdate this_ptr_conv;
25909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25910 this_ptr_conv.is_owned = false;
25911 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25912 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
25916 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_flags(uint32_t this_ptr, int8_t val) {
25917 LDKUnsignedChannelUpdate this_ptr_conv;
25918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25919 this_ptr_conv.is_owned = false;
25920 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25921 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
25924 int16_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint32_t this_ptr) {
25925 LDKUnsignedChannelUpdate this_ptr_conv;
25926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25927 this_ptr_conv.is_owned = false;
25928 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25929 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
25933 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
25934 LDKUnsignedChannelUpdate this_ptr_conv;
25935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25936 this_ptr_conv.is_owned = false;
25937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25938 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
25941 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint32_t this_ptr) {
25942 LDKUnsignedChannelUpdate this_ptr_conv;
25943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25944 this_ptr_conv.is_owned = false;
25945 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25946 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
25950 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
25951 LDKUnsignedChannelUpdate this_ptr_conv;
25952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25953 this_ptr_conv.is_owned = false;
25954 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25955 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
25958 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint32_t this_ptr) {
25959 LDKUnsignedChannelUpdate this_ptr_conv;
25960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25961 this_ptr_conv.is_owned = false;
25962 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25963 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
25967 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
25968 LDKUnsignedChannelUpdate this_ptr_conv;
25969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25970 this_ptr_conv.is_owned = false;
25971 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25972 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
25975 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint32_t this_ptr) {
25976 LDKUnsignedChannelUpdate this_ptr_conv;
25977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25978 this_ptr_conv.is_owned = false;
25979 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25980 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
25984 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
25985 LDKUnsignedChannelUpdate this_ptr_conv;
25986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25987 this_ptr_conv.is_owned = false;
25988 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25989 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
25992 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
25993 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
25994 uint64_t ret_ref = 0;
25995 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25996 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25997 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25998 ret_ref = (uint64_t)ret_var.inner;
25999 if (ret_var.is_owned) {
26004 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_clone_ptr(uint32_t arg) {
26005 LDKUnsignedChannelUpdate arg_conv;
26006 arg_conv.inner = (void*)(arg & (~1));
26007 arg_conv.is_owned = false;
26008 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26009 int64_t ret_val = UnsignedChannelUpdate_clone_ptr(&arg_conv);
26013 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_clone(uint32_t orig) {
26014 LDKUnsignedChannelUpdate orig_conv;
26015 orig_conv.inner = (void*)(orig & (~1));
26016 orig_conv.is_owned = false;
26017 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26018 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
26019 uint64_t ret_ref = 0;
26020 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26021 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26022 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26023 ret_ref = (uint64_t)ret_var.inner;
26024 if (ret_var.is_owned) {
26030 void __attribute__((visibility("default"))) TS_ChannelUpdate_free(uint32_t this_obj) {
26031 LDKChannelUpdate this_obj_conv;
26032 this_obj_conv.inner = (void*)(this_obj & (~1));
26033 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26034 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26035 ChannelUpdate_free(this_obj_conv);
26038 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_get_signature(uint32_t this_ptr) {
26039 LDKChannelUpdate this_ptr_conv;
26040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26041 this_ptr_conv.is_owned = false;
26042 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26043 int8_tArray ret_arr = init_int8_tArray(64);
26044 memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
26048 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_signature(uint32_t this_ptr, int8_tArray val) {
26049 LDKChannelUpdate this_ptr_conv;
26050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26051 this_ptr_conv.is_owned = false;
26052 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26053 LDKSignature val_ref;
26054 CHECK(val->arr_len == 64);
26055 memcpy(val_ref.compact_form, val->elems, 64);
26056 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
26059 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_get_contents(uint32_t this_ptr) {
26060 LDKChannelUpdate this_ptr_conv;
26061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26062 this_ptr_conv.is_owned = false;
26063 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26064 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
26065 uint64_t ret_ref = 0;
26066 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26067 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26068 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26069 ret_ref = (uint64_t)ret_var.inner;
26070 if (ret_var.is_owned) {
26076 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_contents(uint32_t this_ptr, uint32_t val) {
26077 LDKChannelUpdate this_ptr_conv;
26078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26079 this_ptr_conv.is_owned = false;
26080 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26081 LDKUnsignedChannelUpdate val_conv;
26082 val_conv.inner = (void*)(val & (~1));
26083 val_conv.is_owned = (val & 1) || (val == 0);
26084 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26085 val_conv = UnsignedChannelUpdate_clone(&val_conv);
26086 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
26089 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint32_t contents_arg) {
26090 LDKSignature signature_arg_ref;
26091 CHECK(signature_arg->arr_len == 64);
26092 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64);
26093 LDKUnsignedChannelUpdate contents_arg_conv;
26094 contents_arg_conv.inner = (void*)(contents_arg & (~1));
26095 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
26096 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
26097 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
26098 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
26099 uint64_t ret_ref = 0;
26100 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26101 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26102 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26103 ret_ref = (uint64_t)ret_var.inner;
26104 if (ret_var.is_owned) {
26110 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
26111 LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
26112 uint64_t ret_ref = 0;
26113 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26114 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26115 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26116 ret_ref = (uint64_t)ret_var.inner;
26117 if (ret_var.is_owned) {
26122 int64_t __attribute__((visibility("default"))) TS_ChannelUpdate_clone_ptr(uint32_t arg) {
26123 LDKChannelUpdate arg_conv;
26124 arg_conv.inner = (void*)(arg & (~1));
26125 arg_conv.is_owned = false;
26126 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26127 int64_t ret_val = ChannelUpdate_clone_ptr(&arg_conv);
26131 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_clone(uint32_t orig) {
26132 LDKChannelUpdate orig_conv;
26133 orig_conv.inner = (void*)(orig & (~1));
26134 orig_conv.is_owned = false;
26135 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26136 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
26137 uint64_t ret_ref = 0;
26138 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26139 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26140 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26141 ret_ref = (uint64_t)ret_var.inner;
26142 if (ret_var.is_owned) {
26148 void __attribute__((visibility("default"))) TS_QueryChannelRange_free(uint32_t this_obj) {
26149 LDKQueryChannelRange this_obj_conv;
26150 this_obj_conv.inner = (void*)(this_obj & (~1));
26151 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26152 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26153 QueryChannelRange_free(this_obj_conv);
26156 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_get_chain_hash(uint32_t this_ptr) {
26157 LDKQueryChannelRange this_ptr_conv;
26158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26159 this_ptr_conv.is_owned = false;
26160 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26161 int8_tArray ret_arr = init_int8_tArray(32);
26162 memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
26166 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26167 LDKQueryChannelRange this_ptr_conv;
26168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26169 this_ptr_conv.is_owned = false;
26170 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26171 LDKThirtyTwoBytes val_ref;
26172 CHECK(val->arr_len == 32);
26173 memcpy(val_ref.data, val->elems, 32);
26174 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
26177 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_first_blocknum(uint32_t this_ptr) {
26178 LDKQueryChannelRange this_ptr_conv;
26179 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26180 this_ptr_conv.is_owned = false;
26181 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26182 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
26186 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
26187 LDKQueryChannelRange this_ptr_conv;
26188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26189 this_ptr_conv.is_owned = false;
26190 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26191 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
26194 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_number_of_blocks(uint32_t this_ptr) {
26195 LDKQueryChannelRange this_ptr_conv;
26196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26197 this_ptr_conv.is_owned = false;
26198 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26199 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
26203 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
26204 LDKQueryChannelRange this_ptr_conv;
26205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26206 this_ptr_conv.is_owned = false;
26207 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26208 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
26211 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_new(int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
26212 LDKThirtyTwoBytes chain_hash_arg_ref;
26213 CHECK(chain_hash_arg->arr_len == 32);
26214 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32);
26215 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
26216 uint64_t ret_ref = 0;
26217 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26218 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26219 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26220 ret_ref = (uint64_t)ret_var.inner;
26221 if (ret_var.is_owned) {
26227 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
26228 LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
26229 uint64_t ret_ref = 0;
26230 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26231 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26232 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26233 ret_ref = (uint64_t)ret_var.inner;
26234 if (ret_var.is_owned) {
26239 int64_t __attribute__((visibility("default"))) TS_QueryChannelRange_clone_ptr(uint32_t arg) {
26240 LDKQueryChannelRange arg_conv;
26241 arg_conv.inner = (void*)(arg & (~1));
26242 arg_conv.is_owned = false;
26243 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26244 int64_t ret_val = QueryChannelRange_clone_ptr(&arg_conv);
26248 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_clone(uint32_t orig) {
26249 LDKQueryChannelRange orig_conv;
26250 orig_conv.inner = (void*)(orig & (~1));
26251 orig_conv.is_owned = false;
26252 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26253 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
26254 uint64_t ret_ref = 0;
26255 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26256 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26257 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26258 ret_ref = (uint64_t)ret_var.inner;
26259 if (ret_var.is_owned) {
26265 void __attribute__((visibility("default"))) TS_ReplyChannelRange_free(uint32_t this_obj) {
26266 LDKReplyChannelRange this_obj_conv;
26267 this_obj_conv.inner = (void*)(this_obj & (~1));
26268 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26269 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26270 ReplyChannelRange_free(this_obj_conv);
26273 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_get_chain_hash(uint32_t this_ptr) {
26274 LDKReplyChannelRange this_ptr_conv;
26275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26276 this_ptr_conv.is_owned = false;
26277 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26278 int8_tArray ret_arr = init_int8_tArray(32);
26279 memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
26283 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26284 LDKReplyChannelRange this_ptr_conv;
26285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26286 this_ptr_conv.is_owned = false;
26287 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26288 LDKThirtyTwoBytes val_ref;
26289 CHECK(val->arr_len == 32);
26290 memcpy(val_ref.data, val->elems, 32);
26291 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
26294 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_first_blocknum(uint32_t this_ptr) {
26295 LDKReplyChannelRange this_ptr_conv;
26296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26297 this_ptr_conv.is_owned = false;
26298 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26299 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
26303 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
26304 LDKReplyChannelRange this_ptr_conv;
26305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26306 this_ptr_conv.is_owned = false;
26307 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26308 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
26311 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_number_of_blocks(uint32_t this_ptr) {
26312 LDKReplyChannelRange this_ptr_conv;
26313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26314 this_ptr_conv.is_owned = false;
26315 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26316 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
26320 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
26321 LDKReplyChannelRange this_ptr_conv;
26322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26323 this_ptr_conv.is_owned = false;
26324 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26325 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
26328 jboolean __attribute__((visibility("default"))) TS_ReplyChannelRange_get_sync_complete(uint32_t this_ptr) {
26329 LDKReplyChannelRange this_ptr_conv;
26330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26331 this_ptr_conv.is_owned = false;
26332 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26333 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
26337 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_sync_complete(uint32_t this_ptr, jboolean val) {
26338 LDKReplyChannelRange this_ptr_conv;
26339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26340 this_ptr_conv.is_owned = false;
26341 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26342 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
26345 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
26346 LDKReplyChannelRange this_ptr_conv;
26347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26348 this_ptr_conv.is_owned = false;
26349 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26350 LDKCVec_u64Z val_constr;
26351 val_constr.datalen = val->arr_len;
26352 if (val_constr.datalen > 0)
26353 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26355 val_constr.data = NULL;
26356 int64_t* val_vals = val->elems;
26357 for (size_t i = 0; i < val_constr.datalen; i++) {
26358 int64_t val_conv_8 = val_vals[i];
26359 val_constr.data[i] = val_conv_8;
26361 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
26364 uint32_t __attribute__((visibility("default"))) 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) {
26365 LDKThirtyTwoBytes chain_hash_arg_ref;
26366 CHECK(chain_hash_arg->arr_len == 32);
26367 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32);
26368 LDKCVec_u64Z short_channel_ids_arg_constr;
26369 short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
26370 if (short_channel_ids_arg_constr.datalen > 0)
26371 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26373 short_channel_ids_arg_constr.data = NULL;
26374 int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
26375 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
26376 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
26377 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
26379 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
26380 uint64_t ret_ref = 0;
26381 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26382 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26383 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26384 ret_ref = (uint64_t)ret_var.inner;
26385 if (ret_var.is_owned) {
26391 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
26392 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
26393 uint64_t ret_ref = 0;
26394 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26395 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26396 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26397 ret_ref = (uint64_t)ret_var.inner;
26398 if (ret_var.is_owned) {
26403 int64_t __attribute__((visibility("default"))) TS_ReplyChannelRange_clone_ptr(uint32_t arg) {
26404 LDKReplyChannelRange arg_conv;
26405 arg_conv.inner = (void*)(arg & (~1));
26406 arg_conv.is_owned = false;
26407 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26408 int64_t ret_val = ReplyChannelRange_clone_ptr(&arg_conv);
26412 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_clone(uint32_t orig) {
26413 LDKReplyChannelRange orig_conv;
26414 orig_conv.inner = (void*)(orig & (~1));
26415 orig_conv.is_owned = false;
26416 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26417 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
26418 uint64_t ret_ref = 0;
26419 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26420 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26421 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26422 ret_ref = (uint64_t)ret_var.inner;
26423 if (ret_var.is_owned) {
26429 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_free(uint32_t this_obj) {
26430 LDKQueryShortChannelIds this_obj_conv;
26431 this_obj_conv.inner = (void*)(this_obj & (~1));
26432 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26433 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26434 QueryShortChannelIds_free(this_obj_conv);
26437 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_get_chain_hash(uint32_t this_ptr) {
26438 LDKQueryShortChannelIds this_ptr_conv;
26439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26440 this_ptr_conv.is_owned = false;
26441 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26442 int8_tArray ret_arr = init_int8_tArray(32);
26443 memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
26447 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26448 LDKQueryShortChannelIds this_ptr_conv;
26449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26450 this_ptr_conv.is_owned = false;
26451 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26452 LDKThirtyTwoBytes val_ref;
26453 CHECK(val->arr_len == 32);
26454 memcpy(val_ref.data, val->elems, 32);
26455 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
26458 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
26459 LDKQueryShortChannelIds this_ptr_conv;
26460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26461 this_ptr_conv.is_owned = false;
26462 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26463 LDKCVec_u64Z val_constr;
26464 val_constr.datalen = val->arr_len;
26465 if (val_constr.datalen > 0)
26466 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26468 val_constr.data = NULL;
26469 int64_t* val_vals = val->elems;
26470 for (size_t i = 0; i < val_constr.datalen; i++) {
26471 int64_t val_conv_8 = val_vals[i];
26472 val_constr.data[i] = val_conv_8;
26474 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
26477 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
26478 LDKThirtyTwoBytes chain_hash_arg_ref;
26479 CHECK(chain_hash_arg->arr_len == 32);
26480 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32);
26481 LDKCVec_u64Z short_channel_ids_arg_constr;
26482 short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
26483 if (short_channel_ids_arg_constr.datalen > 0)
26484 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26486 short_channel_ids_arg_constr.data = NULL;
26487 int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
26488 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
26489 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
26490 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
26492 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
26493 uint64_t ret_ref = 0;
26494 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26495 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26496 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26497 ret_ref = (uint64_t)ret_var.inner;
26498 if (ret_var.is_owned) {
26504 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
26505 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
26506 uint64_t ret_ref = 0;
26507 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26508 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26509 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26510 ret_ref = (uint64_t)ret_var.inner;
26511 if (ret_var.is_owned) {
26516 int64_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_clone_ptr(uint32_t arg) {
26517 LDKQueryShortChannelIds arg_conv;
26518 arg_conv.inner = (void*)(arg & (~1));
26519 arg_conv.is_owned = false;
26520 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26521 int64_t ret_val = QueryShortChannelIds_clone_ptr(&arg_conv);
26525 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_clone(uint32_t orig) {
26526 LDKQueryShortChannelIds orig_conv;
26527 orig_conv.inner = (void*)(orig & (~1));
26528 orig_conv.is_owned = false;
26529 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26530 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
26531 uint64_t ret_ref = 0;
26532 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26533 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26534 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26535 ret_ref = (uint64_t)ret_var.inner;
26536 if (ret_var.is_owned) {
26542 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_free(uint32_t this_obj) {
26543 LDKReplyShortChannelIdsEnd this_obj_conv;
26544 this_obj_conv.inner = (void*)(this_obj & (~1));
26545 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26546 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26547 ReplyShortChannelIdsEnd_free(this_obj_conv);
26550 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint32_t this_ptr) {
26551 LDKReplyShortChannelIdsEnd this_ptr_conv;
26552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26553 this_ptr_conv.is_owned = false;
26554 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26555 int8_tArray ret_arr = init_int8_tArray(32);
26556 memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
26560 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26561 LDKReplyShortChannelIdsEnd this_ptr_conv;
26562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26563 this_ptr_conv.is_owned = false;
26564 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26565 LDKThirtyTwoBytes val_ref;
26566 CHECK(val->arr_len == 32);
26567 memcpy(val_ref.data, val->elems, 32);
26568 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
26571 jboolean __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint32_t this_ptr) {
26572 LDKReplyShortChannelIdsEnd this_ptr_conv;
26573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26574 this_ptr_conv.is_owned = false;
26575 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26576 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
26580 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint32_t this_ptr, jboolean val) {
26581 LDKReplyShortChannelIdsEnd this_ptr_conv;
26582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26583 this_ptr_conv.is_owned = false;
26584 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26585 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
26588 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
26589 LDKThirtyTwoBytes chain_hash_arg_ref;
26590 CHECK(chain_hash_arg->arr_len == 32);
26591 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32);
26592 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
26593 uint64_t ret_ref = 0;
26594 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26595 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26596 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26597 ret_ref = (uint64_t)ret_var.inner;
26598 if (ret_var.is_owned) {
26604 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
26605 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
26606 uint64_t ret_ref = 0;
26607 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26608 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26609 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26610 ret_ref = (uint64_t)ret_var.inner;
26611 if (ret_var.is_owned) {
26616 int64_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint32_t arg) {
26617 LDKReplyShortChannelIdsEnd arg_conv;
26618 arg_conv.inner = (void*)(arg & (~1));
26619 arg_conv.is_owned = false;
26620 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26621 int64_t ret_val = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
26625 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_clone(uint32_t orig) {
26626 LDKReplyShortChannelIdsEnd orig_conv;
26627 orig_conv.inner = (void*)(orig & (~1));
26628 orig_conv.is_owned = false;
26629 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26630 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
26631 uint64_t ret_ref = 0;
26632 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26633 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26634 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26635 ret_ref = (uint64_t)ret_var.inner;
26636 if (ret_var.is_owned) {
26642 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_free(uint32_t this_obj) {
26643 LDKGossipTimestampFilter this_obj_conv;
26644 this_obj_conv.inner = (void*)(this_obj & (~1));
26645 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26646 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26647 GossipTimestampFilter_free(this_obj_conv);
26650 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_chain_hash(uint32_t this_ptr) {
26651 LDKGossipTimestampFilter this_ptr_conv;
26652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26653 this_ptr_conv.is_owned = false;
26654 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26655 int8_tArray ret_arr = init_int8_tArray(32);
26656 memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
26660 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26661 LDKGossipTimestampFilter this_ptr_conv;
26662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26663 this_ptr_conv.is_owned = false;
26664 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26665 LDKThirtyTwoBytes val_ref;
26666 CHECK(val->arr_len == 32);
26667 memcpy(val_ref.data, val->elems, 32);
26668 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
26671 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_first_timestamp(uint32_t this_ptr) {
26672 LDKGossipTimestampFilter this_ptr_conv;
26673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26674 this_ptr_conv.is_owned = false;
26675 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26676 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
26680 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_first_timestamp(uint32_t this_ptr, int32_t val) {
26681 LDKGossipTimestampFilter this_ptr_conv;
26682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26683 this_ptr_conv.is_owned = false;
26684 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26685 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
26688 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_timestamp_range(uint32_t this_ptr) {
26689 LDKGossipTimestampFilter this_ptr_conv;
26690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26691 this_ptr_conv.is_owned = false;
26692 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26693 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
26697 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_timestamp_range(uint32_t this_ptr, int32_t val) {
26698 LDKGossipTimestampFilter this_ptr_conv;
26699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26700 this_ptr_conv.is_owned = false;
26701 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26702 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
26705 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_new(int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
26706 LDKThirtyTwoBytes chain_hash_arg_ref;
26707 CHECK(chain_hash_arg->arr_len == 32);
26708 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32);
26709 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
26710 uint64_t ret_ref = 0;
26711 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26712 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26713 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26714 ret_ref = (uint64_t)ret_var.inner;
26715 if (ret_var.is_owned) {
26721 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
26722 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
26723 uint64_t ret_ref = 0;
26724 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26725 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26726 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26727 ret_ref = (uint64_t)ret_var.inner;
26728 if (ret_var.is_owned) {
26733 int64_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_clone_ptr(uint32_t arg) {
26734 LDKGossipTimestampFilter arg_conv;
26735 arg_conv.inner = (void*)(arg & (~1));
26736 arg_conv.is_owned = false;
26737 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26738 int64_t ret_val = GossipTimestampFilter_clone_ptr(&arg_conv);
26742 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_clone(uint32_t orig) {
26743 LDKGossipTimestampFilter orig_conv;
26744 orig_conv.inner = (void*)(orig & (~1));
26745 orig_conv.is_owned = false;
26746 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26747 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
26748 uint64_t ret_ref = 0;
26749 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26750 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26751 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26752 ret_ref = (uint64_t)ret_var.inner;
26753 if (ret_var.is_owned) {
26759 void __attribute__((visibility("default"))) TS_ErrorAction_free(uint32_t this_ptr) {
26760 if ((this_ptr & 1) != 0) return;
26761 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
26762 CHECK_ACCESS(this_ptr_ptr);
26763 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
26764 FREE((void*)this_ptr);
26765 ErrorAction_free(this_ptr_conv);
26768 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
26769 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
26770 *ret_copy = ErrorAction_clone(arg);
26771 uint64_t ret_ref = (uint64_t)ret_copy;
26774 int64_t __attribute__((visibility("default"))) TS_ErrorAction_clone_ptr(uint32_t arg) {
26775 LDKErrorAction* arg_conv = (LDKErrorAction*)arg;
26776 int64_t ret_val = ErrorAction_clone_ptr(arg_conv);
26780 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_clone(uint32_t orig) {
26781 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
26782 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
26783 *ret_copy = ErrorAction_clone(orig_conv);
26784 uint64_t ret_ref = (uint64_t)ret_copy;
26788 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_disconnect_peer(uint32_t msg) {
26789 LDKErrorMessage msg_conv;
26790 msg_conv.inner = (void*)(msg & (~1));
26791 msg_conv.is_owned = (msg & 1) || (msg == 0);
26792 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
26793 msg_conv = ErrorMessage_clone(&msg_conv);
26794 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
26795 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
26796 uint64_t ret_ref = (uint64_t)ret_copy;
26800 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_error() {
26801 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
26802 *ret_copy = ErrorAction_ignore_error();
26803 uint64_t ret_ref = (uint64_t)ret_copy;
26807 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
26808 LDKLevel a_conv = LDKLevel_from_js(a);
26809 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
26810 *ret_copy = ErrorAction_ignore_and_log(a_conv);
26811 uint64_t ret_ref = (uint64_t)ret_copy;
26815 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_duplicate_gossip() {
26816 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
26817 *ret_copy = ErrorAction_ignore_duplicate_gossip();
26818 uint64_t ret_ref = (uint64_t)ret_copy;
26822 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_send_error_message(uint32_t msg) {
26823 LDKErrorMessage msg_conv;
26824 msg_conv.inner = (void*)(msg & (~1));
26825 msg_conv.is_owned = (msg & 1) || (msg == 0);
26826 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
26827 msg_conv = ErrorMessage_clone(&msg_conv);
26828 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
26829 *ret_copy = ErrorAction_send_error_message(msg_conv);
26830 uint64_t ret_ref = (uint64_t)ret_copy;
26834 void __attribute__((visibility("default"))) TS_LightningError_free(uint32_t this_obj) {
26835 LDKLightningError this_obj_conv;
26836 this_obj_conv.inner = (void*)(this_obj & (~1));
26837 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26838 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26839 LightningError_free(this_obj_conv);
26842 jstring __attribute__((visibility("default"))) TS_LightningError_get_err(uint32_t this_ptr) {
26843 LDKLightningError this_ptr_conv;
26844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26845 this_ptr_conv.is_owned = false;
26846 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26847 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
26848 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
26853 void __attribute__((visibility("default"))) TS_LightningError_set_err(uint32_t this_ptr, jstring val) {
26854 LDKLightningError this_ptr_conv;
26855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26856 this_ptr_conv.is_owned = false;
26857 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26858 LDKStr val_conv = str_ref_to_owned_c(val);
26859 LightningError_set_err(&this_ptr_conv, val_conv);
26862 uint32_t __attribute__((visibility("default"))) TS_LightningError_get_action(uint32_t this_ptr) {
26863 LDKLightningError this_ptr_conv;
26864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26865 this_ptr_conv.is_owned = false;
26866 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26867 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
26868 *ret_copy = LightningError_get_action(&this_ptr_conv);
26869 uint64_t ret_ref = (uint64_t)ret_copy;
26873 void __attribute__((visibility("default"))) TS_LightningError_set_action(uint32_t this_ptr, uint32_t val) {
26874 LDKLightningError this_ptr_conv;
26875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26876 this_ptr_conv.is_owned = false;
26877 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26878 void* val_ptr = (void*)(((uint64_t)val) & ~1);
26879 CHECK_ACCESS(val_ptr);
26880 LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
26881 val_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)val) & ~1));
26882 LightningError_set_action(&this_ptr_conv, val_conv);
26885 uint32_t __attribute__((visibility("default"))) TS_LightningError_new(jstring err_arg, uint32_t action_arg) {
26886 LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
26887 void* action_arg_ptr = (void*)(((uint64_t)action_arg) & ~1);
26888 CHECK_ACCESS(action_arg_ptr);
26889 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
26890 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action_arg) & ~1));
26891 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
26892 uint64_t ret_ref = 0;
26893 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26894 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26895 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26896 ret_ref = (uint64_t)ret_var.inner;
26897 if (ret_var.is_owned) {
26903 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
26904 LDKLightningError ret_var = LightningError_clone(arg);
26905 uint64_t ret_ref = 0;
26906 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26907 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26908 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26909 ret_ref = (uint64_t)ret_var.inner;
26910 if (ret_var.is_owned) {
26915 int64_t __attribute__((visibility("default"))) TS_LightningError_clone_ptr(uint32_t arg) {
26916 LDKLightningError arg_conv;
26917 arg_conv.inner = (void*)(arg & (~1));
26918 arg_conv.is_owned = false;
26919 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26920 int64_t ret_val = LightningError_clone_ptr(&arg_conv);
26924 uint32_t __attribute__((visibility("default"))) TS_LightningError_clone(uint32_t orig) {
26925 LDKLightningError orig_conv;
26926 orig_conv.inner = (void*)(orig & (~1));
26927 orig_conv.is_owned = false;
26928 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26929 LDKLightningError ret_var = LightningError_clone(&orig_conv);
26930 uint64_t ret_ref = 0;
26931 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26932 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26933 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26934 ret_ref = (uint64_t)ret_var.inner;
26935 if (ret_var.is_owned) {
26941 void __attribute__((visibility("default"))) TS_CommitmentUpdate_free(uint32_t this_obj) {
26942 LDKCommitmentUpdate this_obj_conv;
26943 this_obj_conv.inner = (void*)(this_obj & (~1));
26944 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26945 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26946 CommitmentUpdate_free(this_obj_conv);
26949 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_add_htlcs(uint32_t this_ptr) {
26950 LDKCommitmentUpdate this_ptr_conv;
26951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26952 this_ptr_conv.is_owned = false;
26953 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26954 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
26955 uint32_tArray ret_arr = NULL;
26956 ret_arr = init_uint32_tArray(ret_var.datalen);
26957 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
26958 for (size_t p = 0; p < ret_var.datalen; p++) {
26959 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
26960 uint64_t ret_conv_15_ref = 0;
26961 CHECK((((uint64_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26962 CHECK((((uint64_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26963 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
26964 ret_conv_15_ref = (uint64_t)ret_conv_15_var.inner;
26965 if (ret_conv_15_var.is_owned) {
26966 ret_conv_15_ref |= 1;
26968 ret_arr_ptr[p] = ret_conv_15_ref;
26971 FREE(ret_var.data);
26975 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_add_htlcs(uint32_t this_ptr, uint32_tArray val) {
26976 LDKCommitmentUpdate this_ptr_conv;
26977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26978 this_ptr_conv.is_owned = false;
26979 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26980 LDKCVec_UpdateAddHTLCZ val_constr;
26981 val_constr.datalen = val->arr_len;
26982 if (val_constr.datalen > 0)
26983 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
26985 val_constr.data = NULL;
26986 uint32_t* val_vals = val->elems;
26987 for (size_t p = 0; p < val_constr.datalen; p++) {
26988 uint32_t val_conv_15 = val_vals[p];
26989 LDKUpdateAddHTLC val_conv_15_conv;
26990 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
26991 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
26992 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
26993 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
26994 val_constr.data[p] = val_conv_15_conv;
26996 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
26999 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint32_t this_ptr) {
27000 LDKCommitmentUpdate this_ptr_conv;
27001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27002 this_ptr_conv.is_owned = false;
27003 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27004 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
27005 uint32_tArray ret_arr = NULL;
27006 ret_arr = init_uint32_tArray(ret_var.datalen);
27007 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
27008 for (size_t t = 0; t < ret_var.datalen; t++) {
27009 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
27010 uint64_t ret_conv_19_ref = 0;
27011 CHECK((((uint64_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27012 CHECK((((uint64_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27013 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
27014 ret_conv_19_ref = (uint64_t)ret_conv_19_var.inner;
27015 if (ret_conv_19_var.is_owned) {
27016 ret_conv_19_ref |= 1;
27018 ret_arr_ptr[t] = ret_conv_19_ref;
27021 FREE(ret_var.data);
27025 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint32_t this_ptr, uint32_tArray val) {
27026 LDKCommitmentUpdate this_ptr_conv;
27027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27028 this_ptr_conv.is_owned = false;
27029 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27030 LDKCVec_UpdateFulfillHTLCZ val_constr;
27031 val_constr.datalen = val->arr_len;
27032 if (val_constr.datalen > 0)
27033 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
27035 val_constr.data = NULL;
27036 uint32_t* val_vals = val->elems;
27037 for (size_t t = 0; t < val_constr.datalen; t++) {
27038 uint32_t val_conv_19 = val_vals[t];
27039 LDKUpdateFulfillHTLC val_conv_19_conv;
27040 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
27041 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
27042 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
27043 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
27044 val_constr.data[t] = val_conv_19_conv;
27046 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
27049 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint32_t this_ptr) {
27050 LDKCommitmentUpdate this_ptr_conv;
27051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27052 this_ptr_conv.is_owned = false;
27053 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27054 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
27055 uint32_tArray ret_arr = NULL;
27056 ret_arr = init_uint32_tArray(ret_var.datalen);
27057 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
27058 for (size_t q = 0; q < ret_var.datalen; q++) {
27059 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
27060 uint64_t ret_conv_16_ref = 0;
27061 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27062 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27063 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
27064 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
27065 if (ret_conv_16_var.is_owned) {
27066 ret_conv_16_ref |= 1;
27068 ret_arr_ptr[q] = ret_conv_16_ref;
27071 FREE(ret_var.data);
27075 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint32_t this_ptr, uint32_tArray val) {
27076 LDKCommitmentUpdate this_ptr_conv;
27077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27078 this_ptr_conv.is_owned = false;
27079 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27080 LDKCVec_UpdateFailHTLCZ val_constr;
27081 val_constr.datalen = val->arr_len;
27082 if (val_constr.datalen > 0)
27083 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
27085 val_constr.data = NULL;
27086 uint32_t* val_vals = val->elems;
27087 for (size_t q = 0; q < val_constr.datalen; q++) {
27088 uint32_t val_conv_16 = val_vals[q];
27089 LDKUpdateFailHTLC val_conv_16_conv;
27090 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
27091 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
27092 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
27093 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
27094 val_constr.data[q] = val_conv_16_conv;
27096 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
27099 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint32_t this_ptr) {
27100 LDKCommitmentUpdate this_ptr_conv;
27101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27102 this_ptr_conv.is_owned = false;
27103 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27104 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
27105 uint32_tArray ret_arr = NULL;
27106 ret_arr = init_uint32_tArray(ret_var.datalen);
27107 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
27108 for (size_t z = 0; z < ret_var.datalen; z++) {
27109 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
27110 uint64_t ret_conv_25_ref = 0;
27111 CHECK((((uint64_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27112 CHECK((((uint64_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27113 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
27114 ret_conv_25_ref = (uint64_t)ret_conv_25_var.inner;
27115 if (ret_conv_25_var.is_owned) {
27116 ret_conv_25_ref |= 1;
27118 ret_arr_ptr[z] = ret_conv_25_ref;
27121 FREE(ret_var.data);
27125 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_malformed_htlcs(uint32_t this_ptr, uint32_tArray val) {
27126 LDKCommitmentUpdate this_ptr_conv;
27127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27128 this_ptr_conv.is_owned = false;
27129 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27130 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
27131 val_constr.datalen = val->arr_len;
27132 if (val_constr.datalen > 0)
27133 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
27135 val_constr.data = NULL;
27136 uint32_t* val_vals = val->elems;
27137 for (size_t z = 0; z < val_constr.datalen; z++) {
27138 uint32_t val_conv_25 = val_vals[z];
27139 LDKUpdateFailMalformedHTLC val_conv_25_conv;
27140 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
27141 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
27142 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
27143 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
27144 val_constr.data[z] = val_conv_25_conv;
27146 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
27149 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fee(uint32_t this_ptr) {
27150 LDKCommitmentUpdate this_ptr_conv;
27151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27152 this_ptr_conv.is_owned = false;
27153 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27154 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
27155 uint64_t ret_ref = 0;
27156 if ((uint64_t)ret_var.inner > 4096) {
27157 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27158 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27159 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27160 ret_ref = (uint64_t)ret_var.inner;
27161 if (ret_var.is_owned) {
27168 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fee(uint32_t this_ptr, uint32_t val) {
27169 LDKCommitmentUpdate this_ptr_conv;
27170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27171 this_ptr_conv.is_owned = false;
27172 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27173 LDKUpdateFee val_conv;
27174 val_conv.inner = (void*)(val & (~1));
27175 val_conv.is_owned = (val & 1) || (val == 0);
27176 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27177 val_conv = UpdateFee_clone(&val_conv);
27178 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
27181 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_commitment_signed(uint32_t this_ptr) {
27182 LDKCommitmentUpdate this_ptr_conv;
27183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27184 this_ptr_conv.is_owned = false;
27185 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27186 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
27187 uint64_t ret_ref = 0;
27188 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27189 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27190 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27191 ret_ref = (uint64_t)ret_var.inner;
27192 if (ret_var.is_owned) {
27198 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_commitment_signed(uint32_t this_ptr, uint32_t val) {
27199 LDKCommitmentUpdate this_ptr_conv;
27200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27201 this_ptr_conv.is_owned = false;
27202 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27203 LDKCommitmentSigned val_conv;
27204 val_conv.inner = (void*)(val & (~1));
27205 val_conv.is_owned = (val & 1) || (val == 0);
27206 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27207 val_conv = CommitmentSigned_clone(&val_conv);
27208 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
27211 uint32_t __attribute__((visibility("default"))) 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) {
27212 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
27213 update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
27214 if (update_add_htlcs_arg_constr.datalen > 0)
27215 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
27217 update_add_htlcs_arg_constr.data = NULL;
27218 uint32_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
27219 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
27220 uint32_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
27221 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
27222 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
27223 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
27224 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
27225 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
27226 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
27228 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
27229 update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
27230 if (update_fulfill_htlcs_arg_constr.datalen > 0)
27231 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
27233 update_fulfill_htlcs_arg_constr.data = NULL;
27234 uint32_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
27235 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
27236 uint32_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
27237 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
27238 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
27239 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
27240 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
27241 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
27242 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
27244 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
27245 update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
27246 if (update_fail_htlcs_arg_constr.datalen > 0)
27247 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
27249 update_fail_htlcs_arg_constr.data = NULL;
27250 uint32_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
27251 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
27252 uint32_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
27253 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
27254 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
27255 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
27256 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
27257 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
27258 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
27260 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
27261 update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
27262 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
27263 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
27265 update_fail_malformed_htlcs_arg_constr.data = NULL;
27266 uint32_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
27267 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
27268 uint32_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
27269 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
27270 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
27271 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);
27272 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
27273 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
27274 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
27276 LDKUpdateFee update_fee_arg_conv;
27277 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
27278 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
27279 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
27280 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
27281 LDKCommitmentSigned commitment_signed_arg_conv;
27282 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
27283 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
27284 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
27285 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
27286 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);
27287 uint64_t ret_ref = 0;
27288 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27289 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27290 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27291 ret_ref = (uint64_t)ret_var.inner;
27292 if (ret_var.is_owned) {
27298 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
27299 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
27300 uint64_t ret_ref = 0;
27301 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27302 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27303 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27304 ret_ref = (uint64_t)ret_var.inner;
27305 if (ret_var.is_owned) {
27310 int64_t __attribute__((visibility("default"))) TS_CommitmentUpdate_clone_ptr(uint32_t arg) {
27311 LDKCommitmentUpdate arg_conv;
27312 arg_conv.inner = (void*)(arg & (~1));
27313 arg_conv.is_owned = false;
27314 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27315 int64_t ret_val = CommitmentUpdate_clone_ptr(&arg_conv);
27319 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_clone(uint32_t orig) {
27320 LDKCommitmentUpdate orig_conv;
27321 orig_conv.inner = (void*)(orig & (~1));
27322 orig_conv.is_owned = false;
27323 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27324 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
27325 uint64_t ret_ref = 0;
27326 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27327 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27328 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27329 ret_ref = (uint64_t)ret_var.inner;
27330 if (ret_var.is_owned) {
27336 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_free(uint32_t this_ptr) {
27337 if ((this_ptr & 1) != 0) return;
27338 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
27339 CHECK_ACCESS(this_ptr_ptr);
27340 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
27341 FREE((void*)this_ptr);
27342 ChannelMessageHandler_free(this_ptr_conv);
27345 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_free(uint32_t this_ptr) {
27346 if ((this_ptr & 1) != 0) return;
27347 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
27348 CHECK_ACCESS(this_ptr_ptr);
27349 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
27350 FREE((void*)this_ptr);
27351 RoutingMessageHandler_free(this_ptr_conv);
27354 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_write(uint32_t obj) {
27355 LDKAcceptChannel obj_conv;
27356 obj_conv.inner = (void*)(obj & (~1));
27357 obj_conv.is_owned = false;
27358 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27359 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
27360 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27361 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27362 CVec_u8Z_free(ret_var);
27366 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_read(int8_tArray ser) {
27367 LDKu8slice ser_ref;
27368 ser_ref.datalen = ser->arr_len;
27369 ser_ref.data = ser->elems;
27370 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
27371 *ret_conv = AcceptChannel_read(ser_ref);
27372 return (uint64_t)ret_conv;
27375 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_write(uint32_t obj) {
27376 LDKAnnouncementSignatures obj_conv;
27377 obj_conv.inner = (void*)(obj & (~1));
27378 obj_conv.is_owned = false;
27379 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27380 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
27381 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27382 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27383 CVec_u8Z_free(ret_var);
27387 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
27388 LDKu8slice ser_ref;
27389 ser_ref.datalen = ser->arr_len;
27390 ser_ref.data = ser->elems;
27391 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
27392 *ret_conv = AnnouncementSignatures_read(ser_ref);
27393 return (uint64_t)ret_conv;
27396 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_write(uint32_t obj) {
27397 LDKChannelReestablish obj_conv;
27398 obj_conv.inner = (void*)(obj & (~1));
27399 obj_conv.is_owned = false;
27400 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27401 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
27402 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27403 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27404 CVec_u8Z_free(ret_var);
27408 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_read(int8_tArray ser) {
27409 LDKu8slice ser_ref;
27410 ser_ref.datalen = ser->arr_len;
27411 ser_ref.data = ser->elems;
27412 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
27413 *ret_conv = ChannelReestablish_read(ser_ref);
27414 return (uint64_t)ret_conv;
27417 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_write(uint32_t obj) {
27418 LDKClosingSigned obj_conv;
27419 obj_conv.inner = (void*)(obj & (~1));
27420 obj_conv.is_owned = false;
27421 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27422 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
27423 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27424 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27425 CVec_u8Z_free(ret_var);
27429 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_read(int8_tArray ser) {
27430 LDKu8slice ser_ref;
27431 ser_ref.datalen = ser->arr_len;
27432 ser_ref.data = ser->elems;
27433 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
27434 *ret_conv = ClosingSigned_read(ser_ref);
27435 return (uint64_t)ret_conv;
27438 int8_tArray __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_write(uint32_t obj) {
27439 LDKClosingSignedFeeRange obj_conv;
27440 obj_conv.inner = (void*)(obj & (~1));
27441 obj_conv.is_owned = false;
27442 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27443 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
27444 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27445 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27446 CVec_u8Z_free(ret_var);
27450 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
27451 LDKu8slice ser_ref;
27452 ser_ref.datalen = ser->arr_len;
27453 ser_ref.data = ser->elems;
27454 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
27455 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
27456 return (uint64_t)ret_conv;
27459 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_write(uint32_t obj) {
27460 LDKCommitmentSigned obj_conv;
27461 obj_conv.inner = (void*)(obj & (~1));
27462 obj_conv.is_owned = false;
27463 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27464 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
27465 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27466 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27467 CVec_u8Z_free(ret_var);
27471 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_read(int8_tArray ser) {
27472 LDKu8slice ser_ref;
27473 ser_ref.datalen = ser->arr_len;
27474 ser_ref.data = ser->elems;
27475 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
27476 *ret_conv = CommitmentSigned_read(ser_ref);
27477 return (uint64_t)ret_conv;
27480 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_write(uint32_t obj) {
27481 LDKFundingCreated obj_conv;
27482 obj_conv.inner = (void*)(obj & (~1));
27483 obj_conv.is_owned = false;
27484 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27485 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
27486 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27487 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27488 CVec_u8Z_free(ret_var);
27492 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_read(int8_tArray ser) {
27493 LDKu8slice ser_ref;
27494 ser_ref.datalen = ser->arr_len;
27495 ser_ref.data = ser->elems;
27496 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
27497 *ret_conv = FundingCreated_read(ser_ref);
27498 return (uint64_t)ret_conv;
27501 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_write(uint32_t obj) {
27502 LDKFundingSigned obj_conv;
27503 obj_conv.inner = (void*)(obj & (~1));
27504 obj_conv.is_owned = false;
27505 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27506 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
27507 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27508 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27509 CVec_u8Z_free(ret_var);
27513 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_read(int8_tArray ser) {
27514 LDKu8slice ser_ref;
27515 ser_ref.datalen = ser->arr_len;
27516 ser_ref.data = ser->elems;
27517 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
27518 *ret_conv = FundingSigned_read(ser_ref);
27519 return (uint64_t)ret_conv;
27522 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_write(uint32_t obj) {
27523 LDKFundingLocked obj_conv;
27524 obj_conv.inner = (void*)(obj & (~1));
27525 obj_conv.is_owned = false;
27526 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27527 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
27528 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27529 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27530 CVec_u8Z_free(ret_var);
27534 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_read(int8_tArray ser) {
27535 LDKu8slice ser_ref;
27536 ser_ref.datalen = ser->arr_len;
27537 ser_ref.data = ser->elems;
27538 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
27539 *ret_conv = FundingLocked_read(ser_ref);
27540 return (uint64_t)ret_conv;
27543 int8_tArray __attribute__((visibility("default"))) TS_Init_write(uint32_t obj) {
27545 obj_conv.inner = (void*)(obj & (~1));
27546 obj_conv.is_owned = false;
27547 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27548 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
27549 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27550 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27551 CVec_u8Z_free(ret_var);
27555 uint32_t __attribute__((visibility("default"))) TS_Init_read(int8_tArray ser) {
27556 LDKu8slice ser_ref;
27557 ser_ref.datalen = ser->arr_len;
27558 ser_ref.data = ser->elems;
27559 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
27560 *ret_conv = Init_read(ser_ref);
27561 return (uint64_t)ret_conv;
27564 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_write(uint32_t obj) {
27565 LDKOpenChannel obj_conv;
27566 obj_conv.inner = (void*)(obj & (~1));
27567 obj_conv.is_owned = false;
27568 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27569 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
27570 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27571 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27572 CVec_u8Z_free(ret_var);
27576 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_read(int8_tArray ser) {
27577 LDKu8slice ser_ref;
27578 ser_ref.datalen = ser->arr_len;
27579 ser_ref.data = ser->elems;
27580 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
27581 *ret_conv = OpenChannel_read(ser_ref);
27582 return (uint64_t)ret_conv;
27585 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_write(uint32_t obj) {
27586 LDKRevokeAndACK obj_conv;
27587 obj_conv.inner = (void*)(obj & (~1));
27588 obj_conv.is_owned = false;
27589 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27590 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
27591 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27592 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27593 CVec_u8Z_free(ret_var);
27597 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_read(int8_tArray ser) {
27598 LDKu8slice ser_ref;
27599 ser_ref.datalen = ser->arr_len;
27600 ser_ref.data = ser->elems;
27601 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
27602 *ret_conv = RevokeAndACK_read(ser_ref);
27603 return (uint64_t)ret_conv;
27606 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_write(uint32_t obj) {
27607 LDKShutdown obj_conv;
27608 obj_conv.inner = (void*)(obj & (~1));
27609 obj_conv.is_owned = false;
27610 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27611 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
27612 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27613 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27614 CVec_u8Z_free(ret_var);
27618 uint32_t __attribute__((visibility("default"))) TS_Shutdown_read(int8_tArray ser) {
27619 LDKu8slice ser_ref;
27620 ser_ref.datalen = ser->arr_len;
27621 ser_ref.data = ser->elems;
27622 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
27623 *ret_conv = Shutdown_read(ser_ref);
27624 return (uint64_t)ret_conv;
27627 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_write(uint32_t obj) {
27628 LDKUpdateFailHTLC obj_conv;
27629 obj_conv.inner = (void*)(obj & (~1));
27630 obj_conv.is_owned = false;
27631 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27632 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
27633 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27634 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27635 CVec_u8Z_free(ret_var);
27639 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
27640 LDKu8slice ser_ref;
27641 ser_ref.datalen = ser->arr_len;
27642 ser_ref.data = ser->elems;
27643 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
27644 *ret_conv = UpdateFailHTLC_read(ser_ref);
27645 return (uint64_t)ret_conv;
27648 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_write(uint32_t obj) {
27649 LDKUpdateFailMalformedHTLC obj_conv;
27650 obj_conv.inner = (void*)(obj & (~1));
27651 obj_conv.is_owned = false;
27652 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27653 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
27654 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27655 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27656 CVec_u8Z_free(ret_var);
27660 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
27661 LDKu8slice ser_ref;
27662 ser_ref.datalen = ser->arr_len;
27663 ser_ref.data = ser->elems;
27664 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
27665 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
27666 return (uint64_t)ret_conv;
27669 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_write(uint32_t obj) {
27670 LDKUpdateFee obj_conv;
27671 obj_conv.inner = (void*)(obj & (~1));
27672 obj_conv.is_owned = false;
27673 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27674 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
27675 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27676 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27677 CVec_u8Z_free(ret_var);
27681 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_read(int8_tArray ser) {
27682 LDKu8slice ser_ref;
27683 ser_ref.datalen = ser->arr_len;
27684 ser_ref.data = ser->elems;
27685 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
27686 *ret_conv = UpdateFee_read(ser_ref);
27687 return (uint64_t)ret_conv;
27690 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_write(uint32_t obj) {
27691 LDKUpdateFulfillHTLC obj_conv;
27692 obj_conv.inner = (void*)(obj & (~1));
27693 obj_conv.is_owned = false;
27694 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27695 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
27696 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27697 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27698 CVec_u8Z_free(ret_var);
27702 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
27703 LDKu8slice ser_ref;
27704 ser_ref.datalen = ser->arr_len;
27705 ser_ref.data = ser->elems;
27706 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
27707 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
27708 return (uint64_t)ret_conv;
27711 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_write(uint32_t obj) {
27712 LDKUpdateAddHTLC obj_conv;
27713 obj_conv.inner = (void*)(obj & (~1));
27714 obj_conv.is_owned = false;
27715 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27716 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
27717 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27718 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27719 CVec_u8Z_free(ret_var);
27723 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
27724 LDKu8slice ser_ref;
27725 ser_ref.datalen = ser->arr_len;
27726 ser_ref.data = ser->elems;
27727 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
27728 *ret_conv = UpdateAddHTLC_read(ser_ref);
27729 return (uint64_t)ret_conv;
27732 int8_tArray __attribute__((visibility("default"))) TS_Ping_write(uint32_t obj) {
27734 obj_conv.inner = (void*)(obj & (~1));
27735 obj_conv.is_owned = false;
27736 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27737 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
27738 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27739 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27740 CVec_u8Z_free(ret_var);
27744 uint32_t __attribute__((visibility("default"))) TS_Ping_read(int8_tArray ser) {
27745 LDKu8slice ser_ref;
27746 ser_ref.datalen = ser->arr_len;
27747 ser_ref.data = ser->elems;
27748 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
27749 *ret_conv = Ping_read(ser_ref);
27750 return (uint64_t)ret_conv;
27753 int8_tArray __attribute__((visibility("default"))) TS_Pong_write(uint32_t obj) {
27755 obj_conv.inner = (void*)(obj & (~1));
27756 obj_conv.is_owned = false;
27757 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27758 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
27759 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27760 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27761 CVec_u8Z_free(ret_var);
27765 uint32_t __attribute__((visibility("default"))) TS_Pong_read(int8_tArray ser) {
27766 LDKu8slice ser_ref;
27767 ser_ref.datalen = ser->arr_len;
27768 ser_ref.data = ser->elems;
27769 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
27770 *ret_conv = Pong_read(ser_ref);
27771 return (uint64_t)ret_conv;
27774 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_write(uint32_t obj) {
27775 LDKUnsignedChannelAnnouncement obj_conv;
27776 obj_conv.inner = (void*)(obj & (~1));
27777 obj_conv.is_owned = false;
27778 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27779 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
27780 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27781 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27782 CVec_u8Z_free(ret_var);
27786 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
27787 LDKu8slice ser_ref;
27788 ser_ref.datalen = ser->arr_len;
27789 ser_ref.data = ser->elems;
27790 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
27791 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
27792 return (uint64_t)ret_conv;
27795 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_write(uint32_t obj) {
27796 LDKChannelAnnouncement obj_conv;
27797 obj_conv.inner = (void*)(obj & (~1));
27798 obj_conv.is_owned = false;
27799 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27800 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
27801 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27802 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27803 CVec_u8Z_free(ret_var);
27807 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
27808 LDKu8slice ser_ref;
27809 ser_ref.datalen = ser->arr_len;
27810 ser_ref.data = ser->elems;
27811 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
27812 *ret_conv = ChannelAnnouncement_read(ser_ref);
27813 return (uint64_t)ret_conv;
27816 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_write(uint32_t obj) {
27817 LDKUnsignedChannelUpdate obj_conv;
27818 obj_conv.inner = (void*)(obj & (~1));
27819 obj_conv.is_owned = false;
27820 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27821 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
27822 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27823 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27824 CVec_u8Z_free(ret_var);
27828 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
27829 LDKu8slice ser_ref;
27830 ser_ref.datalen = ser->arr_len;
27831 ser_ref.data = ser->elems;
27832 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
27833 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
27834 return (uint64_t)ret_conv;
27837 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_write(uint32_t obj) {
27838 LDKChannelUpdate obj_conv;
27839 obj_conv.inner = (void*)(obj & (~1));
27840 obj_conv.is_owned = false;
27841 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27842 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
27843 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27844 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27845 CVec_u8Z_free(ret_var);
27849 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_read(int8_tArray ser) {
27850 LDKu8slice ser_ref;
27851 ser_ref.datalen = ser->arr_len;
27852 ser_ref.data = ser->elems;
27853 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
27854 *ret_conv = ChannelUpdate_read(ser_ref);
27855 return (uint64_t)ret_conv;
27858 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_write(uint32_t obj) {
27859 LDKErrorMessage obj_conv;
27860 obj_conv.inner = (void*)(obj & (~1));
27861 obj_conv.is_owned = false;
27862 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27863 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
27864 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27865 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27866 CVec_u8Z_free(ret_var);
27870 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_read(int8_tArray ser) {
27871 LDKu8slice ser_ref;
27872 ser_ref.datalen = ser->arr_len;
27873 ser_ref.data = ser->elems;
27874 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
27875 *ret_conv = ErrorMessage_read(ser_ref);
27876 return (uint64_t)ret_conv;
27879 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_write(uint32_t obj) {
27880 LDKUnsignedNodeAnnouncement obj_conv;
27881 obj_conv.inner = (void*)(obj & (~1));
27882 obj_conv.is_owned = false;
27883 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27884 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
27885 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27886 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27887 CVec_u8Z_free(ret_var);
27891 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
27892 LDKu8slice ser_ref;
27893 ser_ref.datalen = ser->arr_len;
27894 ser_ref.data = ser->elems;
27895 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
27896 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
27897 return (uint64_t)ret_conv;
27900 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_write(uint32_t obj) {
27901 LDKNodeAnnouncement obj_conv;
27902 obj_conv.inner = (void*)(obj & (~1));
27903 obj_conv.is_owned = false;
27904 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27905 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
27906 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27907 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27908 CVec_u8Z_free(ret_var);
27912 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_read(int8_tArray ser) {
27913 LDKu8slice ser_ref;
27914 ser_ref.datalen = ser->arr_len;
27915 ser_ref.data = ser->elems;
27916 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
27917 *ret_conv = NodeAnnouncement_read(ser_ref);
27918 return (uint64_t)ret_conv;
27921 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
27922 LDKu8slice ser_ref;
27923 ser_ref.datalen = ser->arr_len;
27924 ser_ref.data = ser->elems;
27925 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
27926 *ret_conv = QueryShortChannelIds_read(ser_ref);
27927 return (uint64_t)ret_conv;
27930 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_write(uint32_t obj) {
27931 LDKQueryShortChannelIds obj_conv;
27932 obj_conv.inner = (void*)(obj & (~1));
27933 obj_conv.is_owned = false;
27934 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27935 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
27936 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27937 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27938 CVec_u8Z_free(ret_var);
27942 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_write(uint32_t obj) {
27943 LDKReplyShortChannelIdsEnd obj_conv;
27944 obj_conv.inner = (void*)(obj & (~1));
27945 obj_conv.is_owned = false;
27946 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27947 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
27948 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27949 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27950 CVec_u8Z_free(ret_var);
27954 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
27955 LDKu8slice ser_ref;
27956 ser_ref.datalen = ser->arr_len;
27957 ser_ref.data = ser->elems;
27958 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
27959 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
27960 return (uint64_t)ret_conv;
27963 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_end_blocknum(uint32_t this_arg) {
27964 LDKQueryChannelRange this_arg_conv;
27965 this_arg_conv.inner = (void*)(this_arg & (~1));
27966 this_arg_conv.is_owned = false;
27967 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27968 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
27972 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_write(uint32_t obj) {
27973 LDKQueryChannelRange obj_conv;
27974 obj_conv.inner = (void*)(obj & (~1));
27975 obj_conv.is_owned = false;
27976 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27977 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
27978 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27979 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27980 CVec_u8Z_free(ret_var);
27984 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_read(int8_tArray ser) {
27985 LDKu8slice ser_ref;
27986 ser_ref.datalen = ser->arr_len;
27987 ser_ref.data = ser->elems;
27988 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
27989 *ret_conv = QueryChannelRange_read(ser_ref);
27990 return (uint64_t)ret_conv;
27993 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_read(int8_tArray ser) {
27994 LDKu8slice ser_ref;
27995 ser_ref.datalen = ser->arr_len;
27996 ser_ref.data = ser->elems;
27997 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
27998 *ret_conv = ReplyChannelRange_read(ser_ref);
27999 return (uint64_t)ret_conv;
28002 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_write(uint32_t obj) {
28003 LDKReplyChannelRange obj_conv;
28004 obj_conv.inner = (void*)(obj & (~1));
28005 obj_conv.is_owned = false;
28006 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28007 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
28008 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28009 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28010 CVec_u8Z_free(ret_var);
28014 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_write(uint32_t obj) {
28015 LDKGossipTimestampFilter obj_conv;
28016 obj_conv.inner = (void*)(obj & (~1));
28017 obj_conv.is_owned = false;
28018 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28019 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
28020 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28021 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28022 CVec_u8Z_free(ret_var);
28026 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
28027 LDKu8slice ser_ref;
28028 ser_ref.datalen = ser->arr_len;
28029 ser_ref.data = ser->elems;
28030 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
28031 *ret_conv = GossipTimestampFilter_read(ser_ref);
28032 return (uint64_t)ret_conv;
28035 void __attribute__((visibility("default"))) TS_CustomMessageHandler_free(uint32_t this_ptr) {
28036 if ((this_ptr & 1) != 0) return;
28037 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
28038 CHECK_ACCESS(this_ptr_ptr);
28039 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
28040 FREE((void*)this_ptr);
28041 CustomMessageHandler_free(this_ptr_conv);
28044 void __attribute__((visibility("default"))) TS_IgnoringMessageHandler_free(uint32_t this_obj) {
28045 LDKIgnoringMessageHandler this_obj_conv;
28046 this_obj_conv.inner = (void*)(this_obj & (~1));
28047 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28048 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28049 IgnoringMessageHandler_free(this_obj_conv);
28052 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_new() {
28053 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
28054 uint64_t ret_ref = 0;
28055 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28056 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28057 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28058 ret_ref = (uint64_t)ret_var.inner;
28059 if (ret_var.is_owned) {
28065 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
28066 LDKIgnoringMessageHandler this_arg_conv;
28067 this_arg_conv.inner = (void*)(this_arg & (~1));
28068 this_arg_conv.is_owned = false;
28069 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28070 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
28071 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
28072 return (uint64_t)ret_ret;
28075 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint32_t this_arg) {
28076 LDKIgnoringMessageHandler this_arg_conv;
28077 this_arg_conv.inner = (void*)(this_arg & (~1));
28078 this_arg_conv.is_owned = false;
28079 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28080 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
28081 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
28082 return (uint64_t)ret_ret;
28085 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint32_t this_arg) {
28086 LDKIgnoringMessageHandler this_arg_conv;
28087 this_arg_conv.inner = (void*)(this_arg & (~1));
28088 this_arg_conv.is_owned = false;
28089 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28090 LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
28091 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
28092 return (uint64_t)ret_ret;
28095 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint32_t this_arg) {
28096 LDKIgnoringMessageHandler this_arg_conv;
28097 this_arg_conv.inner = (void*)(this_arg & (~1));
28098 this_arg_conv.is_owned = false;
28099 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28100 LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
28101 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
28102 return (uint64_t)ret_ret;
28105 void __attribute__((visibility("default"))) TS_ErroringMessageHandler_free(uint32_t this_obj) {
28106 LDKErroringMessageHandler this_obj_conv;
28107 this_obj_conv.inner = (void*)(this_obj & (~1));
28108 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28109 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28110 ErroringMessageHandler_free(this_obj_conv);
28113 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_new() {
28114 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
28115 uint64_t ret_ref = 0;
28116 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28117 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28118 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28119 ret_ref = (uint64_t)ret_var.inner;
28120 if (ret_var.is_owned) {
28126 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
28127 LDKErroringMessageHandler this_arg_conv;
28128 this_arg_conv.inner = (void*)(this_arg & (~1));
28129 this_arg_conv.is_owned = false;
28130 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28131 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
28132 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
28133 return (uint64_t)ret_ret;
28136 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint32_t this_arg) {
28137 LDKErroringMessageHandler this_arg_conv;
28138 this_arg_conv.inner = (void*)(this_arg & (~1));
28139 this_arg_conv.is_owned = false;
28140 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28141 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
28142 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
28143 return (uint64_t)ret_ret;
28146 void __attribute__((visibility("default"))) TS_MessageHandler_free(uint32_t this_obj) {
28147 LDKMessageHandler this_obj_conv;
28148 this_obj_conv.inner = (void*)(this_obj & (~1));
28149 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28150 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28151 MessageHandler_free(this_obj_conv);
28154 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_chan_handler(uint32_t this_ptr) {
28155 LDKMessageHandler this_ptr_conv;
28156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28157 this_ptr_conv.is_owned = false;
28158 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28159 // WARNING: This object doesn't live past this scope, needs clone!
28160 uint64_t ret_ret = ((uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv)) | 1;
28164 void __attribute__((visibility("default"))) TS_MessageHandler_set_chan_handler(uint32_t this_ptr, uint32_t val) {
28165 LDKMessageHandler this_ptr_conv;
28166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28167 this_ptr_conv.is_owned = false;
28168 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28169 void* val_ptr = (void*)(((uint64_t)val) & ~1);
28170 CHECK_ACCESS(val_ptr);
28171 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
28172 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
28175 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_route_handler(uint32_t this_ptr) {
28176 LDKMessageHandler this_ptr_conv;
28177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28178 this_ptr_conv.is_owned = false;
28179 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28180 // WARNING: This object doesn't live past this scope, needs clone!
28181 uint64_t ret_ret = ((uint64_t)MessageHandler_get_route_handler(&this_ptr_conv)) | 1;
28185 void __attribute__((visibility("default"))) TS_MessageHandler_set_route_handler(uint32_t this_ptr, uint32_t val) {
28186 LDKMessageHandler this_ptr_conv;
28187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28188 this_ptr_conv.is_owned = false;
28189 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28190 void* val_ptr = (void*)(((uint64_t)val) & ~1);
28191 CHECK_ACCESS(val_ptr);
28192 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
28193 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
28196 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_new(uint32_t chan_handler_arg, uint32_t route_handler_arg) {
28197 void* chan_handler_arg_ptr = (void*)(((uint64_t)chan_handler_arg) & ~1);
28198 CHECK_ACCESS(chan_handler_arg_ptr);
28199 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
28200 void* route_handler_arg_ptr = (void*)(((uint64_t)route_handler_arg) & ~1);
28201 CHECK_ACCESS(route_handler_arg_ptr);
28202 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
28203 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
28204 uint64_t ret_ref = 0;
28205 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28206 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28207 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28208 ret_ref = (uint64_t)ret_var.inner;
28209 if (ret_var.is_owned) {
28215 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
28216 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
28217 *ret_ret = SocketDescriptor_clone(arg);
28218 return (uint64_t)ret_ret;
28220 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_clone_ptr(uint32_t arg) {
28221 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
28222 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
28223 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
28224 int64_t ret_val = SocketDescriptor_clone_ptr(arg_conv);
28228 uint32_t __attribute__((visibility("default"))) TS_SocketDescriptor_clone(uint32_t orig) {
28229 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
28230 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
28231 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
28232 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
28233 *ret_ret = SocketDescriptor_clone(orig_conv);
28234 return (uint64_t)ret_ret;
28237 void __attribute__((visibility("default"))) TS_SocketDescriptor_free(uint32_t this_ptr) {
28238 if ((this_ptr & 1) != 0) return;
28239 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
28240 CHECK_ACCESS(this_ptr_ptr);
28241 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
28242 FREE((void*)this_ptr);
28243 SocketDescriptor_free(this_ptr_conv);
28246 void __attribute__((visibility("default"))) TS_PeerHandleError_free(uint32_t this_obj) {
28247 LDKPeerHandleError this_obj_conv;
28248 this_obj_conv.inner = (void*)(this_obj & (~1));
28249 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28250 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28251 PeerHandleError_free(this_obj_conv);
28254 jboolean __attribute__((visibility("default"))) TS_PeerHandleError_get_no_connection_possible(uint32_t this_ptr) {
28255 LDKPeerHandleError this_ptr_conv;
28256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28257 this_ptr_conv.is_owned = false;
28258 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28259 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
28263 void __attribute__((visibility("default"))) TS_PeerHandleError_set_no_connection_possible(uint32_t this_ptr, jboolean val) {
28264 LDKPeerHandleError this_ptr_conv;
28265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28266 this_ptr_conv.is_owned = false;
28267 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28268 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
28271 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
28272 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
28273 uint64_t ret_ref = 0;
28274 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28275 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28276 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28277 ret_ref = (uint64_t)ret_var.inner;
28278 if (ret_var.is_owned) {
28284 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
28285 LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
28286 uint64_t ret_ref = 0;
28287 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28288 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28289 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28290 ret_ref = (uint64_t)ret_var.inner;
28291 if (ret_var.is_owned) {
28296 int64_t __attribute__((visibility("default"))) TS_PeerHandleError_clone_ptr(uint32_t arg) {
28297 LDKPeerHandleError arg_conv;
28298 arg_conv.inner = (void*)(arg & (~1));
28299 arg_conv.is_owned = false;
28300 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28301 int64_t ret_val = PeerHandleError_clone_ptr(&arg_conv);
28305 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_clone(uint32_t orig) {
28306 LDKPeerHandleError orig_conv;
28307 orig_conv.inner = (void*)(orig & (~1));
28308 orig_conv.is_owned = false;
28309 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28310 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
28311 uint64_t ret_ref = 0;
28312 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28313 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28314 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28315 ret_ref = (uint64_t)ret_var.inner;
28316 if (ret_var.is_owned) {
28322 void __attribute__((visibility("default"))) TS_PeerManager_free(uint32_t this_obj) {
28323 LDKPeerManager this_obj_conv;
28324 this_obj_conv.inner = (void*)(this_obj & (~1));
28325 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28326 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28327 PeerManager_free(this_obj_conv);
28330 uint32_t __attribute__((visibility("default"))) 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) {
28331 LDKMessageHandler message_handler_conv;
28332 message_handler_conv.inner = (void*)(message_handler & (~1));
28333 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
28334 CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
28335 // Warning: we need a move here but no clone is available for LDKMessageHandler
28336 LDKSecretKey our_node_secret_ref;
28337 CHECK(our_node_secret->arr_len == 32);
28338 memcpy(our_node_secret_ref.bytes, our_node_secret->elems, 32);
28339 unsigned char ephemeral_random_data_arr[32];
28340 CHECK(ephemeral_random_data->arr_len == 32);
28341 memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32);
28342 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
28343 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
28344 CHECK_ACCESS(logger_ptr);
28345 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
28346 void* custom_message_handler_ptr = (void*)(((uint64_t)custom_message_handler) & ~1);
28347 CHECK_ACCESS(custom_message_handler_ptr);
28348 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
28349 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
28350 uint64_t ret_ref = 0;
28351 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28352 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28353 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28354 ret_ref = (uint64_t)ret_var.inner;
28355 if (ret_var.is_owned) {
28361 ptrArray __attribute__((visibility("default"))) TS_PeerManager_get_peer_node_ids(uint32_t this_arg) {
28362 LDKPeerManager this_arg_conv;
28363 this_arg_conv.inner = (void*)(this_arg & (~1));
28364 this_arg_conv.is_owned = false;
28365 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28366 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
28367 ptrArray ret_arr = NULL;
28368 ret_arr = init_ptrArray(ret_var.datalen);
28369 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
28370 for (size_t m = 0; m < ret_var.datalen; m++) {
28371 int8_tArray ret_conv_12_arr = init_int8_tArray(33);
28372 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compressed_form, 33);
28373 ret_arr_ptr[m] = ret_conv_12_arr;
28376 FREE(ret_var.data);
28380 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_outbound_connection(uint32_t this_arg, int8_tArray their_node_id, uint32_t descriptor) {
28381 LDKPeerManager this_arg_conv;
28382 this_arg_conv.inner = (void*)(this_arg & (~1));
28383 this_arg_conv.is_owned = false;
28384 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28385 LDKPublicKey their_node_id_ref;
28386 CHECK(their_node_id->arr_len == 33);
28387 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
28388 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
28389 CHECK_ACCESS(descriptor_ptr);
28390 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
28391 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
28392 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
28393 return (uint64_t)ret_conv;
28396 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_inbound_connection(uint32_t this_arg, uint32_t descriptor) {
28397 LDKPeerManager this_arg_conv;
28398 this_arg_conv.inner = (void*)(this_arg & (~1));
28399 this_arg_conv.is_owned = false;
28400 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28401 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
28402 CHECK_ACCESS(descriptor_ptr);
28403 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
28404 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
28405 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
28406 return (uint64_t)ret_conv;
28409 uint32_t __attribute__((visibility("default"))) TS_PeerManager_write_buffer_space_avail(uint32_t this_arg, uint32_t descriptor) {
28410 LDKPeerManager this_arg_conv;
28411 this_arg_conv.inner = (void*)(this_arg & (~1));
28412 this_arg_conv.is_owned = false;
28413 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28414 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
28415 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
28416 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
28417 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
28418 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
28419 return (uint64_t)ret_conv;
28422 uint32_t __attribute__((visibility("default"))) TS_PeerManager_read_event(uint32_t this_arg, uint32_t peer_descriptor, int8_tArray data) {
28423 LDKPeerManager this_arg_conv;
28424 this_arg_conv.inner = (void*)(this_arg & (~1));
28425 this_arg_conv.is_owned = false;
28426 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28427 void* peer_descriptor_ptr = (void*)(((uint64_t)peer_descriptor) & ~1);
28428 if (!(peer_descriptor & 1)) { CHECK_ACCESS(peer_descriptor_ptr); }
28429 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
28430 LDKu8slice data_ref;
28431 data_ref.datalen = data->arr_len;
28432 data_ref.data = data->elems;
28433 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
28434 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
28435 return (uint64_t)ret_conv;
28438 void __attribute__((visibility("default"))) TS_PeerManager_process_events(uint32_t this_arg) {
28439 LDKPeerManager this_arg_conv;
28440 this_arg_conv.inner = (void*)(this_arg & (~1));
28441 this_arg_conv.is_owned = false;
28442 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28443 PeerManager_process_events(&this_arg_conv);
28446 void __attribute__((visibility("default"))) TS_PeerManager_socket_disconnected(uint32_t this_arg, uint32_t descriptor) {
28447 LDKPeerManager this_arg_conv;
28448 this_arg_conv.inner = (void*)(this_arg & (~1));
28449 this_arg_conv.is_owned = false;
28450 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28451 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
28452 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
28453 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
28454 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
28457 void __attribute__((visibility("default"))) TS_PeerManager_disconnect_by_node_id(uint32_t this_arg, int8_tArray node_id, jboolean no_connection_possible) {
28458 LDKPeerManager this_arg_conv;
28459 this_arg_conv.inner = (void*)(this_arg & (~1));
28460 this_arg_conv.is_owned = false;
28461 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28462 LDKPublicKey node_id_ref;
28463 CHECK(node_id->arr_len == 33);
28464 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
28465 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
28468 void __attribute__((visibility("default"))) TS_PeerManager_disconnect_all_peers(uint32_t this_arg) {
28469 LDKPeerManager this_arg_conv;
28470 this_arg_conv.inner = (void*)(this_arg & (~1));
28471 this_arg_conv.is_owned = false;
28472 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28473 PeerManager_disconnect_all_peers(&this_arg_conv);
28476 void __attribute__((visibility("default"))) TS_PeerManager_timer_tick_occurred(uint32_t this_arg) {
28477 LDKPeerManager this_arg_conv;
28478 this_arg_conv.inner = (void*)(this_arg & (~1));
28479 this_arg_conv.is_owned = false;
28480 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28481 PeerManager_timer_tick_occurred(&this_arg_conv);
28484 int64_t __attribute__((visibility("default"))) TS_htlc_success_tx_weight(jboolean opt_anchors) {
28485 int64_t ret_val = htlc_success_tx_weight(opt_anchors);
28489 int64_t __attribute__((visibility("default"))) TS_htlc_timeout_tx_weight(jboolean opt_anchors) {
28490 int64_t ret_val = htlc_timeout_tx_weight(opt_anchors);
28494 int8_tArray __attribute__((visibility("default"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
28495 unsigned char commitment_seed_arr[32];
28496 CHECK(commitment_seed->arr_len == 32);
28497 memcpy(commitment_seed_arr, commitment_seed->elems, 32);
28498 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
28499 int8_tArray ret_arr = init_int8_tArray(32);
28500 memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
28504 int8_tArray __attribute__((visibility("default"))) 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) {
28505 LDKCVec_u8Z to_holder_script_ref;
28506 to_holder_script_ref.datalen = to_holder_script->arr_len;
28507 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
28508 memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen);
28509 LDKCVec_u8Z to_counterparty_script_ref;
28510 to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
28511 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
28512 memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen);
28513 LDKOutPoint funding_outpoint_conv;
28514 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
28515 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
28516 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
28517 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
28518 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);
28519 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28520 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28521 Transaction_free(ret_var);
28525 uint32_t __attribute__((visibility("default"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
28526 LDKPublicKey per_commitment_point_ref;
28527 CHECK(per_commitment_point->arr_len == 33);
28528 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33);
28529 unsigned char base_secret_arr[32];
28530 CHECK(base_secret->arr_len == 32);
28531 memcpy(base_secret_arr, base_secret->elems, 32);
28532 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
28533 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
28534 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
28535 return (uint64_t)ret_conv;
28538 uint32_t __attribute__((visibility("default"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
28539 LDKPublicKey per_commitment_point_ref;
28540 CHECK(per_commitment_point->arr_len == 33);
28541 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33);
28542 LDKPublicKey base_point_ref;
28543 CHECK(base_point->arr_len == 33);
28544 memcpy(base_point_ref.compressed_form, base_point->elems, 33);
28545 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
28546 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
28547 return (uint64_t)ret_conv;
28550 uint32_t __attribute__((visibility("default"))) TS_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
28551 unsigned char per_commitment_secret_arr[32];
28552 CHECK(per_commitment_secret->arr_len == 32);
28553 memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32);
28554 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
28555 unsigned char countersignatory_revocation_base_secret_arr[32];
28556 CHECK(countersignatory_revocation_base_secret->arr_len == 32);
28557 memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32);
28558 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
28559 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
28560 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
28561 return (uint64_t)ret_conv;
28564 uint32_t __attribute__((visibility("default"))) TS_derive_public_revocation_key(int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
28565 LDKPublicKey per_commitment_point_ref;
28566 CHECK(per_commitment_point->arr_len == 33);
28567 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33);
28568 LDKPublicKey countersignatory_revocation_base_point_ref;
28569 CHECK(countersignatory_revocation_base_point->arr_len == 33);
28570 memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point->elems, 33);
28571 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
28572 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
28573 return (uint64_t)ret_conv;
28576 void __attribute__((visibility("default"))) TS_TxCreationKeys_free(uint32_t this_obj) {
28577 LDKTxCreationKeys this_obj_conv;
28578 this_obj_conv.inner = (void*)(this_obj & (~1));
28579 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28580 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28581 TxCreationKeys_free(this_obj_conv);
28584 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_per_commitment_point(uint32_t this_ptr) {
28585 LDKTxCreationKeys this_ptr_conv;
28586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28587 this_ptr_conv.is_owned = false;
28588 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28589 int8_tArray ret_arr = init_int8_tArray(33);
28590 memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
28594 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
28595 LDKTxCreationKeys this_ptr_conv;
28596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28597 this_ptr_conv.is_owned = false;
28598 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28599 LDKPublicKey val_ref;
28600 CHECK(val->arr_len == 33);
28601 memcpy(val_ref.compressed_form, val->elems, 33);
28602 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
28605 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_revocation_key(uint32_t this_ptr) {
28606 LDKTxCreationKeys this_ptr_conv;
28607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28608 this_ptr_conv.is_owned = false;
28609 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28610 int8_tArray ret_arr = init_int8_tArray(33);
28611 memcpy(ret_arr->elems, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
28615 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_revocation_key(uint32_t this_ptr, int8_tArray val) {
28616 LDKTxCreationKeys this_ptr_conv;
28617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28618 this_ptr_conv.is_owned = false;
28619 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28620 LDKPublicKey val_ref;
28621 CHECK(val->arr_len == 33);
28622 memcpy(val_ref.compressed_form, val->elems, 33);
28623 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
28626 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint32_t this_ptr) {
28627 LDKTxCreationKeys this_ptr_conv;
28628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28629 this_ptr_conv.is_owned = false;
28630 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28631 int8_tArray ret_arr = init_int8_tArray(33);
28632 memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
28636 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint32_t this_ptr, int8_tArray val) {
28637 LDKTxCreationKeys this_ptr_conv;
28638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28639 this_ptr_conv.is_owned = false;
28640 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28641 LDKPublicKey val_ref;
28642 CHECK(val->arr_len == 33);
28643 memcpy(val_ref.compressed_form, val->elems, 33);
28644 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
28647 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint32_t this_ptr) {
28648 LDKTxCreationKeys this_ptr_conv;
28649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28650 this_ptr_conv.is_owned = false;
28651 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28652 int8_tArray ret_arr = init_int8_tArray(33);
28653 memcpy(ret_arr->elems, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
28657 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint32_t this_ptr, int8_tArray val) {
28658 LDKTxCreationKeys this_ptr_conv;
28659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28660 this_ptr_conv.is_owned = false;
28661 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28662 LDKPublicKey val_ref;
28663 CHECK(val->arr_len == 33);
28664 memcpy(val_ref.compressed_form, val->elems, 33);
28665 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
28668 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint32_t this_ptr) {
28669 LDKTxCreationKeys this_ptr_conv;
28670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28671 this_ptr_conv.is_owned = false;
28672 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28673 int8_tArray ret_arr = init_int8_tArray(33);
28674 memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
28678 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_delayed_payment_key(uint32_t this_ptr, int8_tArray val) {
28679 LDKTxCreationKeys this_ptr_conv;
28680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28681 this_ptr_conv.is_owned = false;
28682 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28683 LDKPublicKey val_ref;
28684 CHECK(val->arr_len == 33);
28685 memcpy(val_ref.compressed_form, val->elems, 33);
28686 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
28689 uint32_t __attribute__((visibility("default"))) 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) {
28690 LDKPublicKey per_commitment_point_arg_ref;
28691 CHECK(per_commitment_point_arg->arr_len == 33);
28692 memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33);
28693 LDKPublicKey revocation_key_arg_ref;
28694 CHECK(revocation_key_arg->arr_len == 33);
28695 memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg->elems, 33);
28696 LDKPublicKey broadcaster_htlc_key_arg_ref;
28697 CHECK(broadcaster_htlc_key_arg->arr_len == 33);
28698 memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg->elems, 33);
28699 LDKPublicKey countersignatory_htlc_key_arg_ref;
28700 CHECK(countersignatory_htlc_key_arg->arr_len == 33);
28701 memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg->elems, 33);
28702 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
28703 CHECK(broadcaster_delayed_payment_key_arg->arr_len == 33);
28704 memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg->elems, 33);
28705 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);
28706 uint64_t ret_ref = 0;
28707 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28708 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28709 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28710 ret_ref = (uint64_t)ret_var.inner;
28711 if (ret_var.is_owned) {
28717 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
28718 LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
28719 uint64_t ret_ref = 0;
28720 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28721 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28722 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28723 ret_ref = (uint64_t)ret_var.inner;
28724 if (ret_var.is_owned) {
28729 int64_t __attribute__((visibility("default"))) TS_TxCreationKeys_clone_ptr(uint32_t arg) {
28730 LDKTxCreationKeys arg_conv;
28731 arg_conv.inner = (void*)(arg & (~1));
28732 arg_conv.is_owned = false;
28733 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28734 int64_t ret_val = TxCreationKeys_clone_ptr(&arg_conv);
28738 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_clone(uint32_t orig) {
28739 LDKTxCreationKeys orig_conv;
28740 orig_conv.inner = (void*)(orig & (~1));
28741 orig_conv.is_owned = false;
28742 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28743 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
28744 uint64_t ret_ref = 0;
28745 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28746 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28747 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28748 ret_ref = (uint64_t)ret_var.inner;
28749 if (ret_var.is_owned) {
28755 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_write(uint32_t obj) {
28756 LDKTxCreationKeys obj_conv;
28757 obj_conv.inner = (void*)(obj & (~1));
28758 obj_conv.is_owned = false;
28759 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28760 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
28761 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28762 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28763 CVec_u8Z_free(ret_var);
28767 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_read(int8_tArray ser) {
28768 LDKu8slice ser_ref;
28769 ser_ref.datalen = ser->arr_len;
28770 ser_ref.data = ser->elems;
28771 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
28772 *ret_conv = TxCreationKeys_read(ser_ref);
28773 return (uint64_t)ret_conv;
28776 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_free(uint32_t this_obj) {
28777 LDKChannelPublicKeys this_obj_conv;
28778 this_obj_conv.inner = (void*)(this_obj & (~1));
28779 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28780 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28781 ChannelPublicKeys_free(this_obj_conv);
28784 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_funding_pubkey(uint32_t this_ptr) {
28785 LDKChannelPublicKeys this_ptr_conv;
28786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28787 this_ptr_conv.is_owned = false;
28788 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28789 int8_tArray ret_arr = init_int8_tArray(33);
28790 memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
28794 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
28795 LDKChannelPublicKeys this_ptr_conv;
28796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28797 this_ptr_conv.is_owned = false;
28798 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28799 LDKPublicKey val_ref;
28800 CHECK(val->arr_len == 33);
28801 memcpy(val_ref.compressed_form, val->elems, 33);
28802 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
28805 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint32_t this_ptr) {
28806 LDKChannelPublicKeys this_ptr_conv;
28807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28808 this_ptr_conv.is_owned = false;
28809 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28810 int8_tArray ret_arr = init_int8_tArray(33);
28811 memcpy(ret_arr->elems, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
28815 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
28816 LDKChannelPublicKeys this_ptr_conv;
28817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28818 this_ptr_conv.is_owned = false;
28819 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28820 LDKPublicKey val_ref;
28821 CHECK(val->arr_len == 33);
28822 memcpy(val_ref.compressed_form, val->elems, 33);
28823 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
28826 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_payment_point(uint32_t this_ptr) {
28827 LDKChannelPublicKeys this_ptr_conv;
28828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28829 this_ptr_conv.is_owned = false;
28830 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28831 int8_tArray ret_arr = init_int8_tArray(33);
28832 memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
28836 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_payment_point(uint32_t this_ptr, int8_tArray val) {
28837 LDKChannelPublicKeys this_ptr_conv;
28838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28839 this_ptr_conv.is_owned = false;
28840 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28841 LDKPublicKey val_ref;
28842 CHECK(val->arr_len == 33);
28843 memcpy(val_ref.compressed_form, val->elems, 33);
28844 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
28847 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint32_t this_ptr) {
28848 LDKChannelPublicKeys this_ptr_conv;
28849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28850 this_ptr_conv.is_owned = false;
28851 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28852 int8_tArray ret_arr = init_int8_tArray(33);
28853 memcpy(ret_arr->elems, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
28857 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
28858 LDKChannelPublicKeys this_ptr_conv;
28859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28860 this_ptr_conv.is_owned = false;
28861 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28862 LDKPublicKey val_ref;
28863 CHECK(val->arr_len == 33);
28864 memcpy(val_ref.compressed_form, val->elems, 33);
28865 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
28868 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint32_t this_ptr) {
28869 LDKChannelPublicKeys this_ptr_conv;
28870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28871 this_ptr_conv.is_owned = false;
28872 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28873 int8_tArray ret_arr = init_int8_tArray(33);
28874 memcpy(ret_arr->elems, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
28878 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
28879 LDKChannelPublicKeys this_ptr_conv;
28880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28881 this_ptr_conv.is_owned = false;
28882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28883 LDKPublicKey val_ref;
28884 CHECK(val->arr_len == 33);
28885 memcpy(val_ref.compressed_form, val->elems, 33);
28886 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
28889 uint32_t __attribute__((visibility("default"))) 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) {
28890 LDKPublicKey funding_pubkey_arg_ref;
28891 CHECK(funding_pubkey_arg->arr_len == 33);
28892 memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33);
28893 LDKPublicKey revocation_basepoint_arg_ref;
28894 CHECK(revocation_basepoint_arg->arr_len == 33);
28895 memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33);
28896 LDKPublicKey payment_point_arg_ref;
28897 CHECK(payment_point_arg->arr_len == 33);
28898 memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33);
28899 LDKPublicKey delayed_payment_basepoint_arg_ref;
28900 CHECK(delayed_payment_basepoint_arg->arr_len == 33);
28901 memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33);
28902 LDKPublicKey htlc_basepoint_arg_ref;
28903 CHECK(htlc_basepoint_arg->arr_len == 33);
28904 memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33);
28905 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);
28906 uint64_t ret_ref = 0;
28907 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28908 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28909 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28910 ret_ref = (uint64_t)ret_var.inner;
28911 if (ret_var.is_owned) {
28917 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
28918 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
28919 uint64_t ret_ref = 0;
28920 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28921 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28922 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28923 ret_ref = (uint64_t)ret_var.inner;
28924 if (ret_var.is_owned) {
28929 int64_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_clone_ptr(uint32_t arg) {
28930 LDKChannelPublicKeys arg_conv;
28931 arg_conv.inner = (void*)(arg & (~1));
28932 arg_conv.is_owned = false;
28933 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28934 int64_t ret_val = ChannelPublicKeys_clone_ptr(&arg_conv);
28938 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_clone(uint32_t orig) {
28939 LDKChannelPublicKeys orig_conv;
28940 orig_conv.inner = (void*)(orig & (~1));
28941 orig_conv.is_owned = false;
28942 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28943 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
28944 uint64_t ret_ref = 0;
28945 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28946 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28947 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28948 ret_ref = (uint64_t)ret_var.inner;
28949 if (ret_var.is_owned) {
28955 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_write(uint32_t obj) {
28956 LDKChannelPublicKeys obj_conv;
28957 obj_conv.inner = (void*)(obj & (~1));
28958 obj_conv.is_owned = false;
28959 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28960 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
28961 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28962 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28963 CVec_u8Z_free(ret_var);
28967 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
28968 LDKu8slice ser_ref;
28969 ser_ref.datalen = ser->arr_len;
28970 ser_ref.data = ser->elems;
28971 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
28972 *ret_conv = ChannelPublicKeys_read(ser_ref);
28973 return (uint64_t)ret_conv;
28976 uint32_t __attribute__((visibility("default"))) 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) {
28977 LDKPublicKey per_commitment_point_ref;
28978 CHECK(per_commitment_point->arr_len == 33);
28979 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33);
28980 LDKPublicKey broadcaster_delayed_payment_base_ref;
28981 CHECK(broadcaster_delayed_payment_base->arr_len == 33);
28982 memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base->elems, 33);
28983 LDKPublicKey broadcaster_htlc_base_ref;
28984 CHECK(broadcaster_htlc_base->arr_len == 33);
28985 memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base->elems, 33);
28986 LDKPublicKey countersignatory_revocation_base_ref;
28987 CHECK(countersignatory_revocation_base->arr_len == 33);
28988 memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base->elems, 33);
28989 LDKPublicKey countersignatory_htlc_base_ref;
28990 CHECK(countersignatory_htlc_base->arr_len == 33);
28991 memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base->elems, 33);
28992 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
28993 *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);
28994 return (uint64_t)ret_conv;
28997 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_from_channel_static_keys(int8_tArray per_commitment_point, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
28998 LDKPublicKey per_commitment_point_ref;
28999 CHECK(per_commitment_point->arr_len == 33);
29000 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33);
29001 LDKChannelPublicKeys broadcaster_keys_conv;
29002 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
29003 broadcaster_keys_conv.is_owned = false;
29004 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
29005 LDKChannelPublicKeys countersignatory_keys_conv;
29006 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
29007 countersignatory_keys_conv.is_owned = false;
29008 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
29009 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
29010 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
29011 return (uint64_t)ret_conv;
29014 int8_tArray __attribute__((visibility("default"))) TS_get_revokeable_redeemscript(int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
29015 LDKPublicKey revocation_key_ref;
29016 CHECK(revocation_key->arr_len == 33);
29017 memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33);
29018 LDKPublicKey broadcaster_delayed_payment_key_ref;
29019 CHECK(broadcaster_delayed_payment_key->arr_len == 33);
29020 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33);
29021 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
29022 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29023 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29024 CVec_u8Z_free(ret_var);
29028 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_free(uint32_t this_obj) {
29029 LDKHTLCOutputInCommitment this_obj_conv;
29030 this_obj_conv.inner = (void*)(this_obj & (~1));
29031 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29032 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29033 HTLCOutputInCommitment_free(this_obj_conv);
29036 jboolean __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_offered(uint32_t this_ptr) {
29037 LDKHTLCOutputInCommitment this_ptr_conv;
29038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29039 this_ptr_conv.is_owned = false;
29040 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29041 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
29045 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_offered(uint32_t this_ptr, jboolean val) {
29046 LDKHTLCOutputInCommitment this_ptr_conv;
29047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29048 this_ptr_conv.is_owned = false;
29049 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29050 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
29053 int64_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_amount_msat(uint32_t this_ptr) {
29054 LDKHTLCOutputInCommitment this_ptr_conv;
29055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29056 this_ptr_conv.is_owned = false;
29057 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29058 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
29062 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_amount_msat(uint32_t this_ptr, int64_t val) {
29063 LDKHTLCOutputInCommitment this_ptr_conv;
29064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29065 this_ptr_conv.is_owned = false;
29066 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29067 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
29070 int32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint32_t this_ptr) {
29071 LDKHTLCOutputInCommitment this_ptr_conv;
29072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29073 this_ptr_conv.is_owned = false;
29074 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29075 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
29079 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
29080 LDKHTLCOutputInCommitment this_ptr_conv;
29081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29082 this_ptr_conv.is_owned = false;
29083 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29084 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
29087 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_payment_hash(uint32_t this_ptr) {
29088 LDKHTLCOutputInCommitment this_ptr_conv;
29089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29090 this_ptr_conv.is_owned = false;
29091 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29092 int8_tArray ret_arr = init_int8_tArray(32);
29093 memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
29097 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
29098 LDKHTLCOutputInCommitment this_ptr_conv;
29099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29100 this_ptr_conv.is_owned = false;
29101 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29102 LDKThirtyTwoBytes val_ref;
29103 CHECK(val->arr_len == 32);
29104 memcpy(val_ref.data, val->elems, 32);
29105 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
29108 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint32_t this_ptr) {
29109 LDKHTLCOutputInCommitment this_ptr_conv;
29110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29111 this_ptr_conv.is_owned = false;
29112 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29113 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
29114 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
29115 uint64_t ret_ref = (uint64_t)ret_copy;
29119 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint32_t this_ptr, uint32_t val) {
29120 LDKHTLCOutputInCommitment this_ptr_conv;
29121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29122 this_ptr_conv.is_owned = false;
29123 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29124 void* val_ptr = (void*)(((uint64_t)val) & ~1);
29125 CHECK_ACCESS(val_ptr);
29126 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
29127 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
29128 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
29131 uint32_t __attribute__((visibility("default"))) 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) {
29132 LDKThirtyTwoBytes payment_hash_arg_ref;
29133 CHECK(payment_hash_arg->arr_len == 32);
29134 memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32);
29135 void* transaction_output_index_arg_ptr = (void*)(((uint64_t)transaction_output_index_arg) & ~1);
29136 CHECK_ACCESS(transaction_output_index_arg_ptr);
29137 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
29138 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1));
29139 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
29140 uint64_t ret_ref = 0;
29141 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29142 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29143 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29144 ret_ref = (uint64_t)ret_var.inner;
29145 if (ret_var.is_owned) {
29151 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
29152 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
29153 uint64_t ret_ref = 0;
29154 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29155 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29156 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29157 ret_ref = (uint64_t)ret_var.inner;
29158 if (ret_var.is_owned) {
29163 int64_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_clone_ptr(uint32_t arg) {
29164 LDKHTLCOutputInCommitment arg_conv;
29165 arg_conv.inner = (void*)(arg & (~1));
29166 arg_conv.is_owned = false;
29167 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29168 int64_t ret_val = HTLCOutputInCommitment_clone_ptr(&arg_conv);
29172 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_clone(uint32_t orig) {
29173 LDKHTLCOutputInCommitment orig_conv;
29174 orig_conv.inner = (void*)(orig & (~1));
29175 orig_conv.is_owned = false;
29176 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29177 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
29178 uint64_t ret_ref = 0;
29179 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29180 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29181 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29182 ret_ref = (uint64_t)ret_var.inner;
29183 if (ret_var.is_owned) {
29189 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_write(uint32_t obj) {
29190 LDKHTLCOutputInCommitment obj_conv;
29191 obj_conv.inner = (void*)(obj & (~1));
29192 obj_conv.is_owned = false;
29193 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29194 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
29195 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29196 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29197 CVec_u8Z_free(ret_var);
29201 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
29202 LDKu8slice ser_ref;
29203 ser_ref.datalen = ser->arr_len;
29204 ser_ref.data = ser->elems;
29205 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
29206 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
29207 return (uint64_t)ret_conv;
29210 int8_tArray __attribute__((visibility("default"))) TS_get_htlc_redeemscript(uint32_t htlc, jboolean opt_anchors, uint32_t keys) {
29211 LDKHTLCOutputInCommitment htlc_conv;
29212 htlc_conv.inner = (void*)(htlc & (~1));
29213 htlc_conv.is_owned = false;
29214 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
29215 LDKTxCreationKeys keys_conv;
29216 keys_conv.inner = (void*)(keys & (~1));
29217 keys_conv.is_owned = false;
29218 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
29219 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
29220 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29221 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29222 CVec_u8Z_free(ret_var);
29226 int8_tArray __attribute__((visibility("default"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
29227 LDKPublicKey broadcaster_ref;
29228 CHECK(broadcaster->arr_len == 33);
29229 memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33);
29230 LDKPublicKey countersignatory_ref;
29231 CHECK(countersignatory->arr_len == 33);
29232 memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33);
29233 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
29234 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29235 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29236 CVec_u8Z_free(ret_var);
29240 int8_tArray __attribute__((visibility("default"))) 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) {
29241 unsigned char commitment_txid_arr[32];
29242 CHECK(commitment_txid->arr_len == 32);
29243 memcpy(commitment_txid_arr, commitment_txid->elems, 32);
29244 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
29245 LDKHTLCOutputInCommitment htlc_conv;
29246 htlc_conv.inner = (void*)(htlc & (~1));
29247 htlc_conv.is_owned = false;
29248 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
29249 LDKPublicKey broadcaster_delayed_payment_key_ref;
29250 CHECK(broadcaster_delayed_payment_key->arr_len == 33);
29251 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33);
29252 LDKPublicKey revocation_key_ref;
29253 CHECK(revocation_key->arr_len == 33);
29254 memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33);
29255 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);
29256 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29257 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29258 Transaction_free(ret_var);
29262 int8_tArray __attribute__((visibility("default"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
29263 LDKPublicKey funding_pubkey_ref;
29264 CHECK(funding_pubkey->arr_len == 33);
29265 memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33);
29266 LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
29267 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29268 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29269 CVec_u8Z_free(ret_var);
29273 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_free(uint32_t this_obj) {
29274 LDKChannelTransactionParameters this_obj_conv;
29275 this_obj_conv.inner = (void*)(this_obj & (~1));
29276 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29277 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29278 ChannelTransactionParameters_free(this_obj_conv);
29281 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint32_t this_ptr) {
29282 LDKChannelTransactionParameters this_ptr_conv;
29283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29284 this_ptr_conv.is_owned = false;
29285 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29286 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
29287 uint64_t ret_ref = 0;
29288 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29289 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29290 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29291 ret_ref = (uint64_t)ret_var.inner;
29292 if (ret_var.is_owned) {
29298 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint32_t this_ptr, uint32_t val) {
29299 LDKChannelTransactionParameters this_ptr_conv;
29300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29301 this_ptr_conv.is_owned = false;
29302 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29303 LDKChannelPublicKeys val_conv;
29304 val_conv.inner = (void*)(val & (~1));
29305 val_conv.is_owned = (val & 1) || (val == 0);
29306 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29307 val_conv = ChannelPublicKeys_clone(&val_conv);
29308 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
29311 int16_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint32_t this_ptr) {
29312 LDKChannelTransactionParameters this_ptr_conv;
29313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29314 this_ptr_conv.is_owned = false;
29315 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29316 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
29320 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_selected_contest_delay(uint32_t this_ptr, int16_t val) {
29321 LDKChannelTransactionParameters this_ptr_conv;
29322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29323 this_ptr_conv.is_owned = false;
29324 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29325 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
29328 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint32_t this_ptr) {
29329 LDKChannelTransactionParameters this_ptr_conv;
29330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29331 this_ptr_conv.is_owned = false;
29332 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29333 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
29337 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint32_t this_ptr, jboolean val) {
29338 LDKChannelTransactionParameters this_ptr_conv;
29339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29340 this_ptr_conv.is_owned = false;
29341 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29342 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
29345 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint32_t this_ptr) {
29346 LDKChannelTransactionParameters 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 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
29351 uint64_t ret_ref = 0;
29352 if ((uint64_t)ret_var.inner > 4096) {
29353 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29354 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29355 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29356 ret_ref = (uint64_t)ret_var.inner;
29357 if (ret_var.is_owned) {
29364 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint32_t this_ptr, uint32_t val) {
29365 LDKChannelTransactionParameters this_ptr_conv;
29366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29367 this_ptr_conv.is_owned = false;
29368 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29369 LDKCounterpartyChannelTransactionParameters val_conv;
29370 val_conv.inner = (void*)(val & (~1));
29371 val_conv.is_owned = (val & 1) || (val == 0);
29372 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29373 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
29374 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
29377 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint32_t this_ptr) {
29378 LDKChannelTransactionParameters this_ptr_conv;
29379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29380 this_ptr_conv.is_owned = false;
29381 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29382 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
29383 uint64_t ret_ref = 0;
29384 if ((uint64_t)ret_var.inner > 4096) {
29385 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29386 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29387 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29388 ret_ref = (uint64_t)ret_var.inner;
29389 if (ret_var.is_owned) {
29396 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint32_t this_ptr, uint32_t val) {
29397 LDKChannelTransactionParameters 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 LDKOutPoint val_conv;
29402 val_conv.inner = (void*)(val & (~1));
29403 val_conv.is_owned = (val & 1) || (val == 0);
29404 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29405 val_conv = OutPoint_clone(&val_conv);
29406 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
29409 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_opt_anchors(uint32_t this_ptr) {
29410 LDKChannelTransactionParameters this_ptr_conv;
29411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29412 this_ptr_conv.is_owned = false;
29413 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29414 uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
29418 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_opt_anchors(uint32_t this_ptr, uint32_t val) {
29419 LDKChannelTransactionParameters this_ptr_conv;
29420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29421 this_ptr_conv.is_owned = false;
29422 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29423 LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
29424 ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
29427 uint32_t __attribute__((visibility("default"))) 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) {
29428 LDKChannelPublicKeys holder_pubkeys_arg_conv;
29429 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
29430 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
29431 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
29432 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
29433 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
29434 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
29435 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
29436 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
29437 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
29438 LDKOutPoint funding_outpoint_arg_conv;
29439 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
29440 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
29441 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
29442 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
29443 LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_anchors_arg);
29444 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);
29445 uint64_t ret_ref = 0;
29446 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29447 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29448 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29449 ret_ref = (uint64_t)ret_var.inner;
29450 if (ret_var.is_owned) {
29456 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
29457 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
29458 uint64_t ret_ref = 0;
29459 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29460 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29461 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29462 ret_ref = (uint64_t)ret_var.inner;
29463 if (ret_var.is_owned) {
29468 int64_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_clone_ptr(uint32_t arg) {
29469 LDKChannelTransactionParameters arg_conv;
29470 arg_conv.inner = (void*)(arg & (~1));
29471 arg_conv.is_owned = false;
29472 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29473 int64_t ret_val = ChannelTransactionParameters_clone_ptr(&arg_conv);
29477 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_clone(uint32_t orig) {
29478 LDKChannelTransactionParameters orig_conv;
29479 orig_conv.inner = (void*)(orig & (~1));
29480 orig_conv.is_owned = false;
29481 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29482 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
29483 uint64_t ret_ref = 0;
29484 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29485 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29486 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29487 ret_ref = (uint64_t)ret_var.inner;
29488 if (ret_var.is_owned) {
29494 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_free(uint32_t this_obj) {
29495 LDKCounterpartyChannelTransactionParameters this_obj_conv;
29496 this_obj_conv.inner = (void*)(this_obj & (~1));
29497 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29498 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29499 CounterpartyChannelTransactionParameters_free(this_obj_conv);
29502 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint32_t this_ptr) {
29503 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
29504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29505 this_ptr_conv.is_owned = false;
29506 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29507 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
29508 uint64_t ret_ref = 0;
29509 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29510 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29511 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29512 ret_ref = (uint64_t)ret_var.inner;
29513 if (ret_var.is_owned) {
29519 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint32_t this_ptr, uint32_t val) {
29520 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
29521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29522 this_ptr_conv.is_owned = false;
29523 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29524 LDKChannelPublicKeys val_conv;
29525 val_conv.inner = (void*)(val & (~1));
29526 val_conv.is_owned = (val & 1) || (val == 0);
29527 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29528 val_conv = ChannelPublicKeys_clone(&val_conv);
29529 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
29532 int16_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint32_t this_ptr) {
29533 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
29534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29535 this_ptr_conv.is_owned = false;
29536 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29537 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
29541 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint32_t this_ptr, int16_t val) {
29542 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
29543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29544 this_ptr_conv.is_owned = false;
29545 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29546 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
29549 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_new(uint32_t pubkeys_arg, int16_t selected_contest_delay_arg) {
29550 LDKChannelPublicKeys pubkeys_arg_conv;
29551 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
29552 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
29553 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
29554 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
29555 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
29556 uint64_t ret_ref = 0;
29557 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29558 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29559 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29560 ret_ref = (uint64_t)ret_var.inner;
29561 if (ret_var.is_owned) {
29567 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
29568 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
29569 uint64_t ret_ref = 0;
29570 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29571 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29572 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29573 ret_ref = (uint64_t)ret_var.inner;
29574 if (ret_var.is_owned) {
29579 int64_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint32_t arg) {
29580 LDKCounterpartyChannelTransactionParameters arg_conv;
29581 arg_conv.inner = (void*)(arg & (~1));
29582 arg_conv.is_owned = false;
29583 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29584 int64_t ret_val = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
29588 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_clone(uint32_t orig) {
29589 LDKCounterpartyChannelTransactionParameters orig_conv;
29590 orig_conv.inner = (void*)(orig & (~1));
29591 orig_conv.is_owned = false;
29592 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29593 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
29594 uint64_t ret_ref = 0;
29595 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29596 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29597 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29598 ret_ref = (uint64_t)ret_var.inner;
29599 if (ret_var.is_owned) {
29605 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_is_populated(uint32_t this_arg) {
29606 LDKChannelTransactionParameters this_arg_conv;
29607 this_arg_conv.inner = (void*)(this_arg & (~1));
29608 this_arg_conv.is_owned = false;
29609 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29610 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
29614 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint32_t this_arg) {
29615 LDKChannelTransactionParameters this_arg_conv;
29616 this_arg_conv.inner = (void*)(this_arg & (~1));
29617 this_arg_conv.is_owned = false;
29618 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29619 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
29620 uint64_t ret_ref = 0;
29621 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29622 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29623 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29624 ret_ref = (uint64_t)ret_var.inner;
29625 if (ret_var.is_owned) {
29631 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint32_t this_arg) {
29632 LDKChannelTransactionParameters this_arg_conv;
29633 this_arg_conv.inner = (void*)(this_arg & (~1));
29634 this_arg_conv.is_owned = false;
29635 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29636 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
29637 uint64_t ret_ref = 0;
29638 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29639 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29640 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29641 ret_ref = (uint64_t)ret_var.inner;
29642 if (ret_var.is_owned) {
29648 int8_tArray __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_write(uint32_t obj) {
29649 LDKCounterpartyChannelTransactionParameters obj_conv;
29650 obj_conv.inner = (void*)(obj & (~1));
29651 obj_conv.is_owned = false;
29652 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29653 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
29654 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29655 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29656 CVec_u8Z_free(ret_var);
29660 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
29661 LDKu8slice ser_ref;
29662 ser_ref.datalen = ser->arr_len;
29663 ser_ref.data = ser->elems;
29664 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
29665 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
29666 return (uint64_t)ret_conv;
29669 int8_tArray __attribute__((visibility("default"))) TS_ChannelTransactionParameters_write(uint32_t obj) {
29670 LDKChannelTransactionParameters obj_conv;
29671 obj_conv.inner = (void*)(obj & (~1));
29672 obj_conv.is_owned = false;
29673 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29674 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
29675 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29676 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29677 CVec_u8Z_free(ret_var);
29681 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
29682 LDKu8slice ser_ref;
29683 ser_ref.datalen = ser->arr_len;
29684 ser_ref.data = ser->elems;
29685 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
29686 *ret_conv = ChannelTransactionParameters_read(ser_ref);
29687 return (uint64_t)ret_conv;
29690 void __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_free(uint32_t this_obj) {
29691 LDKDirectedChannelTransactionParameters this_obj_conv;
29692 this_obj_conv.inner = (void*)(this_obj & (~1));
29693 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29694 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29695 DirectedChannelTransactionParameters_free(this_obj_conv);
29698 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint32_t this_arg) {
29699 LDKDirectedChannelTransactionParameters this_arg_conv;
29700 this_arg_conv.inner = (void*)(this_arg & (~1));
29701 this_arg_conv.is_owned = false;
29702 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29703 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
29704 uint64_t ret_ref = 0;
29705 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29706 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29707 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29708 ret_ref = (uint64_t)ret_var.inner;
29709 if (ret_var.is_owned) {
29715 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint32_t this_arg) {
29716 LDKDirectedChannelTransactionParameters this_arg_conv;
29717 this_arg_conv.inner = (void*)(this_arg & (~1));
29718 this_arg_conv.is_owned = false;
29719 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29720 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
29721 uint64_t ret_ref = 0;
29722 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29723 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29724 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29725 ret_ref = (uint64_t)ret_var.inner;
29726 if (ret_var.is_owned) {
29732 int16_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_contest_delay(uint32_t this_arg) {
29733 LDKDirectedChannelTransactionParameters this_arg_conv;
29734 this_arg_conv.inner = (void*)(this_arg & (~1));
29735 this_arg_conv.is_owned = false;
29736 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29737 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
29741 jboolean __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_is_outbound(uint32_t this_arg) {
29742 LDKDirectedChannelTransactionParameters this_arg_conv;
29743 this_arg_conv.inner = (void*)(this_arg & (~1));
29744 this_arg_conv.is_owned = false;
29745 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29746 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
29750 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint32_t this_arg) {
29751 LDKDirectedChannelTransactionParameters this_arg_conv;
29752 this_arg_conv.inner = (void*)(this_arg & (~1));
29753 this_arg_conv.is_owned = false;
29754 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29755 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
29756 uint64_t ret_ref = 0;
29757 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29758 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29759 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29760 ret_ref = (uint64_t)ret_var.inner;
29761 if (ret_var.is_owned) {
29767 jboolean __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_opt_anchors(uint32_t this_arg) {
29768 LDKDirectedChannelTransactionParameters this_arg_conv;
29769 this_arg_conv.inner = (void*)(this_arg & (~1));
29770 this_arg_conv.is_owned = false;
29771 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29772 jboolean ret_val = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
29776 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_free(uint32_t this_obj) {
29777 LDKHolderCommitmentTransaction this_obj_conv;
29778 this_obj_conv.inner = (void*)(this_obj & (~1));
29779 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29780 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29781 HolderCommitmentTransaction_free(this_obj_conv);
29784 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint32_t this_ptr) {
29785 LDKHolderCommitmentTransaction this_ptr_conv;
29786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29787 this_ptr_conv.is_owned = false;
29788 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29789 int8_tArray ret_arr = init_int8_tArray(64);
29790 memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
29794 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint32_t this_ptr, int8_tArray val) {
29795 LDKHolderCommitmentTransaction this_ptr_conv;
29796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29797 this_ptr_conv.is_owned = false;
29798 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29799 LDKSignature val_ref;
29800 CHECK(val->arr_len == 64);
29801 memcpy(val_ref.compact_form, val->elems, 64);
29802 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
29805 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint32_t this_ptr, ptrArray val) {
29806 LDKHolderCommitmentTransaction this_ptr_conv;
29807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29808 this_ptr_conv.is_owned = false;
29809 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29810 LDKCVec_SignatureZ val_constr;
29811 val_constr.datalen = val->arr_len;
29812 if (val_constr.datalen > 0)
29813 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
29815 val_constr.data = NULL;
29816 int8_tArray* val_vals = (void*) val->elems;
29817 for (size_t m = 0; m < val_constr.datalen; m++) {
29818 int8_tArray val_conv_12 = val_vals[m];
29819 LDKSignature val_conv_12_ref;
29820 CHECK(val_conv_12->arr_len == 64);
29821 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64);
29822 val_constr.data[m] = val_conv_12_ref;
29824 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
29827 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
29828 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
29829 uint64_t ret_ref = 0;
29830 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29831 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29832 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29833 ret_ref = (uint64_t)ret_var.inner;
29834 if (ret_var.is_owned) {
29839 int64_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_clone_ptr(uint32_t arg) {
29840 LDKHolderCommitmentTransaction arg_conv;
29841 arg_conv.inner = (void*)(arg & (~1));
29842 arg_conv.is_owned = false;
29843 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29844 int64_t ret_val = HolderCommitmentTransaction_clone_ptr(&arg_conv);
29848 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_clone(uint32_t orig) {
29849 LDKHolderCommitmentTransaction orig_conv;
29850 orig_conv.inner = (void*)(orig & (~1));
29851 orig_conv.is_owned = false;
29852 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29853 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
29854 uint64_t ret_ref = 0;
29855 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29856 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29857 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29858 ret_ref = (uint64_t)ret_var.inner;
29859 if (ret_var.is_owned) {
29865 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_write(uint32_t obj) {
29866 LDKHolderCommitmentTransaction obj_conv;
29867 obj_conv.inner = (void*)(obj & (~1));
29868 obj_conv.is_owned = false;
29869 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29870 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
29871 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29872 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29873 CVec_u8Z_free(ret_var);
29877 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
29878 LDKu8slice ser_ref;
29879 ser_ref.datalen = ser->arr_len;
29880 ser_ref.data = ser->elems;
29881 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
29882 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
29883 return (uint64_t)ret_conv;
29886 uint32_t __attribute__((visibility("default"))) 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) {
29887 LDKCommitmentTransaction commitment_tx_conv;
29888 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
29889 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
29890 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
29891 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
29892 LDKSignature counterparty_sig_ref;
29893 CHECK(counterparty_sig->arr_len == 64);
29894 memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64);
29895 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
29896 counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
29897 if (counterparty_htlc_sigs_constr.datalen > 0)
29898 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
29900 counterparty_htlc_sigs_constr.data = NULL;
29901 int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
29902 for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
29903 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
29904 LDKSignature counterparty_htlc_sigs_conv_12_ref;
29905 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
29906 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64);
29907 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
29909 LDKPublicKey holder_funding_key_ref;
29910 CHECK(holder_funding_key->arr_len == 33);
29911 memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33);
29912 LDKPublicKey counterparty_funding_key_ref;
29913 CHECK(counterparty_funding_key->arr_len == 33);
29914 memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33);
29915 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
29916 uint64_t ret_ref = 0;
29917 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29918 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29919 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29920 ret_ref = (uint64_t)ret_var.inner;
29921 if (ret_var.is_owned) {
29927 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_free(uint32_t this_obj) {
29928 LDKBuiltCommitmentTransaction this_obj_conv;
29929 this_obj_conv.inner = (void*)(this_obj & (~1));
29930 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29931 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29932 BuiltCommitmentTransaction_free(this_obj_conv);
29935 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_transaction(uint32_t this_ptr) {
29936 LDKBuiltCommitmentTransaction this_ptr_conv;
29937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29938 this_ptr_conv.is_owned = false;
29939 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29940 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
29941 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29942 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29943 Transaction_free(ret_var);
29947 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_transaction(uint32_t this_ptr, int8_tArray val) {
29948 LDKBuiltCommitmentTransaction this_ptr_conv;
29949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29950 this_ptr_conv.is_owned = false;
29951 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29952 LDKTransaction val_ref;
29953 val_ref.datalen = val->arr_len;
29954 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
29955 memcpy(val_ref.data, val->elems, val_ref.datalen);
29956 val_ref.data_is_owned = true;
29957 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
29960 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_txid(uint32_t this_ptr) {
29961 LDKBuiltCommitmentTransaction this_ptr_conv;
29962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29963 this_ptr_conv.is_owned = false;
29964 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29965 int8_tArray ret_arr = init_int8_tArray(32);
29966 memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
29970 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_txid(uint32_t this_ptr, int8_tArray val) {
29971 LDKBuiltCommitmentTransaction this_ptr_conv;
29972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29973 this_ptr_conv.is_owned = false;
29974 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29975 LDKThirtyTwoBytes val_ref;
29976 CHECK(val->arr_len == 32);
29977 memcpy(val_ref.data, val->elems, 32);
29978 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
29981 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
29982 LDKTransaction transaction_arg_ref;
29983 transaction_arg_ref.datalen = transaction_arg->arr_len;
29984 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
29985 memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen);
29986 transaction_arg_ref.data_is_owned = true;
29987 LDKThirtyTwoBytes txid_arg_ref;
29988 CHECK(txid_arg->arr_len == 32);
29989 memcpy(txid_arg_ref.data, txid_arg->elems, 32);
29990 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
29991 uint64_t ret_ref = 0;
29992 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29993 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29994 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29995 ret_ref = (uint64_t)ret_var.inner;
29996 if (ret_var.is_owned) {
30002 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
30003 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
30004 uint64_t ret_ref = 0;
30005 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30006 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30007 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30008 ret_ref = (uint64_t)ret_var.inner;
30009 if (ret_var.is_owned) {
30014 int64_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_clone_ptr(uint32_t arg) {
30015 LDKBuiltCommitmentTransaction arg_conv;
30016 arg_conv.inner = (void*)(arg & (~1));
30017 arg_conv.is_owned = false;
30018 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30019 int64_t ret_val = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
30023 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_clone(uint32_t orig) {
30024 LDKBuiltCommitmentTransaction orig_conv;
30025 orig_conv.inner = (void*)(orig & (~1));
30026 orig_conv.is_owned = false;
30027 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30028 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
30029 uint64_t ret_ref = 0;
30030 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30031 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30032 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30033 ret_ref = (uint64_t)ret_var.inner;
30034 if (ret_var.is_owned) {
30040 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_write(uint32_t obj) {
30041 LDKBuiltCommitmentTransaction obj_conv;
30042 obj_conv.inner = (void*)(obj & (~1));
30043 obj_conv.is_owned = false;
30044 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30045 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
30046 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
30047 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30048 CVec_u8Z_free(ret_var);
30052 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
30053 LDKu8slice ser_ref;
30054 ser_ref.datalen = ser->arr_len;
30055 ser_ref.data = ser->elems;
30056 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
30057 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
30058 return (uint64_t)ret_conv;
30061 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
30062 LDKBuiltCommitmentTransaction this_arg_conv;
30063 this_arg_conv.inner = (void*)(this_arg & (~1));
30064 this_arg_conv.is_owned = false;
30065 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30066 LDKu8slice funding_redeemscript_ref;
30067 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
30068 funding_redeemscript_ref.data = funding_redeemscript->elems;
30069 int8_tArray ret_arr = init_int8_tArray(32);
30070 memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
30074 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_sign(uint32_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
30075 LDKBuiltCommitmentTransaction this_arg_conv;
30076 this_arg_conv.inner = (void*)(this_arg & (~1));
30077 this_arg_conv.is_owned = false;
30078 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30079 unsigned char funding_key_arr[32];
30080 CHECK(funding_key->arr_len == 32);
30081 memcpy(funding_key_arr, funding_key->elems, 32);
30082 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
30083 LDKu8slice funding_redeemscript_ref;
30084 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
30085 funding_redeemscript_ref.data = funding_redeemscript->elems;
30086 int8_tArray ret_arr = init_int8_tArray(64);
30087 memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
30091 void __attribute__((visibility("default"))) TS_ClosingTransaction_free(uint32_t this_obj) {
30092 LDKClosingTransaction this_obj_conv;
30093 this_obj_conv.inner = (void*)(this_obj & (~1));
30094 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30095 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30096 ClosingTransaction_free(this_obj_conv);
30099 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
30100 LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
30101 uint64_t ret_ref = 0;
30102 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30103 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30104 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30105 ret_ref = (uint64_t)ret_var.inner;
30106 if (ret_var.is_owned) {
30111 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_clone_ptr(uint32_t arg) {
30112 LDKClosingTransaction arg_conv;
30113 arg_conv.inner = (void*)(arg & (~1));
30114 arg_conv.is_owned = false;
30115 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30116 int64_t ret_val = ClosingTransaction_clone_ptr(&arg_conv);
30120 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_clone(uint32_t orig) {
30121 LDKClosingTransaction orig_conv;
30122 orig_conv.inner = (void*)(orig & (~1));
30123 orig_conv.is_owned = false;
30124 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30125 LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
30126 uint64_t ret_ref = 0;
30127 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30128 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30129 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30130 ret_ref = (uint64_t)ret_var.inner;
30131 if (ret_var.is_owned) {
30137 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_hash(uint32_t o) {
30138 LDKClosingTransaction o_conv;
30139 o_conv.inner = (void*)(o & (~1));
30140 o_conv.is_owned = false;
30141 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30142 int64_t ret_val = ClosingTransaction_hash(&o_conv);
30146 uint32_t __attribute__((visibility("default"))) 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) {
30147 LDKCVec_u8Z to_holder_script_ref;
30148 to_holder_script_ref.datalen = to_holder_script->arr_len;
30149 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
30150 memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen);
30151 LDKCVec_u8Z to_counterparty_script_ref;
30152 to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
30153 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
30154 memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen);
30155 LDKOutPoint funding_outpoint_conv;
30156 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
30157 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
30158 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
30159 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
30160 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
30161 uint64_t ret_ref = 0;
30162 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30163 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30164 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30165 ret_ref = (uint64_t)ret_var.inner;
30166 if (ret_var.is_owned) {
30172 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_trust(uint32_t this_arg) {
30173 LDKClosingTransaction this_arg_conv;
30174 this_arg_conv.inner = (void*)(this_arg & (~1));
30175 this_arg_conv.is_owned = false;
30176 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30177 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
30178 uint64_t ret_ref = 0;
30179 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30180 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30181 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30182 ret_ref = (uint64_t)ret_var.inner;
30183 if (ret_var.is_owned) {
30189 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_verify(uint32_t this_arg, uint32_t funding_outpoint) {
30190 LDKClosingTransaction this_arg_conv;
30191 this_arg_conv.inner = (void*)(this_arg & (~1));
30192 this_arg_conv.is_owned = false;
30193 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30194 LDKOutPoint funding_outpoint_conv;
30195 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
30196 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
30197 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
30198 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
30199 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
30200 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
30201 return (uint64_t)ret_conv;
30204 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_to_holder_value_sat(uint32_t this_arg) {
30205 LDKClosingTransaction this_arg_conv;
30206 this_arg_conv.inner = (void*)(this_arg & (~1));
30207 this_arg_conv.is_owned = false;
30208 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30209 int64_t ret_val = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
30213 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_to_counterparty_value_sat(uint32_t this_arg) {
30214 LDKClosingTransaction this_arg_conv;
30215 this_arg_conv.inner = (void*)(this_arg & (~1));
30216 this_arg_conv.is_owned = false;
30217 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30218 int64_t ret_val = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
30222 int8_tArray __attribute__((visibility("default"))) TS_ClosingTransaction_to_holder_script(uint32_t this_arg) {
30223 LDKClosingTransaction this_arg_conv;
30224 this_arg_conv.inner = (void*)(this_arg & (~1));
30225 this_arg_conv.is_owned = false;
30226 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30227 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
30228 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
30229 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30233 int8_tArray __attribute__((visibility("default"))) TS_ClosingTransaction_to_counterparty_script(uint32_t this_arg) {
30234 LDKClosingTransaction this_arg_conv;
30235 this_arg_conv.inner = (void*)(this_arg & (~1));
30236 this_arg_conv.is_owned = false;
30237 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30238 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
30239 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
30240 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30244 void __attribute__((visibility("default"))) TS_TrustedClosingTransaction_free(uint32_t this_obj) {
30245 LDKTrustedClosingTransaction this_obj_conv;
30246 this_obj_conv.inner = (void*)(this_obj & (~1));
30247 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30248 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30249 TrustedClosingTransaction_free(this_obj_conv);
30252 int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_built_transaction(uint32_t this_arg) {
30253 LDKTrustedClosingTransaction this_arg_conv;
30254 this_arg_conv.inner = (void*)(this_arg & (~1));
30255 this_arg_conv.is_owned = false;
30256 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30257 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
30258 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
30259 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30260 Transaction_free(ret_var);
30264 int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
30265 LDKTrustedClosingTransaction this_arg_conv;
30266 this_arg_conv.inner = (void*)(this_arg & (~1));
30267 this_arg_conv.is_owned = false;
30268 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30269 LDKu8slice funding_redeemscript_ref;
30270 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
30271 funding_redeemscript_ref.data = funding_redeemscript->elems;
30272 int8_tArray ret_arr = init_int8_tArray(32);
30273 memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
30277 int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_sign(uint32_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
30278 LDKTrustedClosingTransaction this_arg_conv;
30279 this_arg_conv.inner = (void*)(this_arg & (~1));
30280 this_arg_conv.is_owned = false;
30281 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30282 unsigned char funding_key_arr[32];
30283 CHECK(funding_key->arr_len == 32);
30284 memcpy(funding_key_arr, funding_key->elems, 32);
30285 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
30286 LDKu8slice funding_redeemscript_ref;
30287 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
30288 funding_redeemscript_ref.data = funding_redeemscript->elems;
30289 int8_tArray ret_arr = init_int8_tArray(64);
30290 memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
30294 void __attribute__((visibility("default"))) TS_CommitmentTransaction_free(uint32_t this_obj) {
30295 LDKCommitmentTransaction this_obj_conv;
30296 this_obj_conv.inner = (void*)(this_obj & (~1));
30297 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30298 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30299 CommitmentTransaction_free(this_obj_conv);
30302 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
30303 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
30304 uint64_t ret_ref = 0;
30305 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30306 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30307 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30308 ret_ref = (uint64_t)ret_var.inner;
30309 if (ret_var.is_owned) {
30314 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_clone_ptr(uint32_t arg) {
30315 LDKCommitmentTransaction arg_conv;
30316 arg_conv.inner = (void*)(arg & (~1));
30317 arg_conv.is_owned = false;
30318 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30319 int64_t ret_val = CommitmentTransaction_clone_ptr(&arg_conv);
30323 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_clone(uint32_t orig) {
30324 LDKCommitmentTransaction orig_conv;
30325 orig_conv.inner = (void*)(orig & (~1));
30326 orig_conv.is_owned = false;
30327 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30328 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
30329 uint64_t ret_ref = 0;
30330 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30331 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30332 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30333 ret_ref = (uint64_t)ret_var.inner;
30334 if (ret_var.is_owned) {
30340 int8_tArray __attribute__((visibility("default"))) TS_CommitmentTransaction_write(uint32_t obj) {
30341 LDKCommitmentTransaction obj_conv;
30342 obj_conv.inner = (void*)(obj & (~1));
30343 obj_conv.is_owned = false;
30344 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30345 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
30346 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
30347 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30348 CVec_u8Z_free(ret_var);
30352 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_read(int8_tArray ser) {
30353 LDKu8slice ser_ref;
30354 ser_ref.datalen = ser->arr_len;
30355 ser_ref.data = ser->elems;
30356 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
30357 *ret_conv = CommitmentTransaction_read(ser_ref);
30358 return (uint64_t)ret_conv;
30361 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_commitment_number(uint32_t this_arg) {
30362 LDKCommitmentTransaction this_arg_conv;
30363 this_arg_conv.inner = (void*)(this_arg & (~1));
30364 this_arg_conv.is_owned = false;
30365 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30366 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
30370 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint32_t this_arg) {
30371 LDKCommitmentTransaction 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 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
30379 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint32_t this_arg) {
30380 LDKCommitmentTransaction this_arg_conv;
30381 this_arg_conv.inner = (void*)(this_arg & (~1));
30382 this_arg_conv.is_owned = false;
30383 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30384 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
30388 int32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_feerate_per_kw(uint32_t this_arg) {
30389 LDKCommitmentTransaction this_arg_conv;
30390 this_arg_conv.inner = (void*)(this_arg & (~1));
30391 this_arg_conv.is_owned = false;
30392 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30393 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
30397 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_trust(uint32_t this_arg) {
30398 LDKCommitmentTransaction this_arg_conv;
30399 this_arg_conv.inner = (void*)(this_arg & (~1));
30400 this_arg_conv.is_owned = false;
30401 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30402 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
30403 uint64_t ret_ref = 0;
30404 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30405 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30406 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30407 ret_ref = (uint64_t)ret_var.inner;
30408 if (ret_var.is_owned) {
30414 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_verify(uint32_t this_arg, uint32_t channel_parameters, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
30415 LDKCommitmentTransaction this_arg_conv;
30416 this_arg_conv.inner = (void*)(this_arg & (~1));
30417 this_arg_conv.is_owned = false;
30418 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30419 LDKDirectedChannelTransactionParameters channel_parameters_conv;
30420 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
30421 channel_parameters_conv.is_owned = false;
30422 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
30423 LDKChannelPublicKeys broadcaster_keys_conv;
30424 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
30425 broadcaster_keys_conv.is_owned = false;
30426 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
30427 LDKChannelPublicKeys countersignatory_keys_conv;
30428 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
30429 countersignatory_keys_conv.is_owned = false;
30430 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
30431 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
30432 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
30433 return (uint64_t)ret_conv;
30436 void __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_free(uint32_t this_obj) {
30437 LDKTrustedCommitmentTransaction this_obj_conv;
30438 this_obj_conv.inner = (void*)(this_obj & (~1));
30439 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30440 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30441 TrustedCommitmentTransaction_free(this_obj_conv);
30444 int8_tArray __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_txid(uint32_t this_arg) {
30445 LDKTrustedCommitmentTransaction this_arg_conv;
30446 this_arg_conv.inner = (void*)(this_arg & (~1));
30447 this_arg_conv.is_owned = false;
30448 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30449 int8_tArray ret_arr = init_int8_tArray(32);
30450 memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
30454 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_built_transaction(uint32_t this_arg) {
30455 LDKTrustedCommitmentTransaction this_arg_conv;
30456 this_arg_conv.inner = (void*)(this_arg & (~1));
30457 this_arg_conv.is_owned = false;
30458 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30459 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
30460 uint64_t ret_ref = 0;
30461 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30462 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30463 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30464 ret_ref = (uint64_t)ret_var.inner;
30465 if (ret_var.is_owned) {
30471 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_keys(uint32_t this_arg) {
30472 LDKTrustedCommitmentTransaction this_arg_conv;
30473 this_arg_conv.inner = (void*)(this_arg & (~1));
30474 this_arg_conv.is_owned = false;
30475 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30476 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
30477 uint64_t ret_ref = 0;
30478 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30479 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30480 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30481 ret_ref = (uint64_t)ret_var.inner;
30482 if (ret_var.is_owned) {
30488 jboolean __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_opt_anchors(uint32_t this_arg) {
30489 LDKTrustedCommitmentTransaction this_arg_conv;
30490 this_arg_conv.inner = (void*)(this_arg & (~1));
30491 this_arg_conv.is_owned = false;
30492 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30493 jboolean ret_val = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
30497 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_get_htlc_sigs(uint32_t this_arg, int8_tArray htlc_base_key, uint32_t channel_parameters) {
30498 LDKTrustedCommitmentTransaction this_arg_conv;
30499 this_arg_conv.inner = (void*)(this_arg & (~1));
30500 this_arg_conv.is_owned = false;
30501 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30502 unsigned char htlc_base_key_arr[32];
30503 CHECK(htlc_base_key->arr_len == 32);
30504 memcpy(htlc_base_key_arr, htlc_base_key->elems, 32);
30505 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
30506 LDKDirectedChannelTransactionParameters channel_parameters_conv;
30507 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
30508 channel_parameters_conv.is_owned = false;
30509 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
30510 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
30511 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
30512 return (uint64_t)ret_conv;
30515 int64_t __attribute__((visibility("default"))) TS_get_commitment_transaction_number_obscure_factor(int8_tArray broadcaster_payment_basepoint, int8_tArray countersignatory_payment_basepoint, jboolean outbound_from_broadcaster) {
30516 LDKPublicKey broadcaster_payment_basepoint_ref;
30517 CHECK(broadcaster_payment_basepoint->arr_len == 33);
30518 memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33);
30519 LDKPublicKey countersignatory_payment_basepoint_ref;
30520 CHECK(countersignatory_payment_basepoint->arr_len == 33);
30521 memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33);
30522 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
30526 jboolean __attribute__((visibility("default"))) TS_InitFeatures_eq(uint32_t a, uint32_t b) {
30527 LDKInitFeatures a_conv;
30528 a_conv.inner = (void*)(a & (~1));
30529 a_conv.is_owned = false;
30530 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30531 LDKInitFeatures b_conv;
30532 b_conv.inner = (void*)(b & (~1));
30533 b_conv.is_owned = false;
30534 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30535 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
30539 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_eq(uint32_t a, uint32_t b) {
30540 LDKNodeFeatures a_conv;
30541 a_conv.inner = (void*)(a & (~1));
30542 a_conv.is_owned = false;
30543 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30544 LDKNodeFeatures b_conv;
30545 b_conv.inner = (void*)(b & (~1));
30546 b_conv.is_owned = false;
30547 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30548 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
30552 jboolean __attribute__((visibility("default"))) TS_ChannelFeatures_eq(uint32_t a, uint32_t b) {
30553 LDKChannelFeatures a_conv;
30554 a_conv.inner = (void*)(a & (~1));
30555 a_conv.is_owned = false;
30556 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30557 LDKChannelFeatures b_conv;
30558 b_conv.inner = (void*)(b & (~1));
30559 b_conv.is_owned = false;
30560 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30561 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
30565 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_eq(uint32_t a, uint32_t b) {
30566 LDKInvoiceFeatures a_conv;
30567 a_conv.inner = (void*)(a & (~1));
30568 a_conv.is_owned = false;
30569 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30570 LDKInvoiceFeatures b_conv;
30571 b_conv.inner = (void*)(b & (~1));
30572 b_conv.is_owned = false;
30573 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30574 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
30578 jboolean __attribute__((visibility("default"))) TS_ChannelTypeFeatures_eq(uint32_t a, uint32_t b) {
30579 LDKChannelTypeFeatures a_conv;
30580 a_conv.inner = (void*)(a & (~1));
30581 a_conv.is_owned = false;
30582 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30583 LDKChannelTypeFeatures b_conv;
30584 b_conv.inner = (void*)(b & (~1));
30585 b_conv.is_owned = false;
30586 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30587 jboolean ret_val = ChannelTypeFeatures_eq(&a_conv, &b_conv);
30591 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
30592 LDKInitFeatures ret_var = InitFeatures_clone(arg);
30593 uint64_t ret_ref = 0;
30594 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30595 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30596 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30597 ret_ref = (uint64_t)ret_var.inner;
30598 if (ret_var.is_owned) {
30603 int64_t __attribute__((visibility("default"))) TS_InitFeatures_clone_ptr(uint32_t arg) {
30604 LDKInitFeatures arg_conv;
30605 arg_conv.inner = (void*)(arg & (~1));
30606 arg_conv.is_owned = false;
30607 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30608 int64_t ret_val = InitFeatures_clone_ptr(&arg_conv);
30612 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_clone(uint32_t orig) {
30613 LDKInitFeatures orig_conv;
30614 orig_conv.inner = (void*)(orig & (~1));
30615 orig_conv.is_owned = false;
30616 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30617 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
30618 uint64_t ret_ref = 0;
30619 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30620 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30621 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30622 ret_ref = (uint64_t)ret_var.inner;
30623 if (ret_var.is_owned) {
30629 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
30630 LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
30631 uint64_t ret_ref = 0;
30632 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30633 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30634 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30635 ret_ref = (uint64_t)ret_var.inner;
30636 if (ret_var.is_owned) {
30641 int64_t __attribute__((visibility("default"))) TS_NodeFeatures_clone_ptr(uint32_t arg) {
30642 LDKNodeFeatures arg_conv;
30643 arg_conv.inner = (void*)(arg & (~1));
30644 arg_conv.is_owned = false;
30645 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30646 int64_t ret_val = NodeFeatures_clone_ptr(&arg_conv);
30650 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_clone(uint32_t orig) {
30651 LDKNodeFeatures orig_conv;
30652 orig_conv.inner = (void*)(orig & (~1));
30653 orig_conv.is_owned = false;
30654 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30655 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
30656 uint64_t ret_ref = 0;
30657 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30658 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30659 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30660 ret_ref = (uint64_t)ret_var.inner;
30661 if (ret_var.is_owned) {
30667 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
30668 LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
30669 uint64_t ret_ref = 0;
30670 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30671 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30672 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30673 ret_ref = (uint64_t)ret_var.inner;
30674 if (ret_var.is_owned) {
30679 int64_t __attribute__((visibility("default"))) TS_ChannelFeatures_clone_ptr(uint32_t arg) {
30680 LDKChannelFeatures arg_conv;
30681 arg_conv.inner = (void*)(arg & (~1));
30682 arg_conv.is_owned = false;
30683 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30684 int64_t ret_val = ChannelFeatures_clone_ptr(&arg_conv);
30688 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_clone(uint32_t orig) {
30689 LDKChannelFeatures orig_conv;
30690 orig_conv.inner = (void*)(orig & (~1));
30691 orig_conv.is_owned = false;
30692 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30693 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
30694 uint64_t ret_ref = 0;
30695 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30696 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30697 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30698 ret_ref = (uint64_t)ret_var.inner;
30699 if (ret_var.is_owned) {
30705 static inline uint64_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
30706 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
30707 uint64_t ret_ref = 0;
30708 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30709 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30710 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30711 ret_ref = (uint64_t)ret_var.inner;
30712 if (ret_var.is_owned) {
30717 int64_t __attribute__((visibility("default"))) TS_InvoiceFeatures_clone_ptr(uint32_t arg) {
30718 LDKInvoiceFeatures arg_conv;
30719 arg_conv.inner = (void*)(arg & (~1));
30720 arg_conv.is_owned = false;
30721 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30722 int64_t ret_val = InvoiceFeatures_clone_ptr(&arg_conv);
30726 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_clone(uint32_t orig) {
30727 LDKInvoiceFeatures orig_conv;
30728 orig_conv.inner = (void*)(orig & (~1));
30729 orig_conv.is_owned = false;
30730 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30731 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
30732 uint64_t ret_ref = 0;
30733 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30734 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30735 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30736 ret_ref = (uint64_t)ret_var.inner;
30737 if (ret_var.is_owned) {
30743 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
30744 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
30745 uint64_t ret_ref = 0;
30746 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30747 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30748 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30749 ret_ref = (uint64_t)ret_var.inner;
30750 if (ret_var.is_owned) {
30755 int64_t __attribute__((visibility("default"))) TS_ChannelTypeFeatures_clone_ptr(uint32_t arg) {
30756 LDKChannelTypeFeatures arg_conv;
30757 arg_conv.inner = (void*)(arg & (~1));
30758 arg_conv.is_owned = false;
30759 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30760 int64_t ret_val = ChannelTypeFeatures_clone_ptr(&arg_conv);
30764 uint32_t __attribute__((visibility("default"))) TS_ChannelTypeFeatures_clone(uint32_t orig) {
30765 LDKChannelTypeFeatures orig_conv;
30766 orig_conv.inner = (void*)(orig & (~1));
30767 orig_conv.is_owned = false;
30768 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30769 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
30770 uint64_t ret_ref = 0;
30771 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30772 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30773 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30774 ret_ref = (uint64_t)ret_var.inner;
30775 if (ret_var.is_owned) {
30781 void __attribute__((visibility("default"))) TS_InitFeatures_free(uint32_t this_obj) {
30782 LDKInitFeatures this_obj_conv;
30783 this_obj_conv.inner = (void*)(this_obj & (~1));
30784 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30785 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30786 InitFeatures_free(this_obj_conv);
30789 void __attribute__((visibility("default"))) TS_NodeFeatures_free(uint32_t this_obj) {
30790 LDKNodeFeatures this_obj_conv;
30791 this_obj_conv.inner = (void*)(this_obj & (~1));
30792 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30793 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30794 NodeFeatures_free(this_obj_conv);
30797 void __attribute__((visibility("default"))) TS_ChannelFeatures_free(uint32_t this_obj) {
30798 LDKChannelFeatures this_obj_conv;
30799 this_obj_conv.inner = (void*)(this_obj & (~1));
30800 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30801 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30802 ChannelFeatures_free(this_obj_conv);
30805 void __attribute__((visibility("default"))) TS_InvoiceFeatures_free(uint32_t this_obj) {
30806 LDKInvoiceFeatures this_obj_conv;
30807 this_obj_conv.inner = (void*)(this_obj & (~1));
30808 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30809 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30810 InvoiceFeatures_free(this_obj_conv);
30813 void __attribute__((visibility("default"))) TS_ChannelTypeFeatures_free(uint32_t this_obj) {
30814 LDKChannelTypeFeatures this_obj_conv;
30815 this_obj_conv.inner = (void*)(this_obj & (~1));
30816 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30817 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30818 ChannelTypeFeatures_free(this_obj_conv);
30821 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_empty() {
30822 LDKInitFeatures ret_var = InitFeatures_empty();
30823 uint64_t ret_ref = 0;
30824 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30825 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30826 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30827 ret_ref = (uint64_t)ret_var.inner;
30828 if (ret_var.is_owned) {
30834 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_known() {
30835 LDKInitFeatures ret_var = InitFeatures_known();
30836 uint64_t ret_ref = 0;
30837 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30838 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30839 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30840 ret_ref = (uint64_t)ret_var.inner;
30841 if (ret_var.is_owned) {
30847 jboolean __attribute__((visibility("default"))) TS_InitFeatures_requires_unknown_bits(uint32_t this_arg) {
30848 LDKInitFeatures this_arg_conv;
30849 this_arg_conv.inner = (void*)(this_arg & (~1));
30850 this_arg_conv.is_owned = false;
30851 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30852 jboolean ret_val = InitFeatures_requires_unknown_bits(&this_arg_conv);
30856 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_empty() {
30857 LDKNodeFeatures ret_var = NodeFeatures_empty();
30858 uint64_t ret_ref = 0;
30859 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30860 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30861 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30862 ret_ref = (uint64_t)ret_var.inner;
30863 if (ret_var.is_owned) {
30869 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_known() {
30870 LDKNodeFeatures ret_var = NodeFeatures_known();
30871 uint64_t ret_ref = 0;
30872 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30873 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30874 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30875 ret_ref = (uint64_t)ret_var.inner;
30876 if (ret_var.is_owned) {
30882 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_requires_unknown_bits(uint32_t this_arg) {
30883 LDKNodeFeatures this_arg_conv;
30884 this_arg_conv.inner = (void*)(this_arg & (~1));
30885 this_arg_conv.is_owned = false;
30886 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30887 jboolean ret_val = NodeFeatures_requires_unknown_bits(&this_arg_conv);
30891 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_empty() {
30892 LDKChannelFeatures ret_var = ChannelFeatures_empty();
30893 uint64_t ret_ref = 0;
30894 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30895 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30896 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30897 ret_ref = (uint64_t)ret_var.inner;
30898 if (ret_var.is_owned) {
30904 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_known() {
30905 LDKChannelFeatures ret_var = ChannelFeatures_known();
30906 uint64_t ret_ref = 0;
30907 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30908 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30909 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30910 ret_ref = (uint64_t)ret_var.inner;
30911 if (ret_var.is_owned) {
30917 jboolean __attribute__((visibility("default"))) TS_ChannelFeatures_requires_unknown_bits(uint32_t this_arg) {
30918 LDKChannelFeatures this_arg_conv;
30919 this_arg_conv.inner = (void*)(this_arg & (~1));
30920 this_arg_conv.is_owned = false;
30921 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30922 jboolean ret_val = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
30926 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_empty() {
30927 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
30928 uint64_t ret_ref = 0;
30929 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30930 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30931 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30932 ret_ref = (uint64_t)ret_var.inner;
30933 if (ret_var.is_owned) {
30939 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_known() {
30940 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
30941 uint64_t ret_ref = 0;
30942 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30943 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30944 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30945 ret_ref = (uint64_t)ret_var.inner;
30946 if (ret_var.is_owned) {
30952 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_requires_unknown_bits(uint32_t this_arg) {
30953 LDKInvoiceFeatures this_arg_conv;
30954 this_arg_conv.inner = (void*)(this_arg & (~1));
30955 this_arg_conv.is_owned = false;
30956 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30957 jboolean ret_val = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
30961 uint32_t __attribute__((visibility("default"))) TS_ChannelTypeFeatures_empty() {
30962 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
30963 uint64_t ret_ref = 0;
30964 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30965 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30966 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30967 ret_ref = (uint64_t)ret_var.inner;
30968 if (ret_var.is_owned) {
30974 uint32_t __attribute__((visibility("default"))) TS_ChannelTypeFeatures_known() {
30975 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_known();
30976 uint64_t ret_ref = 0;
30977 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30978 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30979 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30980 ret_ref = (uint64_t)ret_var.inner;
30981 if (ret_var.is_owned) {
30987 jboolean __attribute__((visibility("default"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint32_t this_arg) {
30988 LDKChannelTypeFeatures this_arg_conv;
30989 this_arg_conv.inner = (void*)(this_arg & (~1));
30990 this_arg_conv.is_owned = false;
30991 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30992 jboolean ret_val = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
30996 int8_tArray __attribute__((visibility("default"))) TS_InitFeatures_write(uint32_t obj) {
30997 LDKInitFeatures obj_conv;
30998 obj_conv.inner = (void*)(obj & (~1));
30999 obj_conv.is_owned = false;
31000 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31001 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
31002 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31003 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31004 CVec_u8Z_free(ret_var);
31008 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_read(int8_tArray ser) {
31009 LDKu8slice ser_ref;
31010 ser_ref.datalen = ser->arr_len;
31011 ser_ref.data = ser->elems;
31012 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
31013 *ret_conv = InitFeatures_read(ser_ref);
31014 return (uint64_t)ret_conv;
31017 int8_tArray __attribute__((visibility("default"))) TS_ChannelFeatures_write(uint32_t obj) {
31018 LDKChannelFeatures obj_conv;
31019 obj_conv.inner = (void*)(obj & (~1));
31020 obj_conv.is_owned = false;
31021 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31022 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
31023 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31024 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31025 CVec_u8Z_free(ret_var);
31029 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_read(int8_tArray ser) {
31030 LDKu8slice ser_ref;
31031 ser_ref.datalen = ser->arr_len;
31032 ser_ref.data = ser->elems;
31033 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
31034 *ret_conv = ChannelFeatures_read(ser_ref);
31035 return (uint64_t)ret_conv;
31038 int8_tArray __attribute__((visibility("default"))) TS_NodeFeatures_write(uint32_t obj) {
31039 LDKNodeFeatures obj_conv;
31040 obj_conv.inner = (void*)(obj & (~1));
31041 obj_conv.is_owned = false;
31042 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31043 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
31044 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31045 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31046 CVec_u8Z_free(ret_var);
31050 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_read(int8_tArray ser) {
31051 LDKu8slice ser_ref;
31052 ser_ref.datalen = ser->arr_len;
31053 ser_ref.data = ser->elems;
31054 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
31055 *ret_conv = NodeFeatures_read(ser_ref);
31056 return (uint64_t)ret_conv;
31059 int8_tArray __attribute__((visibility("default"))) TS_InvoiceFeatures_write(uint32_t obj) {
31060 LDKInvoiceFeatures obj_conv;
31061 obj_conv.inner = (void*)(obj & (~1));
31062 obj_conv.is_owned = false;
31063 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31064 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
31065 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31066 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31067 CVec_u8Z_free(ret_var);
31071 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_read(int8_tArray ser) {
31072 LDKu8slice ser_ref;
31073 ser_ref.datalen = ser->arr_len;
31074 ser_ref.data = ser->elems;
31075 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
31076 *ret_conv = InvoiceFeatures_read(ser_ref);
31077 return (uint64_t)ret_conv;
31080 int8_tArray __attribute__((visibility("default"))) TS_ChannelTypeFeatures_write(uint32_t obj) {
31081 LDKChannelTypeFeatures obj_conv;
31082 obj_conv.inner = (void*)(obj & (~1));
31083 obj_conv.is_owned = false;
31084 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31085 LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
31086 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31087 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31088 CVec_u8Z_free(ret_var);
31092 uint32_t __attribute__((visibility("default"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
31093 LDKu8slice ser_ref;
31094 ser_ref.datalen = ser->arr_len;
31095 ser_ref.data = ser->elems;
31096 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
31097 *ret_conv = ChannelTypeFeatures_read(ser_ref);
31098 return (uint64_t)ret_conv;
31101 void __attribute__((visibility("default"))) TS_ShutdownScript_free(uint32_t this_obj) {
31102 LDKShutdownScript this_obj_conv;
31103 this_obj_conv.inner = (void*)(this_obj & (~1));
31104 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31105 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31106 ShutdownScript_free(this_obj_conv);
31109 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
31110 LDKShutdownScript ret_var = ShutdownScript_clone(arg);
31111 uint64_t ret_ref = 0;
31112 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31113 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31114 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31115 ret_ref = (uint64_t)ret_var.inner;
31116 if (ret_var.is_owned) {
31121 int64_t __attribute__((visibility("default"))) TS_ShutdownScript_clone_ptr(uint32_t arg) {
31122 LDKShutdownScript arg_conv;
31123 arg_conv.inner = (void*)(arg & (~1));
31124 arg_conv.is_owned = false;
31125 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31126 int64_t ret_val = ShutdownScript_clone_ptr(&arg_conv);
31130 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_clone(uint32_t orig) {
31131 LDKShutdownScript orig_conv;
31132 orig_conv.inner = (void*)(orig & (~1));
31133 orig_conv.is_owned = false;
31134 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31135 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
31136 uint64_t ret_ref = 0;
31137 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31138 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31139 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31140 ret_ref = (uint64_t)ret_var.inner;
31141 if (ret_var.is_owned) {
31147 void __attribute__((visibility("default"))) TS_InvalidShutdownScript_free(uint32_t this_obj) {
31148 LDKInvalidShutdownScript this_obj_conv;
31149 this_obj_conv.inner = (void*)(this_obj & (~1));
31150 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31151 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31152 InvalidShutdownScript_free(this_obj_conv);
31155 int8_tArray __attribute__((visibility("default"))) TS_InvalidShutdownScript_get_script(uint32_t this_ptr) {
31156 LDKInvalidShutdownScript this_ptr_conv;
31157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31158 this_ptr_conv.is_owned = false;
31159 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31160 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
31161 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31162 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31166 void __attribute__((visibility("default"))) TS_InvalidShutdownScript_set_script(uint32_t this_ptr, int8_tArray val) {
31167 LDKInvalidShutdownScript this_ptr_conv;
31168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31169 this_ptr_conv.is_owned = false;
31170 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31171 LDKCVec_u8Z val_ref;
31172 val_ref.datalen = val->arr_len;
31173 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
31174 memcpy(val_ref.data, val->elems, val_ref.datalen);
31175 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
31178 uint32_t __attribute__((visibility("default"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
31179 LDKCVec_u8Z script_arg_ref;
31180 script_arg_ref.datalen = script_arg->arr_len;
31181 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
31182 memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen);
31183 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
31184 uint64_t ret_ref = 0;
31185 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31186 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31187 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31188 ret_ref = (uint64_t)ret_var.inner;
31189 if (ret_var.is_owned) {
31195 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
31196 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
31197 uint64_t ret_ref = 0;
31198 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31199 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31200 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31201 ret_ref = (uint64_t)ret_var.inner;
31202 if (ret_var.is_owned) {
31207 int64_t __attribute__((visibility("default"))) TS_InvalidShutdownScript_clone_ptr(uint32_t arg) {
31208 LDKInvalidShutdownScript arg_conv;
31209 arg_conv.inner = (void*)(arg & (~1));
31210 arg_conv.is_owned = false;
31211 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31212 int64_t ret_val = InvalidShutdownScript_clone_ptr(&arg_conv);
31216 uint32_t __attribute__((visibility("default"))) TS_InvalidShutdownScript_clone(uint32_t orig) {
31217 LDKInvalidShutdownScript orig_conv;
31218 orig_conv.inner = (void*)(orig & (~1));
31219 orig_conv.is_owned = false;
31220 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31221 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
31222 uint64_t ret_ref = 0;
31223 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31224 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31225 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31226 ret_ref = (uint64_t)ret_var.inner;
31227 if (ret_var.is_owned) {
31233 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_write(uint32_t obj) {
31234 LDKShutdownScript obj_conv;
31235 obj_conv.inner = (void*)(obj & (~1));
31236 obj_conv.is_owned = false;
31237 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31238 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
31239 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31240 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31241 CVec_u8Z_free(ret_var);
31245 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_read(int8_tArray ser) {
31246 LDKu8slice ser_ref;
31247 ser_ref.datalen = ser->arr_len;
31248 ser_ref.data = ser->elems;
31249 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
31250 *ret_conv = ShutdownScript_read(ser_ref);
31251 return (uint64_t)ret_conv;
31254 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
31255 unsigned char pubkey_hash_arr[20];
31256 CHECK(pubkey_hash->arr_len == 20);
31257 memcpy(pubkey_hash_arr, pubkey_hash->elems, 20);
31258 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
31259 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
31260 uint64_t ret_ref = 0;
31261 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31262 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31263 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31264 ret_ref = (uint64_t)ret_var.inner;
31265 if (ret_var.is_owned) {
31271 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
31272 unsigned char script_hash_arr[32];
31273 CHECK(script_hash->arr_len == 32);
31274 memcpy(script_hash_arr, script_hash->elems, 32);
31275 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
31276 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
31277 uint64_t ret_ref = 0;
31278 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31279 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31280 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31281 ret_ref = (uint64_t)ret_var.inner;
31282 if (ret_var.is_owned) {
31288 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
31289 LDKu8slice program_ref;
31290 program_ref.datalen = program->arr_len;
31291 program_ref.data = program->elems;
31292 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
31293 *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
31294 return (uint64_t)ret_conv;
31297 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_into_inner(uint32_t this_arg) {
31298 LDKShutdownScript this_arg_conv;
31299 this_arg_conv.inner = (void*)(this_arg & (~1));
31300 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
31301 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31302 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
31303 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
31304 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31305 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31306 CVec_u8Z_free(ret_var);
31310 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_as_legacy_pubkey(uint32_t this_arg) {
31311 LDKShutdownScript this_arg_conv;
31312 this_arg_conv.inner = (void*)(this_arg & (~1));
31313 this_arg_conv.is_owned = false;
31314 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31315 int8_tArray ret_arr = init_int8_tArray(33);
31316 memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
31320 jboolean __attribute__((visibility("default"))) TS_ShutdownScript_is_compatible(uint32_t this_arg, uint32_t features) {
31321 LDKShutdownScript this_arg_conv;
31322 this_arg_conv.inner = (void*)(this_arg & (~1));
31323 this_arg_conv.is_owned = false;
31324 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31325 LDKInitFeatures features_conv;
31326 features_conv.inner = (void*)(features & (~1));
31327 features_conv.is_owned = false;
31328 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
31329 jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
31333 void __attribute__((visibility("default"))) TS_CustomMessageReader_free(uint32_t this_ptr) {
31334 if ((this_ptr & 1) != 0) return;
31335 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
31336 CHECK_ACCESS(this_ptr_ptr);
31337 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
31338 FREE((void*)this_ptr);
31339 CustomMessageReader_free(this_ptr_conv);
31342 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
31343 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
31344 *ret_ret = Type_clone(arg);
31345 return (uint64_t)ret_ret;
31347 int64_t __attribute__((visibility("default"))) TS_Type_clone_ptr(uint32_t arg) {
31348 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
31349 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
31350 LDKType* arg_conv = (LDKType*)arg_ptr;
31351 int64_t ret_val = Type_clone_ptr(arg_conv);
31355 uint32_t __attribute__((visibility("default"))) TS_Type_clone(uint32_t orig) {
31356 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
31357 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
31358 LDKType* orig_conv = (LDKType*)orig_ptr;
31359 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
31360 *ret_ret = Type_clone(orig_conv);
31361 return (uint64_t)ret_ret;
31364 void __attribute__((visibility("default"))) TS_Type_free(uint32_t this_ptr) {
31365 if ((this_ptr & 1) != 0) return;
31366 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
31367 CHECK_ACCESS(this_ptr_ptr);
31368 LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
31369 FREE((void*)this_ptr);
31370 Type_free(this_ptr_conv);
31373 void __attribute__((visibility("default"))) TS_NodeId_free(uint32_t this_obj) {
31374 LDKNodeId this_obj_conv;
31375 this_obj_conv.inner = (void*)(this_obj & (~1));
31376 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31377 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31378 NodeId_free(this_obj_conv);
31381 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
31382 LDKNodeId ret_var = NodeId_clone(arg);
31383 uint64_t ret_ref = 0;
31384 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31385 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31386 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31387 ret_ref = (uint64_t)ret_var.inner;
31388 if (ret_var.is_owned) {
31393 int64_t __attribute__((visibility("default"))) TS_NodeId_clone_ptr(uint32_t arg) {
31394 LDKNodeId arg_conv;
31395 arg_conv.inner = (void*)(arg & (~1));
31396 arg_conv.is_owned = false;
31397 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31398 int64_t ret_val = NodeId_clone_ptr(&arg_conv);
31402 uint32_t __attribute__((visibility("default"))) TS_NodeId_clone(uint32_t orig) {
31403 LDKNodeId orig_conv;
31404 orig_conv.inner = (void*)(orig & (~1));
31405 orig_conv.is_owned = false;
31406 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31407 LDKNodeId ret_var = NodeId_clone(&orig_conv);
31408 uint64_t ret_ref = 0;
31409 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31410 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31411 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31412 ret_ref = (uint64_t)ret_var.inner;
31413 if (ret_var.is_owned) {
31419 uint32_t __attribute__((visibility("default"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
31420 LDKPublicKey pubkey_ref;
31421 CHECK(pubkey->arr_len == 33);
31422 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33);
31423 LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
31424 uint64_t ret_ref = 0;
31425 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31426 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31427 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31428 ret_ref = (uint64_t)ret_var.inner;
31429 if (ret_var.is_owned) {
31435 int8_tArray __attribute__((visibility("default"))) TS_NodeId_as_slice(uint32_t this_arg) {
31436 LDKNodeId this_arg_conv;
31437 this_arg_conv.inner = (void*)(this_arg & (~1));
31438 this_arg_conv.is_owned = false;
31439 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31440 LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
31441 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31442 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31446 int64_t __attribute__((visibility("default"))) TS_NodeId_hash(uint32_t o) {
31448 o_conv.inner = (void*)(o & (~1));
31449 o_conv.is_owned = false;
31450 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31451 int64_t ret_val = NodeId_hash(&o_conv);
31455 int8_tArray __attribute__((visibility("default"))) TS_NodeId_write(uint32_t obj) {
31456 LDKNodeId obj_conv;
31457 obj_conv.inner = (void*)(obj & (~1));
31458 obj_conv.is_owned = false;
31459 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31460 LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
31461 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31462 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31463 CVec_u8Z_free(ret_var);
31467 uint32_t __attribute__((visibility("default"))) TS_NodeId_read(int8_tArray ser) {
31468 LDKu8slice ser_ref;
31469 ser_ref.datalen = ser->arr_len;
31470 ser_ref.data = ser->elems;
31471 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
31472 *ret_conv = NodeId_read(ser_ref);
31473 return (uint64_t)ret_conv;
31476 void __attribute__((visibility("default"))) TS_NetworkGraph_free(uint32_t this_obj) {
31477 LDKNetworkGraph this_obj_conv;
31478 this_obj_conv.inner = (void*)(this_obj & (~1));
31479 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31480 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31481 NetworkGraph_free(this_obj_conv);
31484 static inline uint64_t NetworkGraph_clone_ptr(LDKNetworkGraph *NONNULL_PTR arg) {
31485 LDKNetworkGraph ret_var = NetworkGraph_clone(arg);
31486 uint64_t ret_ref = 0;
31487 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31488 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31489 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31490 ret_ref = (uint64_t)ret_var.inner;
31491 if (ret_var.is_owned) {
31496 int64_t __attribute__((visibility("default"))) TS_NetworkGraph_clone_ptr(uint32_t arg) {
31497 LDKNetworkGraph arg_conv;
31498 arg_conv.inner = (void*)(arg & (~1));
31499 arg_conv.is_owned = false;
31500 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31501 int64_t ret_val = NetworkGraph_clone_ptr(&arg_conv);
31505 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_clone(uint32_t orig) {
31506 LDKNetworkGraph orig_conv;
31507 orig_conv.inner = (void*)(orig & (~1));
31508 orig_conv.is_owned = false;
31509 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31510 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
31511 uint64_t ret_ref = 0;
31512 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31513 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31514 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31515 ret_ref = (uint64_t)ret_var.inner;
31516 if (ret_var.is_owned) {
31522 void __attribute__((visibility("default"))) TS_ReadOnlyNetworkGraph_free(uint32_t this_obj) {
31523 LDKReadOnlyNetworkGraph this_obj_conv;
31524 this_obj_conv.inner = (void*)(this_obj & (~1));
31525 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31526 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31527 ReadOnlyNetworkGraph_free(this_obj_conv);
31530 void __attribute__((visibility("default"))) TS_NetworkUpdate_free(uint32_t this_ptr) {
31531 if ((this_ptr & 1) != 0) return;
31532 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
31533 CHECK_ACCESS(this_ptr_ptr);
31534 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
31535 FREE((void*)this_ptr);
31536 NetworkUpdate_free(this_ptr_conv);
31539 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
31540 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
31541 *ret_copy = NetworkUpdate_clone(arg);
31542 uint64_t ret_ref = (uint64_t)ret_copy;
31545 int64_t __attribute__((visibility("default"))) TS_NetworkUpdate_clone_ptr(uint32_t arg) {
31546 LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)arg;
31547 int64_t ret_val = NetworkUpdate_clone_ptr(arg_conv);
31551 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_clone(uint32_t orig) {
31552 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
31553 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
31554 *ret_copy = NetworkUpdate_clone(orig_conv);
31555 uint64_t ret_ref = (uint64_t)ret_copy;
31559 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_update_message(uint32_t msg) {
31560 LDKChannelUpdate msg_conv;
31561 msg_conv.inner = (void*)(msg & (~1));
31562 msg_conv.is_owned = (msg & 1) || (msg == 0);
31563 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
31564 msg_conv = ChannelUpdate_clone(&msg_conv);
31565 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
31566 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
31567 uint64_t ret_ref = (uint64_t)ret_copy;
31571 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_closed(int64_t short_channel_id, jboolean is_permanent) {
31572 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
31573 *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent);
31574 uint64_t ret_ref = (uint64_t)ret_copy;
31578 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
31579 LDKPublicKey node_id_ref;
31580 CHECK(node_id->arr_len == 33);
31581 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
31582 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
31583 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
31584 uint64_t ret_ref = (uint64_t)ret_copy;
31588 int8_tArray __attribute__((visibility("default"))) TS_NetworkUpdate_write(uint32_t obj) {
31589 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
31590 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
31591 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31592 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31593 CVec_u8Z_free(ret_var);
31597 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_read(int8_tArray ser) {
31598 LDKu8slice ser_ref;
31599 ser_ref.datalen = ser->arr_len;
31600 ser_ref.data = ser->elems;
31601 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
31602 *ret_conv = NetworkUpdate_read(ser_ref);
31603 return (uint64_t)ret_conv;
31606 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_EventHandler(uint32_t this_arg) {
31607 LDKNetGraphMsgHandler this_arg_conv;
31608 this_arg_conv.inner = (void*)(this_arg & (~1));
31609 this_arg_conv.is_owned = false;
31610 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31611 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
31612 *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv);
31613 return (uint64_t)ret_ret;
31616 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_free(uint32_t this_obj) {
31617 LDKNetGraphMsgHandler this_obj_conv;
31618 this_obj_conv.inner = (void*)(this_obj & (~1));
31619 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31620 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31621 NetGraphMsgHandler_free(this_obj_conv);
31624 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_new(uint32_t network_graph, uint32_t chain_access, uint32_t logger) {
31625 LDKNetworkGraph network_graph_conv;
31626 network_graph_conv.inner = (void*)(network_graph & (~1));
31627 network_graph_conv.is_owned = false;
31628 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
31629 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
31630 CHECK_ACCESS(chain_access_ptr);
31631 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
31632 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
31633 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
31634 // Manually implement clone for Java trait instances
31636 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
31637 CHECK_ACCESS(logger_ptr);
31638 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
31639 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(&network_graph_conv, chain_access_conv, logger_conv);
31640 uint64_t ret_ref = 0;
31641 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31642 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31643 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31644 ret_ref = (uint64_t)ret_var.inner;
31645 if (ret_var.is_owned) {
31651 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_add_chain_access(uint32_t this_arg, uint32_t chain_access) {
31652 LDKNetGraphMsgHandler this_arg_conv;
31653 this_arg_conv.inner = (void*)(this_arg & (~1));
31654 this_arg_conv.is_owned = false;
31655 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31656 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
31657 CHECK_ACCESS(chain_access_ptr);
31658 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
31659 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
31660 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
31661 // Manually implement clone for Java trait instances
31663 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
31666 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_RoutingMessageHandler(uint32_t this_arg) {
31667 LDKNetGraphMsgHandler this_arg_conv;
31668 this_arg_conv.inner = (void*)(this_arg & (~1));
31669 this_arg_conv.is_owned = false;
31670 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31671 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
31672 *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
31673 return (uint64_t)ret_ret;
31676 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
31677 LDKNetGraphMsgHandler this_arg_conv;
31678 this_arg_conv.inner = (void*)(this_arg & (~1));
31679 this_arg_conv.is_owned = false;
31680 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31681 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
31682 *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
31683 return (uint64_t)ret_ret;
31686 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_free(uint32_t this_obj) {
31687 LDKDirectionalChannelInfo this_obj_conv;
31688 this_obj_conv.inner = (void*)(this_obj & (~1));
31689 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31690 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31691 DirectionalChannelInfo_free(this_obj_conv);
31694 int32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update(uint32_t this_ptr) {
31695 LDKDirectionalChannelInfo this_ptr_conv;
31696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31697 this_ptr_conv.is_owned = false;
31698 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31699 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
31703 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update(uint32_t this_ptr, int32_t val) {
31704 LDKDirectionalChannelInfo this_ptr_conv;
31705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31706 this_ptr_conv.is_owned = false;
31707 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31708 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
31711 jboolean __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_enabled(uint32_t this_ptr) {
31712 LDKDirectionalChannelInfo this_ptr_conv;
31713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31714 this_ptr_conv.is_owned = false;
31715 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31716 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
31720 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_enabled(uint32_t this_ptr, jboolean val) {
31721 LDKDirectionalChannelInfo this_ptr_conv;
31722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31723 this_ptr_conv.is_owned = false;
31724 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31725 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
31728 int16_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
31729 LDKDirectionalChannelInfo this_ptr_conv;
31730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31731 this_ptr_conv.is_owned = false;
31732 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31733 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
31737 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
31738 LDKDirectionalChannelInfo this_ptr_conv;
31739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31740 this_ptr_conv.is_owned = false;
31741 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31742 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
31745 int64_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_minimum_msat(uint32_t this_ptr) {
31746 LDKDirectionalChannelInfo this_ptr_conv;
31747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31748 this_ptr_conv.is_owned = false;
31749 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31750 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
31754 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
31755 LDKDirectionalChannelInfo this_ptr_conv;
31756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31757 this_ptr_conv.is_owned = false;
31758 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31759 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
31762 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_maximum_msat(uint32_t this_ptr) {
31763 LDKDirectionalChannelInfo this_ptr_conv;
31764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31765 this_ptr_conv.is_owned = false;
31766 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31767 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31768 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
31769 uint64_t ret_ref = (uint64_t)ret_copy;
31773 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
31774 LDKDirectionalChannelInfo this_ptr_conv;
31775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31776 this_ptr_conv.is_owned = false;
31777 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31778 void* val_ptr = (void*)(((uint64_t)val) & ~1);
31779 CHECK_ACCESS(val_ptr);
31780 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31781 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
31782 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
31785 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_fees(uint32_t this_ptr) {
31786 LDKDirectionalChannelInfo this_ptr_conv;
31787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31788 this_ptr_conv.is_owned = false;
31789 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31790 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
31791 uint64_t ret_ref = 0;
31792 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31793 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31794 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31795 ret_ref = (uint64_t)ret_var.inner;
31796 if (ret_var.is_owned) {
31802 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_fees(uint32_t this_ptr, uint32_t val) {
31803 LDKDirectionalChannelInfo this_ptr_conv;
31804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31805 this_ptr_conv.is_owned = false;
31806 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31807 LDKRoutingFees val_conv;
31808 val_conv.inner = (void*)(val & (~1));
31809 val_conv.is_owned = (val & 1) || (val == 0);
31810 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31811 val_conv = RoutingFees_clone(&val_conv);
31812 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
31815 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update_message(uint32_t this_ptr) {
31816 LDKDirectionalChannelInfo this_ptr_conv;
31817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31818 this_ptr_conv.is_owned = false;
31819 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31820 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
31821 uint64_t ret_ref = 0;
31822 if ((uint64_t)ret_var.inner > 4096) {
31823 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31824 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31825 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31826 ret_ref = (uint64_t)ret_var.inner;
31827 if (ret_var.is_owned) {
31834 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) {
31835 LDKDirectionalChannelInfo this_ptr_conv;
31836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31837 this_ptr_conv.is_owned = false;
31838 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31839 LDKChannelUpdate val_conv;
31840 val_conv.inner = (void*)(val & (~1));
31841 val_conv.is_owned = (val & 1) || (val == 0);
31842 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31843 val_conv = ChannelUpdate_clone(&val_conv);
31844 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
31847 uint32_t __attribute__((visibility("default"))) 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) {
31848 void* htlc_maximum_msat_arg_ptr = (void*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
31849 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
31850 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
31851 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
31852 LDKRoutingFees fees_arg_conv;
31853 fees_arg_conv.inner = (void*)(fees_arg & (~1));
31854 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
31855 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
31856 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
31857 LDKChannelUpdate last_update_message_arg_conv;
31858 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
31859 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
31860 CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
31861 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
31862 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);
31863 uint64_t ret_ref = 0;
31864 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31865 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31866 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31867 ret_ref = (uint64_t)ret_var.inner;
31868 if (ret_var.is_owned) {
31874 static inline uint64_t DirectionalChannelInfo_clone_ptr(LDKDirectionalChannelInfo *NONNULL_PTR arg) {
31875 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(arg);
31876 uint64_t ret_ref = 0;
31877 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31878 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31879 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31880 ret_ref = (uint64_t)ret_var.inner;
31881 if (ret_var.is_owned) {
31886 int64_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_clone_ptr(uint32_t arg) {
31887 LDKDirectionalChannelInfo arg_conv;
31888 arg_conv.inner = (void*)(arg & (~1));
31889 arg_conv.is_owned = false;
31890 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31891 int64_t ret_val = DirectionalChannelInfo_clone_ptr(&arg_conv);
31895 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_clone(uint32_t orig) {
31896 LDKDirectionalChannelInfo orig_conv;
31897 orig_conv.inner = (void*)(orig & (~1));
31898 orig_conv.is_owned = false;
31899 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31900 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
31901 uint64_t ret_ref = 0;
31902 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31903 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31904 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31905 ret_ref = (uint64_t)ret_var.inner;
31906 if (ret_var.is_owned) {
31912 int8_tArray __attribute__((visibility("default"))) TS_DirectionalChannelInfo_write(uint32_t obj) {
31913 LDKDirectionalChannelInfo obj_conv;
31914 obj_conv.inner = (void*)(obj & (~1));
31915 obj_conv.is_owned = false;
31916 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31917 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
31918 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31919 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31920 CVec_u8Z_free(ret_var);
31924 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_read(int8_tArray ser) {
31925 LDKu8slice ser_ref;
31926 ser_ref.datalen = ser->arr_len;
31927 ser_ref.data = ser->elems;
31928 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
31929 *ret_conv = DirectionalChannelInfo_read(ser_ref);
31930 return (uint64_t)ret_conv;
31933 void __attribute__((visibility("default"))) TS_ChannelInfo_free(uint32_t this_obj) {
31934 LDKChannelInfo this_obj_conv;
31935 this_obj_conv.inner = (void*)(this_obj & (~1));
31936 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31938 ChannelInfo_free(this_obj_conv);
31941 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_features(uint32_t this_ptr) {
31942 LDKChannelInfo this_ptr_conv;
31943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31944 this_ptr_conv.is_owned = false;
31945 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31946 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
31947 uint64_t ret_ref = 0;
31948 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31949 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31950 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31951 ret_ref = (uint64_t)ret_var.inner;
31952 if (ret_var.is_owned) {
31958 void __attribute__((visibility("default"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) {
31959 LDKChannelInfo this_ptr_conv;
31960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31961 this_ptr_conv.is_owned = false;
31962 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31963 LDKChannelFeatures val_conv;
31964 val_conv.inner = (void*)(val & (~1));
31965 val_conv.is_owned = (val & 1) || (val == 0);
31966 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31967 val_conv = ChannelFeatures_clone(&val_conv);
31968 ChannelInfo_set_features(&this_ptr_conv, val_conv);
31971 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) {
31972 LDKChannelInfo this_ptr_conv;
31973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31974 this_ptr_conv.is_owned = false;
31975 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31976 LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
31977 uint64_t ret_ref = 0;
31978 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31979 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31980 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31981 ret_ref = (uint64_t)ret_var.inner;
31982 if (ret_var.is_owned) {
31988 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, uint32_t val) {
31989 LDKChannelInfo this_ptr_conv;
31990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31991 this_ptr_conv.is_owned = false;
31992 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31993 LDKNodeId val_conv;
31994 val_conv.inner = (void*)(val & (~1));
31995 val_conv.is_owned = (val & 1) || (val == 0);
31996 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31997 val_conv = NodeId_clone(&val_conv);
31998 ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
32001 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_one_to_two(uint32_t this_ptr) {
32002 LDKChannelInfo this_ptr_conv;
32003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32004 this_ptr_conv.is_owned = false;
32005 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32006 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
32007 uint64_t ret_ref = 0;
32008 if ((uint64_t)ret_var.inner > 4096) {
32009 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32010 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32011 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32012 ret_ref = (uint64_t)ret_var.inner;
32013 if (ret_var.is_owned) {
32020 void __attribute__((visibility("default"))) TS_ChannelInfo_set_one_to_two(uint32_t this_ptr, uint32_t val) {
32021 LDKChannelInfo 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 LDKDirectionalChannelInfo val_conv;
32026 val_conv.inner = (void*)(val & (~1));
32027 val_conv.is_owned = (val & 1) || (val == 0);
32028 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32029 val_conv = DirectionalChannelInfo_clone(&val_conv);
32030 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
32033 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_node_two(uint32_t this_ptr) {
32034 LDKChannelInfo this_ptr_conv;
32035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32036 this_ptr_conv.is_owned = false;
32037 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32038 LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
32039 uint64_t ret_ref = 0;
32040 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32041 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32042 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32043 ret_ref = (uint64_t)ret_var.inner;
32044 if (ret_var.is_owned) {
32050 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, uint32_t val) {
32051 LDKChannelInfo this_ptr_conv;
32052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32053 this_ptr_conv.is_owned = false;
32054 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32055 LDKNodeId val_conv;
32056 val_conv.inner = (void*)(val & (~1));
32057 val_conv.is_owned = (val & 1) || (val == 0);
32058 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32059 val_conv = NodeId_clone(&val_conv);
32060 ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
32063 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) {
32064 LDKChannelInfo 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 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
32069 uint64_t ret_ref = 0;
32070 if ((uint64_t)ret_var.inner > 4096) {
32071 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32072 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32073 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32074 ret_ref = (uint64_t)ret_var.inner;
32075 if (ret_var.is_owned) {
32082 void __attribute__((visibility("default"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) {
32083 LDKChannelInfo 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 LDKDirectionalChannelInfo val_conv;
32088 val_conv.inner = (void*)(val & (~1));
32089 val_conv.is_owned = (val & 1) || (val == 0);
32090 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32091 val_conv = DirectionalChannelInfo_clone(&val_conv);
32092 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
32095 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_capacity_sats(uint32_t this_ptr) {
32096 LDKChannelInfo this_ptr_conv;
32097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32098 this_ptr_conv.is_owned = false;
32099 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32100 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
32101 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
32102 uint64_t ret_ref = (uint64_t)ret_copy;
32106 void __attribute__((visibility("default"))) TS_ChannelInfo_set_capacity_sats(uint32_t this_ptr, uint32_t val) {
32107 LDKChannelInfo this_ptr_conv;
32108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32109 this_ptr_conv.is_owned = false;
32110 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32111 void* val_ptr = (void*)(((uint64_t)val) & ~1);
32112 CHECK_ACCESS(val_ptr);
32113 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
32114 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
32115 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
32118 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) {
32119 LDKChannelInfo this_ptr_conv;
32120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32121 this_ptr_conv.is_owned = false;
32122 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32123 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
32124 uint64_t ret_ref = 0;
32125 if ((uint64_t)ret_var.inner > 4096) {
32126 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32127 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32128 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32129 ret_ref = (uint64_t)ret_var.inner;
32130 if (ret_var.is_owned) {
32137 void __attribute__((visibility("default"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
32138 LDKChannelInfo this_ptr_conv;
32139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32140 this_ptr_conv.is_owned = false;
32141 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32142 LDKChannelAnnouncement val_conv;
32143 val_conv.inner = (void*)(val & (~1));
32144 val_conv.is_owned = (val & 1) || (val == 0);
32145 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32146 val_conv = ChannelAnnouncement_clone(&val_conv);
32147 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
32150 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
32151 LDKChannelInfo ret_var = ChannelInfo_clone(arg);
32152 uint64_t ret_ref = 0;
32153 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32154 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32155 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32156 ret_ref = (uint64_t)ret_var.inner;
32157 if (ret_var.is_owned) {
32162 int64_t __attribute__((visibility("default"))) TS_ChannelInfo_clone_ptr(uint32_t arg) {
32163 LDKChannelInfo arg_conv;
32164 arg_conv.inner = (void*)(arg & (~1));
32165 arg_conv.is_owned = false;
32166 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32167 int64_t ret_val = ChannelInfo_clone_ptr(&arg_conv);
32171 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_clone(uint32_t orig) {
32172 LDKChannelInfo orig_conv;
32173 orig_conv.inner = (void*)(orig & (~1));
32174 orig_conv.is_owned = false;
32175 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32176 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
32177 uint64_t ret_ref = 0;
32178 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32179 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32180 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32181 ret_ref = (uint64_t)ret_var.inner;
32182 if (ret_var.is_owned) {
32188 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_write(uint32_t obj) {
32189 LDKChannelInfo obj_conv;
32190 obj_conv.inner = (void*)(obj & (~1));
32191 obj_conv.is_owned = false;
32192 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32193 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
32194 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
32195 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32196 CVec_u8Z_free(ret_var);
32200 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_read(int8_tArray ser) {
32201 LDKu8slice ser_ref;
32202 ser_ref.datalen = ser->arr_len;
32203 ser_ref.data = ser->elems;
32204 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
32205 *ret_conv = ChannelInfo_read(ser_ref);
32206 return (uint64_t)ret_conv;
32209 void __attribute__((visibility("default"))) TS_RoutingFees_free(uint32_t this_obj) {
32210 LDKRoutingFees this_obj_conv;
32211 this_obj_conv.inner = (void*)(this_obj & (~1));
32212 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32213 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32214 RoutingFees_free(this_obj_conv);
32217 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) {
32218 LDKRoutingFees this_ptr_conv;
32219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32220 this_ptr_conv.is_owned = false;
32221 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32222 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
32226 void __attribute__((visibility("default"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) {
32227 LDKRoutingFees this_ptr_conv;
32228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32229 this_ptr_conv.is_owned = false;
32230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32231 RoutingFees_set_base_msat(&this_ptr_conv, val);
32234 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) {
32235 LDKRoutingFees this_ptr_conv;
32236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32237 this_ptr_conv.is_owned = false;
32238 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32239 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
32243 void __attribute__((visibility("default"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) {
32244 LDKRoutingFees this_ptr_conv;
32245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32246 this_ptr_conv.is_owned = false;
32247 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32248 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
32251 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
32252 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
32253 uint64_t ret_ref = 0;
32254 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32255 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32256 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32257 ret_ref = (uint64_t)ret_var.inner;
32258 if (ret_var.is_owned) {
32264 jboolean __attribute__((visibility("default"))) TS_RoutingFees_eq(uint32_t a, uint32_t b) {
32265 LDKRoutingFees a_conv;
32266 a_conv.inner = (void*)(a & (~1));
32267 a_conv.is_owned = false;
32268 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32269 LDKRoutingFees b_conv;
32270 b_conv.inner = (void*)(b & (~1));
32271 b_conv.is_owned = false;
32272 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32273 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
32277 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
32278 LDKRoutingFees ret_var = RoutingFees_clone(arg);
32279 uint64_t ret_ref = 0;
32280 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32281 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32282 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32283 ret_ref = (uint64_t)ret_var.inner;
32284 if (ret_var.is_owned) {
32289 int64_t __attribute__((visibility("default"))) TS_RoutingFees_clone_ptr(uint32_t arg) {
32290 LDKRoutingFees arg_conv;
32291 arg_conv.inner = (void*)(arg & (~1));
32292 arg_conv.is_owned = false;
32293 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32294 int64_t ret_val = RoutingFees_clone_ptr(&arg_conv);
32298 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_clone(uint32_t orig) {
32299 LDKRoutingFees orig_conv;
32300 orig_conv.inner = (void*)(orig & (~1));
32301 orig_conv.is_owned = false;
32302 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32303 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
32304 uint64_t ret_ref = 0;
32305 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32306 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32307 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32308 ret_ref = (uint64_t)ret_var.inner;
32309 if (ret_var.is_owned) {
32315 int64_t __attribute__((visibility("default"))) TS_RoutingFees_hash(uint32_t o) {
32316 LDKRoutingFees o_conv;
32317 o_conv.inner = (void*)(o & (~1));
32318 o_conv.is_owned = false;
32319 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32320 int64_t ret_val = RoutingFees_hash(&o_conv);
32324 int8_tArray __attribute__((visibility("default"))) TS_RoutingFees_write(uint32_t obj) {
32325 LDKRoutingFees obj_conv;
32326 obj_conv.inner = (void*)(obj & (~1));
32327 obj_conv.is_owned = false;
32328 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32329 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
32330 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
32331 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32332 CVec_u8Z_free(ret_var);
32336 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_read(int8_tArray ser) {
32337 LDKu8slice ser_ref;
32338 ser_ref.datalen = ser->arr_len;
32339 ser_ref.data = ser->elems;
32340 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
32341 *ret_conv = RoutingFees_read(ser_ref);
32342 return (uint64_t)ret_conv;
32345 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_free(uint32_t this_obj) {
32346 LDKNodeAnnouncementInfo this_obj_conv;
32347 this_obj_conv.inner = (void*)(this_obj & (~1));
32348 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32349 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32350 NodeAnnouncementInfo_free(this_obj_conv);
32353 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) {
32354 LDKNodeAnnouncementInfo this_ptr_conv;
32355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32356 this_ptr_conv.is_owned = false;
32357 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32358 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
32359 uint64_t ret_ref = 0;
32360 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32361 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32362 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32363 ret_ref = (uint64_t)ret_var.inner;
32364 if (ret_var.is_owned) {
32370 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) {
32371 LDKNodeAnnouncementInfo this_ptr_conv;
32372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32373 this_ptr_conv.is_owned = false;
32374 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32375 LDKNodeFeatures val_conv;
32376 val_conv.inner = (void*)(val & (~1));
32377 val_conv.is_owned = (val & 1) || (val == 0);
32378 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32379 val_conv = NodeFeatures_clone(&val_conv);
32380 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
32383 int32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) {
32384 LDKNodeAnnouncementInfo this_ptr_conv;
32385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32386 this_ptr_conv.is_owned = false;
32387 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32388 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
32392 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) {
32393 LDKNodeAnnouncementInfo this_ptr_conv;
32394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32395 this_ptr_conv.is_owned = false;
32396 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32397 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
32400 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) {
32401 LDKNodeAnnouncementInfo this_ptr_conv;
32402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32403 this_ptr_conv.is_owned = false;
32404 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32405 int8_tArray ret_arr = init_int8_tArray(3);
32406 memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
32410 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) {
32411 LDKNodeAnnouncementInfo this_ptr_conv;
32412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32413 this_ptr_conv.is_owned = false;
32414 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32415 LDKThreeBytes val_ref;
32416 CHECK(val->arr_len == 3);
32417 memcpy(val_ref.data, val->elems, 3);
32418 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
32421 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) {
32422 LDKNodeAnnouncementInfo this_ptr_conv;
32423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32424 this_ptr_conv.is_owned = false;
32425 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32426 int8_tArray ret_arr = init_int8_tArray(32);
32427 memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
32431 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, int8_tArray val) {
32432 LDKNodeAnnouncementInfo this_ptr_conv;
32433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32434 this_ptr_conv.is_owned = false;
32435 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32436 LDKThirtyTwoBytes val_ref;
32437 CHECK(val->arr_len == 32);
32438 memcpy(val_ref.data, val->elems, 32);
32439 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
32442 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) {
32443 LDKNodeAnnouncementInfo this_ptr_conv;
32444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32445 this_ptr_conv.is_owned = false;
32446 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32447 LDKCVec_NetAddressZ val_constr;
32448 val_constr.datalen = val->arr_len;
32449 if (val_constr.datalen > 0)
32450 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
32452 val_constr.data = NULL;
32453 uint32_t* val_vals = val->elems;
32454 for (size_t m = 0; m < val_constr.datalen; m++) {
32455 uint32_t val_conv_12 = val_vals[m];
32456 void* val_conv_12_ptr = (void*)(((uint64_t)val_conv_12) & ~1);
32457 CHECK_ACCESS(val_conv_12_ptr);
32458 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
32459 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
32460 val_constr.data[m] = val_conv_12_conv;
32462 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
32465 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) {
32466 LDKNodeAnnouncementInfo this_ptr_conv;
32467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32468 this_ptr_conv.is_owned = false;
32469 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32470 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
32471 uint64_t ret_ref = 0;
32472 if ((uint64_t)ret_var.inner > 4096) {
32473 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32474 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32475 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32476 ret_ref = (uint64_t)ret_var.inner;
32477 if (ret_var.is_owned) {
32484 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
32485 LDKNodeAnnouncementInfo this_ptr_conv;
32486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32487 this_ptr_conv.is_owned = false;
32488 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32489 LDKNodeAnnouncement val_conv;
32490 val_conv.inner = (void*)(val & (~1));
32491 val_conv.is_owned = (val & 1) || (val == 0);
32492 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32493 val_conv = NodeAnnouncement_clone(&val_conv);
32494 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
32497 uint32_t __attribute__((visibility("default"))) 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) {
32498 LDKNodeFeatures features_arg_conv;
32499 features_arg_conv.inner = (void*)(features_arg & (~1));
32500 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
32501 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
32502 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
32503 LDKThreeBytes rgb_arg_ref;
32504 CHECK(rgb_arg->arr_len == 3);
32505 memcpy(rgb_arg_ref.data, rgb_arg->elems, 3);
32506 LDKThirtyTwoBytes alias_arg_ref;
32507 CHECK(alias_arg->arr_len == 32);
32508 memcpy(alias_arg_ref.data, alias_arg->elems, 32);
32509 LDKCVec_NetAddressZ addresses_arg_constr;
32510 addresses_arg_constr.datalen = addresses_arg->arr_len;
32511 if (addresses_arg_constr.datalen > 0)
32512 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
32514 addresses_arg_constr.data = NULL;
32515 uint32_t* addresses_arg_vals = addresses_arg->elems;
32516 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
32517 uint32_t addresses_arg_conv_12 = addresses_arg_vals[m];
32518 void* addresses_arg_conv_12_ptr = (void*)(((uint64_t)addresses_arg_conv_12) & ~1);
32519 CHECK_ACCESS(addresses_arg_conv_12_ptr);
32520 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
32521 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
32523 LDKNodeAnnouncement announcement_message_arg_conv;
32524 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
32525 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
32526 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
32527 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
32528 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
32529 uint64_t ret_ref = 0;
32530 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32531 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32532 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32533 ret_ref = (uint64_t)ret_var.inner;
32534 if (ret_var.is_owned) {
32540 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
32541 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
32542 uint64_t ret_ref = 0;
32543 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32544 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32545 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32546 ret_ref = (uint64_t)ret_var.inner;
32547 if (ret_var.is_owned) {
32552 int64_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_clone_ptr(uint32_t arg) {
32553 LDKNodeAnnouncementInfo arg_conv;
32554 arg_conv.inner = (void*)(arg & (~1));
32555 arg_conv.is_owned = false;
32556 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32557 int64_t ret_val = NodeAnnouncementInfo_clone_ptr(&arg_conv);
32561 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) {
32562 LDKNodeAnnouncementInfo orig_conv;
32563 orig_conv.inner = (void*)(orig & (~1));
32564 orig_conv.is_owned = false;
32565 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32566 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
32567 uint64_t ret_ref = 0;
32568 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32569 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32570 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32571 ret_ref = (uint64_t)ret_var.inner;
32572 if (ret_var.is_owned) {
32578 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_write(uint32_t obj) {
32579 LDKNodeAnnouncementInfo obj_conv;
32580 obj_conv.inner = (void*)(obj & (~1));
32581 obj_conv.is_owned = false;
32582 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32583 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
32584 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
32585 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32586 CVec_u8Z_free(ret_var);
32590 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
32591 LDKu8slice ser_ref;
32592 ser_ref.datalen = ser->arr_len;
32593 ser_ref.data = ser->elems;
32594 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
32595 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
32596 return (uint64_t)ret_conv;
32599 void __attribute__((visibility("default"))) TS_NodeInfo_free(uint32_t this_obj) {
32600 LDKNodeInfo this_obj_conv;
32601 this_obj_conv.inner = (void*)(this_obj & (~1));
32602 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32603 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32604 NodeInfo_free(this_obj_conv);
32607 void __attribute__((visibility("default"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) {
32608 LDKNodeInfo this_ptr_conv;
32609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32610 this_ptr_conv.is_owned = false;
32611 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32612 LDKCVec_u64Z val_constr;
32613 val_constr.datalen = val->arr_len;
32614 if (val_constr.datalen > 0)
32615 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
32617 val_constr.data = NULL;
32618 int64_t* val_vals = val->elems;
32619 for (size_t i = 0; i < val_constr.datalen; i++) {
32620 int64_t val_conv_8 = val_vals[i];
32621 val_constr.data[i] = val_conv_8;
32623 NodeInfo_set_channels(&this_ptr_conv, val_constr);
32626 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) {
32627 LDKNodeInfo this_ptr_conv;
32628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32629 this_ptr_conv.is_owned = false;
32630 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32631 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
32632 uint64_t ret_ref = 0;
32633 if ((uint64_t)ret_var.inner > 4096) {
32634 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32635 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32636 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32637 ret_ref = (uint64_t)ret_var.inner;
32638 if (ret_var.is_owned) {
32645 void __attribute__((visibility("default"))) TS_NodeInfo_set_lowest_inbound_channel_fees(uint32_t this_ptr, uint32_t val) {
32646 LDKNodeInfo this_ptr_conv;
32647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32648 this_ptr_conv.is_owned = false;
32649 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32650 LDKRoutingFees val_conv;
32651 val_conv.inner = (void*)(val & (~1));
32652 val_conv.is_owned = (val & 1) || (val == 0);
32653 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32654 val_conv = RoutingFees_clone(&val_conv);
32655 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
32658 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) {
32659 LDKNodeInfo this_ptr_conv;
32660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32661 this_ptr_conv.is_owned = false;
32662 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32663 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
32664 uint64_t ret_ref = 0;
32665 if ((uint64_t)ret_var.inner > 4096) {
32666 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32667 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32668 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32669 ret_ref = (uint64_t)ret_var.inner;
32670 if (ret_var.is_owned) {
32677 void __attribute__((visibility("default"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) {
32678 LDKNodeInfo this_ptr_conv;
32679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32680 this_ptr_conv.is_owned = false;
32681 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32682 LDKNodeAnnouncementInfo val_conv;
32683 val_conv.inner = (void*)(val & (~1));
32684 val_conv.is_owned = (val & 1) || (val == 0);
32685 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32686 val_conv = NodeAnnouncementInfo_clone(&val_conv);
32687 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
32690 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_new(int64_tArray channels_arg, uint32_t lowest_inbound_channel_fees_arg, uint32_t announcement_info_arg) {
32691 LDKCVec_u64Z channels_arg_constr;
32692 channels_arg_constr.datalen = channels_arg->arr_len;
32693 if (channels_arg_constr.datalen > 0)
32694 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
32696 channels_arg_constr.data = NULL;
32697 int64_t* channels_arg_vals = channels_arg->elems;
32698 for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
32699 int64_t channels_arg_conv_8 = channels_arg_vals[i];
32700 channels_arg_constr.data[i] = channels_arg_conv_8;
32702 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
32703 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
32704 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
32705 CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
32706 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
32707 LDKNodeAnnouncementInfo announcement_info_arg_conv;
32708 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
32709 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
32710 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
32711 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
32712 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
32713 uint64_t ret_ref = 0;
32714 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32715 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32716 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32717 ret_ref = (uint64_t)ret_var.inner;
32718 if (ret_var.is_owned) {
32724 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
32725 LDKNodeInfo ret_var = NodeInfo_clone(arg);
32726 uint64_t ret_ref = 0;
32727 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32728 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32729 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32730 ret_ref = (uint64_t)ret_var.inner;
32731 if (ret_var.is_owned) {
32736 int64_t __attribute__((visibility("default"))) TS_NodeInfo_clone_ptr(uint32_t arg) {
32737 LDKNodeInfo arg_conv;
32738 arg_conv.inner = (void*)(arg & (~1));
32739 arg_conv.is_owned = false;
32740 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32741 int64_t ret_val = NodeInfo_clone_ptr(&arg_conv);
32745 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_clone(uint32_t orig) {
32746 LDKNodeInfo orig_conv;
32747 orig_conv.inner = (void*)(orig & (~1));
32748 orig_conv.is_owned = false;
32749 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32750 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
32751 uint64_t ret_ref = 0;
32752 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32753 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32754 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32755 ret_ref = (uint64_t)ret_var.inner;
32756 if (ret_var.is_owned) {
32762 int8_tArray __attribute__((visibility("default"))) TS_NodeInfo_write(uint32_t obj) {
32763 LDKNodeInfo obj_conv;
32764 obj_conv.inner = (void*)(obj & (~1));
32765 obj_conv.is_owned = false;
32766 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32767 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
32768 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
32769 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32770 CVec_u8Z_free(ret_var);
32774 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_read(int8_tArray ser) {
32775 LDKu8slice ser_ref;
32776 ser_ref.datalen = ser->arr_len;
32777 ser_ref.data = ser->elems;
32778 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
32779 *ret_conv = NodeInfo_read(ser_ref);
32780 return (uint64_t)ret_conv;
32783 int8_tArray __attribute__((visibility("default"))) TS_NetworkGraph_write(uint32_t obj) {
32784 LDKNetworkGraph obj_conv;
32785 obj_conv.inner = (void*)(obj & (~1));
32786 obj_conv.is_owned = false;
32787 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32788 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
32789 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
32790 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32791 CVec_u8Z_free(ret_var);
32795 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read(int8_tArray ser) {
32796 LDKu8slice ser_ref;
32797 ser_ref.datalen = ser->arr_len;
32798 ser_ref.data = ser->elems;
32799 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
32800 *ret_conv = NetworkGraph_read(ser_ref);
32801 return (uint64_t)ret_conv;
32804 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_new(int8_tArray genesis_hash) {
32805 LDKThirtyTwoBytes genesis_hash_ref;
32806 CHECK(genesis_hash->arr_len == 32);
32807 memcpy(genesis_hash_ref.data, genesis_hash->elems, 32);
32808 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
32809 uint64_t ret_ref = 0;
32810 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32811 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32812 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32813 ret_ref = (uint64_t)ret_var.inner;
32814 if (ret_var.is_owned) {
32820 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read_only(uint32_t this_arg) {
32821 LDKNetworkGraph this_arg_conv;
32822 this_arg_conv.inner = (void*)(this_arg & (~1));
32823 this_arg_conv.is_owned = false;
32824 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32825 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
32826 uint64_t ret_ref = 0;
32827 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32828 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32829 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32830 ret_ref = (uint64_t)ret_var.inner;
32831 if (ret_var.is_owned) {
32837 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) {
32838 LDKNetworkGraph this_arg_conv;
32839 this_arg_conv.inner = (void*)(this_arg & (~1));
32840 this_arg_conv.is_owned = false;
32841 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32842 LDKNodeAnnouncement msg_conv;
32843 msg_conv.inner = (void*)(msg & (~1));
32844 msg_conv.is_owned = false;
32845 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32846 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
32847 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
32848 return (uint64_t)ret_conv;
32851 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_unsigned_announcement(uint32_t this_arg, uint32_t msg) {
32852 LDKNetworkGraph this_arg_conv;
32853 this_arg_conv.inner = (void*)(this_arg & (~1));
32854 this_arg_conv.is_owned = false;
32855 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32856 LDKUnsignedNodeAnnouncement msg_conv;
32857 msg_conv.inner = (void*)(msg & (~1));
32858 msg_conv.is_owned = false;
32859 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32860 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
32861 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
32862 return (uint64_t)ret_conv;
32865 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
32866 LDKNetworkGraph this_arg_conv;
32867 this_arg_conv.inner = (void*)(this_arg & (~1));
32868 this_arg_conv.is_owned = false;
32869 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32870 LDKChannelAnnouncement msg_conv;
32871 msg_conv.inner = (void*)(msg & (~1));
32872 msg_conv.is_owned = false;
32873 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32874 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
32875 CHECK_ACCESS(chain_access_ptr);
32876 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
32877 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
32878 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
32879 // Manually implement clone for Java trait instances
32881 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
32882 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
32883 return (uint64_t)ret_conv;
32886 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_unsigned_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
32887 LDKNetworkGraph this_arg_conv;
32888 this_arg_conv.inner = (void*)(this_arg & (~1));
32889 this_arg_conv.is_owned = false;
32890 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32891 LDKUnsignedChannelAnnouncement msg_conv;
32892 msg_conv.inner = (void*)(msg & (~1));
32893 msg_conv.is_owned = false;
32894 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32895 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
32896 CHECK_ACCESS(chain_access_ptr);
32897 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
32898 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
32899 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
32900 // Manually implement clone for Java trait instances
32902 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
32903 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
32904 return (uint64_t)ret_conv;
32907 void __attribute__((visibility("default"))) TS_NetworkGraph_close_channel_from_update(uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
32908 LDKNetworkGraph this_arg_conv;
32909 this_arg_conv.inner = (void*)(this_arg & (~1));
32910 this_arg_conv.is_owned = false;
32911 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32912 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
32915 void __attribute__((visibility("default"))) TS_NetworkGraph_fail_node(uint32_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
32916 LDKNetworkGraph this_arg_conv;
32917 this_arg_conv.inner = (void*)(this_arg & (~1));
32918 this_arg_conv.is_owned = false;
32919 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32920 LDKPublicKey _node_id_ref;
32921 CHECK(_node_id->arr_len == 33);
32922 memcpy(_node_id_ref.compressed_form, _node_id->elems, 33);
32923 NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent);
32926 void __attribute__((visibility("default"))) TS_NetworkGraph_remove_stale_channels_with_time(uint32_t this_arg, int64_t current_time_unix) {
32927 LDKNetworkGraph this_arg_conv;
32928 this_arg_conv.inner = (void*)(this_arg & (~1));
32929 this_arg_conv.is_owned = false;
32930 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32931 NetworkGraph_remove_stale_channels_with_time(&this_arg_conv, current_time_unix);
32934 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) {
32935 LDKNetworkGraph this_arg_conv;
32936 this_arg_conv.inner = (void*)(this_arg & (~1));
32937 this_arg_conv.is_owned = false;
32938 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32939 LDKChannelUpdate msg_conv;
32940 msg_conv.inner = (void*)(msg & (~1));
32941 msg_conv.is_owned = false;
32942 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32943 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
32944 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
32945 return (uint64_t)ret_conv;
32948 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) {
32949 LDKNetworkGraph this_arg_conv;
32950 this_arg_conv.inner = (void*)(this_arg & (~1));
32951 this_arg_conv.is_owned = false;
32952 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32953 LDKUnsignedChannelUpdate msg_conv;
32954 msg_conv.inner = (void*)(msg & (~1));
32955 msg_conv.is_owned = false;
32956 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32957 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
32958 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
32959 return (uint64_t)ret_conv;
32962 uint32_t __attribute__((visibility("default"))) TS_ReadOnlyNetworkGraph_get_addresses(uint32_t this_arg, int8_tArray pubkey) {
32963 LDKReadOnlyNetworkGraph this_arg_conv;
32964 this_arg_conv.inner = (void*)(this_arg & (~1));
32965 this_arg_conv.is_owned = false;
32966 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32967 LDKPublicKey pubkey_ref;
32968 CHECK(pubkey->arr_len == 33);
32969 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33);
32970 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
32971 *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
32972 uint64_t ret_ref = (uint64_t)ret_copy;
32976 void __attribute__((visibility("default"))) TS_RouteHop_free(uint32_t this_obj) {
32977 LDKRouteHop this_obj_conv;
32978 this_obj_conv.inner = (void*)(this_obj & (~1));
32979 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32980 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32981 RouteHop_free(this_obj_conv);
32984 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) {
32985 LDKRouteHop this_ptr_conv;
32986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32987 this_ptr_conv.is_owned = false;
32988 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32989 int8_tArray ret_arr = init_int8_tArray(33);
32990 memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
32994 void __attribute__((visibility("default"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) {
32995 LDKRouteHop this_ptr_conv;
32996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32997 this_ptr_conv.is_owned = false;
32998 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32999 LDKPublicKey val_ref;
33000 CHECK(val->arr_len == 33);
33001 memcpy(val_ref.compressed_form, val->elems, 33);
33002 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
33005 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_node_features(uint32_t this_ptr) {
33006 LDKRouteHop this_ptr_conv;
33007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33008 this_ptr_conv.is_owned = false;
33009 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33010 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
33011 uint64_t ret_ref = 0;
33012 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33013 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33014 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33015 ret_ref = (uint64_t)ret_var.inner;
33016 if (ret_var.is_owned) {
33022 void __attribute__((visibility("default"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) {
33023 LDKRouteHop this_ptr_conv;
33024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33025 this_ptr_conv.is_owned = false;
33026 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33027 LDKNodeFeatures val_conv;
33028 val_conv.inner = (void*)(val & (~1));
33029 val_conv.is_owned = (val & 1) || (val == 0);
33030 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33031 val_conv = NodeFeatures_clone(&val_conv);
33032 RouteHop_set_node_features(&this_ptr_conv, val_conv);
33035 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) {
33036 LDKRouteHop this_ptr_conv;
33037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33038 this_ptr_conv.is_owned = false;
33039 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33040 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
33044 void __attribute__((visibility("default"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
33045 LDKRouteHop this_ptr_conv;
33046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33047 this_ptr_conv.is_owned = false;
33048 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33049 RouteHop_set_short_channel_id(&this_ptr_conv, val);
33052 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) {
33053 LDKRouteHop this_ptr_conv;
33054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33055 this_ptr_conv.is_owned = false;
33056 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33057 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
33058 uint64_t ret_ref = 0;
33059 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33060 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33061 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33062 ret_ref = (uint64_t)ret_var.inner;
33063 if (ret_var.is_owned) {
33069 void __attribute__((visibility("default"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) {
33070 LDKRouteHop this_ptr_conv;
33071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33072 this_ptr_conv.is_owned = false;
33073 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33074 LDKChannelFeatures val_conv;
33075 val_conv.inner = (void*)(val & (~1));
33076 val_conv.is_owned = (val & 1) || (val == 0);
33077 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33078 val_conv = ChannelFeatures_clone(&val_conv);
33079 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
33082 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) {
33083 LDKRouteHop this_ptr_conv;
33084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33085 this_ptr_conv.is_owned = false;
33086 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33087 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
33091 void __attribute__((visibility("default"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) {
33092 LDKRouteHop this_ptr_conv;
33093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33094 this_ptr_conv.is_owned = false;
33095 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33096 RouteHop_set_fee_msat(&this_ptr_conv, val);
33099 int32_t __attribute__((visibility("default"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) {
33100 LDKRouteHop this_ptr_conv;
33101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33102 this_ptr_conv.is_owned = false;
33103 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33104 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
33108 void __attribute__((visibility("default"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
33109 LDKRouteHop this_ptr_conv;
33110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33111 this_ptr_conv.is_owned = false;
33112 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33113 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
33116 uint32_t __attribute__((visibility("default"))) 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) {
33117 LDKPublicKey pubkey_arg_ref;
33118 CHECK(pubkey_arg->arr_len == 33);
33119 memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33);
33120 LDKNodeFeatures node_features_arg_conv;
33121 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
33122 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
33123 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
33124 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
33125 LDKChannelFeatures channel_features_arg_conv;
33126 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
33127 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
33128 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
33129 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
33130 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);
33131 uint64_t ret_ref = 0;
33132 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33133 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33134 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33135 ret_ref = (uint64_t)ret_var.inner;
33136 if (ret_var.is_owned) {
33142 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
33143 LDKRouteHop ret_var = RouteHop_clone(arg);
33144 uint64_t ret_ref = 0;
33145 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33146 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33147 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33148 ret_ref = (uint64_t)ret_var.inner;
33149 if (ret_var.is_owned) {
33154 int64_t __attribute__((visibility("default"))) TS_RouteHop_clone_ptr(uint32_t arg) {
33155 LDKRouteHop arg_conv;
33156 arg_conv.inner = (void*)(arg & (~1));
33157 arg_conv.is_owned = false;
33158 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33159 int64_t ret_val = RouteHop_clone_ptr(&arg_conv);
33163 uint32_t __attribute__((visibility("default"))) TS_RouteHop_clone(uint32_t orig) {
33164 LDKRouteHop orig_conv;
33165 orig_conv.inner = (void*)(orig & (~1));
33166 orig_conv.is_owned = false;
33167 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33168 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
33169 uint64_t ret_ref = 0;
33170 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33171 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33172 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33173 ret_ref = (uint64_t)ret_var.inner;
33174 if (ret_var.is_owned) {
33180 int64_t __attribute__((visibility("default"))) TS_RouteHop_hash(uint32_t o) {
33181 LDKRouteHop o_conv;
33182 o_conv.inner = (void*)(o & (~1));
33183 o_conv.is_owned = false;
33184 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33185 int64_t ret_val = RouteHop_hash(&o_conv);
33189 jboolean __attribute__((visibility("default"))) TS_RouteHop_eq(uint32_t a, uint32_t b) {
33190 LDKRouteHop a_conv;
33191 a_conv.inner = (void*)(a & (~1));
33192 a_conv.is_owned = false;
33193 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33194 LDKRouteHop b_conv;
33195 b_conv.inner = (void*)(b & (~1));
33196 b_conv.is_owned = false;
33197 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33198 jboolean ret_val = RouteHop_eq(&a_conv, &b_conv);
33202 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_write(uint32_t obj) {
33203 LDKRouteHop obj_conv;
33204 obj_conv.inner = (void*)(obj & (~1));
33205 obj_conv.is_owned = false;
33206 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33207 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
33208 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
33209 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33210 CVec_u8Z_free(ret_var);
33214 uint32_t __attribute__((visibility("default"))) TS_RouteHop_read(int8_tArray ser) {
33215 LDKu8slice ser_ref;
33216 ser_ref.datalen = ser->arr_len;
33217 ser_ref.data = ser->elems;
33218 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
33219 *ret_conv = RouteHop_read(ser_ref);
33220 return (uint64_t)ret_conv;
33223 void __attribute__((visibility("default"))) TS_Route_free(uint32_t this_obj) {
33224 LDKRoute this_obj_conv;
33225 this_obj_conv.inner = (void*)(this_obj & (~1));
33226 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33227 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33228 Route_free(this_obj_conv);
33231 ptrArray __attribute__((visibility("default"))) TS_Route_get_paths(uint32_t this_ptr) {
33232 LDKRoute this_ptr_conv;
33233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33234 this_ptr_conv.is_owned = false;
33235 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33236 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
33237 ptrArray ret_arr = NULL;
33238 ret_arr = init_ptrArray(ret_var.datalen);
33239 uint32_tArray *ret_arr_ptr = (uint32_tArray*)(ret_arr + 4);
33240 for (size_t m = 0; m < ret_var.datalen; m++) {
33241 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
33242 uint32_tArray ret_conv_12_arr = NULL;
33243 ret_conv_12_arr = init_uint32_tArray(ret_conv_12_var.datalen);
33244 uint32_t *ret_conv_12_arr_ptr = (uint32_t*)(ret_conv_12_arr + 4);
33245 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
33246 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
33247 uint64_t ret_conv_12_conv_10_ref = 0;
33248 CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33249 CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33250 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
33251 ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner;
33252 if (ret_conv_12_conv_10_var.is_owned) {
33253 ret_conv_12_conv_10_ref |= 1;
33255 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
33258 FREE(ret_conv_12_var.data);
33259 ret_arr_ptr[m] = ret_conv_12_arr;
33262 FREE(ret_var.data);
33266 void __attribute__((visibility("default"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) {
33267 LDKRoute this_ptr_conv;
33268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33269 this_ptr_conv.is_owned = false;
33270 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33271 LDKCVec_CVec_RouteHopZZ val_constr;
33272 val_constr.datalen = val->arr_len;
33273 if (val_constr.datalen > 0)
33274 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
33276 val_constr.data = NULL;
33277 uint32_tArray* val_vals = (void*) val->elems;
33278 for (size_t m = 0; m < val_constr.datalen; m++) {
33279 uint32_tArray val_conv_12 = val_vals[m];
33280 LDKCVec_RouteHopZ val_conv_12_constr;
33281 val_conv_12_constr.datalen = val_conv_12->arr_len;
33282 if (val_conv_12_constr.datalen > 0)
33283 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
33285 val_conv_12_constr.data = NULL;
33286 uint32_t* val_conv_12_vals = val_conv_12->elems;
33287 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
33288 uint32_t val_conv_12_conv_10 = val_conv_12_vals[k];
33289 LDKRouteHop val_conv_12_conv_10_conv;
33290 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
33291 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
33292 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
33293 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
33294 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
33296 val_constr.data[m] = val_conv_12_constr;
33298 Route_set_paths(&this_ptr_conv, val_constr);
33301 uint32_t __attribute__((visibility("default"))) TS_Route_get_payee(uint32_t this_ptr) {
33302 LDKRoute this_ptr_conv;
33303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33304 this_ptr_conv.is_owned = false;
33305 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33306 LDKPayee ret_var = Route_get_payee(&this_ptr_conv);
33307 uint64_t ret_ref = 0;
33308 if ((uint64_t)ret_var.inner > 4096) {
33309 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33310 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33311 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33312 ret_ref = (uint64_t)ret_var.inner;
33313 if (ret_var.is_owned) {
33320 void __attribute__((visibility("default"))) TS_Route_set_payee(uint32_t this_ptr, uint32_t val) {
33321 LDKRoute this_ptr_conv;
33322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33323 this_ptr_conv.is_owned = false;
33324 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33326 val_conv.inner = (void*)(val & (~1));
33327 val_conv.is_owned = (val & 1) || (val == 0);
33328 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33329 val_conv = Payee_clone(&val_conv);
33330 Route_set_payee(&this_ptr_conv, val_conv);
33333 uint32_t __attribute__((visibility("default"))) TS_Route_new(ptrArray paths_arg, uint32_t payee_arg) {
33334 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
33335 paths_arg_constr.datalen = paths_arg->arr_len;
33336 if (paths_arg_constr.datalen > 0)
33337 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
33339 paths_arg_constr.data = NULL;
33340 uint32_tArray* paths_arg_vals = (void*) paths_arg->elems;
33341 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
33342 uint32_tArray paths_arg_conv_12 = paths_arg_vals[m];
33343 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
33344 paths_arg_conv_12_constr.datalen = paths_arg_conv_12->arr_len;
33345 if (paths_arg_conv_12_constr.datalen > 0)
33346 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
33348 paths_arg_conv_12_constr.data = NULL;
33349 uint32_t* paths_arg_conv_12_vals = paths_arg_conv_12->elems;
33350 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
33351 uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
33352 LDKRouteHop paths_arg_conv_12_conv_10_conv;
33353 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
33354 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
33355 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
33356 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
33357 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
33359 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
33361 LDKPayee payee_arg_conv;
33362 payee_arg_conv.inner = (void*)(payee_arg & (~1));
33363 payee_arg_conv.is_owned = (payee_arg & 1) || (payee_arg == 0);
33364 CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_arg_conv);
33365 payee_arg_conv = Payee_clone(&payee_arg_conv);
33366 LDKRoute ret_var = Route_new(paths_arg_constr, payee_arg_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 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
33379 LDKRoute ret_var = Route_clone(arg);
33380 uint64_t ret_ref = 0;
33381 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33382 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33383 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33384 ret_ref = (uint64_t)ret_var.inner;
33385 if (ret_var.is_owned) {
33390 int64_t __attribute__((visibility("default"))) TS_Route_clone_ptr(uint32_t arg) {
33392 arg_conv.inner = (void*)(arg & (~1));
33393 arg_conv.is_owned = false;
33394 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33395 int64_t ret_val = Route_clone_ptr(&arg_conv);
33399 uint32_t __attribute__((visibility("default"))) TS_Route_clone(uint32_t orig) {
33400 LDKRoute orig_conv;
33401 orig_conv.inner = (void*)(orig & (~1));
33402 orig_conv.is_owned = false;
33403 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33404 LDKRoute ret_var = Route_clone(&orig_conv);
33405 uint64_t ret_ref = 0;
33406 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33407 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33408 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33409 ret_ref = (uint64_t)ret_var.inner;
33410 if (ret_var.is_owned) {
33416 int64_t __attribute__((visibility("default"))) TS_Route_hash(uint32_t o) {
33418 o_conv.inner = (void*)(o & (~1));
33419 o_conv.is_owned = false;
33420 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33421 int64_t ret_val = Route_hash(&o_conv);
33425 jboolean __attribute__((visibility("default"))) TS_Route_eq(uint32_t a, uint32_t b) {
33427 a_conv.inner = (void*)(a & (~1));
33428 a_conv.is_owned = false;
33429 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33431 b_conv.inner = (void*)(b & (~1));
33432 b_conv.is_owned = false;
33433 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33434 jboolean ret_val = Route_eq(&a_conv, &b_conv);
33438 int64_t __attribute__((visibility("default"))) TS_Route_get_total_fees(uint32_t this_arg) {
33439 LDKRoute this_arg_conv;
33440 this_arg_conv.inner = (void*)(this_arg & (~1));
33441 this_arg_conv.is_owned = false;
33442 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33443 int64_t ret_val = Route_get_total_fees(&this_arg_conv);
33447 int64_t __attribute__((visibility("default"))) TS_Route_get_total_amount(uint32_t this_arg) {
33448 LDKRoute this_arg_conv;
33449 this_arg_conv.inner = (void*)(this_arg & (~1));
33450 this_arg_conv.is_owned = false;
33451 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33452 int64_t ret_val = Route_get_total_amount(&this_arg_conv);
33456 int8_tArray __attribute__((visibility("default"))) TS_Route_write(uint32_t obj) {
33458 obj_conv.inner = (void*)(obj & (~1));
33459 obj_conv.is_owned = false;
33460 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33461 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
33462 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
33463 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33464 CVec_u8Z_free(ret_var);
33468 uint32_t __attribute__((visibility("default"))) TS_Route_read(int8_tArray ser) {
33469 LDKu8slice ser_ref;
33470 ser_ref.datalen = ser->arr_len;
33471 ser_ref.data = ser->elems;
33472 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
33473 *ret_conv = Route_read(ser_ref);
33474 return (uint64_t)ret_conv;
33477 void __attribute__((visibility("default"))) TS_RouteParameters_free(uint32_t this_obj) {
33478 LDKRouteParameters this_obj_conv;
33479 this_obj_conv.inner = (void*)(this_obj & (~1));
33480 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33481 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33482 RouteParameters_free(this_obj_conv);
33485 uint32_t __attribute__((visibility("default"))) TS_RouteParameters_get_payee(uint32_t this_ptr) {
33486 LDKRouteParameters this_ptr_conv;
33487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33488 this_ptr_conv.is_owned = false;
33489 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33490 LDKPayee ret_var = RouteParameters_get_payee(&this_ptr_conv);
33491 uint64_t ret_ref = 0;
33492 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33493 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33494 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33495 ret_ref = (uint64_t)ret_var.inner;
33496 if (ret_var.is_owned) {
33502 void __attribute__((visibility("default"))) TS_RouteParameters_set_payee(uint32_t this_ptr, uint32_t val) {
33503 LDKRouteParameters this_ptr_conv;
33504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33505 this_ptr_conv.is_owned = false;
33506 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33508 val_conv.inner = (void*)(val & (~1));
33509 val_conv.is_owned = (val & 1) || (val == 0);
33510 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33511 val_conv = Payee_clone(&val_conv);
33512 RouteParameters_set_payee(&this_ptr_conv, val_conv);
33515 int64_t __attribute__((visibility("default"))) TS_RouteParameters_get_final_value_msat(uint32_t this_ptr) {
33516 LDKRouteParameters this_ptr_conv;
33517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33518 this_ptr_conv.is_owned = false;
33519 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33520 int64_t ret_val = RouteParameters_get_final_value_msat(&this_ptr_conv);
33524 void __attribute__((visibility("default"))) TS_RouteParameters_set_final_value_msat(uint32_t this_ptr, int64_t val) {
33525 LDKRouteParameters this_ptr_conv;
33526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33527 this_ptr_conv.is_owned = false;
33528 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33529 RouteParameters_set_final_value_msat(&this_ptr_conv, val);
33532 int32_t __attribute__((visibility("default"))) TS_RouteParameters_get_final_cltv_expiry_delta(uint32_t this_ptr) {
33533 LDKRouteParameters this_ptr_conv;
33534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33535 this_ptr_conv.is_owned = false;
33536 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33537 int32_t ret_val = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
33541 void __attribute__((visibility("default"))) TS_RouteParameters_set_final_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
33542 LDKRouteParameters this_ptr_conv;
33543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33544 this_ptr_conv.is_owned = false;
33545 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33546 RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
33549 uint32_t __attribute__((visibility("default"))) TS_RouteParameters_new(uint32_t payee_arg, int64_t final_value_msat_arg, int32_t final_cltv_expiry_delta_arg) {
33550 LDKPayee payee_arg_conv;
33551 payee_arg_conv.inner = (void*)(payee_arg & (~1));
33552 payee_arg_conv.is_owned = (payee_arg & 1) || (payee_arg == 0);
33553 CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_arg_conv);
33554 payee_arg_conv = Payee_clone(&payee_arg_conv);
33555 LDKRouteParameters ret_var = RouteParameters_new(payee_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
33556 uint64_t ret_ref = 0;
33557 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33558 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33559 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33560 ret_ref = (uint64_t)ret_var.inner;
33561 if (ret_var.is_owned) {
33567 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
33568 LDKRouteParameters ret_var = RouteParameters_clone(arg);
33569 uint64_t ret_ref = 0;
33570 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33571 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33572 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33573 ret_ref = (uint64_t)ret_var.inner;
33574 if (ret_var.is_owned) {
33579 int64_t __attribute__((visibility("default"))) TS_RouteParameters_clone_ptr(uint32_t arg) {
33580 LDKRouteParameters arg_conv;
33581 arg_conv.inner = (void*)(arg & (~1));
33582 arg_conv.is_owned = false;
33583 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33584 int64_t ret_val = RouteParameters_clone_ptr(&arg_conv);
33588 uint32_t __attribute__((visibility("default"))) TS_RouteParameters_clone(uint32_t orig) {
33589 LDKRouteParameters orig_conv;
33590 orig_conv.inner = (void*)(orig & (~1));
33591 orig_conv.is_owned = false;
33592 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33593 LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
33594 uint64_t ret_ref = 0;
33595 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33596 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33597 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33598 ret_ref = (uint64_t)ret_var.inner;
33599 if (ret_var.is_owned) {
33605 int8_tArray __attribute__((visibility("default"))) TS_RouteParameters_write(uint32_t obj) {
33606 LDKRouteParameters obj_conv;
33607 obj_conv.inner = (void*)(obj & (~1));
33608 obj_conv.is_owned = false;
33609 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33610 LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
33611 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
33612 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33613 CVec_u8Z_free(ret_var);
33617 uint32_t __attribute__((visibility("default"))) TS_RouteParameters_read(int8_tArray ser) {
33618 LDKu8slice ser_ref;
33619 ser_ref.datalen = ser->arr_len;
33620 ser_ref.data = ser->elems;
33621 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
33622 *ret_conv = RouteParameters_read(ser_ref);
33623 return (uint64_t)ret_conv;
33626 void __attribute__((visibility("default"))) TS_Payee_free(uint32_t this_obj) {
33627 LDKPayee this_obj_conv;
33628 this_obj_conv.inner = (void*)(this_obj & (~1));
33629 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33630 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33631 Payee_free(this_obj_conv);
33634 int8_tArray __attribute__((visibility("default"))) TS_Payee_get_pubkey(uint32_t this_ptr) {
33635 LDKPayee this_ptr_conv;
33636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33637 this_ptr_conv.is_owned = false;
33638 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33639 int8_tArray ret_arr = init_int8_tArray(33);
33640 memcpy(ret_arr->elems, Payee_get_pubkey(&this_ptr_conv).compressed_form, 33);
33644 void __attribute__((visibility("default"))) TS_Payee_set_pubkey(uint32_t this_ptr, int8_tArray val) {
33645 LDKPayee this_ptr_conv;
33646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33647 this_ptr_conv.is_owned = false;
33648 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33649 LDKPublicKey val_ref;
33650 CHECK(val->arr_len == 33);
33651 memcpy(val_ref.compressed_form, val->elems, 33);
33652 Payee_set_pubkey(&this_ptr_conv, val_ref);
33655 uint32_t __attribute__((visibility("default"))) TS_Payee_get_features(uint32_t this_ptr) {
33656 LDKPayee this_ptr_conv;
33657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33658 this_ptr_conv.is_owned = false;
33659 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33660 LDKInvoiceFeatures ret_var = Payee_get_features(&this_ptr_conv);
33661 uint64_t ret_ref = 0;
33662 if ((uint64_t)ret_var.inner > 4096) {
33663 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33664 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33665 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33666 ret_ref = (uint64_t)ret_var.inner;
33667 if (ret_var.is_owned) {
33674 void __attribute__((visibility("default"))) TS_Payee_set_features(uint32_t this_ptr, uint32_t val) {
33675 LDKPayee this_ptr_conv;
33676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33677 this_ptr_conv.is_owned = false;
33678 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33679 LDKInvoiceFeatures val_conv;
33680 val_conv.inner = (void*)(val & (~1));
33681 val_conv.is_owned = (val & 1) || (val == 0);
33682 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33683 val_conv = InvoiceFeatures_clone(&val_conv);
33684 Payee_set_features(&this_ptr_conv, val_conv);
33687 uint32_tArray __attribute__((visibility("default"))) TS_Payee_get_route_hints(uint32_t this_ptr) {
33688 LDKPayee this_ptr_conv;
33689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33690 this_ptr_conv.is_owned = false;
33691 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33692 LDKCVec_RouteHintZ ret_var = Payee_get_route_hints(&this_ptr_conv);
33693 uint32_tArray ret_arr = NULL;
33694 ret_arr = init_uint32_tArray(ret_var.datalen);
33695 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
33696 for (size_t l = 0; l < ret_var.datalen; l++) {
33697 LDKRouteHint ret_conv_11_var = ret_var.data[l];
33698 uint64_t ret_conv_11_ref = 0;
33699 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33700 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33701 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
33702 ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
33703 if (ret_conv_11_var.is_owned) {
33704 ret_conv_11_ref |= 1;
33706 ret_arr_ptr[l] = ret_conv_11_ref;
33709 FREE(ret_var.data);
33713 void __attribute__((visibility("default"))) TS_Payee_set_route_hints(uint32_t this_ptr, uint32_tArray val) {
33714 LDKPayee this_ptr_conv;
33715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33716 this_ptr_conv.is_owned = false;
33717 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33718 LDKCVec_RouteHintZ val_constr;
33719 val_constr.datalen = val->arr_len;
33720 if (val_constr.datalen > 0)
33721 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
33723 val_constr.data = NULL;
33724 uint32_t* val_vals = val->elems;
33725 for (size_t l = 0; l < val_constr.datalen; l++) {
33726 uint32_t val_conv_11 = val_vals[l];
33727 LDKRouteHint val_conv_11_conv;
33728 val_conv_11_conv.inner = (void*)(val_conv_11 & (~1));
33729 val_conv_11_conv.is_owned = (val_conv_11 & 1) || (val_conv_11 == 0);
33730 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
33731 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
33732 val_constr.data[l] = val_conv_11_conv;
33734 Payee_set_route_hints(&this_ptr_conv, val_constr);
33737 uint32_t __attribute__((visibility("default"))) TS_Payee_get_expiry_time(uint32_t this_ptr) {
33738 LDKPayee this_ptr_conv;
33739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33740 this_ptr_conv.is_owned = false;
33741 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33742 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
33743 *ret_copy = Payee_get_expiry_time(&this_ptr_conv);
33744 uint64_t ret_ref = (uint64_t)ret_copy;
33748 void __attribute__((visibility("default"))) TS_Payee_set_expiry_time(uint32_t this_ptr, uint32_t val) {
33749 LDKPayee this_ptr_conv;
33750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33751 this_ptr_conv.is_owned = false;
33752 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33753 void* val_ptr = (void*)(((uint64_t)val) & ~1);
33754 CHECK_ACCESS(val_ptr);
33755 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
33756 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
33757 Payee_set_expiry_time(&this_ptr_conv, val_conv);
33760 uint32_t __attribute__((visibility("default"))) TS_Payee_new(int8_tArray pubkey_arg, uint32_t features_arg, uint32_tArray route_hints_arg, uint32_t expiry_time_arg) {
33761 LDKPublicKey pubkey_arg_ref;
33762 CHECK(pubkey_arg->arr_len == 33);
33763 memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33);
33764 LDKInvoiceFeatures features_arg_conv;
33765 features_arg_conv.inner = (void*)(features_arg & (~1));
33766 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
33767 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
33768 features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
33769 LDKCVec_RouteHintZ route_hints_arg_constr;
33770 route_hints_arg_constr.datalen = route_hints_arg->arr_len;
33771 if (route_hints_arg_constr.datalen > 0)
33772 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
33774 route_hints_arg_constr.data = NULL;
33775 uint32_t* route_hints_arg_vals = route_hints_arg->elems;
33776 for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
33777 uint32_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
33778 LDKRouteHint route_hints_arg_conv_11_conv;
33779 route_hints_arg_conv_11_conv.inner = (void*)(route_hints_arg_conv_11 & (~1));
33780 route_hints_arg_conv_11_conv.is_owned = (route_hints_arg_conv_11 & 1) || (route_hints_arg_conv_11 == 0);
33781 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
33782 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
33783 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
33785 void* expiry_time_arg_ptr = (void*)(((uint64_t)expiry_time_arg) & ~1);
33786 CHECK_ACCESS(expiry_time_arg_ptr);
33787 LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
33788 expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)expiry_time_arg) & ~1));
33789 LDKPayee ret_var = Payee_new(pubkey_arg_ref, features_arg_conv, route_hints_arg_constr, expiry_time_arg_conv);
33790 uint64_t ret_ref = 0;
33791 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33792 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33793 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33794 ret_ref = (uint64_t)ret_var.inner;
33795 if (ret_var.is_owned) {
33801 static inline uint64_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
33802 LDKPayee ret_var = Payee_clone(arg);
33803 uint64_t ret_ref = 0;
33804 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33805 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33806 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33807 ret_ref = (uint64_t)ret_var.inner;
33808 if (ret_var.is_owned) {
33813 int64_t __attribute__((visibility("default"))) TS_Payee_clone_ptr(uint32_t arg) {
33815 arg_conv.inner = (void*)(arg & (~1));
33816 arg_conv.is_owned = false;
33817 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33818 int64_t ret_val = Payee_clone_ptr(&arg_conv);
33822 uint32_t __attribute__((visibility("default"))) TS_Payee_clone(uint32_t orig) {
33823 LDKPayee orig_conv;
33824 orig_conv.inner = (void*)(orig & (~1));
33825 orig_conv.is_owned = false;
33826 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33827 LDKPayee ret_var = Payee_clone(&orig_conv);
33828 uint64_t ret_ref = 0;
33829 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33830 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33831 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33832 ret_ref = (uint64_t)ret_var.inner;
33833 if (ret_var.is_owned) {
33839 int64_t __attribute__((visibility("default"))) TS_Payee_hash(uint32_t o) {
33841 o_conv.inner = (void*)(o & (~1));
33842 o_conv.is_owned = false;
33843 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33844 int64_t ret_val = Payee_hash(&o_conv);
33848 jboolean __attribute__((visibility("default"))) TS_Payee_eq(uint32_t a, uint32_t b) {
33850 a_conv.inner = (void*)(a & (~1));
33851 a_conv.is_owned = false;
33852 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33854 b_conv.inner = (void*)(b & (~1));
33855 b_conv.is_owned = false;
33856 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33857 jboolean ret_val = Payee_eq(&a_conv, &b_conv);
33861 int8_tArray __attribute__((visibility("default"))) TS_Payee_write(uint32_t obj) {
33863 obj_conv.inner = (void*)(obj & (~1));
33864 obj_conv.is_owned = false;
33865 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33866 LDKCVec_u8Z ret_var = Payee_write(&obj_conv);
33867 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
33868 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33869 CVec_u8Z_free(ret_var);
33873 uint32_t __attribute__((visibility("default"))) TS_Payee_read(int8_tArray ser) {
33874 LDKu8slice ser_ref;
33875 ser_ref.datalen = ser->arr_len;
33876 ser_ref.data = ser->elems;
33877 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
33878 *ret_conv = Payee_read(ser_ref);
33879 return (uint64_t)ret_conv;
33882 uint32_t __attribute__((visibility("default"))) TS_Payee_from_node_id(int8_tArray pubkey) {
33883 LDKPublicKey pubkey_ref;
33884 CHECK(pubkey->arr_len == 33);
33885 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33);
33886 LDKPayee ret_var = Payee_from_node_id(pubkey_ref);
33887 uint64_t ret_ref = 0;
33888 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33889 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33890 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33891 ret_ref = (uint64_t)ret_var.inner;
33892 if (ret_var.is_owned) {
33898 uint32_t __attribute__((visibility("default"))) TS_Payee_for_keysend(int8_tArray pubkey) {
33899 LDKPublicKey pubkey_ref;
33900 CHECK(pubkey->arr_len == 33);
33901 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33);
33902 LDKPayee ret_var = Payee_for_keysend(pubkey_ref);
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 void __attribute__((visibility("default"))) TS_RouteHint_free(uint32_t this_obj) {
33915 LDKRouteHint this_obj_conv;
33916 this_obj_conv.inner = (void*)(this_obj & (~1));
33917 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33918 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33919 RouteHint_free(this_obj_conv);
33922 uint32_tArray __attribute__((visibility("default"))) TS_RouteHint_get_a(uint32_t this_ptr) {
33923 LDKRouteHint this_ptr_conv;
33924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33925 this_ptr_conv.is_owned = false;
33926 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33927 LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
33928 uint32_tArray ret_arr = NULL;
33929 ret_arr = init_uint32_tArray(ret_var.datalen);
33930 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
33931 for (size_t o = 0; o < ret_var.datalen; o++) {
33932 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
33933 uint64_t ret_conv_14_ref = 0;
33934 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33935 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33936 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
33937 ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
33938 if (ret_conv_14_var.is_owned) {
33939 ret_conv_14_ref |= 1;
33941 ret_arr_ptr[o] = ret_conv_14_ref;
33944 FREE(ret_var.data);
33948 void __attribute__((visibility("default"))) TS_RouteHint_set_a(uint32_t this_ptr, uint32_tArray val) {
33949 LDKRouteHint this_ptr_conv;
33950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33951 this_ptr_conv.is_owned = false;
33952 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33953 LDKCVec_RouteHintHopZ val_constr;
33954 val_constr.datalen = val->arr_len;
33955 if (val_constr.datalen > 0)
33956 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
33958 val_constr.data = NULL;
33959 uint32_t* val_vals = val->elems;
33960 for (size_t o = 0; o < val_constr.datalen; o++) {
33961 uint32_t val_conv_14 = val_vals[o];
33962 LDKRouteHintHop val_conv_14_conv;
33963 val_conv_14_conv.inner = (void*)(val_conv_14 & (~1));
33964 val_conv_14_conv.is_owned = (val_conv_14 & 1) || (val_conv_14 == 0);
33965 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
33966 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
33967 val_constr.data[o] = val_conv_14_conv;
33969 RouteHint_set_a(&this_ptr_conv, val_constr);
33972 uint32_t __attribute__((visibility("default"))) TS_RouteHint_new(uint32_tArray a_arg) {
33973 LDKCVec_RouteHintHopZ a_arg_constr;
33974 a_arg_constr.datalen = a_arg->arr_len;
33975 if (a_arg_constr.datalen > 0)
33976 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
33978 a_arg_constr.data = NULL;
33979 uint32_t* a_arg_vals = a_arg->elems;
33980 for (size_t o = 0; o < a_arg_constr.datalen; o++) {
33981 uint32_t a_arg_conv_14 = a_arg_vals[o];
33982 LDKRouteHintHop a_arg_conv_14_conv;
33983 a_arg_conv_14_conv.inner = (void*)(a_arg_conv_14 & (~1));
33984 a_arg_conv_14_conv.is_owned = (a_arg_conv_14 & 1) || (a_arg_conv_14 == 0);
33985 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
33986 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
33987 a_arg_constr.data[o] = a_arg_conv_14_conv;
33989 LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
33990 uint64_t ret_ref = 0;
33991 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33992 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33993 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33994 ret_ref = (uint64_t)ret_var.inner;
33995 if (ret_var.is_owned) {
34001 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
34002 LDKRouteHint ret_var = RouteHint_clone(arg);
34003 uint64_t ret_ref = 0;
34004 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34005 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34006 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34007 ret_ref = (uint64_t)ret_var.inner;
34008 if (ret_var.is_owned) {
34013 int64_t __attribute__((visibility("default"))) TS_RouteHint_clone_ptr(uint32_t arg) {
34014 LDKRouteHint arg_conv;
34015 arg_conv.inner = (void*)(arg & (~1));
34016 arg_conv.is_owned = false;
34017 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34018 int64_t ret_val = RouteHint_clone_ptr(&arg_conv);
34022 uint32_t __attribute__((visibility("default"))) TS_RouteHint_clone(uint32_t orig) {
34023 LDKRouteHint orig_conv;
34024 orig_conv.inner = (void*)(orig & (~1));
34025 orig_conv.is_owned = false;
34026 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34027 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
34028 uint64_t ret_ref = 0;
34029 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34030 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34031 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34032 ret_ref = (uint64_t)ret_var.inner;
34033 if (ret_var.is_owned) {
34039 int64_t __attribute__((visibility("default"))) TS_RouteHint_hash(uint32_t o) {
34040 LDKRouteHint o_conv;
34041 o_conv.inner = (void*)(o & (~1));
34042 o_conv.is_owned = false;
34043 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34044 int64_t ret_val = RouteHint_hash(&o_conv);
34048 jboolean __attribute__((visibility("default"))) TS_RouteHint_eq(uint32_t a, uint32_t b) {
34049 LDKRouteHint a_conv;
34050 a_conv.inner = (void*)(a & (~1));
34051 a_conv.is_owned = false;
34052 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34053 LDKRouteHint b_conv;
34054 b_conv.inner = (void*)(b & (~1));
34055 b_conv.is_owned = false;
34056 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34057 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
34061 int8_tArray __attribute__((visibility("default"))) TS_RouteHint_write(uint32_t obj) {
34062 LDKRouteHint obj_conv;
34063 obj_conv.inner = (void*)(obj & (~1));
34064 obj_conv.is_owned = false;
34065 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34066 LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
34067 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
34068 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34069 CVec_u8Z_free(ret_var);
34073 uint32_t __attribute__((visibility("default"))) TS_RouteHint_read(int8_tArray ser) {
34074 LDKu8slice ser_ref;
34075 ser_ref.datalen = ser->arr_len;
34076 ser_ref.data = ser->elems;
34077 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
34078 *ret_conv = RouteHint_read(ser_ref);
34079 return (uint64_t)ret_conv;
34082 void __attribute__((visibility("default"))) TS_RouteHintHop_free(uint32_t this_obj) {
34083 LDKRouteHintHop this_obj_conv;
34084 this_obj_conv.inner = (void*)(this_obj & (~1));
34085 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34086 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34087 RouteHintHop_free(this_obj_conv);
34090 int8_tArray __attribute__((visibility("default"))) TS_RouteHintHop_get_src_node_id(uint32_t this_ptr) {
34091 LDKRouteHintHop this_ptr_conv;
34092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34093 this_ptr_conv.is_owned = false;
34094 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34095 int8_tArray ret_arr = init_int8_tArray(33);
34096 memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
34100 void __attribute__((visibility("default"))) TS_RouteHintHop_set_src_node_id(uint32_t this_ptr, int8_tArray val) {
34101 LDKRouteHintHop this_ptr_conv;
34102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34103 this_ptr_conv.is_owned = false;
34104 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34105 LDKPublicKey val_ref;
34106 CHECK(val->arr_len == 33);
34107 memcpy(val_ref.compressed_form, val->elems, 33);
34108 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
34111 int64_t __attribute__((visibility("default"))) TS_RouteHintHop_get_short_channel_id(uint32_t this_ptr) {
34112 LDKRouteHintHop this_ptr_conv;
34113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34114 this_ptr_conv.is_owned = false;
34115 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34116 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
34120 void __attribute__((visibility("default"))) TS_RouteHintHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
34121 LDKRouteHintHop this_ptr_conv;
34122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34123 this_ptr_conv.is_owned = false;
34124 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34125 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
34128 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_fees(uint32_t this_ptr) {
34129 LDKRouteHintHop this_ptr_conv;
34130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34131 this_ptr_conv.is_owned = false;
34132 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34133 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
34134 uint64_t ret_ref = 0;
34135 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34136 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34137 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34138 ret_ref = (uint64_t)ret_var.inner;
34139 if (ret_var.is_owned) {
34145 void __attribute__((visibility("default"))) TS_RouteHintHop_set_fees(uint32_t this_ptr, uint32_t val) {
34146 LDKRouteHintHop this_ptr_conv;
34147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34148 this_ptr_conv.is_owned = false;
34149 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34150 LDKRoutingFees val_conv;
34151 val_conv.inner = (void*)(val & (~1));
34152 val_conv.is_owned = (val & 1) || (val == 0);
34153 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34154 val_conv = RoutingFees_clone(&val_conv);
34155 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
34158 int16_t __attribute__((visibility("default"))) TS_RouteHintHop_get_cltv_expiry_delta(uint32_t this_ptr) {
34159 LDKRouteHintHop this_ptr_conv;
34160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34161 this_ptr_conv.is_owned = false;
34162 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34163 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
34167 void __attribute__((visibility("default"))) TS_RouteHintHop_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
34168 LDKRouteHintHop this_ptr_conv;
34169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34170 this_ptr_conv.is_owned = false;
34171 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34172 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
34175 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_minimum_msat(uint32_t this_ptr) {
34176 LDKRouteHintHop this_ptr_conv;
34177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34178 this_ptr_conv.is_owned = false;
34179 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34180 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34181 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
34182 uint64_t ret_ref = (uint64_t)ret_copy;
34186 void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_minimum_msat(uint32_t this_ptr, uint32_t val) {
34187 LDKRouteHintHop this_ptr_conv;
34188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34189 this_ptr_conv.is_owned = false;
34190 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34191 void* val_ptr = (void*)(((uint64_t)val) & ~1);
34192 CHECK_ACCESS(val_ptr);
34193 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34194 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
34195 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
34198 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_maximum_msat(uint32_t this_ptr) {
34199 LDKRouteHintHop this_ptr_conv;
34200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34201 this_ptr_conv.is_owned = false;
34202 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34203 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34204 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
34205 uint64_t ret_ref = (uint64_t)ret_copy;
34209 void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
34210 LDKRouteHintHop this_ptr_conv;
34211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34212 this_ptr_conv.is_owned = false;
34213 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34214 void* val_ptr = (void*)(((uint64_t)val) & ~1);
34215 CHECK_ACCESS(val_ptr);
34216 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34217 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
34218 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
34221 uint32_t __attribute__((visibility("default"))) 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) {
34222 LDKPublicKey src_node_id_arg_ref;
34223 CHECK(src_node_id_arg->arr_len == 33);
34224 memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33);
34225 LDKRoutingFees fees_arg_conv;
34226 fees_arg_conv.inner = (void*)(fees_arg & (~1));
34227 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
34228 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
34229 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
34230 void* htlc_minimum_msat_arg_ptr = (void*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
34231 CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
34232 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
34233 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1));
34234 void* htlc_maximum_msat_arg_ptr = (void*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
34235 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
34236 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
34237 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
34238 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);
34239 uint64_t ret_ref = 0;
34240 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34241 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34242 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34243 ret_ref = (uint64_t)ret_var.inner;
34244 if (ret_var.is_owned) {
34250 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
34251 LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
34252 uint64_t ret_ref = 0;
34253 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34254 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34255 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34256 ret_ref = (uint64_t)ret_var.inner;
34257 if (ret_var.is_owned) {
34262 int64_t __attribute__((visibility("default"))) TS_RouteHintHop_clone_ptr(uint32_t arg) {
34263 LDKRouteHintHop arg_conv;
34264 arg_conv.inner = (void*)(arg & (~1));
34265 arg_conv.is_owned = false;
34266 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34267 int64_t ret_val = RouteHintHop_clone_ptr(&arg_conv);
34271 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_clone(uint32_t orig) {
34272 LDKRouteHintHop orig_conv;
34273 orig_conv.inner = (void*)(orig & (~1));
34274 orig_conv.is_owned = false;
34275 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34276 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
34277 uint64_t ret_ref = 0;
34278 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34279 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34280 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34281 ret_ref = (uint64_t)ret_var.inner;
34282 if (ret_var.is_owned) {
34288 int64_t __attribute__((visibility("default"))) TS_RouteHintHop_hash(uint32_t o) {
34289 LDKRouteHintHop o_conv;
34290 o_conv.inner = (void*)(o & (~1));
34291 o_conv.is_owned = false;
34292 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34293 int64_t ret_val = RouteHintHop_hash(&o_conv);
34297 jboolean __attribute__((visibility("default"))) TS_RouteHintHop_eq(uint32_t a, uint32_t b) {
34298 LDKRouteHintHop a_conv;
34299 a_conv.inner = (void*)(a & (~1));
34300 a_conv.is_owned = false;
34301 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34302 LDKRouteHintHop b_conv;
34303 b_conv.inner = (void*)(b & (~1));
34304 b_conv.is_owned = false;
34305 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34306 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
34310 int8_tArray __attribute__((visibility("default"))) TS_RouteHintHop_write(uint32_t obj) {
34311 LDKRouteHintHop obj_conv;
34312 obj_conv.inner = (void*)(obj & (~1));
34313 obj_conv.is_owned = false;
34314 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34315 LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
34316 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
34317 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34318 CVec_u8Z_free(ret_var);
34322 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_read(int8_tArray ser) {
34323 LDKu8slice ser_ref;
34324 ser_ref.datalen = ser->arr_len;
34325 ser_ref.data = ser->elems;
34326 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
34327 *ret_conv = RouteHintHop_read(ser_ref);
34328 return (uint64_t)ret_conv;
34331 uint32_t __attribute__((visibility("default"))) TS_find_route(int8_tArray our_node_pubkey, uint32_t params, uint32_t network, uint32_tArray first_hops, uint32_t logger, uint32_t scorer) {
34332 LDKPublicKey our_node_pubkey_ref;
34333 CHECK(our_node_pubkey->arr_len == 33);
34334 memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33);
34335 LDKRouteParameters params_conv;
34336 params_conv.inner = (void*)(params & (~1));
34337 params_conv.is_owned = false;
34338 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
34339 LDKNetworkGraph network_conv;
34340 network_conv.inner = (void*)(network & (~1));
34341 network_conv.is_owned = false;
34342 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_conv);
34343 LDKCVec_ChannelDetailsZ first_hops_constr;
34344 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
34345 if (first_hops != 0) {
34346 first_hops_constr.datalen = first_hops->arr_len;
34347 if (first_hops_constr.datalen > 0)
34348 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
34350 first_hops_constr.data = NULL;
34351 uint32_t* first_hops_vals = first_hops->elems;
34352 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
34353 uint32_t first_hops_conv_16 = first_hops_vals[q];
34354 LDKChannelDetails first_hops_conv_16_conv;
34355 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
34356 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
34357 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
34358 first_hops_constr.data[q] = first_hops_conv_16_conv;
34360 first_hops_ptr = &first_hops_constr;
34362 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
34363 CHECK_ACCESS(logger_ptr);
34364 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
34365 void* scorer_ptr = (void*)(((uint64_t)scorer) & ~1);
34366 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
34367 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
34368 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
34369 *ret_conv = find_route(our_node_pubkey_ref, ¶ms_conv, &network_conv, first_hops_ptr, logger_conv, scorer_conv);
34370 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
34371 return (uint64_t)ret_conv;
34374 void __attribute__((visibility("default"))) TS_Score_free(uint32_t this_ptr) {
34375 if ((this_ptr & 1) != 0) return;
34376 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
34377 CHECK_ACCESS(this_ptr_ptr);
34378 LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
34379 FREE((void*)this_ptr);
34380 Score_free(this_ptr_conv);
34383 void __attribute__((visibility("default"))) TS_LockableScore_free(uint32_t this_ptr) {
34384 if ((this_ptr & 1) != 0) return;
34385 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
34386 CHECK_ACCESS(this_ptr_ptr);
34387 LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
34388 FREE((void*)this_ptr);
34389 LockableScore_free(this_ptr_conv);
34392 void __attribute__((visibility("default"))) TS_MultiThreadedLockableScore_free(uint32_t this_obj) {
34393 LDKMultiThreadedLockableScore this_obj_conv;
34394 this_obj_conv.inner = (void*)(this_obj & (~1));
34395 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34396 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34397 MultiThreadedLockableScore_free(this_obj_conv);
34400 uint32_t __attribute__((visibility("default"))) TS_MultiThreadedLockableScore_new(uint32_t score) {
34401 void* score_ptr = (void*)(((uint64_t)score) & ~1);
34402 CHECK_ACCESS(score_ptr);
34403 LDKScore score_conv = *(LDKScore*)(score_ptr);
34404 LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
34405 uint64_t ret_ref = 0;
34406 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34407 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34408 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34409 ret_ref = (uint64_t)ret_var.inner;
34410 if (ret_var.is_owned) {
34416 void __attribute__((visibility("default"))) TS_ScoringParameters_free(uint32_t this_obj) {
34417 LDKScoringParameters this_obj_conv;
34418 this_obj_conv.inner = (void*)(this_obj & (~1));
34419 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34420 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34421 ScoringParameters_free(this_obj_conv);
34424 int64_t __attribute__((visibility("default"))) TS_ScoringParameters_get_base_penalty_msat(uint32_t this_ptr) {
34425 LDKScoringParameters this_ptr_conv;
34426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34427 this_ptr_conv.is_owned = false;
34428 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34429 int64_t ret_val = ScoringParameters_get_base_penalty_msat(&this_ptr_conv);
34433 void __attribute__((visibility("default"))) TS_ScoringParameters_set_base_penalty_msat(uint32_t this_ptr, int64_t val) {
34434 LDKScoringParameters this_ptr_conv;
34435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34436 this_ptr_conv.is_owned = false;
34437 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34438 ScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
34441 int64_t __attribute__((visibility("default"))) TS_ScoringParameters_get_failure_penalty_msat(uint32_t this_ptr) {
34442 LDKScoringParameters this_ptr_conv;
34443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34444 this_ptr_conv.is_owned = false;
34445 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34446 int64_t ret_val = ScoringParameters_get_failure_penalty_msat(&this_ptr_conv);
34450 void __attribute__((visibility("default"))) TS_ScoringParameters_set_failure_penalty_msat(uint32_t this_ptr, int64_t val) {
34451 LDKScoringParameters this_ptr_conv;
34452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34453 this_ptr_conv.is_owned = false;
34454 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34455 ScoringParameters_set_failure_penalty_msat(&this_ptr_conv, val);
34458 int16_t __attribute__((visibility("default"))) TS_ScoringParameters_get_overuse_penalty_start_1024th(uint32_t this_ptr) {
34459 LDKScoringParameters this_ptr_conv;
34460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34461 this_ptr_conv.is_owned = false;
34462 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34463 int16_t ret_val = ScoringParameters_get_overuse_penalty_start_1024th(&this_ptr_conv);
34467 void __attribute__((visibility("default"))) TS_ScoringParameters_set_overuse_penalty_start_1024th(uint32_t this_ptr, int16_t val) {
34468 LDKScoringParameters 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 ScoringParameters_set_overuse_penalty_start_1024th(&this_ptr_conv, val);
34475 int64_t __attribute__((visibility("default"))) TS_ScoringParameters_get_overuse_penalty_msat_per_1024th(uint32_t this_ptr) {
34476 LDKScoringParameters this_ptr_conv;
34477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34478 this_ptr_conv.is_owned = false;
34479 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34480 int64_t ret_val = ScoringParameters_get_overuse_penalty_msat_per_1024th(&this_ptr_conv);
34484 void __attribute__((visibility("default"))) TS_ScoringParameters_set_overuse_penalty_msat_per_1024th(uint32_t this_ptr, int64_t val) {
34485 LDKScoringParameters 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 ScoringParameters_set_overuse_penalty_msat_per_1024th(&this_ptr_conv, val);
34492 int64_t __attribute__((visibility("default"))) TS_ScoringParameters_get_failure_penalty_half_life(uint32_t this_ptr) {
34493 LDKScoringParameters this_ptr_conv;
34494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34495 this_ptr_conv.is_owned = false;
34496 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34497 int64_t ret_val = ScoringParameters_get_failure_penalty_half_life(&this_ptr_conv);
34501 void __attribute__((visibility("default"))) TS_ScoringParameters_set_failure_penalty_half_life(uint32_t this_ptr, int64_t val) {
34502 LDKScoringParameters this_ptr_conv;
34503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34504 this_ptr_conv.is_owned = false;
34505 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34506 ScoringParameters_set_failure_penalty_half_life(&this_ptr_conv, val);
34509 uint32_t __attribute__((visibility("default"))) 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) {
34510 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);
34511 uint64_t ret_ref = 0;
34512 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34513 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34514 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34515 ret_ref = (uint64_t)ret_var.inner;
34516 if (ret_var.is_owned) {
34522 int8_tArray __attribute__((visibility("default"))) TS_ScoringParameters_write(uint32_t obj) {
34523 LDKScoringParameters obj_conv;
34524 obj_conv.inner = (void*)(obj & (~1));
34525 obj_conv.is_owned = false;
34526 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34527 LDKCVec_u8Z ret_var = ScoringParameters_write(&obj_conv);
34528 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
34529 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34530 CVec_u8Z_free(ret_var);
34534 uint32_t __attribute__((visibility("default"))) TS_ScoringParameters_read(int8_tArray ser) {
34535 LDKu8slice ser_ref;
34536 ser_ref.datalen = ser->arr_len;
34537 ser_ref.data = ser->elems;
34538 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
34539 *ret_conv = ScoringParameters_read(ser_ref);
34540 return (uint64_t)ret_conv;
34543 uint32_t __attribute__((visibility("default"))) TS_ScoringParameters_default() {
34544 LDKScoringParameters ret_var = ScoringParameters_default();
34545 uint64_t ret_ref = 0;
34546 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34547 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34548 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34549 ret_ref = (uint64_t)ret_var.inner;
34550 if (ret_var.is_owned) {