5 // These should be provided...somehow...
6 void *memset(void *s, int c, size_t n);
7 void *memcpy(void *dest, const void *src, size_t n);
8 int memcmp(const void *s1, const void *s2, size_t n);
10 void __attribute__((noreturn)) abort(void);
11 static inline void assert(bool expression) {
12 if (!expression) { abort(); }
15 void *malloc(size_t size);
18 #define MALLOC(a, _) malloc(a)
19 #define FREE(p) if ((unsigned long)(p) > 4096) { free(p); }
20 #define DO_ASSERT(a) (void)(a)
22 #define CHECK_ACCESS(p)
23 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
25 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
26 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
27 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
28 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
30 _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
32 #define DECL_ARR_TYPE(ty, name) \
33 struct name##array { \
37 typedef struct name##array * name##Array; \
38 static inline name##Array init_##name##Array(size_t arr_len) { \
39 name##Array arr = (name##Array)MALLOC(arr_len * sizeof(ty) + sizeof(uint32_t), "##name array init"); \
40 arr->arr_len = arr_len; \
44 DECL_ARR_TYPE(int64_t, int64_t);
45 DECL_ARR_TYPE(int8_t, int8_t);
46 DECL_ARR_TYPE(uint32_t, uint32_t);
47 DECL_ARR_TYPE(void*, ptr);
48 DECL_ARR_TYPE(char, char);
49 typedef charArray jstring;
51 static inline jstring str_ref_to_ts(const char* chars, size_t len) {
52 charArray arr = init_charArray(len);
53 memcpy(arr->elems, chars, len);
56 static inline LDKStr str_ref_to_owned_c(const jstring str) {
57 char* newchars = MALLOC(str->arr_len + 1, "String chars");
58 memcpy(newchars, str->elems, str->arr_len);
59 newchars[str->arr_len] = 0;
63 .chars_is_owned = true
68 typedef bool jboolean;
70 uint32_t __attribute__((visibility("default"))) TS_malloc(uint32_t size) {
71 return (uint32_t)MALLOC(size, "JS-Called malloc");
73 void __attribute__((visibility("default"))) TS_free(uint32_t ptr) {
76 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
77 static inline LDKAccessError LDKAccessError_from_js(int32_t ord) {
79 case 0: return LDKAccessError_UnknownChain;
80 case 1: return LDKAccessError_UnknownTx;
84 static inline int32_t LDKAccessError_to_js(LDKAccessError val) {
86 case LDKAccessError_UnknownChain: return 0;
87 case LDKAccessError_UnknownTx: return 1;
91 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_js(int32_t ord) {
93 case 0: return LDKCOption_NoneZ_Some;
94 case 1: return LDKCOption_NoneZ_None;
98 static inline int32_t LDKCOption_NoneZ_to_js(LDKCOption_NoneZ val) {
100 case LDKCOption_NoneZ_Some: return 0;
101 case LDKCOption_NoneZ_None: return 1;
105 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_js(int32_t ord) {
107 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
108 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
112 static inline int32_t LDKChannelMonitorUpdateErr_to_js(LDKChannelMonitorUpdateErr val) {
114 case LDKChannelMonitorUpdateErr_TemporaryFailure: return 0;
115 case LDKChannelMonitorUpdateErr_PermanentFailure: return 1;
119 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
121 case 0: return LDKConfirmationTarget_Background;
122 case 1: return LDKConfirmationTarget_Normal;
123 case 2: return LDKConfirmationTarget_HighPriority;
127 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
129 case LDKConfirmationTarget_Background: return 0;
130 case LDKConfirmationTarget_Normal: return 1;
131 case LDKConfirmationTarget_HighPriority: return 2;
135 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
137 case 0: return LDKLevel_Gossip;
138 case 1: return LDKLevel_Trace;
139 case 2: return LDKLevel_Debug;
140 case 3: return LDKLevel_Info;
141 case 4: return LDKLevel_Warn;
142 case 5: return LDKLevel_Error;
146 static inline int32_t LDKLevel_to_js(LDKLevel val) {
148 case LDKLevel_Gossip: return 0;
149 case LDKLevel_Trace: return 1;
150 case LDKLevel_Debug: return 2;
151 case LDKLevel_Info: return 3;
152 case LDKLevel_Warn: return 4;
153 case LDKLevel_Error: return 5;
157 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
159 case 0: return LDKNetwork_Bitcoin;
160 case 1: return LDKNetwork_Testnet;
161 case 2: return LDKNetwork_Regtest;
162 case 3: return LDKNetwork_Signet;
166 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
168 case LDKNetwork_Bitcoin: return 0;
169 case LDKNetwork_Testnet: return 1;
170 case LDKNetwork_Regtest: return 2;
171 case LDKNetwork_Signet: return 3;
175 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
177 case 0: return LDKSecp256k1Error_IncorrectSignature;
178 case 1: return LDKSecp256k1Error_InvalidMessage;
179 case 2: return LDKSecp256k1Error_InvalidPublicKey;
180 case 3: return LDKSecp256k1Error_InvalidSignature;
181 case 4: return LDKSecp256k1Error_InvalidSecretKey;
182 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
183 case 6: return LDKSecp256k1Error_InvalidTweak;
184 case 7: return LDKSecp256k1Error_TweakCheckFailed;
185 case 8: return LDKSecp256k1Error_NotEnoughMemory;
189 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
191 case LDKSecp256k1Error_IncorrectSignature: return 0;
192 case LDKSecp256k1Error_InvalidMessage: return 1;
193 case LDKSecp256k1Error_InvalidPublicKey: return 2;
194 case LDKSecp256k1Error_InvalidSignature: return 3;
195 case LDKSecp256k1Error_InvalidSecretKey: return 4;
196 case LDKSecp256k1Error_InvalidRecoveryId: return 5;
197 case LDKSecp256k1Error_InvalidTweak: return 6;
198 case LDKSecp256k1Error_TweakCheckFailed: return 7;
199 case LDKSecp256k1Error_NotEnoughMemory: return 8;
203 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
204 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
205 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
208 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) {
209 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
210 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
211 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
212 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
213 CVec_u8Z_free(ret_var);
217 uint64_t TxOut_get_value (struct LDKTxOut* thing) { return thing->value;}int64_t __attribute__((visibility("default"))) TS_TxOut_get_value(uint32_t thing) {
218 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
219 int64_t ret_val = TxOut_get_value(thing_conv);
223 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
224 CHECK(owner->result_ok);
225 return ChannelConfig_clone(&*owner->contents.result);
227 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_get_ok(uint32_t owner) {
228 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
229 LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
230 uint64_t ret_ref = 0;
231 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
232 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
233 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
234 ret_ref = (uint64_t)ret_var.inner;
235 if (ret_var.is_owned) {
241 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
242 CHECK(!owner->result_ok);
243 return DecodeError_clone(&*owner->contents.err);
245 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_get_err(uint32_t owner) {
246 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
247 LDKDecodeError ret_var = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
248 uint64_t ret_ref = 0;
249 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
250 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
251 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
252 ret_ref = (uint64_t)ret_var.inner;
253 if (ret_var.is_owned) {
259 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
260 CHECK(owner->result_ok);
261 return OutPoint_clone(&*owner->contents.result);
263 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_get_ok(uint32_t owner) {
264 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
265 LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
266 uint64_t ret_ref = 0;
267 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
268 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
269 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
270 ret_ref = (uint64_t)ret_var.inner;
271 if (ret_var.is_owned) {
277 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
278 CHECK(!owner->result_ok);
279 return DecodeError_clone(&*owner->contents.err);
281 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_get_err(uint32_t owner) {
282 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
283 LDKDecodeError ret_var = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
284 uint64_t ret_ref = 0;
285 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
286 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
287 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
288 ret_ref = (uint64_t)ret_var.inner;
289 if (ret_var.is_owned) {
295 static inline struct LDKSecretKey CResult_SecretKeyErrorZ_get_ok(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
296 CHECK(owner->result_ok);
297 return *owner->contents.result;
299 int8_tArray __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_get_ok(uint32_t owner) {
300 LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)(owner & ~1);
301 int8_tArray ret_arr = init_int8_tArray(32);
302 memcpy(ret_arr->elems, CResult_SecretKeyErrorZ_get_ok(owner_conv).bytes, 32);
306 static inline enum LDKSecp256k1Error CResult_SecretKeyErrorZ_get_err(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
307 CHECK(!owner->result_ok);
308 return *owner->contents.err;
310 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_get_err(uint32_t owner) {
311 LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)(owner & ~1);
312 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_SecretKeyErrorZ_get_err(owner_conv));
316 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
317 CHECK(owner->result_ok);
318 return *owner->contents.result;
320 int8_tArray __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_get_ok(uint32_t owner) {
321 LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)(owner & ~1);
322 int8_tArray ret_arr = init_int8_tArray(33);
323 memcpy(ret_arr->elems, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form, 33);
327 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
328 CHECK(!owner->result_ok);
329 return *owner->contents.err;
331 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_get_err(uint32_t owner) {
332 LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)(owner & ~1);
333 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PublicKeyErrorZ_get_err(owner_conv));
337 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
338 CHECK(owner->result_ok);
339 return TxCreationKeys_clone(&*owner->contents.result);
341 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_ok(uint32_t owner) {
342 LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(owner & ~1);
343 LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
344 uint64_t ret_ref = 0;
345 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
346 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
347 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
348 ret_ref = (uint64_t)ret_var.inner;
349 if (ret_var.is_owned) {
355 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
356 CHECK(!owner->result_ok);
357 return DecodeError_clone(&*owner->contents.err);
359 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_err(uint32_t owner) {
360 LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(owner & ~1);
361 LDKDecodeError ret_var = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
362 uint64_t ret_ref = 0;
363 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
364 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
365 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
366 ret_ref = (uint64_t)ret_var.inner;
367 if (ret_var.is_owned) {
373 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
374 CHECK(owner->result_ok);
375 return ChannelPublicKeys_clone(&*owner->contents.result);
377 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint32_t owner) {
378 LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(owner & ~1);
379 LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
380 uint64_t ret_ref = 0;
381 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
382 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
383 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
384 ret_ref = (uint64_t)ret_var.inner;
385 if (ret_var.is_owned) {
391 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
392 CHECK(!owner->result_ok);
393 return DecodeError_clone(&*owner->contents.err);
395 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err(uint32_t owner) {
396 LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(owner & ~1);
397 LDKDecodeError ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
398 uint64_t ret_ref = 0;
399 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
400 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
401 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
402 ret_ref = (uint64_t)ret_var.inner;
403 if (ret_var.is_owned) {
409 static inline struct LDKTxCreationKeys CResult_TxCreationKeysErrorZ_get_ok(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
410 CHECK(owner->result_ok);
411 return TxCreationKeys_clone(&*owner->contents.result);
413 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_get_ok(uint32_t owner) {
414 LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)(owner & ~1);
415 LDKTxCreationKeys ret_var = CResult_TxCreationKeysErrorZ_get_ok(owner_conv);
416 uint64_t ret_ref = 0;
417 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
418 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
419 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
420 ret_ref = (uint64_t)ret_var.inner;
421 if (ret_var.is_owned) {
427 static inline enum LDKSecp256k1Error CResult_TxCreationKeysErrorZ_get_err(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
428 CHECK(!owner->result_ok);
429 return *owner->contents.err;
431 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_get_err(uint32_t owner) {
432 LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)(owner & ~1);
433 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_TxCreationKeysErrorZ_get_err(owner_conv));
437 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u32Z_ref_from_ptr(uint32_t ptr) {
438 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
440 case LDKCOption_u32Z_Some: {
441 return 0 /* LDKCOption_u32Z - Some */; (void) obj->some;
443 case LDKCOption_u32Z_None: {
444 return 0 /* LDKCOption_u32Z - None */;
449 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
450 CHECK(owner->result_ok);
451 return HTLCOutputInCommitment_clone(&*owner->contents.result);
453 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint32_t owner) {
454 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(owner & ~1);
455 LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
456 uint64_t ret_ref = 0;
457 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
458 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
459 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
460 ret_ref = (uint64_t)ret_var.inner;
461 if (ret_var.is_owned) {
467 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
468 CHECK(!owner->result_ok);
469 return DecodeError_clone(&*owner->contents.err);
471 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint32_t owner) {
472 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(owner & ~1);
473 LDKDecodeError ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
474 uint64_t ret_ref = 0;
475 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
476 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
477 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
478 ret_ref = (uint64_t)ret_var.inner;
479 if (ret_var.is_owned) {
485 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
486 CHECK(owner->result_ok);
487 return CounterpartyChannelTransactionParameters_clone(&*owner->contents.result);
489 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t owner) {
490 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
491 LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
492 uint64_t ret_ref = 0;
493 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
494 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
495 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
496 ret_ref = (uint64_t)ret_var.inner;
497 if (ret_var.is_owned) {
503 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
504 CHECK(!owner->result_ok);
505 return DecodeError_clone(&*owner->contents.err);
507 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint32_t owner) {
508 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
509 LDKDecodeError ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
510 uint64_t ret_ref = 0;
511 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
512 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
513 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
514 ret_ref = (uint64_t)ret_var.inner;
515 if (ret_var.is_owned) {
521 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
522 CHECK(owner->result_ok);
523 return ChannelTransactionParameters_clone(&*owner->contents.result);
525 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t owner) {
526 LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
527 LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
528 uint64_t ret_ref = 0;
529 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
530 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
531 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
532 ret_ref = (uint64_t)ret_var.inner;
533 if (ret_var.is_owned) {
539 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
540 CHECK(!owner->result_ok);
541 return DecodeError_clone(&*owner->contents.err);
543 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint32_t owner) {
544 LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
545 LDKDecodeError ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
546 uint64_t ret_ref = 0;
547 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
548 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
549 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
550 ret_ref = (uint64_t)ret_var.inner;
551 if (ret_var.is_owned) {
557 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
558 CHECK(owner->result_ok);
559 return HolderCommitmentTransaction_clone(&*owner->contents.result);
561 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint32_t owner) {
562 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(owner & ~1);
563 LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
564 uint64_t ret_ref = 0;
565 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
566 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
567 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
568 ret_ref = (uint64_t)ret_var.inner;
569 if (ret_var.is_owned) {
575 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
576 CHECK(!owner->result_ok);
577 return DecodeError_clone(&*owner->contents.err);
579 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint32_t owner) {
580 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(owner & ~1);
581 LDKDecodeError ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
582 uint64_t ret_ref = 0;
583 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
584 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
585 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
586 ret_ref = (uint64_t)ret_var.inner;
587 if (ret_var.is_owned) {
593 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
594 CHECK(owner->result_ok);
595 return BuiltCommitmentTransaction_clone(&*owner->contents.result);
597 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint32_t owner) {
598 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(owner & ~1);
599 LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
600 uint64_t ret_ref = 0;
601 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
602 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
603 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
604 ret_ref = (uint64_t)ret_var.inner;
605 if (ret_var.is_owned) {
611 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
612 CHECK(!owner->result_ok);
613 return DecodeError_clone(&*owner->contents.err);
615 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint32_t owner) {
616 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(owner & ~1);
617 LDKDecodeError ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
618 uint64_t ret_ref = 0;
619 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
620 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
621 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
622 ret_ref = (uint64_t)ret_var.inner;
623 if (ret_var.is_owned) {
629 static inline struct LDKTrustedClosingTransaction *CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
630 CHECK(owner->result_ok);
631 return &*owner->contents.result;
633 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_get_ok(uint32_t owner) {
634 LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(owner & ~1);
635 LDKTrustedClosingTransaction ret_var = *CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
636 uint64_t ret_ref = 0;
637 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
638 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
639 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
640 ret_ref = (uint64_t)ret_var.inner & ~1;
644 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
645 CHECK(!owner->result_ok);
646 return *owner->contents.err;
648 void __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_get_err(uint32_t owner) {
649 LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(owner & ~1);
650 CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
653 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
654 CHECK(owner->result_ok);
655 return CommitmentTransaction_clone(&*owner->contents.result);
657 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok(uint32_t owner) {
658 LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(owner & ~1);
659 LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
660 uint64_t ret_ref = 0;
661 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
662 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
663 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
664 ret_ref = (uint64_t)ret_var.inner;
665 if (ret_var.is_owned) {
671 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
672 CHECK(!owner->result_ok);
673 return DecodeError_clone(&*owner->contents.err);
675 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_err(uint32_t owner) {
676 LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(owner & ~1);
677 LDKDecodeError ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
678 uint64_t ret_ref = 0;
679 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
680 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
681 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
682 ret_ref = (uint64_t)ret_var.inner;
683 if (ret_var.is_owned) {
689 static inline struct LDKTrustedCommitmentTransaction *CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
690 CHECK(owner->result_ok);
691 return &*owner->contents.result;
693 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok(uint32_t owner) {
694 LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(owner & ~1);
695 LDKTrustedCommitmentTransaction ret_var = *CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
696 uint64_t ret_ref = 0;
697 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
698 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
699 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
700 ret_ref = (uint64_t)ret_var.inner & ~1;
704 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
705 CHECK(!owner->result_ok);
706 return *owner->contents.err;
708 void __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_err(uint32_t owner) {
709 LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(owner & ~1);
710 CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
713 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
714 CHECK(owner->result_ok);
715 return *owner->contents.result;
717 ptrArray __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_get_ok(uint32_t owner) {
718 LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)(owner & ~1);
719 LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
720 ptrArray ret_arr = NULL;
721 ret_arr = init_ptrArray(ret_var.datalen);
722 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
723 for (size_t m = 0; m < ret_var.datalen; m++) {
724 int8_tArray ret_conv_12_arr = init_int8_tArray(64);
725 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
726 ret_arr_ptr[m] = ret_conv_12_arr;
733 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
734 CHECK(!owner->result_ok);
735 return *owner->contents.err;
737 void __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_get_err(uint32_t owner) {
738 LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)(owner & ~1);
739 CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
742 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
743 CHECK(owner->result_ok);
744 return ShutdownScript_clone(&*owner->contents.result);
746 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_ok(uint32_t owner) {
747 LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(owner & ~1);
748 LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
749 uint64_t ret_ref = 0;
750 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
751 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
752 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
753 ret_ref = (uint64_t)ret_var.inner;
754 if (ret_var.is_owned) {
760 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
761 CHECK(!owner->result_ok);
762 return DecodeError_clone(&*owner->contents.err);
764 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_err(uint32_t owner) {
765 LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(owner & ~1);
766 LDKDecodeError ret_var = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
767 uint64_t ret_ref = 0;
768 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
769 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
770 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
771 ret_ref = (uint64_t)ret_var.inner;
772 if (ret_var.is_owned) {
778 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
779 CHECK(owner->result_ok);
780 return ShutdownScript_clone(&*owner->contents.result);
782 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint32_t owner) {
783 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(owner & ~1);
784 LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
785 uint64_t ret_ref = 0;
786 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
787 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
788 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
789 ret_ref = (uint64_t)ret_var.inner;
790 if (ret_var.is_owned) {
796 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
797 CHECK(!owner->result_ok);
798 return InvalidShutdownScript_clone(&*owner->contents.err);
800 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint32_t owner) {
801 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(owner & ~1);
802 LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
803 uint64_t ret_ref = 0;
804 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
805 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
806 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
807 ret_ref = (uint64_t)ret_var.inner;
808 if (ret_var.is_owned) {
814 typedef struct LDKType_JCalls {
815 atomic_size_t refcnt;
816 uint32_t type_id_meth;
817 uint32_t debug_str_meth;
820 static void LDKType_JCalls_free(void* this_arg) {
821 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
822 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
823 js_free_function_ptr(j_calls->type_id_meth);
824 js_free_function_ptr(j_calls->debug_str_meth);
825 js_free_function_ptr(j_calls->write_meth);
829 uint16_t type_id_LDKType_jcall(const void* this_arg) {
830 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
831 return js_invoke_function_0(j_calls->type_id_meth);
833 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
834 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
835 jstring ret = (jstring)js_invoke_function_0(j_calls->debug_str_meth);
836 LDKStr ret_conv = str_ref_to_owned_c(ret);
839 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
840 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
841 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->write_meth);
843 ret_ref.datalen = ret->arr_len;
844 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
845 memcpy(ret_ref.data, ret->elems, ret_ref.datalen);
848 static void LDKType_JCalls_cloned(LDKType* new_obj) {
849 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
850 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
852 static inline LDKType LDKType_init (/*TODO: JS Object Reference */void* o) {
853 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
854 atomic_init(&calls->refcnt, 1);
855 //TODO: Assign calls->o from o
858 .this_arg = (void*) calls,
859 .type_id = type_id_LDKType_jcall,
860 .debug_str = debug_str_LDKType_jcall,
861 .write = write_LDKType_jcall,
862 .cloned = LDKType_JCalls_cloned,
863 .free = LDKType_JCalls_free,
867 long __attribute__((visibility("default"))) TS_LDKType_new(/*TODO: JS Object Reference */void* o) {
868 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
869 *res_ptr = LDKType_init(o);
870 return (long)res_ptr;
872 int16_t __attribute__((visibility("default"))) TS_Type_type_id(uint32_t this_arg) {
873 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
874 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
875 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
876 int16_t ret_val = (this_arg_conv->type_id)(this_arg_conv->this_arg);
880 jstring __attribute__((visibility("default"))) TS_Type_debug_str(uint32_t this_arg) {
881 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
882 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
883 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
884 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
885 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
890 int8_tArray __attribute__((visibility("default"))) TS_Type_write(uint32_t this_arg) {
891 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
892 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
893 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
894 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
895 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
896 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
897 CVec_u8Z_free(ret_var);
901 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_TypeZ_ref_from_ptr(uint32_t ptr) {
902 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
904 case LDKCOption_TypeZ_Some: {
905 LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
906 *some_ret = Type_clone(&obj->some);
907 return 0 /* LDKCOption_TypeZ - Some */; (void) (uint64_t)some_ret;
909 case LDKCOption_TypeZ_None: {
910 return 0 /* LDKCOption_TypeZ - None */;
915 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
916 CHECK(owner->result_ok);
917 return COption_TypeZ_clone(&*owner->contents.result);
919 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_get_ok(uint32_t owner) {
920 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
921 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
922 *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
923 uint64_t ret_ref = (uint64_t)ret_copy;
927 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
928 CHECK(!owner->result_ok);
929 return DecodeError_clone(&*owner->contents.err);
931 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_get_err(uint32_t owner) {
932 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
933 LDKDecodeError ret_var = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
934 uint64_t ret_ref = 0;
935 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
936 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
937 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
938 ret_ref = (uint64_t)ret_var.inner;
939 if (ret_var.is_owned) {
945 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
946 CHECK(owner->result_ok);
947 return *owner->contents.result;
949 jstring __attribute__((visibility("default"))) TS_CResult_StringErrorZ_get_ok(uint32_t owner) {
950 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
951 LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
952 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
957 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
958 CHECK(!owner->result_ok);
959 return *owner->contents.err;
961 uint32_t __attribute__((visibility("default"))) TS_CResult_StringErrorZ_get_err(uint32_t owner) {
962 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
963 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StringErrorZ_get_err(owner_conv));
967 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
968 CHECK(owner->result_ok);
969 return ChannelMonitorUpdate_clone(&*owner->contents.result);
971 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint32_t owner) {
972 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
973 LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
974 uint64_t ret_ref = 0;
975 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
976 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
977 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
978 ret_ref = (uint64_t)ret_var.inner;
979 if (ret_var.is_owned) {
985 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
986 CHECK(!owner->result_ok);
987 return DecodeError_clone(&*owner->contents.err);
989 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint32_t owner) {
990 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
991 LDKDecodeError ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
992 uint64_t ret_ref = 0;
993 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
994 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
995 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
996 ret_ref = (uint64_t)ret_var.inner;
997 if (ret_var.is_owned) {
1003 uint32_t __attribute__((visibility("default"))) TS_LDKMonitorEvent_ref_from_ptr(uint32_t ptr) {
1004 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1006 case LDKMonitorEvent_HTLCEvent: {
1007 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
1008 uint64_t htlc_event_ref = 0;
1009 CHECK((((uint64_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1010 CHECK((((uint64_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1011 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
1012 htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
1013 return 0 /* LDKMonitorEvent - HTLCEvent */; (void) htlc_event_ref;
1015 case LDKMonitorEvent_CommitmentTxConfirmed: {
1016 LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
1017 uint64_t commitment_tx_confirmed_ref = 0;
1018 CHECK((((uint64_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1019 CHECK((((uint64_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1020 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
1021 commitment_tx_confirmed_ref = (uint64_t)commitment_tx_confirmed_var.inner & ~1;
1022 return 0 /* LDKMonitorEvent - CommitmentTxConfirmed */; (void) commitment_tx_confirmed_ref;
1024 case LDKMonitorEvent_UpdateCompleted: {
1025 LDKOutPoint funding_txo_var = obj->update_completed.funding_txo;
1026 uint64_t funding_txo_ref = 0;
1027 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1028 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1029 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
1030 funding_txo_ref = (uint64_t)funding_txo_var.inner & ~1;
1031 return 0 /* LDKMonitorEvent - UpdateCompleted */; (void) funding_txo_ref; (void) obj->update_completed.monitor_update_id;
1033 case LDKMonitorEvent_UpdateFailed: {
1034 LDKOutPoint update_failed_var = obj->update_failed;
1035 uint64_t update_failed_ref = 0;
1036 CHECK((((uint64_t)update_failed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1037 CHECK((((uint64_t)&update_failed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1038 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
1039 update_failed_ref = (uint64_t)update_failed_var.inner & ~1;
1040 return 0 /* LDKMonitorEvent - UpdateFailed */; (void) update_failed_ref;
1045 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_MonitorEventZ_ref_from_ptr(uint32_t ptr) {
1046 LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)(ptr & ~1);
1048 case LDKCOption_MonitorEventZ_Some: {
1049 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
1050 return 0 /* LDKCOption_MonitorEventZ - Some */; (void) some_ref;
1052 case LDKCOption_MonitorEventZ_None: {
1053 return 0 /* LDKCOption_MonitorEventZ - None */;
1058 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
1059 CHECK(owner->result_ok);
1060 return COption_MonitorEventZ_clone(&*owner->contents.result);
1062 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint32_t owner) {
1063 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
1064 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
1065 *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
1066 uint64_t ret_ref = (uint64_t)ret_copy;
1070 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
1071 CHECK(!owner->result_ok);
1072 return DecodeError_clone(&*owner->contents.err);
1074 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint32_t owner) {
1075 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
1076 LDKDecodeError ret_var = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
1077 uint64_t ret_ref = 0;
1078 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1079 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1080 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1081 ret_ref = (uint64_t)ret_var.inner;
1082 if (ret_var.is_owned) {
1088 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
1089 CHECK(owner->result_ok);
1090 return HTLCUpdate_clone(&*owner->contents.result);
1092 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint32_t owner) {
1093 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
1094 LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
1095 uint64_t ret_ref = 0;
1096 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1097 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1098 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1099 ret_ref = (uint64_t)ret_var.inner;
1100 if (ret_var.is_owned) {
1106 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
1107 CHECK(!owner->result_ok);
1108 return DecodeError_clone(&*owner->contents.err);
1110 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint32_t owner) {
1111 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
1112 LDKDecodeError ret_var = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
1113 uint64_t ret_ref = 0;
1114 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1115 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1116 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1117 ret_ref = (uint64_t)ret_var.inner;
1118 if (ret_var.is_owned) {
1124 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1125 CHECK(owner->result_ok);
1126 return *owner->contents.result;
1128 void __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_get_ok(uint32_t owner) {
1129 LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1);
1130 CResult_NoneNoneZ_get_ok(owner_conv);
1133 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1134 CHECK(!owner->result_ok);
1135 return *owner->contents.err;
1137 void __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_get_err(uint32_t owner) {
1138 LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1);
1139 CResult_NoneNoneZ_get_err(owner_conv);
1142 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
1143 return OutPoint_clone(&owner->a);
1145 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_get_a(uint32_t owner) {
1146 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
1147 LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
1148 uint64_t ret_ref = 0;
1149 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1150 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1151 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1152 ret_ref = (uint64_t)ret_var.inner;
1153 if (ret_var.is_owned) {
1159 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
1160 return CVec_u8Z_clone(&owner->b);
1162 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_get_b(uint32_t owner) {
1163 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
1164 LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
1165 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
1166 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1167 CVec_u8Z_free(ret_var);
1171 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
1174 int32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_get_a(uint32_t owner) {
1175 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
1176 int32_t ret_val = C2Tuple_u32ScriptZ_get_a(owner_conv);
1180 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
1181 return CVec_u8Z_clone(&owner->b);
1183 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_get_b(uint32_t owner) {
1184 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
1185 LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
1186 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
1187 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1188 CVec_u8Z_free(ret_var);
1192 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
1193 return ThirtyTwoBytes_clone(&owner->a);
1195 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint32_t owner) {
1196 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
1197 int8_tArray ret_arr = init_int8_tArray(32);
1198 memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data, 32);
1202 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
1205 uint32_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint32_t owner) {
1206 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
1207 LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
1208 uint32_tArray ret_arr = NULL;
1209 ret_arr = init_uint32_tArray(ret_var.datalen);
1210 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
1211 for (size_t v = 0; v < ret_var.datalen; v++) {
1212 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
1213 *ret_conv_21_conv = ret_var.data[v];
1214 ret_arr_ptr[v] = ((uint64_t)ret_conv_21_conv);
1221 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1222 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1223 for (size_t i = 0; i < ret.datalen; i++) {
1224 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1228 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentPurpose_ref_from_ptr(uint32_t ptr) {
1229 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1231 case LDKPaymentPurpose_InvoicePayment: {
1232 int8_tArray payment_preimage_arr = init_int8_tArray(32);
1233 memcpy(payment_preimage_arr->elems, obj->invoice_payment.payment_preimage.data, 32);
1234 int8_tArray payment_secret_arr = init_int8_tArray(32);
1235 memcpy(payment_secret_arr->elems, obj->invoice_payment.payment_secret.data, 32);
1236 return 0 /* LDKPaymentPurpose - InvoicePayment */; (void) payment_preimage_arr; (void) payment_secret_arr;
1238 case LDKPaymentPurpose_SpontaneousPayment: {
1239 int8_tArray spontaneous_payment_arr = init_int8_tArray(32);
1240 memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
1241 return 0 /* LDKPaymentPurpose - SpontaneousPayment */; (void) spontaneous_payment_arr;
1246 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u64Z_ref_from_ptr(uint32_t ptr) {
1247 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1249 case LDKCOption_u64Z_Some: {
1250 return 0 /* LDKCOption_u64Z - Some */; (void) obj->some;
1252 case LDKCOption_u64Z_None: {
1253 return 0 /* LDKCOption_u64Z - None */;
1258 uint32_t __attribute__((visibility("default"))) TS_LDKNetworkUpdate_ref_from_ptr(uint32_t ptr) {
1259 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1261 case LDKNetworkUpdate_ChannelUpdateMessage: {
1262 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1263 uint64_t msg_ref = 0;
1264 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1265 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1266 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1267 msg_ref = (uint64_t)msg_var.inner & ~1;
1268 return 0 /* LDKNetworkUpdate - ChannelUpdateMessage */; (void) msg_ref;
1270 case LDKNetworkUpdate_ChannelClosed: {
1271 return 0 /* LDKNetworkUpdate - ChannelClosed */; (void) obj->channel_closed.short_channel_id; (void) obj->channel_closed.is_permanent;
1273 case LDKNetworkUpdate_NodeFailure: {
1274 int8_tArray node_id_arr = init_int8_tArray(33);
1275 memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
1276 return 0 /* LDKNetworkUpdate - NodeFailure */; (void) node_id_arr; (void) obj->node_failure.is_permanent;
1281 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_NetworkUpdateZ_ref_from_ptr(uint32_t ptr) {
1282 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
1284 case LDKCOption_NetworkUpdateZ_Some: {
1285 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
1286 return 0 /* LDKCOption_NetworkUpdateZ - Some */; (void) some_ref;
1288 case LDKCOption_NetworkUpdateZ_None: {
1289 return 0 /* LDKCOption_NetworkUpdateZ - None */;
1294 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1295 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1296 for (size_t i = 0; i < ret.datalen; i++) {
1297 ret.data[i] = RouteHop_clone(&orig->data[i]);
1301 uint32_t __attribute__((visibility("default"))) TS_LDKSpendableOutputDescriptor_ref_from_ptr(uint32_t ptr) {
1302 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1304 case LDKSpendableOutputDescriptor_StaticOutput: {
1305 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1306 uint64_t outpoint_ref = 0;
1307 CHECK((((uint64_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1308 CHECK((((uint64_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1309 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1310 outpoint_ref = (uint64_t)outpoint_var.inner & ~1;
1311 uint64_t output_ref = ((uint64_t)&obj->static_output.output) | 1;
1312 return 0 /* LDKSpendableOutputDescriptor - StaticOutput */; (void) outpoint_ref; (void) (uint64_t)output_ref;
1314 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1315 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1316 uint64_t delayed_payment_output_ref = 0;
1317 CHECK((((uint64_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1318 CHECK((((uint64_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1319 CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1320 delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1;
1321 return 0 /* LDKSpendableOutputDescriptor - DelayedPaymentOutput */; (void) delayed_payment_output_ref;
1323 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1324 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1325 uint64_t static_payment_output_ref = 0;
1326 CHECK((((uint64_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1327 CHECK((((uint64_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1328 CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1329 static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1;
1330 return 0 /* LDKSpendableOutputDescriptor - StaticPaymentOutput */; (void) static_payment_output_ref;
1335 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1336 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1337 for (size_t i = 0; i < ret.datalen; i++) {
1338 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1342 uint32_t __attribute__((visibility("default"))) TS_LDKClosureReason_ref_from_ptr(uint32_t ptr) {
1343 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
1345 case LDKClosureReason_CounterpartyForceClosed: {
1346 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
1347 jstring peer_msg_conv = str_ref_to_ts(peer_msg_str.chars, peer_msg_str.len);
1348 return 0 /* LDKClosureReason - CounterpartyForceClosed */; (void) peer_msg_conv;
1350 case LDKClosureReason_HolderForceClosed: {
1351 return 0 /* LDKClosureReason - HolderForceClosed */;
1353 case LDKClosureReason_CooperativeClosure: {
1354 return 0 /* LDKClosureReason - CooperativeClosure */;
1356 case LDKClosureReason_CommitmentTxConfirmed: {
1357 return 0 /* LDKClosureReason - CommitmentTxConfirmed */;
1359 case LDKClosureReason_FundingTimedOut: {
1360 return 0 /* LDKClosureReason - FundingTimedOut */;
1362 case LDKClosureReason_ProcessingError: {
1363 LDKStr err_str = obj->processing_error.err;
1364 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
1365 return 0 /* LDKClosureReason - ProcessingError */; (void) err_conv;
1367 case LDKClosureReason_DisconnectedPeer: {
1368 return 0 /* LDKClosureReason - DisconnectedPeer */;
1370 case LDKClosureReason_OutdatedChannelManager: {
1371 return 0 /* LDKClosureReason - OutdatedChannelManager */;
1376 uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_t ptr) {
1377 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1379 case LDKEvent_FundingGenerationReady: {
1380 int8_tArray temporary_channel_id_arr = init_int8_tArray(32);
1381 memcpy(temporary_channel_id_arr->elems, obj->funding_generation_ready.temporary_channel_id.data, 32);
1382 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1383 int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen);
1384 memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
1385 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;
1387 case LDKEvent_PaymentReceived: {
1388 int8_tArray payment_hash_arr = init_int8_tArray(32);
1389 memcpy(payment_hash_arr->elems, obj->payment_received.payment_hash.data, 32);
1390 uint64_t purpose_ref = ((uint64_t)&obj->payment_received.purpose) | 1;
1391 return 0 /* LDKEvent - PaymentReceived */; (void) payment_hash_arr; (void) obj->payment_received.amt; (void) purpose_ref;
1393 case LDKEvent_PaymentSent: {
1394 int8_tArray payment_id_arr = init_int8_tArray(32);
1395 memcpy(payment_id_arr->elems, obj->payment_sent.payment_id.data, 32);
1396 int8_tArray payment_preimage_arr = init_int8_tArray(32);
1397 memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
1398 int8_tArray payment_hash_arr = init_int8_tArray(32);
1399 memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
1400 uint64_t fee_paid_msat_ref = ((uint64_t)&obj->payment_sent.fee_paid_msat) | 1;
1401 return 0 /* LDKEvent - PaymentSent */; (void) payment_id_arr; (void) payment_preimage_arr; (void) payment_hash_arr; (void) fee_paid_msat_ref;
1403 case LDKEvent_PaymentPathFailed: {
1404 int8_tArray payment_id_arr = init_int8_tArray(32);
1405 memcpy(payment_id_arr->elems, obj->payment_path_failed.payment_id.data, 32);
1406 int8_tArray payment_hash_arr = init_int8_tArray(32);
1407 memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
1408 uint64_t network_update_ref = ((uint64_t)&obj->payment_path_failed.network_update) | 1;
1409 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
1410 uint32_tArray path_arr = NULL;
1411 path_arr = init_uint32_tArray(path_var.datalen);
1412 uint32_t *path_arr_ptr = (uint32_t*)(path_arr + 4);
1413 for (size_t k = 0; k < path_var.datalen; k++) {
1414 LDKRouteHop path_conv_10_var = path_var.data[k];
1415 uint64_t path_conv_10_ref = 0;
1416 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1417 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1418 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1419 path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1;
1420 path_arr_ptr[k] = path_conv_10_ref;
1423 uint64_t short_channel_id_ref = ((uint64_t)&obj->payment_path_failed.short_channel_id) | 1;
1424 LDKRouteParameters retry_var = obj->payment_path_failed.retry;
1425 uint64_t retry_ref = 0;
1426 if ((uint64_t)retry_var.inner > 4096) {
1427 CHECK((((uint64_t)retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1428 CHECK((((uint64_t)&retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1429 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
1430 retry_ref = (uint64_t)retry_var.inner & ~1;
1432 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;
1434 case LDKEvent_PaymentFailed: {
1435 int8_tArray payment_id_arr = init_int8_tArray(32);
1436 memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
1437 int8_tArray payment_hash_arr = init_int8_tArray(32);
1438 memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
1439 return 0 /* LDKEvent - PaymentFailed */; (void) payment_id_arr; (void) payment_hash_arr;
1441 case LDKEvent_PendingHTLCsForwardable: {
1442 return 0 /* LDKEvent - PendingHTLCsForwardable */; (void) obj->pending_htl_cs_forwardable.time_forwardable;
1444 case LDKEvent_SpendableOutputs: {
1445 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1446 uint32_tArray outputs_arr = NULL;
1447 outputs_arr = init_uint32_tArray(outputs_var.datalen);
1448 uint32_t *outputs_arr_ptr = (uint32_t*)(outputs_arr + 4);
1449 for (size_t b = 0; b < outputs_var.datalen; b++) {
1450 uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1;
1451 outputs_arr_ptr[b] = outputs_conv_27_ref;
1454 return 0 /* LDKEvent - SpendableOutputs */; (void) outputs_arr;
1456 case LDKEvent_PaymentForwarded: {
1457 uint64_t fee_earned_msat_ref = ((uint64_t)&obj->payment_forwarded.fee_earned_msat) | 1;
1458 return 0 /* LDKEvent - PaymentForwarded */; (void) fee_earned_msat_ref; (void) obj->payment_forwarded.claim_from_onchain_tx;
1460 case LDKEvent_ChannelClosed: {
1461 int8_tArray channel_id_arr = init_int8_tArray(32);
1462 memcpy(channel_id_arr->elems, obj->channel_closed.channel_id.data, 32);
1463 uint64_t reason_ref = ((uint64_t)&obj->channel_closed.reason) | 1;
1464 return 0 /* LDKEvent - ChannelClosed */; (void) channel_id_arr; (void) obj->channel_closed.user_channel_id; (void) reason_ref;
1466 case LDKEvent_DiscardFunding: {
1467 int8_tArray channel_id_arr = init_int8_tArray(32);
1468 memcpy(channel_id_arr->elems, obj->discard_funding.channel_id.data, 32);
1469 LDKTransaction transaction_var = obj->discard_funding.transaction;
1470 int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen);
1471 memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
1472 return 0 /* LDKEvent - DiscardFunding */; (void) channel_id_arr; (void) transaction_arr;
1474 case LDKEvent_PaymentPathSuccessful: {
1475 int8_tArray payment_id_arr = init_int8_tArray(32);
1476 memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
1477 int8_tArray payment_hash_arr = init_int8_tArray(32);
1478 memcpy(payment_hash_arr->elems, obj->payment_path_successful.payment_hash.data, 32);
1479 LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
1480 uint32_tArray path_arr = NULL;
1481 path_arr = init_uint32_tArray(path_var.datalen);
1482 uint32_t *path_arr_ptr = (uint32_t*)(path_arr + 4);
1483 for (size_t k = 0; k < path_var.datalen; k++) {
1484 LDKRouteHop path_conv_10_var = path_var.data[k];
1485 uint64_t path_conv_10_ref = 0;
1486 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1487 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1488 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1489 path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1;
1490 path_arr_ptr[k] = path_conv_10_ref;
1493 return 0 /* LDKEvent - PaymentPathSuccessful */; (void) payment_id_arr; (void) payment_hash_arr; (void) path_arr;
1498 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
1499 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
1500 for (size_t i = 0; i < ret.datalen; i++) {
1501 ret.data[i] = Event_clone(&orig->data[i]);
1505 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
1508 int64_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_get_a(uint32_t owner) {
1509 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
1510 int64_t ret_val = C2Tuple_usizeTransactionZ_get_a(owner_conv);
1514 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
1517 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_get_b(uint32_t owner) {
1518 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
1519 LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
1520 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
1521 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1522 Transaction_free(ret_var);
1526 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
1527 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
1528 for (size_t i = 0; i < ret.datalen; i++) {
1529 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
1533 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
1536 int32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_get_a(uint32_t owner) {
1537 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
1538 int32_t ret_val = C2Tuple_u32TxOutZ_get_a(owner_conv);
1542 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
1543 return TxOut_clone(&owner->b);
1545 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_get_b(uint32_t owner) {
1546 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
1547 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
1548 *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
1549 return (uint64_t)ret_ref;
1552 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
1553 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
1554 for (size_t i = 0; i < ret.datalen; i++) {
1555 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
1559 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
1560 return ThirtyTwoBytes_clone(&owner->a);
1562 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint32_t owner) {
1563 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
1564 int8_tArray ret_arr = init_int8_tArray(32);
1565 memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
1569 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
1570 return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
1572 uint32_tArray __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint32_t owner) {
1573 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
1574 LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
1575 uint32_tArray ret_arr = NULL;
1576 ret_arr = init_uint32_tArray(ret_var.datalen);
1577 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
1578 for (size_t u = 0; u < ret_var.datalen; u++) {
1579 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
1580 *ret_conv_20_conv = ret_var.data[u];
1581 ret_arr_ptr[u] = ((uint64_t)ret_conv_20_conv);
1588 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
1589 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 };
1590 for (size_t i = 0; i < ret.datalen; i++) {
1591 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
1595 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
1596 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
1597 for (size_t i = 0; i < ret.datalen; i++) {
1598 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1602 uint32_t __attribute__((visibility("default"))) TS_LDKBalance_ref_from_ptr(uint32_t ptr) {
1603 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
1605 case LDKBalance_ClaimableOnChannelClose: {
1606 return 0 /* LDKBalance - ClaimableOnChannelClose */; (void) obj->claimable_on_channel_close.claimable_amount_satoshis;
1608 case LDKBalance_ClaimableAwaitingConfirmations: {
1609 return 0 /* LDKBalance - ClaimableAwaitingConfirmations */; (void) obj->claimable_awaiting_confirmations.claimable_amount_satoshis; (void) obj->claimable_awaiting_confirmations.confirmation_height;
1611 case LDKBalance_ContentiousClaimable: {
1612 return 0 /* LDKBalance - ContentiousClaimable */; (void) obj->contentious_claimable.claimable_amount_satoshis; (void) obj->contentious_claimable.timeout_height;
1614 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
1615 return 0 /* LDKBalance - MaybeClaimableHTLCAwaitingTimeout */; (void) obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis; (void) obj->maybe_claimable_htlc_awaiting_timeout.claimable_height;
1620 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
1621 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
1622 for (size_t i = 0; i < ret.datalen; i++) {
1623 ret.data[i] = Balance_clone(&orig->data[i]);
1627 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
1630 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_a(uint32_t owner) {
1631 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
1632 int8_tArray ret_arr = init_int8_tArray(64);
1633 memcpy(ret_arr->elems, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form, 64);
1637 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
1640 ptrArray __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_b(uint32_t owner) {
1641 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
1642 LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
1643 ptrArray ret_arr = NULL;
1644 ret_arr = init_ptrArray(ret_var.datalen);
1645 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
1646 for (size_t m = 0; m < ret_var.datalen; m++) {
1647 int8_tArray ret_conv_12_arr = init_int8_tArray(64);
1648 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
1649 ret_arr_ptr[m] = ret_conv_12_arr;
1656 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
1657 CHECK(owner->result_ok);
1658 return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
1660 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint32_t owner) {
1661 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
1662 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
1663 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
1664 return ((uint64_t)ret_conv);
1667 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
1668 CHECK(!owner->result_ok);
1669 return *owner->contents.err;
1671 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint32_t owner) {
1672 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
1673 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
1676 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
1677 CHECK(owner->result_ok);
1678 return *owner->contents.result;
1680 int8_tArray __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_get_ok(uint32_t owner) {
1681 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
1682 int8_tArray ret_arr = init_int8_tArray(64);
1683 memcpy(ret_arr->elems, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form, 64);
1687 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
1688 CHECK(!owner->result_ok);
1689 return *owner->contents.err;
1691 void __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_get_err(uint32_t owner) {
1692 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
1693 CResult_SignatureNoneZ_get_err(owner_conv);
1696 typedef struct LDKBaseSign_JCalls {
1697 atomic_size_t refcnt;
1698 uint32_t get_per_commitment_point_meth;
1699 uint32_t release_commitment_secret_meth;
1700 uint32_t validate_holder_commitment_meth;
1701 uint32_t channel_keys_id_meth;
1702 uint32_t sign_counterparty_commitment_meth;
1703 uint32_t validate_counterparty_revocation_meth;
1704 uint32_t sign_holder_commitment_and_htlcs_meth;
1705 uint32_t sign_justice_revoked_output_meth;
1706 uint32_t sign_justice_revoked_htlc_meth;
1707 uint32_t sign_counterparty_htlc_transaction_meth;
1708 uint32_t sign_closing_transaction_meth;
1709 uint32_t sign_channel_announcement_meth;
1710 uint32_t ready_channel_meth;
1711 } LDKBaseSign_JCalls;
1712 static void LDKBaseSign_JCalls_free(void* this_arg) {
1713 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1714 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1715 js_free_function_ptr(j_calls->get_per_commitment_point_meth);
1716 js_free_function_ptr(j_calls->release_commitment_secret_meth);
1717 js_free_function_ptr(j_calls->validate_holder_commitment_meth);
1718 js_free_function_ptr(j_calls->channel_keys_id_meth);
1719 js_free_function_ptr(j_calls->sign_counterparty_commitment_meth);
1720 js_free_function_ptr(j_calls->validate_counterparty_revocation_meth);
1721 js_free_function_ptr(j_calls->sign_holder_commitment_and_htlcs_meth);
1722 js_free_function_ptr(j_calls->sign_justice_revoked_output_meth);
1723 js_free_function_ptr(j_calls->sign_justice_revoked_htlc_meth);
1724 js_free_function_ptr(j_calls->sign_counterparty_htlc_transaction_meth);
1725 js_free_function_ptr(j_calls->sign_closing_transaction_meth);
1726 js_free_function_ptr(j_calls->sign_channel_announcement_meth);
1727 js_free_function_ptr(j_calls->ready_channel_meth);
1731 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1732 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1733 int8_tArray ret = (int8_tArray)js_invoke_function_1(j_calls->get_per_commitment_point_meth, (uint32_t)idx);
1734 LDKPublicKey ret_ref;
1735 CHECK(ret->arr_len == 33);
1736 memcpy(ret_ref.compressed_form, ret->elems, 33);
1739 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
1740 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1741 int8_tArray ret = (int8_tArray)js_invoke_function_1(j_calls->release_commitment_secret_meth, (uint32_t)idx);
1742 LDKThirtyTwoBytes ret_ref;
1743 CHECK(ret->arr_len == 32);
1744 memcpy(ret_ref.data, ret->elems, 32);
1747 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx) {
1748 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1749 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
1750 uint64_t holder_tx_ref = 0;
1751 holder_tx_var = HolderCommitmentTransaction_clone(holder_tx);
1752 CHECK((((uint64_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1753 CHECK((((uint64_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1754 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
1755 holder_tx_ref = (uint64_t)holder_tx_var.inner;
1756 if (holder_tx_var.is_owned) {
1759 uint32_t ret = js_invoke_function_1(j_calls->validate_holder_commitment_meth, (uint32_t)holder_tx_ref);
1760 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1761 CHECK_ACCESS(ret_ptr);
1762 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1766 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
1767 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1768 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->channel_keys_id_meth);
1769 LDKThirtyTwoBytes ret_ref;
1770 CHECK(ret->arr_len == 32);
1771 memcpy(ret_ref.data, ret->elems, 32);
1774 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
1775 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1776 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1777 uint64_t commitment_tx_ref = 0;
1778 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
1779 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1780 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1781 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1782 commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
1783 if (commitment_tx_var.is_owned) {
1784 commitment_tx_ref |= 1;
1786 uint32_t ret = js_invoke_function_1(j_calls->sign_counterparty_commitment_meth, (uint32_t)commitment_tx_ref);
1787 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1788 CHECK_ACCESS(ret_ptr);
1789 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
1793 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
1794 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1795 int8_tArray secret_arr = init_int8_tArray(32);
1796 memcpy(secret_arr->elems, *secret, 32);
1797 uint32_t ret = js_invoke_function_2(j_calls->validate_counterparty_revocation_meth, (uint32_t)idx, (uint32_t)secret_arr);
1798 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1799 CHECK_ACCESS(ret_ptr);
1800 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1804 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1805 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1806 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1807 uint64_t commitment_tx_ref = 0;
1808 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
1809 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1810 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1811 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1812 commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
1813 if (commitment_tx_var.is_owned) {
1814 commitment_tx_ref |= 1;
1816 uint32_t ret = js_invoke_function_1(j_calls->sign_holder_commitment_and_htlcs_meth, (uint32_t)commitment_tx_ref);
1817 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1818 CHECK_ACCESS(ret_ptr);
1819 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
1823 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]) {
1824 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1825 LDKTransaction justice_tx_var = justice_tx;
1826 int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen);
1827 memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
1828 Transaction_free(justice_tx_var);
1829 int8_tArray per_commitment_key_arr = init_int8_tArray(32);
1830 memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
1831 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);
1832 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1833 CHECK_ACCESS(ret_ptr);
1834 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1838 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) {
1839 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1840 LDKTransaction justice_tx_var = justice_tx;
1841 int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen);
1842 memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
1843 Transaction_free(justice_tx_var);
1844 int8_tArray per_commitment_key_arr = init_int8_tArray(32);
1845 memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
1846 LDKHTLCOutputInCommitment htlc_var = *htlc;
1847 uint64_t htlc_ref = 0;
1848 htlc_var = HTLCOutputInCommitment_clone(htlc);
1849 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1850 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1851 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
1852 htlc_ref = (uint64_t)htlc_var.inner;
1853 if (htlc_var.is_owned) {
1856 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);
1857 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1858 CHECK_ACCESS(ret_ptr);
1859 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1863 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) {
1864 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1865 LDKTransaction htlc_tx_var = htlc_tx;
1866 int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen);
1867 memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
1868 Transaction_free(htlc_tx_var);
1869 int8_tArray per_commitment_point_arr = init_int8_tArray(33);
1870 memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
1871 LDKHTLCOutputInCommitment htlc_var = *htlc;
1872 uint64_t htlc_ref = 0;
1873 htlc_var = HTLCOutputInCommitment_clone(htlc);
1874 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1875 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1876 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
1877 htlc_ref = (uint64_t)htlc_var.inner;
1878 if (htlc_var.is_owned) {
1881 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);
1882 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1883 CHECK_ACCESS(ret_ptr);
1884 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1888 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
1889 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1890 LDKClosingTransaction closing_tx_var = *closing_tx;
1891 uint64_t closing_tx_ref = 0;
1892 closing_tx_var = ClosingTransaction_clone(closing_tx);
1893 CHECK((((uint64_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1894 CHECK((((uint64_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1895 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
1896 closing_tx_ref = (uint64_t)closing_tx_var.inner;
1897 if (closing_tx_var.is_owned) {
1898 closing_tx_ref |= 1;
1900 uint32_t ret = js_invoke_function_1(j_calls->sign_closing_transaction_meth, (uint32_t)closing_tx_ref);
1901 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1902 CHECK_ACCESS(ret_ptr);
1903 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1907 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
1908 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1909 LDKUnsignedChannelAnnouncement msg_var = *msg;
1910 uint64_t msg_ref = 0;
1911 msg_var = UnsignedChannelAnnouncement_clone(msg);
1912 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1913 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1914 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1915 msg_ref = (uint64_t)msg_var.inner;
1916 if (msg_var.is_owned) {
1919 uint32_t ret = js_invoke_function_1(j_calls->sign_channel_announcement_meth, (uint32_t)msg_ref);
1920 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
1921 CHECK_ACCESS(ret_ptr);
1922 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
1926 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1927 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
1928 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1929 uint64_t channel_parameters_ref = 0;
1930 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
1931 CHECK((((uint64_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1932 CHECK((((uint64_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1933 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
1934 channel_parameters_ref = (uint64_t)channel_parameters_var.inner;
1935 if (channel_parameters_var.is_owned) {
1936 channel_parameters_ref |= 1;
1938 js_invoke_function_1(j_calls->ready_channel_meth, (uint32_t)channel_parameters_ref);
1940 static void LDKBaseSign_JCalls_cloned(LDKBaseSign* new_obj) {
1941 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) new_obj->this_arg;
1942 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1944 static inline LDKBaseSign LDKBaseSign_init (/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1945 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
1946 atomic_init(&calls->refcnt, 1);
1947 //TODO: Assign calls->o from o
1949 LDKChannelPublicKeys pubkeys_conv;
1950 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1951 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1952 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
1955 .this_arg = (void*) calls,
1956 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
1957 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
1958 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
1959 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
1960 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
1961 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
1962 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
1963 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
1964 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
1965 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
1966 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
1967 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
1968 .ready_channel = ready_channel_LDKBaseSign_jcall,
1969 .free = LDKBaseSign_JCalls_free,
1970 .pubkeys = pubkeys_conv,
1971 .set_pubkeys = NULL,
1975 long __attribute__((visibility("default"))) TS_LDKBaseSign_new(/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1976 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
1977 *res_ptr = LDKBaseSign_init(o, pubkeys);
1978 return (long)res_ptr;
1980 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_get_per_commitment_point(uint32_t this_arg, int64_t idx) {
1981 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
1982 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
1983 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
1984 int8_tArray ret_arr = init_int8_tArray(33);
1985 memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
1989 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_release_commitment_secret(uint32_t this_arg, int64_t idx) {
1990 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
1991 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
1992 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
1993 int8_tArray ret_arr = init_int8_tArray(32);
1994 memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
1998 uint32_t __attribute__((visibility("default"))) TS_BaseSign_validate_holder_commitment(uint32_t this_arg, uint32_t holder_tx) {
1999 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2000 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2001 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2002 LDKHolderCommitmentTransaction holder_tx_conv;
2003 holder_tx_conv.inner = (void*)(holder_tx & (~1));
2004 holder_tx_conv.is_owned = false;
2005 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
2006 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2007 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv);
2008 return (uint64_t)ret_conv;
2011 int8_tArray __attribute__((visibility("default"))) TS_BaseSign_channel_keys_id(uint32_t this_arg) {
2012 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2013 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2014 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2015 int8_tArray ret_arr = init_int8_tArray(32);
2016 memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
2020 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_counterparty_commitment(uint32_t this_arg, uint32_t commitment_tx) {
2021 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2022 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2023 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2024 LDKCommitmentTransaction commitment_tx_conv;
2025 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2026 commitment_tx_conv.is_owned = false;
2027 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2028 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2029 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2030 return (uint64_t)ret_conv;
2033 uint32_t __attribute__((visibility("default"))) TS_BaseSign_validate_counterparty_revocation(uint32_t this_arg, int64_t idx, int8_tArray secret) {
2034 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2035 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2036 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2037 unsigned char secret_arr[32];
2038 CHECK(secret->arr_len == 32);
2039 memcpy(secret_arr, secret->elems, 32);
2040 unsigned char (*secret_ref)[32] = &secret_arr;
2041 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2042 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
2043 return (uint64_t)ret_conv;
2046 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_holder_commitment_and_htlcs(uint32_t this_arg, uint32_t commitment_tx) {
2047 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2048 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2049 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2050 LDKHolderCommitmentTransaction commitment_tx_conv;
2051 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2052 commitment_tx_conv.is_owned = false;
2053 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2054 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2055 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
2056 return (uint64_t)ret_conv;
2059 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) {
2060 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2061 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2062 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2063 LDKTransaction justice_tx_ref;
2064 justice_tx_ref.datalen = justice_tx->arr_len;
2065 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2066 memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen);
2067 justice_tx_ref.data_is_owned = true;
2068 unsigned char per_commitment_key_arr[32];
2069 CHECK(per_commitment_key->arr_len == 32);
2070 memcpy(per_commitment_key_arr, per_commitment_key->elems, 32);
2071 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2072 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2073 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
2074 return (uint64_t)ret_conv;
2077 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) {
2078 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2079 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2080 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2081 LDKTransaction justice_tx_ref;
2082 justice_tx_ref.datalen = justice_tx->arr_len;
2083 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2084 memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen);
2085 justice_tx_ref.data_is_owned = true;
2086 unsigned char per_commitment_key_arr[32];
2087 CHECK(per_commitment_key->arr_len == 32);
2088 memcpy(per_commitment_key_arr, per_commitment_key->elems, 32);
2089 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2090 LDKHTLCOutputInCommitment htlc_conv;
2091 htlc_conv.inner = (void*)(htlc & (~1));
2092 htlc_conv.is_owned = false;
2093 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2094 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2095 *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);
2096 return (uint64_t)ret_conv;
2099 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) {
2100 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2101 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2102 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2103 LDKTransaction htlc_tx_ref;
2104 htlc_tx_ref.datalen = htlc_tx->arr_len;
2105 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2106 memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen);
2107 htlc_tx_ref.data_is_owned = true;
2108 LDKPublicKey per_commitment_point_ref;
2109 CHECK(per_commitment_point->arr_len == 33);
2110 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33);
2111 LDKHTLCOutputInCommitment htlc_conv;
2112 htlc_conv.inner = (void*)(htlc & (~1));
2113 htlc_conv.is_owned = false;
2114 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2115 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2116 *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);
2117 return (uint64_t)ret_conv;
2120 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_closing_transaction(uint32_t this_arg, uint32_t closing_tx) {
2121 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2122 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2123 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2124 LDKClosingTransaction closing_tx_conv;
2125 closing_tx_conv.inner = (void*)(closing_tx & (~1));
2126 closing_tx_conv.is_owned = false;
2127 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
2128 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2129 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
2130 return (uint64_t)ret_conv;
2133 uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_channel_announcement(uint32_t this_arg, uint32_t msg) {
2134 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2135 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2136 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2137 LDKUnsignedChannelAnnouncement msg_conv;
2138 msg_conv.inner = (void*)(msg & (~1));
2139 msg_conv.is_owned = false;
2140 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
2141 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2142 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2143 return (uint64_t)ret_conv;
2146 void __attribute__((visibility("default"))) TS_BaseSign_ready_channel(uint32_t this_arg, uint32_t channel_parameters) {
2147 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2148 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2149 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2150 LDKChannelTransactionParameters channel_parameters_conv;
2151 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
2152 channel_parameters_conv.is_owned = false;
2153 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
2154 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
2157 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
2158 if (this_arg->set_pubkeys != NULL)
2159 this_arg->set_pubkeys(this_arg);
2160 return this_arg->pubkeys;
2162 uint32_t __attribute__((visibility("default"))) TS_BaseSign_get_pubkeys(uint32_t this_arg) {
2163 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2164 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2165 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
2166 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
2167 uint64_t ret_ref = 0;
2168 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2169 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2170 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2171 ret_ref = (uint64_t)ret_var.inner;
2172 if (ret_var.is_owned) {
2178 typedef struct LDKSign_JCalls {
2179 atomic_size_t refcnt;
2180 LDKBaseSign_JCalls* BaseSign;
2181 uint32_t write_meth;
2183 static void LDKSign_JCalls_free(void* this_arg) {
2184 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2185 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2186 js_free_function_ptr(j_calls->write_meth);
2190 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
2191 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2192 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->write_meth);
2193 LDKCVec_u8Z ret_ref;
2194 ret_ref.datalen = ret->arr_len;
2195 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2196 memcpy(ret_ref.data, ret->elems, ret_ref.datalen);
2199 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
2200 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
2201 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2202 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
2204 static inline LDKSign LDKSign_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* BaseSign, uint32_t pubkeys) {
2205 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
2206 atomic_init(&calls->refcnt, 1);
2207 //TODO: Assign calls->o from o
2209 LDKChannelPublicKeys pubkeys_conv;
2210 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2211 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2212 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2215 .this_arg = (void*) calls,
2216 .write = write_LDKSign_jcall,
2217 .cloned = LDKSign_JCalls_cloned,
2218 .free = LDKSign_JCalls_free,
2219 .BaseSign = LDKBaseSign_init(BaseSign, pubkeys),
2221 calls->BaseSign = ret.BaseSign.this_arg;
2224 long __attribute__((visibility("default"))) TS_LDKSign_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* BaseSign, uint32_t pubkeys) {
2225 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
2226 *res_ptr = LDKSign_init(o, BaseSign, pubkeys);
2227 return (long)res_ptr;
2229 int8_tArray __attribute__((visibility("default"))) TS_Sign_write(uint32_t this_arg) {
2230 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
2231 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
2232 LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
2233 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2234 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
2235 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2236 CVec_u8Z_free(ret_var);
2240 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
2241 return ThirtyTwoBytes_clone(&owner->a);
2243 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_a(uint32_t owner) {
2244 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
2245 int8_tArray ret_arr = init_int8_tArray(32);
2246 memcpy(ret_arr->elems, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data, 32);
2250 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
2251 return ChannelMonitor_clone(&owner->b);
2253 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_b(uint32_t owner) {
2254 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
2255 LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
2256 uint64_t ret_ref = 0;
2257 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2258 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2259 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2260 ret_ref = (uint64_t)ret_var.inner;
2261 if (ret_var.is_owned) {
2267 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
2268 CHECK(owner->result_ok);
2269 return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
2271 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint32_t owner) {
2272 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
2273 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
2274 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
2275 return ((uint64_t)ret_conv);
2278 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
2279 CHECK(!owner->result_ok);
2280 return DecodeError_clone(&*owner->contents.err);
2282 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint32_t owner) {
2283 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
2284 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
2285 uint64_t ret_ref = 0;
2286 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2287 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2288 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2289 ret_ref = (uint64_t)ret_var.inner;
2290 if (ret_var.is_owned) {
2296 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2297 CHECK(owner->result_ok);
2298 return RouteHop_clone(&*owner->contents.result);
2300 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_get_ok(uint32_t owner) {
2301 LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)(owner & ~1);
2302 LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
2303 uint64_t ret_ref = 0;
2304 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2305 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2306 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2307 ret_ref = (uint64_t)ret_var.inner;
2308 if (ret_var.is_owned) {
2314 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2315 CHECK(!owner->result_ok);
2316 return DecodeError_clone(&*owner->contents.err);
2318 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_get_err(uint32_t owner) {
2319 LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)(owner & ~1);
2320 LDKDecodeError ret_var = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
2321 uint64_t ret_ref = 0;
2322 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2323 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2324 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2325 ret_ref = (uint64_t)ret_var.inner;
2326 if (ret_var.is_owned) {
2332 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
2333 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
2334 for (size_t i = 0; i < ret.datalen; i++) {
2335 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
2339 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2340 CHECK(owner->result_ok);
2341 return Route_clone(&*owner->contents.result);
2343 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_get_ok(uint32_t owner) {
2344 LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)(owner & ~1);
2345 LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
2346 uint64_t ret_ref = 0;
2347 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2348 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2349 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2350 ret_ref = (uint64_t)ret_var.inner;
2351 if (ret_var.is_owned) {
2357 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2358 CHECK(!owner->result_ok);
2359 return DecodeError_clone(&*owner->contents.err);
2361 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_get_err(uint32_t owner) {
2362 LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)(owner & ~1);
2363 LDKDecodeError ret_var = CResult_RouteDecodeErrorZ_get_err(owner_conv);
2364 uint64_t ret_ref = 0;
2365 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2366 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2367 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2368 ret_ref = (uint64_t)ret_var.inner;
2369 if (ret_var.is_owned) {
2375 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2376 CHECK(owner->result_ok);
2377 return RouteParameters_clone(&*owner->contents.result);
2379 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_get_ok(uint32_t owner) {
2380 LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(owner & ~1);
2381 LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
2382 uint64_t ret_ref = 0;
2383 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2384 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2385 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2386 ret_ref = (uint64_t)ret_var.inner;
2387 if (ret_var.is_owned) {
2393 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2394 CHECK(!owner->result_ok);
2395 return DecodeError_clone(&*owner->contents.err);
2397 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_get_err(uint32_t owner) {
2398 LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(owner & ~1);
2399 LDKDecodeError ret_var = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
2400 uint64_t ret_ref = 0;
2401 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2402 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2403 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2404 ret_ref = (uint64_t)ret_var.inner;
2405 if (ret_var.is_owned) {
2411 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
2412 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
2413 for (size_t i = 0; i < ret.datalen; i++) {
2414 ret.data[i] = RouteHint_clone(&orig->data[i]);
2418 static inline struct LDKPayee CResult_PayeeDecodeErrorZ_get_ok(LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR owner){
2419 CHECK(owner->result_ok);
2420 return Payee_clone(&*owner->contents.result);
2422 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_get_ok(uint32_t owner) {
2423 LDKCResult_PayeeDecodeErrorZ* owner_conv = (LDKCResult_PayeeDecodeErrorZ*)(owner & ~1);
2424 LDKPayee ret_var = CResult_PayeeDecodeErrorZ_get_ok(owner_conv);
2425 uint64_t ret_ref = 0;
2426 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2427 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2428 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2429 ret_ref = (uint64_t)ret_var.inner;
2430 if (ret_var.is_owned) {
2436 static inline struct LDKDecodeError CResult_PayeeDecodeErrorZ_get_err(LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR owner){
2437 CHECK(!owner->result_ok);
2438 return DecodeError_clone(&*owner->contents.err);
2440 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_get_err(uint32_t owner) {
2441 LDKCResult_PayeeDecodeErrorZ* owner_conv = (LDKCResult_PayeeDecodeErrorZ*)(owner & ~1);
2442 LDKDecodeError ret_var = CResult_PayeeDecodeErrorZ_get_err(owner_conv);
2443 uint64_t ret_ref = 0;
2444 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2445 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2446 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2447 ret_ref = (uint64_t)ret_var.inner;
2448 if (ret_var.is_owned) {
2454 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
2455 LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
2456 for (size_t i = 0; i < ret.datalen; i++) {
2457 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
2461 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2462 CHECK(owner->result_ok);
2463 return RouteHint_clone(&*owner->contents.result);
2465 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_get_ok(uint32_t owner) {
2466 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
2467 LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
2468 uint64_t ret_ref = 0;
2469 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2470 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2471 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2472 ret_ref = (uint64_t)ret_var.inner;
2473 if (ret_var.is_owned) {
2479 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2480 CHECK(!owner->result_ok);
2481 return DecodeError_clone(&*owner->contents.err);
2483 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_get_err(uint32_t owner) {
2484 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
2485 LDKDecodeError ret_var = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
2486 uint64_t ret_ref = 0;
2487 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2488 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2489 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2490 ret_ref = (uint64_t)ret_var.inner;
2491 if (ret_var.is_owned) {
2497 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2498 CHECK(owner->result_ok);
2499 return RouteHintHop_clone(&*owner->contents.result);
2501 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_get_ok(uint32_t owner) {
2502 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
2503 LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
2504 uint64_t ret_ref = 0;
2505 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2506 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2507 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2508 ret_ref = (uint64_t)ret_var.inner;
2509 if (ret_var.is_owned) {
2515 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2516 CHECK(!owner->result_ok);
2517 return DecodeError_clone(&*owner->contents.err);
2519 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_get_err(uint32_t owner) {
2520 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
2521 LDKDecodeError ret_var = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
2522 uint64_t ret_ref = 0;
2523 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2524 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2525 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2526 ret_ref = (uint64_t)ret_var.inner;
2527 if (ret_var.is_owned) {
2533 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
2534 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
2535 for (size_t i = 0; i < ret.datalen; i++) {
2536 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
2540 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2541 CHECK(owner->result_ok);
2542 return Route_clone(&*owner->contents.result);
2544 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_get_ok(uint32_t owner) {
2545 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
2546 LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
2547 uint64_t ret_ref = 0;
2548 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2549 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2550 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2551 ret_ref = (uint64_t)ret_var.inner;
2552 if (ret_var.is_owned) {
2558 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2559 CHECK(!owner->result_ok);
2560 return LightningError_clone(&*owner->contents.err);
2562 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_get_err(uint32_t owner) {
2563 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
2564 LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
2565 uint64_t ret_ref = 0;
2566 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2567 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2568 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2569 ret_ref = (uint64_t)ret_var.inner;
2570 if (ret_var.is_owned) {
2576 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
2577 CHECK(owner->result_ok);
2578 return *owner->contents.result;
2580 void __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_get_ok(uint32_t owner) {
2581 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
2582 CResult_NoneLightningErrorZ_get_ok(owner_conv);
2585 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
2586 CHECK(!owner->result_ok);
2587 return LightningError_clone(&*owner->contents.err);
2589 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_get_err(uint32_t owner) {
2590 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
2591 LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
2592 uint64_t ret_ref = 0;
2593 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2594 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2595 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2596 ret_ref = (uint64_t)ret_var.inner;
2597 if (ret_var.is_owned) {
2603 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
2606 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint32_t owner) {
2607 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
2608 int8_tArray ret_arr = init_int8_tArray(33);
2609 memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
2613 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
2614 return Type_clone(&owner->b);
2616 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint32_t owner) {
2617 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
2618 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
2619 *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
2620 return (uint64_t)ret_ret;
2623 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
2624 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
2625 for (size_t i = 0; i < ret.datalen; i++) {
2626 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
2630 uint32_t __attribute__((visibility("default"))) TS_LDKErrorAction_ref_from_ptr(uint32_t ptr) {
2631 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
2633 case LDKErrorAction_DisconnectPeer: {
2634 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
2635 uint64_t msg_ref = 0;
2636 if ((uint64_t)msg_var.inner > 4096) {
2637 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2638 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2639 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2640 msg_ref = (uint64_t)msg_var.inner & ~1;
2642 return 0 /* LDKErrorAction - DisconnectPeer */; (void) msg_ref;
2644 case LDKErrorAction_IgnoreError: {
2645 return 0 /* LDKErrorAction - IgnoreError */;
2647 case LDKErrorAction_IgnoreAndLog: {
2648 uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
2649 return 0 /* LDKErrorAction - IgnoreAndLog */; (void) ignore_and_log_conv;
2651 case LDKErrorAction_IgnoreDuplicateGossip: {
2652 return 0 /* LDKErrorAction - IgnoreDuplicateGossip */;
2654 case LDKErrorAction_SendErrorMessage: {
2655 LDKErrorMessage msg_var = obj->send_error_message.msg;
2656 uint64_t msg_ref = 0;
2657 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2658 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2659 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2660 msg_ref = (uint64_t)msg_var.inner & ~1;
2661 return 0 /* LDKErrorAction - SendErrorMessage */; (void) msg_ref;
2666 uint32_t __attribute__((visibility("default"))) TS_LDKMessageSendEvent_ref_from_ptr(uint32_t ptr) {
2667 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2669 case LDKMessageSendEvent_SendAcceptChannel: {
2670 int8_tArray node_id_arr = init_int8_tArray(33);
2671 memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
2672 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
2673 uint64_t msg_ref = 0;
2674 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2675 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2676 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2677 msg_ref = (uint64_t)msg_var.inner & ~1;
2678 return 0 /* LDKMessageSendEvent - SendAcceptChannel */; (void) node_id_arr; (void) msg_ref;
2680 case LDKMessageSendEvent_SendOpenChannel: {
2681 int8_tArray node_id_arr = init_int8_tArray(33);
2682 memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
2683 LDKOpenChannel msg_var = obj->send_open_channel.msg;
2684 uint64_t msg_ref = 0;
2685 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2686 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2687 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2688 msg_ref = (uint64_t)msg_var.inner & ~1;
2689 return 0 /* LDKMessageSendEvent - SendOpenChannel */; (void) node_id_arr; (void) msg_ref;
2691 case LDKMessageSendEvent_SendFundingCreated: {
2692 int8_tArray node_id_arr = init_int8_tArray(33);
2693 memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
2694 LDKFundingCreated msg_var = obj->send_funding_created.msg;
2695 uint64_t msg_ref = 0;
2696 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2697 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2698 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2699 msg_ref = (uint64_t)msg_var.inner & ~1;
2700 return 0 /* LDKMessageSendEvent - SendFundingCreated */; (void) node_id_arr; (void) msg_ref;
2702 case LDKMessageSendEvent_SendFundingSigned: {
2703 int8_tArray node_id_arr = init_int8_tArray(33);
2704 memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
2705 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
2706 uint64_t msg_ref = 0;
2707 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2708 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2709 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2710 msg_ref = (uint64_t)msg_var.inner & ~1;
2711 return 0 /* LDKMessageSendEvent - SendFundingSigned */; (void) node_id_arr; (void) msg_ref;
2713 case LDKMessageSendEvent_SendFundingLocked: {
2714 int8_tArray node_id_arr = init_int8_tArray(33);
2715 memcpy(node_id_arr->elems, obj->send_funding_locked.node_id.compressed_form, 33);
2716 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
2717 uint64_t msg_ref = 0;
2718 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2719 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2720 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2721 msg_ref = (uint64_t)msg_var.inner & ~1;
2722 return 0 /* LDKMessageSendEvent - SendFundingLocked */; (void) node_id_arr; (void) msg_ref;
2724 case LDKMessageSendEvent_SendAnnouncementSignatures: {
2725 int8_tArray node_id_arr = init_int8_tArray(33);
2726 memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
2727 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
2728 uint64_t msg_ref = 0;
2729 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2730 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2731 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2732 msg_ref = (uint64_t)msg_var.inner & ~1;
2733 return 0 /* LDKMessageSendEvent - SendAnnouncementSignatures */; (void) node_id_arr; (void) msg_ref;
2735 case LDKMessageSendEvent_UpdateHTLCs: {
2736 int8_tArray node_id_arr = init_int8_tArray(33);
2737 memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
2738 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
2739 uint64_t updates_ref = 0;
2740 CHECK((((uint64_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2741 CHECK((((uint64_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2742 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
2743 updates_ref = (uint64_t)updates_var.inner & ~1;
2744 return 0 /* LDKMessageSendEvent - UpdateHTLCs */; (void) node_id_arr; (void) updates_ref;
2746 case LDKMessageSendEvent_SendRevokeAndACK: {
2747 int8_tArray node_id_arr = init_int8_tArray(33);
2748 memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
2749 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
2750 uint64_t msg_ref = 0;
2751 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2752 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2753 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2754 msg_ref = (uint64_t)msg_var.inner & ~1;
2755 return 0 /* LDKMessageSendEvent - SendRevokeAndACK */; (void) node_id_arr; (void) msg_ref;
2757 case LDKMessageSendEvent_SendClosingSigned: {
2758 int8_tArray node_id_arr = init_int8_tArray(33);
2759 memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
2760 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
2761 uint64_t msg_ref = 0;
2762 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2763 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2764 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2765 msg_ref = (uint64_t)msg_var.inner & ~1;
2766 return 0 /* LDKMessageSendEvent - SendClosingSigned */; (void) node_id_arr; (void) msg_ref;
2768 case LDKMessageSendEvent_SendShutdown: {
2769 int8_tArray node_id_arr = init_int8_tArray(33);
2770 memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
2771 LDKShutdown msg_var = obj->send_shutdown.msg;
2772 uint64_t msg_ref = 0;
2773 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2774 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2775 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2776 msg_ref = (uint64_t)msg_var.inner & ~1;
2777 return 0 /* LDKMessageSendEvent - SendShutdown */; (void) node_id_arr; (void) msg_ref;
2779 case LDKMessageSendEvent_SendChannelReestablish: {
2780 int8_tArray node_id_arr = init_int8_tArray(33);
2781 memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
2782 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
2783 uint64_t msg_ref = 0;
2784 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2785 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2786 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2787 msg_ref = (uint64_t)msg_var.inner & ~1;
2788 return 0 /* LDKMessageSendEvent - SendChannelReestablish */; (void) node_id_arr; (void) msg_ref;
2790 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
2791 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
2792 uint64_t msg_ref = 0;
2793 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2794 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2795 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2796 msg_ref = (uint64_t)msg_var.inner & ~1;
2797 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
2798 uint64_t update_msg_ref = 0;
2799 CHECK((((uint64_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2800 CHECK((((uint64_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2801 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
2802 update_msg_ref = (uint64_t)update_msg_var.inner & ~1;
2803 return 0 /* LDKMessageSendEvent - BroadcastChannelAnnouncement */; (void) msg_ref; (void) update_msg_ref;
2805 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
2806 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
2807 uint64_t msg_ref = 0;
2808 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2809 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2810 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2811 msg_ref = (uint64_t)msg_var.inner & ~1;
2812 return 0 /* LDKMessageSendEvent - BroadcastNodeAnnouncement */; (void) msg_ref;
2814 case LDKMessageSendEvent_BroadcastChannelUpdate: {
2815 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
2816 uint64_t msg_ref = 0;
2817 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2818 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2819 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2820 msg_ref = (uint64_t)msg_var.inner & ~1;
2821 return 0 /* LDKMessageSendEvent - BroadcastChannelUpdate */; (void) msg_ref;
2823 case LDKMessageSendEvent_SendChannelUpdate: {
2824 int8_tArray node_id_arr = init_int8_tArray(33);
2825 memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
2826 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
2827 uint64_t msg_ref = 0;
2828 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2829 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2830 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2831 msg_ref = (uint64_t)msg_var.inner & ~1;
2832 return 0 /* LDKMessageSendEvent - SendChannelUpdate */; (void) node_id_arr; (void) msg_ref;
2834 case LDKMessageSendEvent_HandleError: {
2835 int8_tArray node_id_arr = init_int8_tArray(33);
2836 memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
2837 uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
2838 return 0 /* LDKMessageSendEvent - HandleError */; (void) node_id_arr; (void) action_ref;
2840 case LDKMessageSendEvent_SendChannelRangeQuery: {
2841 int8_tArray node_id_arr = init_int8_tArray(33);
2842 memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
2843 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
2844 uint64_t msg_ref = 0;
2845 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2846 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2847 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2848 msg_ref = (uint64_t)msg_var.inner & ~1;
2849 return 0 /* LDKMessageSendEvent - SendChannelRangeQuery */; (void) node_id_arr; (void) msg_ref;
2851 case LDKMessageSendEvent_SendShortIdsQuery: {
2852 int8_tArray node_id_arr = init_int8_tArray(33);
2853 memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
2854 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
2855 uint64_t msg_ref = 0;
2856 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2857 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2858 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2859 msg_ref = (uint64_t)msg_var.inner & ~1;
2860 return 0 /* LDKMessageSendEvent - SendShortIdsQuery */; (void) node_id_arr; (void) msg_ref;
2862 case LDKMessageSendEvent_SendReplyChannelRange: {
2863 int8_tArray node_id_arr = init_int8_tArray(33);
2864 memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
2865 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
2866 uint64_t msg_ref = 0;
2867 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2868 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2869 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2870 msg_ref = (uint64_t)msg_var.inner & ~1;
2871 return 0 /* LDKMessageSendEvent - SendReplyChannelRange */; (void) node_id_arr; (void) msg_ref;
2876 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
2877 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
2878 for (size_t i = 0; i < ret.datalen; i++) {
2879 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
2883 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
2884 CHECK(owner->result_ok);
2885 return *owner->contents.result;
2887 jboolean __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_get_ok(uint32_t owner) {
2888 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
2889 jboolean ret_val = CResult_boolLightningErrorZ_get_ok(owner_conv);
2893 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
2894 CHECK(!owner->result_ok);
2895 return LightningError_clone(&*owner->contents.err);
2897 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_get_err(uint32_t owner) {
2898 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
2899 LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
2900 uint64_t ret_ref = 0;
2901 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2902 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2903 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2904 ret_ref = (uint64_t)ret_var.inner;
2905 if (ret_var.is_owned) {
2911 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
2912 return ChannelAnnouncement_clone(&owner->a);
2914 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint32_t owner) {
2915 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
2916 LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
2917 uint64_t ret_ref = 0;
2918 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2919 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2920 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2921 ret_ref = (uint64_t)ret_var.inner;
2922 if (ret_var.is_owned) {
2928 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
2929 return ChannelUpdate_clone(&owner->b);
2931 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint32_t owner) {
2932 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
2933 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
2934 uint64_t ret_ref = 0;
2935 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2936 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2937 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2938 ret_ref = (uint64_t)ret_var.inner;
2939 if (ret_var.is_owned) {
2945 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
2946 return ChannelUpdate_clone(&owner->c);
2948 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint32_t owner) {
2949 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
2950 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
2951 uint64_t ret_ref = 0;
2952 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2953 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2954 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2955 ret_ref = (uint64_t)ret_var.inner;
2956 if (ret_var.is_owned) {
2962 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
2963 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
2964 for (size_t i = 0; i < ret.datalen; i++) {
2965 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
2969 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
2970 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
2971 for (size_t i = 0; i < ret.datalen; i++) {
2972 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
2976 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
2977 CHECK(owner->result_ok);
2978 return CVec_u8Z_clone(&*owner->contents.result);
2980 int8_tArray __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint32_t owner) {
2981 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
2982 LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
2983 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
2984 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2985 CVec_u8Z_free(ret_var);
2989 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
2990 CHECK(!owner->result_ok);
2991 return PeerHandleError_clone(&*owner->contents.err);
2993 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err(uint32_t owner) {
2994 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
2995 LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
2996 uint64_t ret_ref = 0;
2997 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2998 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2999 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3000 ret_ref = (uint64_t)ret_var.inner;
3001 if (ret_var.is_owned) {
3007 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
3008 CHECK(owner->result_ok);
3009 return *owner->contents.result;
3011 void __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_get_ok(uint32_t owner) {
3012 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
3013 CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
3016 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
3017 CHECK(!owner->result_ok);
3018 return PeerHandleError_clone(&*owner->contents.err);
3020 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_get_err(uint32_t owner) {
3021 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
3022 LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
3023 uint64_t ret_ref = 0;
3024 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3025 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3026 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3027 ret_ref = (uint64_t)ret_var.inner;
3028 if (ret_var.is_owned) {
3034 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
3035 CHECK(owner->result_ok);
3036 return *owner->contents.result;
3038 jboolean __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_get_ok(uint32_t owner) {
3039 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
3040 jboolean ret_val = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
3044 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
3045 CHECK(!owner->result_ok);
3046 return PeerHandleError_clone(&*owner->contents.err);
3048 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_get_err(uint32_t owner) {
3049 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
3050 LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
3051 uint64_t ret_ref = 0;
3052 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3053 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3054 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3055 ret_ref = (uint64_t)ret_var.inner;
3056 if (ret_var.is_owned) {
3062 static inline struct LDKTxOut CResult_TxOutAccessErrorZ_get_ok(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
3063 CHECK(owner->result_ok);
3064 return TxOut_clone(&*owner->contents.result);
3066 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_get_ok(uint32_t owner) {
3067 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
3068 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
3069 *ret_ref = CResult_TxOutAccessErrorZ_get_ok(owner_conv);
3070 return (uint64_t)ret_ref;
3073 static inline enum LDKAccessError CResult_TxOutAccessErrorZ_get_err(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
3074 CHECK(!owner->result_ok);
3075 return AccessError_clone(&*owner->contents.err);
3077 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_get_err(uint32_t owner) {
3078 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
3079 uint32_t ret_conv = LDKAccessError_to_js(CResult_TxOutAccessErrorZ_get_err(owner_conv));
3083 static inline void CResult_NoneChannelMonitorUpdateErrZ_get_ok(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
3084 CHECK(owner->result_ok);
3085 return *owner->contents.result;
3087 void __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_get_ok(uint32_t owner) {
3088 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
3089 CResult_NoneChannelMonitorUpdateErrZ_get_ok(owner_conv);
3092 static inline enum LDKChannelMonitorUpdateErr CResult_NoneChannelMonitorUpdateErrZ_get_err(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
3093 CHECK(!owner->result_ok);
3094 return ChannelMonitorUpdateErr_clone(&*owner->contents.err);
3096 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_get_err(uint32_t owner) {
3097 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
3098 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(CResult_NoneChannelMonitorUpdateErrZ_get_err(owner_conv));
3102 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_ref_from_ptr(uint32_t ptr) {
3103 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
3105 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
3106 LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
3107 *some_conv = obj->some;
3108 *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
3109 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - Some */; (void) ((uint64_t)some_conv);
3111 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
3112 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - None */;
3117 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_ClosureReasonZ_ref_from_ptr(uint32_t ptr) {
3118 LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)(ptr & ~1);
3120 case LDKCOption_ClosureReasonZ_Some: {
3121 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
3122 return 0 /* LDKCOption_ClosureReasonZ - Some */; (void) some_ref;
3124 case LDKCOption_ClosureReasonZ_None: {
3125 return 0 /* LDKCOption_ClosureReasonZ - None */;
3130 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
3131 CHECK(owner->result_ok);
3132 return COption_ClosureReasonZ_clone(&*owner->contents.result);
3134 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint32_t owner) {
3135 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
3136 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
3137 *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
3138 uint64_t ret_ref = (uint64_t)ret_copy;
3142 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
3143 CHECK(!owner->result_ok);
3144 return DecodeError_clone(&*owner->contents.err);
3146 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint32_t owner) {
3147 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
3148 LDKDecodeError ret_var = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
3149 uint64_t ret_ref = 0;
3150 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3151 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3152 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3153 ret_ref = (uint64_t)ret_var.inner;
3154 if (ret_var.is_owned) {
3160 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_EventZ_ref_from_ptr(uint32_t ptr) {
3161 LDKCOption_EventZ *obj = (LDKCOption_EventZ*)(ptr & ~1);
3163 case LDKCOption_EventZ_Some: {
3164 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
3165 return 0 /* LDKCOption_EventZ - Some */; (void) some_ref;
3167 case LDKCOption_EventZ_None: {
3168 return 0 /* LDKCOption_EventZ - None */;
3173 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
3174 CHECK(owner->result_ok);
3175 return COption_EventZ_clone(&*owner->contents.result);
3177 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_get_ok(uint32_t owner) {
3178 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
3179 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
3180 *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
3181 uint64_t ret_ref = (uint64_t)ret_copy;
3185 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
3186 CHECK(!owner->result_ok);
3187 return DecodeError_clone(&*owner->contents.err);
3189 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_get_err(uint32_t owner) {
3190 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
3191 LDKDecodeError ret_var = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
3192 uint64_t ret_ref = 0;
3193 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3194 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3195 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3196 ret_ref = (uint64_t)ret_var.inner;
3197 if (ret_var.is_owned) {
3203 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3204 CHECK(owner->result_ok);
3205 return NodeId_clone(&*owner->contents.result);
3207 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_get_ok(uint32_t owner) {
3208 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
3209 LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
3210 uint64_t ret_ref = 0;
3211 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3212 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3213 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3214 ret_ref = (uint64_t)ret_var.inner;
3215 if (ret_var.is_owned) {
3221 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3222 CHECK(!owner->result_ok);
3223 return DecodeError_clone(&*owner->contents.err);
3225 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_get_err(uint32_t owner) {
3226 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
3227 LDKDecodeError ret_var = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
3228 uint64_t ret_ref = 0;
3229 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3230 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3231 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3232 ret_ref = (uint64_t)ret_var.inner;
3233 if (ret_var.is_owned) {
3239 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3240 CHECK(owner->result_ok);
3241 return COption_NetworkUpdateZ_clone(&*owner->contents.result);
3243 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint32_t owner) {
3244 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
3245 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
3246 *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
3247 uint64_t ret_ref = (uint64_t)ret_copy;
3251 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3252 CHECK(!owner->result_ok);
3253 return DecodeError_clone(&*owner->contents.err);
3255 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint32_t owner) {
3256 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
3257 LDKDecodeError ret_var = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
3258 uint64_t ret_ref = 0;
3259 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3260 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3261 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3262 ret_ref = (uint64_t)ret_var.inner;
3263 if (ret_var.is_owned) {
3269 typedef struct LDKAccess_JCalls {
3270 atomic_size_t refcnt;
3271 uint32_t get_utxo_meth;
3273 static void LDKAccess_JCalls_free(void* this_arg) {
3274 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3275 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3276 js_free_function_ptr(j_calls->get_utxo_meth);
3280 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
3281 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3282 int8_tArray genesis_hash_arr = init_int8_tArray(32);
3283 memcpy(genesis_hash_arr->elems, *genesis_hash, 32);
3284 uint32_t ret = js_invoke_function_2(j_calls->get_utxo_meth, (uint32_t)genesis_hash_arr, (uint32_t)short_channel_id);
3285 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
3286 CHECK_ACCESS(ret_ptr);
3287 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
3291 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
3292 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
3293 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3295 static inline LDKAccess LDKAccess_init (/*TODO: JS Object Reference */void* o) {
3296 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
3297 atomic_init(&calls->refcnt, 1);
3298 //TODO: Assign calls->o from o
3301 .this_arg = (void*) calls,
3302 .get_utxo = get_utxo_LDKAccess_jcall,
3303 .free = LDKAccess_JCalls_free,
3307 long __attribute__((visibility("default"))) TS_LDKAccess_new(/*TODO: JS Object Reference */void* o) {
3308 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
3309 *res_ptr = LDKAccess_init(o);
3310 return (long)res_ptr;
3312 uint32_t __attribute__((visibility("default"))) TS_Access_get_utxo(uint32_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
3313 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
3314 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3315 LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
3316 unsigned char genesis_hash_arr[32];
3317 CHECK(genesis_hash->arr_len == 32);
3318 memcpy(genesis_hash_arr, genesis_hash->elems, 32);
3319 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
3320 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
3321 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
3322 return (uint64_t)ret_conv;
3325 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_AccessZ_ref_from_ptr(uint32_t ptr) {
3326 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
3328 case LDKCOption_AccessZ_Some: {
3329 LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
3330 *some_ret = obj->some;
3331 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
3332 return 0 /* LDKCOption_AccessZ - Some */; (void) (uint64_t)some_ret;
3334 case LDKCOption_AccessZ_None: {
3335 return 0 /* LDKCOption_AccessZ - None */;
3340 static inline struct LDKDirectionalChannelInfo CResult_DirectionalChannelInfoDecodeErrorZ_get_ok(LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3341 CHECK(owner->result_ok);
3342 return DirectionalChannelInfo_clone(&*owner->contents.result);
3344 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_get_ok(uint32_t owner) {
3345 LDKCResult_DirectionalChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(owner & ~1);
3346 LDKDirectionalChannelInfo ret_var = CResult_DirectionalChannelInfoDecodeErrorZ_get_ok(owner_conv);
3347 uint64_t ret_ref = 0;
3348 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3349 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3350 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3351 ret_ref = (uint64_t)ret_var.inner;
3352 if (ret_var.is_owned) {
3358 static inline struct LDKDecodeError CResult_DirectionalChannelInfoDecodeErrorZ_get_err(LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3359 CHECK(!owner->result_ok);
3360 return DecodeError_clone(&*owner->contents.err);
3362 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_get_err(uint32_t owner) {
3363 LDKCResult_DirectionalChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(owner & ~1);
3364 LDKDecodeError ret_var = CResult_DirectionalChannelInfoDecodeErrorZ_get_err(owner_conv);
3365 uint64_t ret_ref = 0;
3366 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3367 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3368 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3369 ret_ref = (uint64_t)ret_var.inner;
3370 if (ret_var.is_owned) {
3376 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3377 CHECK(owner->result_ok);
3378 return ChannelInfo_clone(&*owner->contents.result);
3380 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_get_ok(uint32_t owner) {
3381 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
3382 LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
3383 uint64_t ret_ref = 0;
3384 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3385 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3386 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3387 ret_ref = (uint64_t)ret_var.inner;
3388 if (ret_var.is_owned) {
3394 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3395 CHECK(!owner->result_ok);
3396 return DecodeError_clone(&*owner->contents.err);
3398 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_get_err(uint32_t owner) {
3399 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
3400 LDKDecodeError ret_var = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
3401 uint64_t ret_ref = 0;
3402 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3403 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3404 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3405 ret_ref = (uint64_t)ret_var.inner;
3406 if (ret_var.is_owned) {
3412 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3413 CHECK(owner->result_ok);
3414 return RoutingFees_clone(&*owner->contents.result);
3416 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_get_ok(uint32_t owner) {
3417 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
3418 LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
3419 uint64_t ret_ref = 0;
3420 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3421 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3422 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3423 ret_ref = (uint64_t)ret_var.inner;
3424 if (ret_var.is_owned) {
3430 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3431 CHECK(!owner->result_ok);
3432 return DecodeError_clone(&*owner->contents.err);
3434 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_get_err(uint32_t owner) {
3435 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
3436 LDKDecodeError ret_var = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
3437 uint64_t ret_ref = 0;
3438 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3439 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3440 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3441 ret_ref = (uint64_t)ret_var.inner;
3442 if (ret_var.is_owned) {
3448 uint32_t __attribute__((visibility("default"))) TS_LDKNetAddress_ref_from_ptr(uint32_t ptr) {
3449 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3451 case LDKNetAddress_IPv4: {
3452 int8_tArray addr_arr = init_int8_tArray(4);
3453 memcpy(addr_arr->elems, obj->i_pv4.addr.data, 4);
3454 return 0 /* LDKNetAddress - IPv4 */; (void) addr_arr; (void) obj->i_pv4.port;
3456 case LDKNetAddress_IPv6: {
3457 int8_tArray addr_arr = init_int8_tArray(16);
3458 memcpy(addr_arr->elems, obj->i_pv6.addr.data, 16);
3459 return 0 /* LDKNetAddress - IPv6 */; (void) addr_arr; (void) obj->i_pv6.port;
3461 case LDKNetAddress_OnionV2: {
3462 int8_tArray onion_v2_arr = init_int8_tArray(12);
3463 memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
3464 return 0 /* LDKNetAddress - OnionV2 */; (void) onion_v2_arr;
3466 case LDKNetAddress_OnionV3: {
3467 int8_tArray ed25519_pubkey_arr = init_int8_tArray(32);
3468 memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
3469 return 0 /* LDKNetAddress - OnionV3 */; (void) ed25519_pubkey_arr; (void) obj->onion_v3.checksum; (void) obj->onion_v3.version; (void) obj->onion_v3.port;
3474 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3475 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3476 for (size_t i = 0; i < ret.datalen; i++) {
3477 ret.data[i] = NetAddress_clone(&orig->data[i]);
3481 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3482 CHECK(owner->result_ok);
3483 return NodeAnnouncementInfo_clone(&*owner->contents.result);
3485 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint32_t owner) {
3486 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
3487 LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
3488 uint64_t ret_ref = 0;
3489 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3490 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3491 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3492 ret_ref = (uint64_t)ret_var.inner;
3493 if (ret_var.is_owned) {
3499 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3500 CHECK(!owner->result_ok);
3501 return DecodeError_clone(&*owner->contents.err);
3503 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint32_t owner) {
3504 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
3505 LDKDecodeError ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
3506 uint64_t ret_ref = 0;
3507 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3508 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3509 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3510 ret_ref = (uint64_t)ret_var.inner;
3511 if (ret_var.is_owned) {
3517 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
3518 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
3519 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
3522 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3523 CHECK(owner->result_ok);
3524 return NodeInfo_clone(&*owner->contents.result);
3526 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_get_ok(uint32_t owner) {
3527 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
3528 LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
3529 uint64_t ret_ref = 0;
3530 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3531 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3532 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3533 ret_ref = (uint64_t)ret_var.inner;
3534 if (ret_var.is_owned) {
3540 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3541 CHECK(!owner->result_ok);
3542 return DecodeError_clone(&*owner->contents.err);
3544 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_get_err(uint32_t owner) {
3545 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
3546 LDKDecodeError ret_var = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
3547 uint64_t ret_ref = 0;
3548 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3549 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3550 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3551 ret_ref = (uint64_t)ret_var.inner;
3552 if (ret_var.is_owned) {
3558 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3559 CHECK(owner->result_ok);
3560 return NetworkGraph_clone(&*owner->contents.result);
3562 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_get_ok(uint32_t owner) {
3563 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
3564 LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
3565 uint64_t ret_ref = 0;
3566 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3567 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3568 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3569 ret_ref = (uint64_t)ret_var.inner;
3570 if (ret_var.is_owned) {
3576 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3577 CHECK(!owner->result_ok);
3578 return DecodeError_clone(&*owner->contents.err);
3580 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_get_err(uint32_t owner) {
3581 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
3582 LDKDecodeError ret_var = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
3583 uint64_t ret_ref = 0;
3584 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3585 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3586 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3587 ret_ref = (uint64_t)ret_var.inner;
3588 if (ret_var.is_owned) {
3594 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_CVec_NetAddressZZ_ref_from_ptr(uint32_t ptr) {
3595 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
3597 case LDKCOption_CVec_NetAddressZZ_Some: {
3598 LDKCVec_NetAddressZ some_var = obj->some;
3599 uint32_tArray some_arr = NULL;
3600 some_arr = init_uint32_tArray(some_var.datalen);
3601 uint32_t *some_arr_ptr = (uint32_t*)(some_arr + 4);
3602 for (size_t m = 0; m < some_var.datalen; m++) {
3603 uint64_t some_conv_12_ref = ((uint64_t)&some_var.data[m]) | 1;
3604 some_arr_ptr[m] = some_conv_12_ref;
3607 return 0 /* LDKCOption_CVec_NetAddressZZ - Some */; (void) some_arr;
3609 case LDKCOption_CVec_NetAddressZZ_None: {
3610 return 0 /* LDKCOption_CVec_NetAddressZZ - None */;
3615 static inline struct LDKScoringParameters *CResult_ScoringParametersDecodeErrorZ_get_ok(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR owner){
3616 CHECK(owner->result_ok);
3617 return &*owner->contents.result;
3619 uint32_t __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_get_ok(uint32_t owner) {
3620 LDKCResult_ScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(owner & ~1);
3621 LDKScoringParameters ret_var = *CResult_ScoringParametersDecodeErrorZ_get_ok(owner_conv);
3622 uint64_t ret_ref = 0;
3623 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3624 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3625 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3626 ret_ref = (uint64_t)ret_var.inner & ~1;
3630 static inline struct LDKDecodeError CResult_ScoringParametersDecodeErrorZ_get_err(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR owner){
3631 CHECK(!owner->result_ok);
3632 return DecodeError_clone(&*owner->contents.err);
3634 uint32_t __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_get_err(uint32_t owner) {
3635 LDKCResult_ScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(owner & ~1);
3636 LDKDecodeError ret_var = CResult_ScoringParametersDecodeErrorZ_get_err(owner_conv);
3637 uint64_t ret_ref = 0;
3638 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3639 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3640 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3641 ret_ref = (uint64_t)ret_var.inner;
3642 if (ret_var.is_owned) {
3648 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3649 CHECK(owner->result_ok);
3650 return InitFeatures_clone(&*owner->contents.result);
3652 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
3653 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
3654 LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
3655 uint64_t ret_ref = 0;
3656 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3657 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3658 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3659 ret_ref = (uint64_t)ret_var.inner;
3660 if (ret_var.is_owned) {
3666 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3667 CHECK(!owner->result_ok);
3668 return DecodeError_clone(&*owner->contents.err);
3670 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_get_err(uint32_t owner) {
3671 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
3672 LDKDecodeError ret_var = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
3673 uint64_t ret_ref = 0;
3674 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3675 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3676 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3677 ret_ref = (uint64_t)ret_var.inner;
3678 if (ret_var.is_owned) {
3684 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3685 CHECK(owner->result_ok);
3686 return ChannelFeatures_clone(&*owner->contents.result);
3688 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
3689 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
3690 LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
3691 uint64_t ret_ref = 0;
3692 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3693 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3694 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3695 ret_ref = (uint64_t)ret_var.inner;
3696 if (ret_var.is_owned) {
3702 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3703 CHECK(!owner->result_ok);
3704 return DecodeError_clone(&*owner->contents.err);
3706 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_err(uint32_t owner) {
3707 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
3708 LDKDecodeError ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
3709 uint64_t ret_ref = 0;
3710 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3711 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3712 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3713 ret_ref = (uint64_t)ret_var.inner;
3714 if (ret_var.is_owned) {
3720 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3721 CHECK(owner->result_ok);
3722 return NodeFeatures_clone(&*owner->contents.result);
3724 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
3725 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
3726 LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
3727 uint64_t ret_ref = 0;
3728 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3729 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3730 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3731 ret_ref = (uint64_t)ret_var.inner;
3732 if (ret_var.is_owned) {
3738 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3739 CHECK(!owner->result_ok);
3740 return DecodeError_clone(&*owner->contents.err);
3742 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_err(uint32_t owner) {
3743 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
3744 LDKDecodeError ret_var = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
3745 uint64_t ret_ref = 0;
3746 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3747 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3748 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3749 ret_ref = (uint64_t)ret_var.inner;
3750 if (ret_var.is_owned) {
3756 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3757 CHECK(owner->result_ok);
3758 return InvoiceFeatures_clone(&*owner->contents.result);
3760 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
3761 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
3762 LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3763 uint64_t ret_ref = 0;
3764 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3765 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3766 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3767 ret_ref = (uint64_t)ret_var.inner;
3768 if (ret_var.is_owned) {
3774 static inline struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3775 CHECK(!owner->result_ok);
3776 return DecodeError_clone(&*owner->contents.err);
3778 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err(uint32_t owner) {
3779 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
3780 LDKDecodeError ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3781 uint64_t ret_ref = 0;
3782 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3783 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3784 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3785 ret_ref = (uint64_t)ret_var.inner;
3786 if (ret_var.is_owned) {
3792 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3793 CHECK(owner->result_ok);
3794 return ChannelTypeFeatures_clone(&*owner->contents.result);
3796 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
3797 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
3798 LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
3799 uint64_t ret_ref = 0;
3800 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3801 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3802 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3803 ret_ref = (uint64_t)ret_var.inner;
3804 if (ret_var.is_owned) {
3810 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3811 CHECK(!owner->result_ok);
3812 return DecodeError_clone(&*owner->contents.err);
3814 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint32_t owner) {
3815 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
3816 LDKDecodeError ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
3817 uint64_t ret_ref = 0;
3818 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3819 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3820 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3821 ret_ref = (uint64_t)ret_var.inner;
3822 if (ret_var.is_owned) {
3828 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
3829 CHECK(owner->result_ok);
3830 return NetAddress_clone(&*owner->contents.result);
3832 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_get_ok(uint32_t owner) {
3833 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
3834 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
3835 *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
3836 uint64_t ret_ref = (uint64_t)ret_copy;
3840 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
3841 CHECK(!owner->result_ok);
3842 return DecodeError_clone(&*owner->contents.err);
3844 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_get_err(uint32_t owner) {
3845 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
3846 LDKDecodeError ret_var = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
3847 uint64_t ret_ref = 0;
3848 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3849 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3850 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3851 ret_ref = (uint64_t)ret_var.inner;
3852 if (ret_var.is_owned) {
3858 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
3859 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
3860 for (size_t i = 0; i < ret.datalen; i++) {
3861 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
3865 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
3866 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
3867 for (size_t i = 0; i < ret.datalen; i++) {
3868 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
3872 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
3873 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
3874 for (size_t i = 0; i < ret.datalen; i++) {
3875 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
3879 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
3880 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
3881 for (size_t i = 0; i < ret.datalen; i++) {
3882 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
3886 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
3887 CHECK(owner->result_ok);
3888 return AcceptChannel_clone(&*owner->contents.result);
3890 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint32_t owner) {
3891 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
3892 LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
3893 uint64_t ret_ref = 0;
3894 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3895 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3896 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3897 ret_ref = (uint64_t)ret_var.inner;
3898 if (ret_var.is_owned) {
3904 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
3905 CHECK(!owner->result_ok);
3906 return DecodeError_clone(&*owner->contents.err);
3908 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint32_t owner) {
3909 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
3910 LDKDecodeError ret_var = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
3911 uint64_t ret_ref = 0;
3912 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3913 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3914 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3915 ret_ref = (uint64_t)ret_var.inner;
3916 if (ret_var.is_owned) {
3922 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
3923 CHECK(owner->result_ok);
3924 return AnnouncementSignatures_clone(&*owner->contents.result);
3926 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint32_t owner) {
3927 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
3928 LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
3929 uint64_t ret_ref = 0;
3930 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3931 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3932 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3933 ret_ref = (uint64_t)ret_var.inner;
3934 if (ret_var.is_owned) {
3940 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
3941 CHECK(!owner->result_ok);
3942 return DecodeError_clone(&*owner->contents.err);
3944 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint32_t owner) {
3945 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
3946 LDKDecodeError ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
3947 uint64_t ret_ref = 0;
3948 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3949 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3950 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3951 ret_ref = (uint64_t)ret_var.inner;
3952 if (ret_var.is_owned) {
3958 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
3959 CHECK(owner->result_ok);
3960 return ChannelReestablish_clone(&*owner->contents.result);
3962 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint32_t owner) {
3963 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
3964 LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
3965 uint64_t ret_ref = 0;
3966 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3967 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3968 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3969 ret_ref = (uint64_t)ret_var.inner;
3970 if (ret_var.is_owned) {
3976 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
3977 CHECK(!owner->result_ok);
3978 return DecodeError_clone(&*owner->contents.err);
3980 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint32_t owner) {
3981 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
3982 LDKDecodeError ret_var = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
3983 uint64_t ret_ref = 0;
3984 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3985 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3986 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3987 ret_ref = (uint64_t)ret_var.inner;
3988 if (ret_var.is_owned) {
3994 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
3995 CHECK(owner->result_ok);
3996 return ClosingSigned_clone(&*owner->contents.result);
3998 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint32_t owner) {
3999 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
4000 LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
4001 uint64_t ret_ref = 0;
4002 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4003 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4004 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4005 ret_ref = (uint64_t)ret_var.inner;
4006 if (ret_var.is_owned) {
4012 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
4013 CHECK(!owner->result_ok);
4014 return DecodeError_clone(&*owner->contents.err);
4016 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint32_t owner) {
4017 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
4018 LDKDecodeError ret_var = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
4019 uint64_t ret_ref = 0;
4020 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4021 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4022 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4023 ret_ref = (uint64_t)ret_var.inner;
4024 if (ret_var.is_owned) {
4030 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
4031 CHECK(owner->result_ok);
4032 return ClosingSignedFeeRange_clone(&*owner->contents.result);
4034 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint32_t owner) {
4035 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
4036 LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
4037 uint64_t ret_ref = 0;
4038 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4039 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4040 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4041 ret_ref = (uint64_t)ret_var.inner;
4042 if (ret_var.is_owned) {
4048 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
4049 CHECK(!owner->result_ok);
4050 return DecodeError_clone(&*owner->contents.err);
4052 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint32_t owner) {
4053 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
4054 LDKDecodeError ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
4055 uint64_t ret_ref = 0;
4056 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4057 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4058 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4059 ret_ref = (uint64_t)ret_var.inner;
4060 if (ret_var.is_owned) {
4066 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
4067 CHECK(owner->result_ok);
4068 return CommitmentSigned_clone(&*owner->contents.result);
4070 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_ok(uint32_t owner) {
4071 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
4072 LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
4073 uint64_t ret_ref = 0;
4074 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4075 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4076 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4077 ret_ref = (uint64_t)ret_var.inner;
4078 if (ret_var.is_owned) {
4084 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
4085 CHECK(!owner->result_ok);
4086 return DecodeError_clone(&*owner->contents.err);
4088 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_err(uint32_t owner) {
4089 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
4090 LDKDecodeError ret_var = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
4091 uint64_t ret_ref = 0;
4092 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4093 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4094 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4095 ret_ref = (uint64_t)ret_var.inner;
4096 if (ret_var.is_owned) {
4102 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
4103 CHECK(owner->result_ok);
4104 return FundingCreated_clone(&*owner->contents.result);
4106 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_get_ok(uint32_t owner) {
4107 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
4108 LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
4109 uint64_t ret_ref = 0;
4110 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4111 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4112 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4113 ret_ref = (uint64_t)ret_var.inner;
4114 if (ret_var.is_owned) {
4120 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
4121 CHECK(!owner->result_ok);
4122 return DecodeError_clone(&*owner->contents.err);
4124 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_get_err(uint32_t owner) {
4125 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
4126 LDKDecodeError ret_var = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
4127 uint64_t ret_ref = 0;
4128 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4129 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4130 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4131 ret_ref = (uint64_t)ret_var.inner;
4132 if (ret_var.is_owned) {
4138 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
4139 CHECK(owner->result_ok);
4140 return FundingSigned_clone(&*owner->contents.result);
4142 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_get_ok(uint32_t owner) {
4143 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
4144 LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
4145 uint64_t ret_ref = 0;
4146 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4147 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4148 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4149 ret_ref = (uint64_t)ret_var.inner;
4150 if (ret_var.is_owned) {
4156 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
4157 CHECK(!owner->result_ok);
4158 return DecodeError_clone(&*owner->contents.err);
4160 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_get_err(uint32_t owner) {
4161 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
4162 LDKDecodeError ret_var = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
4163 uint64_t ret_ref = 0;
4164 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4165 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4166 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4167 ret_ref = (uint64_t)ret_var.inner;
4168 if (ret_var.is_owned) {
4174 static inline struct LDKFundingLocked CResult_FundingLockedDecodeErrorZ_get_ok(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR owner){
4175 CHECK(owner->result_ok);
4176 return FundingLocked_clone(&*owner->contents.result);
4178 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_get_ok(uint32_t owner) {
4179 LDKCResult_FundingLockedDecodeErrorZ* owner_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(owner & ~1);
4180 LDKFundingLocked ret_var = CResult_FundingLockedDecodeErrorZ_get_ok(owner_conv);
4181 uint64_t ret_ref = 0;
4182 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4183 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4184 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4185 ret_ref = (uint64_t)ret_var.inner;
4186 if (ret_var.is_owned) {
4192 static inline struct LDKDecodeError CResult_FundingLockedDecodeErrorZ_get_err(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR owner){
4193 CHECK(!owner->result_ok);
4194 return DecodeError_clone(&*owner->contents.err);
4196 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_get_err(uint32_t owner) {
4197 LDKCResult_FundingLockedDecodeErrorZ* owner_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(owner & ~1);
4198 LDKDecodeError ret_var = CResult_FundingLockedDecodeErrorZ_get_err(owner_conv);
4199 uint64_t ret_ref = 0;
4200 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4201 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4202 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4203 ret_ref = (uint64_t)ret_var.inner;
4204 if (ret_var.is_owned) {
4210 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
4211 CHECK(owner->result_ok);
4212 return Init_clone(&*owner->contents.result);
4214 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_get_ok(uint32_t owner) {
4215 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
4216 LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
4217 uint64_t ret_ref = 0;
4218 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4219 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4220 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4221 ret_ref = (uint64_t)ret_var.inner;
4222 if (ret_var.is_owned) {
4228 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
4229 CHECK(!owner->result_ok);
4230 return DecodeError_clone(&*owner->contents.err);
4232 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_get_err(uint32_t owner) {
4233 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
4234 LDKDecodeError ret_var = CResult_InitDecodeErrorZ_get_err(owner_conv);
4235 uint64_t ret_ref = 0;
4236 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4237 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4238 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4239 ret_ref = (uint64_t)ret_var.inner;
4240 if (ret_var.is_owned) {
4246 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
4247 CHECK(owner->result_ok);
4248 return OpenChannel_clone(&*owner->contents.result);
4250 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_get_ok(uint32_t owner) {
4251 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
4252 LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
4253 uint64_t ret_ref = 0;
4254 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4255 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4256 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4257 ret_ref = (uint64_t)ret_var.inner;
4258 if (ret_var.is_owned) {
4264 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
4265 CHECK(!owner->result_ok);
4266 return DecodeError_clone(&*owner->contents.err);
4268 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_get_err(uint32_t owner) {
4269 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
4270 LDKDecodeError ret_var = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
4271 uint64_t ret_ref = 0;
4272 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4273 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4274 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4275 ret_ref = (uint64_t)ret_var.inner;
4276 if (ret_var.is_owned) {
4282 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
4283 CHECK(owner->result_ok);
4284 return RevokeAndACK_clone(&*owner->contents.result);
4286 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_ok(uint32_t owner) {
4287 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
4288 LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
4289 uint64_t ret_ref = 0;
4290 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4291 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4292 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4293 ret_ref = (uint64_t)ret_var.inner;
4294 if (ret_var.is_owned) {
4300 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
4301 CHECK(!owner->result_ok);
4302 return DecodeError_clone(&*owner->contents.err);
4304 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_err(uint32_t owner) {
4305 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
4306 LDKDecodeError ret_var = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
4307 uint64_t ret_ref = 0;
4308 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4309 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4310 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4311 ret_ref = (uint64_t)ret_var.inner;
4312 if (ret_var.is_owned) {
4318 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
4319 CHECK(owner->result_ok);
4320 return Shutdown_clone(&*owner->contents.result);
4322 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_get_ok(uint32_t owner) {
4323 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
4324 LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
4325 uint64_t ret_ref = 0;
4326 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4327 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4328 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4329 ret_ref = (uint64_t)ret_var.inner;
4330 if (ret_var.is_owned) {
4336 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
4337 CHECK(!owner->result_ok);
4338 return DecodeError_clone(&*owner->contents.err);
4340 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_get_err(uint32_t owner) {
4341 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
4342 LDKDecodeError ret_var = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
4343 uint64_t ret_ref = 0;
4344 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4345 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4346 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4347 ret_ref = (uint64_t)ret_var.inner;
4348 if (ret_var.is_owned) {
4354 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
4355 CHECK(owner->result_ok);
4356 return UpdateFailHTLC_clone(&*owner->contents.result);
4358 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint32_t owner) {
4359 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
4360 LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
4361 uint64_t ret_ref = 0;
4362 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4363 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4364 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4365 ret_ref = (uint64_t)ret_var.inner;
4366 if (ret_var.is_owned) {
4372 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
4373 CHECK(!owner->result_ok);
4374 return DecodeError_clone(&*owner->contents.err);
4376 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err(uint32_t owner) {
4377 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
4378 LDKDecodeError ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
4379 uint64_t ret_ref = 0;
4380 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4381 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4382 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4383 ret_ref = (uint64_t)ret_var.inner;
4384 if (ret_var.is_owned) {
4390 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
4391 CHECK(owner->result_ok);
4392 return UpdateFailMalformedHTLC_clone(&*owner->contents.result);
4394 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint32_t owner) {
4395 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
4396 LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
4397 uint64_t ret_ref = 0;
4398 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4399 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4400 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4401 ret_ref = (uint64_t)ret_var.inner;
4402 if (ret_var.is_owned) {
4408 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
4409 CHECK(!owner->result_ok);
4410 return DecodeError_clone(&*owner->contents.err);
4412 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint32_t owner) {
4413 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
4414 LDKDecodeError ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
4415 uint64_t ret_ref = 0;
4416 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4417 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4418 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4419 ret_ref = (uint64_t)ret_var.inner;
4420 if (ret_var.is_owned) {
4426 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
4427 CHECK(owner->result_ok);
4428 return UpdateFee_clone(&*owner->contents.result);
4430 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_get_ok(uint32_t owner) {
4431 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
4432 LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
4433 uint64_t ret_ref = 0;
4434 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4435 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4436 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4437 ret_ref = (uint64_t)ret_var.inner;
4438 if (ret_var.is_owned) {
4444 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
4445 CHECK(!owner->result_ok);
4446 return DecodeError_clone(&*owner->contents.err);
4448 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_get_err(uint32_t owner) {
4449 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
4450 LDKDecodeError ret_var = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
4451 uint64_t ret_ref = 0;
4452 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4453 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4454 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4455 ret_ref = (uint64_t)ret_var.inner;
4456 if (ret_var.is_owned) {
4462 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
4463 CHECK(owner->result_ok);
4464 return UpdateFulfillHTLC_clone(&*owner->contents.result);
4466 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint32_t owner) {
4467 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
4468 LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
4469 uint64_t ret_ref = 0;
4470 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4471 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4472 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4473 ret_ref = (uint64_t)ret_var.inner;
4474 if (ret_var.is_owned) {
4480 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
4481 CHECK(!owner->result_ok);
4482 return DecodeError_clone(&*owner->contents.err);
4484 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint32_t owner) {
4485 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
4486 LDKDecodeError ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
4487 uint64_t ret_ref = 0;
4488 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4489 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4490 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4491 ret_ref = (uint64_t)ret_var.inner;
4492 if (ret_var.is_owned) {
4498 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
4499 CHECK(owner->result_ok);
4500 return UpdateAddHTLC_clone(&*owner->contents.result);
4502 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint32_t owner) {
4503 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
4504 LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
4505 uint64_t ret_ref = 0;
4506 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4507 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4508 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4509 ret_ref = (uint64_t)ret_var.inner;
4510 if (ret_var.is_owned) {
4516 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
4517 CHECK(!owner->result_ok);
4518 return DecodeError_clone(&*owner->contents.err);
4520 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err(uint32_t owner) {
4521 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
4522 LDKDecodeError ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
4523 uint64_t ret_ref = 0;
4524 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4525 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4526 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4527 ret_ref = (uint64_t)ret_var.inner;
4528 if (ret_var.is_owned) {
4534 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
4535 CHECK(owner->result_ok);
4536 return Ping_clone(&*owner->contents.result);
4538 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_get_ok(uint32_t owner) {
4539 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
4540 LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
4541 uint64_t ret_ref = 0;
4542 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4543 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4544 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4545 ret_ref = (uint64_t)ret_var.inner;
4546 if (ret_var.is_owned) {
4552 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
4553 CHECK(!owner->result_ok);
4554 return DecodeError_clone(&*owner->contents.err);
4556 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_get_err(uint32_t owner) {
4557 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
4558 LDKDecodeError ret_var = CResult_PingDecodeErrorZ_get_err(owner_conv);
4559 uint64_t ret_ref = 0;
4560 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4561 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4562 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4563 ret_ref = (uint64_t)ret_var.inner;
4564 if (ret_var.is_owned) {
4570 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
4571 CHECK(owner->result_ok);
4572 return Pong_clone(&*owner->contents.result);
4574 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_get_ok(uint32_t owner) {
4575 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
4576 LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
4577 uint64_t ret_ref = 0;
4578 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4579 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4580 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4581 ret_ref = (uint64_t)ret_var.inner;
4582 if (ret_var.is_owned) {
4588 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
4589 CHECK(!owner->result_ok);
4590 return DecodeError_clone(&*owner->contents.err);
4592 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_get_err(uint32_t owner) {
4593 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
4594 LDKDecodeError ret_var = CResult_PongDecodeErrorZ_get_err(owner_conv);
4595 uint64_t ret_ref = 0;
4596 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4597 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4598 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4599 ret_ref = (uint64_t)ret_var.inner;
4600 if (ret_var.is_owned) {
4606 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
4607 CHECK(owner->result_ok);
4608 return UnsignedChannelAnnouncement_clone(&*owner->contents.result);
4610 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
4611 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
4612 LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
4613 uint64_t ret_ref = 0;
4614 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4615 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4616 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4617 ret_ref = (uint64_t)ret_var.inner;
4618 if (ret_var.is_owned) {
4624 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
4625 CHECK(!owner->result_ok);
4626 return DecodeError_clone(&*owner->contents.err);
4628 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
4629 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
4630 LDKDecodeError ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
4631 uint64_t ret_ref = 0;
4632 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4633 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4634 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4635 ret_ref = (uint64_t)ret_var.inner;
4636 if (ret_var.is_owned) {
4642 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
4643 CHECK(owner->result_ok);
4644 return ChannelAnnouncement_clone(&*owner->contents.result);
4646 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
4647 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
4648 LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
4649 uint64_t ret_ref = 0;
4650 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4651 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4652 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4653 ret_ref = (uint64_t)ret_var.inner;
4654 if (ret_var.is_owned) {
4660 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
4661 CHECK(!owner->result_ok);
4662 return DecodeError_clone(&*owner->contents.err);
4664 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
4665 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
4666 LDKDecodeError ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
4667 uint64_t ret_ref = 0;
4668 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4669 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4670 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4671 ret_ref = (uint64_t)ret_var.inner;
4672 if (ret_var.is_owned) {
4678 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
4679 CHECK(owner->result_ok);
4680 return UnsignedChannelUpdate_clone(&*owner->contents.result);
4682 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint32_t owner) {
4683 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
4684 LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
4685 uint64_t ret_ref = 0;
4686 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4687 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4688 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4689 ret_ref = (uint64_t)ret_var.inner;
4690 if (ret_var.is_owned) {
4696 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
4697 CHECK(!owner->result_ok);
4698 return DecodeError_clone(&*owner->contents.err);
4700 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint32_t owner) {
4701 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
4702 LDKDecodeError ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
4703 uint64_t ret_ref = 0;
4704 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4705 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4706 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4707 ret_ref = (uint64_t)ret_var.inner;
4708 if (ret_var.is_owned) {
4714 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
4715 CHECK(owner->result_ok);
4716 return ChannelUpdate_clone(&*owner->contents.result);
4718 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_ok(uint32_t owner) {
4719 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
4720 LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
4721 uint64_t ret_ref = 0;
4722 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4723 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4724 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4725 ret_ref = (uint64_t)ret_var.inner;
4726 if (ret_var.is_owned) {
4732 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
4733 CHECK(!owner->result_ok);
4734 return DecodeError_clone(&*owner->contents.err);
4736 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_err(uint32_t owner) {
4737 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
4738 LDKDecodeError ret_var = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
4739 uint64_t ret_ref = 0;
4740 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4741 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4742 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4743 ret_ref = (uint64_t)ret_var.inner;
4744 if (ret_var.is_owned) {
4750 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
4751 CHECK(owner->result_ok);
4752 return ErrorMessage_clone(&*owner->contents.result);
4754 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_get_ok(uint32_t owner) {
4755 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
4756 LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
4757 uint64_t ret_ref = 0;
4758 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4759 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4760 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4761 ret_ref = (uint64_t)ret_var.inner;
4762 if (ret_var.is_owned) {
4768 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
4769 CHECK(!owner->result_ok);
4770 return DecodeError_clone(&*owner->contents.err);
4772 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_get_err(uint32_t owner) {
4773 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
4774 LDKDecodeError ret_var = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
4775 uint64_t ret_ref = 0;
4776 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4777 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4778 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4779 ret_ref = (uint64_t)ret_var.inner;
4780 if (ret_var.is_owned) {
4786 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
4787 CHECK(owner->result_ok);
4788 return UnsignedNodeAnnouncement_clone(&*owner->contents.result);
4790 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
4791 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
4792 LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
4793 uint64_t ret_ref = 0;
4794 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4795 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4796 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4797 ret_ref = (uint64_t)ret_var.inner;
4798 if (ret_var.is_owned) {
4804 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
4805 CHECK(!owner->result_ok);
4806 return DecodeError_clone(&*owner->contents.err);
4808 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
4809 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
4810 LDKDecodeError ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
4811 uint64_t ret_ref = 0;
4812 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4813 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4814 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4815 ret_ref = (uint64_t)ret_var.inner;
4816 if (ret_var.is_owned) {
4822 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
4823 CHECK(owner->result_ok);
4824 return NodeAnnouncement_clone(&*owner->contents.result);
4826 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
4827 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
4828 LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
4829 uint64_t ret_ref = 0;
4830 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4831 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4832 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4833 ret_ref = (uint64_t)ret_var.inner;
4834 if (ret_var.is_owned) {
4840 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
4841 CHECK(!owner->result_ok);
4842 return DecodeError_clone(&*owner->contents.err);
4844 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
4845 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
4846 LDKDecodeError ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
4847 uint64_t ret_ref = 0;
4848 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4849 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4850 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4851 ret_ref = (uint64_t)ret_var.inner;
4852 if (ret_var.is_owned) {
4858 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
4859 CHECK(owner->result_ok);
4860 return QueryShortChannelIds_clone(&*owner->contents.result);
4862 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint32_t owner) {
4863 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
4864 LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
4865 uint64_t ret_ref = 0;
4866 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4867 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4868 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4869 ret_ref = (uint64_t)ret_var.inner;
4870 if (ret_var.is_owned) {
4876 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
4877 CHECK(!owner->result_ok);
4878 return DecodeError_clone(&*owner->contents.err);
4880 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint32_t owner) {
4881 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
4882 LDKDecodeError ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
4883 uint64_t ret_ref = 0;
4884 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4885 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4886 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4887 ret_ref = (uint64_t)ret_var.inner;
4888 if (ret_var.is_owned) {
4894 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
4895 CHECK(owner->result_ok);
4896 return ReplyShortChannelIdsEnd_clone(&*owner->contents.result);
4898 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint32_t owner) {
4899 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
4900 LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
4901 uint64_t ret_ref = 0;
4902 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4903 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4904 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4905 ret_ref = (uint64_t)ret_var.inner;
4906 if (ret_var.is_owned) {
4912 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
4913 CHECK(!owner->result_ok);
4914 return DecodeError_clone(&*owner->contents.err);
4916 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint32_t owner) {
4917 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
4918 LDKDecodeError ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
4919 uint64_t ret_ref = 0;
4920 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4921 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4922 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4923 ret_ref = (uint64_t)ret_var.inner;
4924 if (ret_var.is_owned) {
4930 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
4931 CHECK(owner->result_ok);
4932 return QueryChannelRange_clone(&*owner->contents.result);
4934 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok(uint32_t owner) {
4935 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
4936 LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
4937 uint64_t ret_ref = 0;
4938 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4939 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4940 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4941 ret_ref = (uint64_t)ret_var.inner;
4942 if (ret_var.is_owned) {
4948 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
4949 CHECK(!owner->result_ok);
4950 return DecodeError_clone(&*owner->contents.err);
4952 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_err(uint32_t owner) {
4953 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
4954 LDKDecodeError ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
4955 uint64_t ret_ref = 0;
4956 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4957 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4958 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4959 ret_ref = (uint64_t)ret_var.inner;
4960 if (ret_var.is_owned) {
4966 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
4967 CHECK(owner->result_ok);
4968 return ReplyChannelRange_clone(&*owner->contents.result);
4970 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint32_t owner) {
4971 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
4972 LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
4973 uint64_t ret_ref = 0;
4974 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4975 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4976 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4977 ret_ref = (uint64_t)ret_var.inner;
4978 if (ret_var.is_owned) {
4984 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
4985 CHECK(!owner->result_ok);
4986 return DecodeError_clone(&*owner->contents.err);
4988 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err(uint32_t owner) {
4989 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
4990 LDKDecodeError ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
4991 uint64_t ret_ref = 0;
4992 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4993 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4994 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4995 ret_ref = (uint64_t)ret_var.inner;
4996 if (ret_var.is_owned) {
5002 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
5003 CHECK(owner->result_ok);
5004 return GossipTimestampFilter_clone(&*owner->contents.result);
5006 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint32_t owner) {
5007 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
5008 LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
5009 uint64_t ret_ref = 0;
5010 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5011 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5012 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5013 ret_ref = (uint64_t)ret_var.inner;
5014 if (ret_var.is_owned) {
5020 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
5021 CHECK(!owner->result_ok);
5022 return DecodeError_clone(&*owner->contents.err);
5024 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err(uint32_t owner) {
5025 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
5026 LDKDecodeError ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
5027 uint64_t ret_ref = 0;
5028 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5029 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5030 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5031 ret_ref = (uint64_t)ret_var.inner;
5032 if (ret_var.is_owned) {
5038 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
5039 CHECK(owner->result_ok);
5040 return DelayedPaymentOutputDescriptor_clone(&*owner->contents.result);
5042 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t owner) {
5043 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
5044 LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
5045 uint64_t ret_ref = 0;
5046 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5047 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5048 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5049 ret_ref = (uint64_t)ret_var.inner;
5050 if (ret_var.is_owned) {
5056 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
5057 CHECK(!owner->result_ok);
5058 return DecodeError_clone(&*owner->contents.err);
5060 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t owner) {
5061 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
5062 LDKDecodeError ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
5063 uint64_t ret_ref = 0;
5064 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5065 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5066 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5067 ret_ref = (uint64_t)ret_var.inner;
5068 if (ret_var.is_owned) {
5074 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
5075 CHECK(owner->result_ok);
5076 return StaticPaymentOutputDescriptor_clone(&*owner->contents.result);
5078 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t owner) {
5079 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
5080 LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
5081 uint64_t ret_ref = 0;
5082 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5083 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5084 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5085 ret_ref = (uint64_t)ret_var.inner;
5086 if (ret_var.is_owned) {
5092 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
5093 CHECK(!owner->result_ok);
5094 return DecodeError_clone(&*owner->contents.err);
5096 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t owner) {
5097 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
5098 LDKDecodeError ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
5099 uint64_t ret_ref = 0;
5100 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5101 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5102 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5103 ret_ref = (uint64_t)ret_var.inner;
5104 if (ret_var.is_owned) {
5110 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
5111 CHECK(owner->result_ok);
5112 return SpendableOutputDescriptor_clone(&*owner->contents.result);
5114 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint32_t owner) {
5115 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
5116 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
5117 *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
5118 uint64_t ret_ref = (uint64_t)ret_copy;
5122 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
5123 CHECK(!owner->result_ok);
5124 return DecodeError_clone(&*owner->contents.err);
5126 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint32_t owner) {
5127 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
5128 LDKDecodeError ret_var = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
5129 uint64_t ret_ref = 0;
5130 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5131 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5132 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5133 ret_ref = (uint64_t)ret_var.inner;
5134 if (ret_var.is_owned) {
5140 static inline struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
5141 CHECK(owner->result_ok);
5142 return Sign_clone(&*owner->contents.result);
5144 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_get_ok(uint32_t owner) {
5145 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
5146 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
5147 *ret_ret = CResult_SignDecodeErrorZ_get_ok(owner_conv);
5148 return (uint64_t)ret_ret;
5151 static inline struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
5152 CHECK(!owner->result_ok);
5153 return DecodeError_clone(&*owner->contents.err);
5155 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_get_err(uint32_t owner) {
5156 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
5157 LDKDecodeError ret_var = CResult_SignDecodeErrorZ_get_err(owner_conv);
5158 uint64_t ret_ref = 0;
5159 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5160 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5161 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5162 ret_ref = (uint64_t)ret_var.inner;
5163 if (ret_var.is_owned) {
5169 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
5170 CHECK(owner->result_ok);
5171 return *owner->contents.result;
5173 int8_tArray __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint32_t owner) {
5174 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
5175 int8_tArray et_arr = init_int8_tArray(68);
5176 memcpy(et_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
5180 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
5181 CHECK(!owner->result_ok);
5182 return *owner->contents.err;
5184 void __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint32_t owner) {
5185 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
5186 CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
5189 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
5190 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
5191 for (size_t i = 0; i < ret.datalen; i++) {
5192 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
5196 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
5197 CHECK(owner->result_ok);
5198 return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
5200 ptrArray __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok(uint32_t owner) {
5201 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
5202 LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
5203 ptrArray ret_arr = NULL;
5204 ret_arr = init_ptrArray(ret_var.datalen);
5205 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
5206 for (size_t m = 0; m < ret_var.datalen; m++) {
5207 LDKCVec_u8Z ret_conv_12_var = ret_var.data[m];
5208 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen);
5209 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
5210 CVec_u8Z_free(ret_conv_12_var);
5211 ret_arr_ptr[m] = ret_conv_12_arr;
5218 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
5219 CHECK(!owner->result_ok);
5220 return *owner->contents.err;
5222 void __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_err(uint32_t owner) {
5223 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
5224 CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
5227 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
5228 CHECK(owner->result_ok);
5229 return InMemorySigner_clone(&*owner->contents.result);
5231 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_get_ok(uint32_t owner) {
5232 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
5233 LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
5234 uint64_t ret_ref = 0;
5235 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5236 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5237 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5238 ret_ref = (uint64_t)ret_var.inner;
5239 if (ret_var.is_owned) {
5245 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
5246 CHECK(!owner->result_ok);
5247 return DecodeError_clone(&*owner->contents.err);
5249 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_get_err(uint32_t owner) {
5250 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
5251 LDKDecodeError ret_var = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
5252 uint64_t ret_ref = 0;
5253 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5254 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5255 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5256 ret_ref = (uint64_t)ret_var.inner;
5257 if (ret_var.is_owned) {
5263 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
5264 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
5265 for (size_t i = 0; i < ret.datalen; i++) {
5266 ret.data[i] = TxOut_clone(&orig->data[i]);
5270 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
5271 CHECK(owner->result_ok);
5272 return *owner->contents.result;
5274 int8_tArray __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_get_ok(uint32_t owner) {
5275 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
5276 LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
5277 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
5278 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5279 Transaction_free(ret_var);
5283 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
5284 CHECK(!owner->result_ok);
5285 return *owner->contents.err;
5287 void __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_get_err(uint32_t owner) {
5288 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
5289 CResult_TransactionNoneZ_get_err(owner_conv);
5292 typedef struct LDKFilter_JCalls {
5293 atomic_size_t refcnt;
5294 uint32_t register_tx_meth;
5295 uint32_t register_output_meth;
5297 static void LDKFilter_JCalls_free(void* this_arg) {
5298 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5299 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5300 js_free_function_ptr(j_calls->register_tx_meth);
5301 js_free_function_ptr(j_calls->register_output_meth);
5305 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
5306 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5307 int8_tArray txid_arr = init_int8_tArray(32);
5308 memcpy(txid_arr->elems, *txid, 32);
5309 LDKu8slice script_pubkey_var = script_pubkey;
5310 int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen);
5311 memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
5312 js_invoke_function_2(j_calls->register_tx_meth, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr);
5314 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
5315 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
5316 LDKWatchedOutput output_var = output;
5317 uint64_t output_ref = 0;
5318 CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5319 CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5320 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
5321 output_ref = (uint64_t)output_var.inner;
5322 if (output_var.is_owned) {
5325 uint32_t ret = js_invoke_function_1(j_calls->register_output_meth, (uint32_t)output_ref);
5326 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
5327 CHECK_ACCESS(ret_ptr);
5328 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(ret_ptr);
5332 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
5333 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
5334 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5336 static inline LDKFilter LDKFilter_init (/*TODO: JS Object Reference */void* o) {
5337 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
5338 atomic_init(&calls->refcnt, 1);
5339 //TODO: Assign calls->o from o
5342 .this_arg = (void*) calls,
5343 .register_tx = register_tx_LDKFilter_jcall,
5344 .register_output = register_output_LDKFilter_jcall,
5345 .free = LDKFilter_JCalls_free,
5349 long __attribute__((visibility("default"))) TS_LDKFilter_new(/*TODO: JS Object Reference */void* o) {
5350 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
5351 *res_ptr = LDKFilter_init(o);
5352 return (long)res_ptr;
5354 void __attribute__((visibility("default"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
5355 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5356 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5357 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
5358 unsigned char txid_arr[32];
5359 CHECK(txid->arr_len == 32);
5360 memcpy(txid_arr, txid->elems, 32);
5361 unsigned char (*txid_ref)[32] = &txid_arr;
5362 LDKu8slice script_pubkey_ref;
5363 script_pubkey_ref.datalen = script_pubkey->arr_len;
5364 script_pubkey_ref.data = script_pubkey->elems;
5365 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
5368 uint32_t __attribute__((visibility("default"))) TS_Filter_register_output(uint32_t this_arg, uint32_t output) {
5369 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5370 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5371 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
5372 LDKWatchedOutput output_conv;
5373 output_conv.inner = (void*)(output & (~1));
5374 output_conv.is_owned = (output & 1) || (output == 0);
5375 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
5376 output_conv = WatchedOutput_clone(&output_conv);
5377 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
5378 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
5379 uint64_t ret_ref = (uint64_t)ret_copy;
5383 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_FilterZ_ref_from_ptr(uint32_t ptr) {
5384 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
5386 case LDKCOption_FilterZ_Some: {
5387 LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
5388 *some_ret = obj->some;
5389 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
5390 return 0 /* LDKCOption_FilterZ - Some */; (void) (uint64_t)some_ret;
5392 case LDKCOption_FilterZ_None: {
5393 return 0 /* LDKCOption_FilterZ - None */;
5398 static inline struct LDKLockedChannelMonitor *CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
5399 CHECK(owner->result_ok);
5400 return &*owner->contents.result;
5402 uint32_t __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_get_ok(uint32_t owner) {
5403 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
5404 LDKLockedChannelMonitor ret_var = *CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
5405 uint64_t ret_ref = 0;
5406 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5407 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5408 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5409 ret_ref = (uint64_t)ret_var.inner & ~1;
5413 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
5414 CHECK(!owner->result_ok);
5415 return *owner->contents.err;
5417 void __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_get_err(uint32_t owner) {
5418 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
5419 CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
5422 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
5423 LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
5424 for (size_t i = 0; i < ret.datalen; i++) {
5425 ret.data[i] = OutPoint_clone(&orig->data[i]);
5429 uint32_t __attribute__((visibility("default"))) TS_LDKAPIError_ref_from_ptr(uint32_t ptr) {
5430 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
5432 case LDKAPIError_APIMisuseError: {
5433 LDKStr err_str = obj->api_misuse_error.err;
5434 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
5435 return 0 /* LDKAPIError - APIMisuseError */; (void) err_conv;
5437 case LDKAPIError_FeeRateTooHigh: {
5438 LDKStr err_str = obj->fee_rate_too_high.err;
5439 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
5440 return 0 /* LDKAPIError - FeeRateTooHigh */; (void) err_conv; (void) obj->fee_rate_too_high.feerate;
5442 case LDKAPIError_RouteError: {
5443 LDKStr err_str = obj->route_error.err;
5444 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
5445 return 0 /* LDKAPIError - RouteError */; (void) err_conv;
5447 case LDKAPIError_ChannelUnavailable: {
5448 LDKStr err_str = obj->channel_unavailable.err;
5449 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
5450 return 0 /* LDKAPIError - ChannelUnavailable */; (void) err_conv;
5452 case LDKAPIError_MonitorUpdateFailed: {
5453 return 0 /* LDKAPIError - MonitorUpdateFailed */;
5455 case LDKAPIError_IncompatibleShutdownScript: {
5456 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
5457 uint64_t script_ref = 0;
5458 CHECK((((uint64_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5459 CHECK((((uint64_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5460 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
5461 script_ref = (uint64_t)script_var.inner & ~1;
5462 return 0 /* LDKAPIError - IncompatibleShutdownScript */; (void) script_ref;
5467 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
5468 CHECK(owner->result_ok);
5469 return *owner->contents.result;
5471 void __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_get_ok(uint32_t owner) {
5472 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
5473 CResult_NoneAPIErrorZ_get_ok(owner_conv);
5476 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
5477 CHECK(!owner->result_ok);
5478 return APIError_clone(&*owner->contents.err);
5480 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_get_err(uint32_t owner) {
5481 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
5482 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5483 *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
5484 uint64_t ret_ref = (uint64_t)ret_copy;
5488 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u16Z_ref_from_ptr(uint32_t ptr) {
5489 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
5491 case LDKCOption_u16Z_Some: {
5492 return 0 /* LDKCOption_u16Z - Some */; (void) obj->some;
5494 case LDKCOption_u16Z_None: {
5495 return 0 /* LDKCOption_u16Z - None */;
5500 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
5501 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
5502 for (size_t i = 0; i < ret.datalen; i++) {
5503 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
5507 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
5508 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
5509 for (size_t i = 0; i < ret.datalen; i++) {
5510 ret.data[i] = APIError_clone(&orig->data[i]);
5514 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
5515 CHECK(owner->result_ok);
5516 return ThirtyTwoBytes_clone(&*owner->contents.result);
5518 int8_tArray __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_get_ok(uint32_t owner) {
5519 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
5520 int8_tArray ret_arr = init_int8_tArray(32);
5521 memcpy(ret_arr->elems, CResult__u832APIErrorZ_get_ok(owner_conv).data, 32);
5525 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
5526 CHECK(!owner->result_ok);
5527 return APIError_clone(&*owner->contents.err);
5529 uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_get_err(uint32_t owner) {
5530 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
5531 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5532 *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
5533 uint64_t ret_ref = (uint64_t)ret_copy;
5537 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentSendFailure_ref_from_ptr(uint32_t ptr) {
5538 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
5540 case LDKPaymentSendFailure_ParameterError: {
5541 uint64_t parameter_error_ref = ((uint64_t)&obj->parameter_error) | 1;
5542 return 0 /* LDKPaymentSendFailure - ParameterError */; (void) parameter_error_ref;
5544 case LDKPaymentSendFailure_PathParameterError: {
5545 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
5546 uint32_tArray path_parameter_error_arr = NULL;
5547 path_parameter_error_arr = init_uint32_tArray(path_parameter_error_var.datalen);
5548 uint32_t *path_parameter_error_arr_ptr = (uint32_t*)(path_parameter_error_arr + 4);
5549 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
5550 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5551 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
5552 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
5553 path_parameter_error_arr_ptr[w] = (uint64_t)path_parameter_error_conv_22_conv;
5556 return 0 /* LDKPaymentSendFailure - PathParameterError */; (void) path_parameter_error_arr;
5558 case LDKPaymentSendFailure_AllFailedRetrySafe: {
5559 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
5560 uint32_tArray all_failed_retry_safe_arr = NULL;
5561 all_failed_retry_safe_arr = init_uint32_tArray(all_failed_retry_safe_var.datalen);
5562 uint32_t *all_failed_retry_safe_arr_ptr = (uint32_t*)(all_failed_retry_safe_arr + 4);
5563 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
5564 uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1;
5565 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
5568 return 0 /* LDKPaymentSendFailure - AllFailedRetrySafe */; (void) all_failed_retry_safe_arr;
5570 case LDKPaymentSendFailure_PartialFailure: {
5571 LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
5572 uint32_tArray results_arr = NULL;
5573 results_arr = init_uint32_tArray(results_var.datalen);
5574 uint32_t *results_arr_ptr = (uint32_t*)(results_arr + 4);
5575 for (size_t w = 0; w < results_var.datalen; w++) {
5576 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5577 *results_conv_22_conv = results_var.data[w];
5578 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
5579 results_arr_ptr[w] = (uint64_t)results_conv_22_conv;
5582 LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
5583 uint64_t failed_paths_retry_ref = 0;
5584 if ((uint64_t)failed_paths_retry_var.inner > 4096) {
5585 CHECK((((uint64_t)failed_paths_retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5586 CHECK((((uint64_t)&failed_paths_retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5587 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
5588 failed_paths_retry_ref = (uint64_t)failed_paths_retry_var.inner & ~1;
5590 int8_tArray payment_id_arr = init_int8_tArray(32);
5591 memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
5592 return 0 /* LDKPaymentSendFailure - PartialFailure */; (void) results_arr; (void) failed_paths_retry_ref; (void) payment_id_arr;
5597 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentSendFailureZ_get_ok(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
5598 CHECK(owner->result_ok);
5599 return ThirtyTwoBytes_clone(&*owner->contents.result);
5601 int8_tArray __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_get_ok(uint32_t owner) {
5602 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
5603 int8_tArray ret_arr = init_int8_tArray(32);
5604 memcpy(ret_arr->elems, CResult_PaymentIdPaymentSendFailureZ_get_ok(owner_conv).data, 32);
5608 static inline struct LDKPaymentSendFailure CResult_PaymentIdPaymentSendFailureZ_get_err(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
5609 CHECK(!owner->result_ok);
5610 return PaymentSendFailure_clone(&*owner->contents.err);
5612 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_get_err(uint32_t owner) {
5613 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
5614 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5615 *ret_copy = CResult_PaymentIdPaymentSendFailureZ_get_err(owner_conv);
5616 uint64_t ret_ref = (uint64_t)ret_copy;
5620 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5621 CHECK(owner->result_ok);
5622 return *owner->contents.result;
5624 void __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint32_t owner) {
5625 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
5626 CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
5629 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5630 CHECK(!owner->result_ok);
5631 return PaymentSendFailure_clone(&*owner->contents.err);
5633 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint32_t owner) {
5634 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
5635 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5636 *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
5637 uint64_t ret_ref = (uint64_t)ret_copy;
5641 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
5642 return ThirtyTwoBytes_clone(&owner->a);
5644 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_a(uint32_t owner) {
5645 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
5646 int8_tArray ret_arr = init_int8_tArray(32);
5647 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data, 32);
5651 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
5652 return ThirtyTwoBytes_clone(&owner->b);
5654 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_b(uint32_t owner) {
5655 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
5656 int8_tArray ret_arr = init_int8_tArray(32);
5657 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data, 32);
5661 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
5662 CHECK(owner->result_ok);
5663 return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
5665 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(uint32_t owner) {
5666 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
5667 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
5668 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
5669 return ((uint64_t)ret_conv);
5672 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
5673 CHECK(!owner->result_ok);
5674 return PaymentSendFailure_clone(&*owner->contents.err);
5676 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(uint32_t owner) {
5677 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
5678 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5679 *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
5680 uint64_t ret_ref = (uint64_t)ret_copy;
5684 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
5685 return ThirtyTwoBytes_clone(&owner->a);
5687 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_a(uint32_t owner) {
5688 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
5689 int8_tArray ret_arr = init_int8_tArray(32);
5690 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data, 32);
5694 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
5695 return ThirtyTwoBytes_clone(&owner->b);
5697 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_b(uint32_t owner) {
5698 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
5699 int8_tArray ret_arr = init_int8_tArray(32);
5700 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data, 32);
5704 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
5705 CHECK(owner->result_ok);
5706 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
5708 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(uint32_t owner) {
5709 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
5710 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
5711 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
5712 return ((uint64_t)ret_conv);
5715 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
5716 CHECK(!owner->result_ok);
5717 return *owner->contents.err;
5719 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(uint32_t owner) {
5720 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
5721 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
5724 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
5725 CHECK(owner->result_ok);
5726 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
5728 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(uint32_t owner) {
5729 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
5730 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
5731 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
5732 return ((uint64_t)ret_conv);
5735 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
5736 CHECK(!owner->result_ok);
5737 return APIError_clone(&*owner->contents.err);
5739 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(uint32_t owner) {
5740 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
5741 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5742 *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
5743 uint64_t ret_ref = (uint64_t)ret_copy;
5747 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
5748 CHECK(owner->result_ok);
5749 return ThirtyTwoBytes_clone(&*owner->contents.result);
5751 int8_tArray __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_get_ok(uint32_t owner) {
5752 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
5753 int8_tArray ret_arr = init_int8_tArray(32);
5754 memcpy(ret_arr->elems, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data, 32);
5758 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
5759 CHECK(!owner->result_ok);
5760 return *owner->contents.err;
5762 void __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_get_err(uint32_t owner) {
5763 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
5764 CResult_PaymentSecretNoneZ_get_err(owner_conv);
5767 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
5768 CHECK(owner->result_ok);
5769 return ThirtyTwoBytes_clone(&*owner->contents.result);
5771 int8_tArray __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_get_ok(uint32_t owner) {
5772 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
5773 int8_tArray ret_arr = init_int8_tArray(32);
5774 memcpy(ret_arr->elems, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data, 32);
5778 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
5779 CHECK(!owner->result_ok);
5780 return APIError_clone(&*owner->contents.err);
5782 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_get_err(uint32_t owner) {
5783 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
5784 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5785 *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
5786 uint64_t ret_ref = (uint64_t)ret_copy;
5790 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
5791 CHECK(owner->result_ok);
5792 return ThirtyTwoBytes_clone(&*owner->contents.result);
5794 int8_tArray __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_get_ok(uint32_t owner) {
5795 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
5796 int8_tArray ret_arr = init_int8_tArray(32);
5797 memcpy(ret_arr->elems, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data, 32);
5801 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
5802 CHECK(!owner->result_ok);
5803 return APIError_clone(&*owner->contents.err);
5805 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_get_err(uint32_t owner) {
5806 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
5807 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5808 *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
5809 uint64_t ret_ref = (uint64_t)ret_copy;
5813 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
5814 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
5815 for (size_t i = 0; i < ret.datalen; i++) {
5816 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
5820 typedef struct LDKWatch_JCalls {
5821 atomic_size_t refcnt;
5822 uint32_t watch_channel_meth;
5823 uint32_t update_channel_meth;
5824 uint32_t release_pending_monitor_events_meth;
5826 static void LDKWatch_JCalls_free(void* this_arg) {
5827 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5828 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5829 js_free_function_ptr(j_calls->watch_channel_meth);
5830 js_free_function_ptr(j_calls->update_channel_meth);
5831 js_free_function_ptr(j_calls->release_pending_monitor_events_meth);
5835 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
5836 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5837 LDKOutPoint funding_txo_var = funding_txo;
5838 uint64_t funding_txo_ref = 0;
5839 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5840 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5841 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5842 funding_txo_ref = (uint64_t)funding_txo_var.inner;
5843 if (funding_txo_var.is_owned) {
5844 funding_txo_ref |= 1;
5846 LDKChannelMonitor monitor_var = monitor;
5847 uint64_t monitor_ref = 0;
5848 CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5849 CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5850 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
5851 monitor_ref = (uint64_t)monitor_var.inner;
5852 if (monitor_var.is_owned) {
5855 uint32_t ret = js_invoke_function_2(j_calls->watch_channel_meth, (uint32_t)funding_txo_ref, (uint32_t)monitor_ref);
5856 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
5857 CHECK_ACCESS(ret_ptr);
5858 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
5862 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
5863 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5864 LDKOutPoint funding_txo_var = funding_txo;
5865 uint64_t funding_txo_ref = 0;
5866 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5867 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5868 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5869 funding_txo_ref = (uint64_t)funding_txo_var.inner;
5870 if (funding_txo_var.is_owned) {
5871 funding_txo_ref |= 1;
5873 LDKChannelMonitorUpdate update_var = update;
5874 uint64_t update_ref = 0;
5875 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5876 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5877 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
5878 update_ref = (uint64_t)update_var.inner;
5879 if (update_var.is_owned) {
5882 uint32_t ret = js_invoke_function_2(j_calls->update_channel_meth, (uint32_t)funding_txo_ref, (uint32_t)update_ref);
5883 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
5884 CHECK_ACCESS(ret_ptr);
5885 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
5889 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
5890 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5891 uint32_tArray ret = (uint32_tArray)js_invoke_function_0(j_calls->release_pending_monitor_events_meth);
5892 LDKCVec_MonitorEventZ ret_constr;
5893 ret_constr.datalen = ret->arr_len;
5894 if (ret_constr.datalen > 0)
5895 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
5897 ret_constr.data = NULL;
5898 uint32_t* ret_vals = ret->elems;
5899 for (size_t o = 0; o < ret_constr.datalen; o++) {
5900 uint32_t ret_conv_14 = ret_vals[o];
5901 void* ret_conv_14_ptr = (void*)(((uint64_t)ret_conv_14) & ~1);
5902 CHECK_ACCESS(ret_conv_14_ptr);
5903 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(ret_conv_14_ptr);
5904 FREE((void*)ret_conv_14);
5905 ret_constr.data[o] = ret_conv_14_conv;
5909 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
5910 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
5911 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5913 static inline LDKWatch LDKWatch_init (/*TODO: JS Object Reference */void* o) {
5914 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
5915 atomic_init(&calls->refcnt, 1);
5916 //TODO: Assign calls->o from o
5919 .this_arg = (void*) calls,
5920 .watch_channel = watch_channel_LDKWatch_jcall,
5921 .update_channel = update_channel_LDKWatch_jcall,
5922 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
5923 .free = LDKWatch_JCalls_free,
5927 long __attribute__((visibility("default"))) TS_LDKWatch_new(/*TODO: JS Object Reference */void* o) {
5928 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
5929 *res_ptr = LDKWatch_init(o);
5930 return (long)res_ptr;
5932 uint32_t __attribute__((visibility("default"))) TS_Watch_watch_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t monitor) {
5933 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5934 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5935 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5936 LDKOutPoint funding_txo_conv;
5937 funding_txo_conv.inner = (void*)(funding_txo & (~1));
5938 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
5939 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5940 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5941 LDKChannelMonitor monitor_conv;
5942 monitor_conv.inner = (void*)(monitor & (~1));
5943 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
5944 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
5945 monitor_conv = ChannelMonitor_clone(&monitor_conv);
5946 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5947 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
5948 return (uint64_t)ret_conv;
5951 uint32_t __attribute__((visibility("default"))) TS_Watch_update_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t update) {
5952 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5953 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5954 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5955 LDKOutPoint funding_txo_conv;
5956 funding_txo_conv.inner = (void*)(funding_txo & (~1));
5957 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
5958 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5959 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5960 LDKChannelMonitorUpdate update_conv;
5961 update_conv.inner = (void*)(update & (~1));
5962 update_conv.is_owned = (update & 1) || (update == 0);
5963 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
5964 update_conv = ChannelMonitorUpdate_clone(&update_conv);
5965 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5966 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
5967 return (uint64_t)ret_conv;
5970 uint32_tArray __attribute__((visibility("default"))) TS_Watch_release_pending_monitor_events(uint32_t this_arg) {
5971 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
5972 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5973 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5974 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
5975 uint32_tArray ret_arr = NULL;
5976 ret_arr = init_uint32_tArray(ret_var.datalen);
5977 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
5978 for (size_t o = 0; o < ret_var.datalen; o++) {
5979 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
5980 *ret_conv_14_copy = ret_var.data[o];
5981 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
5982 ret_arr_ptr[o] = ret_conv_14_ref;
5989 typedef struct LDKBroadcasterInterface_JCalls {
5990 atomic_size_t refcnt;
5991 uint32_t broadcast_transaction_meth;
5992 } LDKBroadcasterInterface_JCalls;
5993 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
5994 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5995 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5996 js_free_function_ptr(j_calls->broadcast_transaction_meth);
6000 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
6001 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6002 LDKTransaction tx_var = tx;
6003 int8_tArray tx_arr = init_int8_tArray(tx_var.datalen);
6004 memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
6005 Transaction_free(tx_var);
6006 js_invoke_function_1(j_calls->broadcast_transaction_meth, (uint32_t)tx_arr);
6008 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
6009 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
6010 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6012 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (/*TODO: JS Object Reference */void* o) {
6013 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
6014 atomic_init(&calls->refcnt, 1);
6015 //TODO: Assign calls->o from o
6017 LDKBroadcasterInterface ret = {
6018 .this_arg = (void*) calls,
6019 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
6020 .free = LDKBroadcasterInterface_JCalls_free,
6024 long __attribute__((visibility("default"))) TS_LDKBroadcasterInterface_new(/*TODO: JS Object Reference */void* o) {
6025 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
6026 *res_ptr = LDKBroadcasterInterface_init(o);
6027 return (long)res_ptr;
6029 void __attribute__((visibility("default"))) TS_BroadcasterInterface_broadcast_transaction(uint32_t this_arg, int8_tArray tx) {
6030 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6031 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6032 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
6033 LDKTransaction tx_ref;
6034 tx_ref.datalen = tx->arr_len;
6035 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
6036 memcpy(tx_ref.data, tx->elems, tx_ref.datalen);
6037 tx_ref.data_is_owned = true;
6038 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
6041 typedef struct LDKKeysInterface_JCalls {
6042 atomic_size_t refcnt;
6043 uint32_t get_node_secret_meth;
6044 uint32_t get_destination_script_meth;
6045 uint32_t get_shutdown_scriptpubkey_meth;
6046 uint32_t get_channel_signer_meth;
6047 uint32_t get_secure_random_bytes_meth;
6048 uint32_t read_chan_signer_meth;
6049 uint32_t sign_invoice_meth;
6050 uint32_t get_inbound_payment_key_material_meth;
6051 } LDKKeysInterface_JCalls;
6052 static void LDKKeysInterface_JCalls_free(void* this_arg) {
6053 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6054 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6055 js_free_function_ptr(j_calls->get_node_secret_meth);
6056 js_free_function_ptr(j_calls->get_destination_script_meth);
6057 js_free_function_ptr(j_calls->get_shutdown_scriptpubkey_meth);
6058 js_free_function_ptr(j_calls->get_channel_signer_meth);
6059 js_free_function_ptr(j_calls->get_secure_random_bytes_meth);
6060 js_free_function_ptr(j_calls->read_chan_signer_meth);
6061 js_free_function_ptr(j_calls->sign_invoice_meth);
6062 js_free_function_ptr(j_calls->get_inbound_payment_key_material_meth);
6066 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
6067 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6068 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->get_node_secret_meth);
6069 LDKSecretKey ret_ref;
6070 CHECK(ret->arr_len == 32);
6071 memcpy(ret_ref.bytes, ret->elems, 32);
6074 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
6075 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6076 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->get_destination_script_meth);
6077 LDKCVec_u8Z ret_ref;
6078 ret_ref.datalen = ret->arr_len;
6079 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6080 memcpy(ret_ref.data, ret->elems, ret_ref.datalen);
6083 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
6084 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6085 uint32_t ret = js_invoke_function_0(j_calls->get_shutdown_scriptpubkey_meth);
6086 LDKShutdownScript ret_conv;
6087 ret_conv.inner = (void*)(ret & (~1));
6088 ret_conv.is_owned = (ret & 1) || (ret == 0);
6089 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
6092 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
6093 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6094 uint32_t ret = js_invoke_function_2(j_calls->get_channel_signer_meth, (uint32_t)inbound, (uint32_t)channel_value_satoshis);
6095 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6096 CHECK_ACCESS(ret_ptr);
6097 LDKSign ret_conv = *(LDKSign*)(ret_ptr);
6101 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
6102 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6103 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->get_secure_random_bytes_meth);
6104 LDKThirtyTwoBytes ret_ref;
6105 CHECK(ret->arr_len == 32);
6106 memcpy(ret_ref.data, ret->elems, 32);
6109 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
6110 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6111 LDKu8slice reader_var = reader;
6112 int8_tArray reader_arr = init_int8_tArray(reader_var.datalen);
6113 memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
6114 uint32_t ret = js_invoke_function_1(j_calls->read_chan_signer_meth, (uint32_t)reader_arr);
6115 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6116 CHECK_ACCESS(ret_ptr);
6117 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
6121 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
6122 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6123 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
6124 int8_tArray invoice_preimage_arr = init_int8_tArray(invoice_preimage_var.datalen);
6125 memcpy(invoice_preimage_arr->elems, invoice_preimage_var.data, invoice_preimage_var.datalen);
6126 CVec_u8Z_free(invoice_preimage_var);
6127 uint32_t ret = js_invoke_function_1(j_calls->sign_invoice_meth, (uint32_t)invoice_preimage_arr);
6128 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6129 CHECK_ACCESS(ret_ptr);
6130 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
6134 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) {
6135 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6136 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->get_inbound_payment_key_material_meth);
6137 LDKThirtyTwoBytes ret_ref;
6138 CHECK(ret->arr_len == 32);
6139 memcpy(ret_ref.data, ret->elems, 32);
6142 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
6143 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
6144 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6146 static inline LDKKeysInterface LDKKeysInterface_init (/*TODO: JS Object Reference */void* o) {
6147 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
6148 atomic_init(&calls->refcnt, 1);
6149 //TODO: Assign calls->o from o
6151 LDKKeysInterface ret = {
6152 .this_arg = (void*) calls,
6153 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
6154 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
6155 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
6156 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
6157 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
6158 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
6159 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
6160 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall,
6161 .free = LDKKeysInterface_JCalls_free,
6165 long __attribute__((visibility("default"))) TS_LDKKeysInterface_new(/*TODO: JS Object Reference */void* o) {
6166 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
6167 *res_ptr = LDKKeysInterface_init(o);
6168 return (long)res_ptr;
6170 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_node_secret(uint32_t this_arg) {
6171 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6172 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6173 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6174 int8_tArray ret_arr = init_int8_tArray(32);
6175 memcpy(ret_arr->elems, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes, 32);
6179 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_destination_script(uint32_t this_arg) {
6180 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6181 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6182 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6183 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
6184 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
6185 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6186 CVec_u8Z_free(ret_var);
6190 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_shutdown_scriptpubkey(uint32_t this_arg) {
6191 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6192 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6193 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6194 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
6195 uint64_t ret_ref = 0;
6196 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6197 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6198 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6199 ret_ref = (uint64_t)ret_var.inner;
6200 if (ret_var.is_owned) {
6206 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_channel_signer(uint32_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
6207 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6208 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6209 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6210 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
6211 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
6212 return (uint64_t)ret_ret;
6215 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_secure_random_bytes(uint32_t this_arg) {
6216 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6217 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6218 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6219 int8_tArray ret_arr = init_int8_tArray(32);
6220 memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
6224 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_read_chan_signer(uint32_t this_arg, int8_tArray reader) {
6225 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6226 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6227 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6228 LDKu8slice reader_ref;
6229 reader_ref.datalen = reader->arr_len;
6230 reader_ref.data = reader->elems;
6231 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
6232 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
6233 return (uint64_t)ret_conv;
6236 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_sign_invoice(uint32_t this_arg, int8_tArray invoice_preimage) {
6237 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6238 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6239 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6240 LDKCVec_u8Z invoice_preimage_ref;
6241 invoice_preimage_ref.datalen = invoice_preimage->arr_len;
6242 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
6243 memcpy(invoice_preimage_ref.data, invoice_preimage->elems, invoice_preimage_ref.datalen);
6244 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
6245 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
6246 return (uint64_t)ret_conv;
6249 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_inbound_payment_key_material(uint32_t this_arg) {
6250 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6251 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6252 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6253 int8_tArray ret_arr = init_int8_tArray(32);
6254 memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
6258 typedef struct LDKFeeEstimator_JCalls {
6259 atomic_size_t refcnt;
6260 uint32_t get_est_sat_per_1000_weight_meth;
6261 } LDKFeeEstimator_JCalls;
6262 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
6263 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6264 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6265 js_free_function_ptr(j_calls->get_est_sat_per_1000_weight_meth);
6269 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
6270 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6271 uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
6272 return js_invoke_function_1(j_calls->get_est_sat_per_1000_weight_meth, (uint32_t)confirmation_target_conv);
6274 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
6275 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
6276 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6278 static inline LDKFeeEstimator LDKFeeEstimator_init (/*TODO: JS Object Reference */void* o) {
6279 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
6280 atomic_init(&calls->refcnt, 1);
6281 //TODO: Assign calls->o from o
6283 LDKFeeEstimator ret = {
6284 .this_arg = (void*) calls,
6285 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
6286 .free = LDKFeeEstimator_JCalls_free,
6290 long __attribute__((visibility("default"))) TS_LDKFeeEstimator_new(/*TODO: JS Object Reference */void* o) {
6291 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
6292 *res_ptr = LDKFeeEstimator_init(o);
6293 return (long)res_ptr;
6295 int32_t __attribute__((visibility("default"))) TS_FeeEstimator_get_est_sat_per_1000_weight(uint32_t this_arg, uint32_t confirmation_target) {
6296 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6297 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6298 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
6299 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
6300 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
6304 typedef struct LDKLogger_JCalls {
6305 atomic_size_t refcnt;
6308 static void LDKLogger_JCalls_free(void* this_arg) {
6309 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
6310 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6311 js_free_function_ptr(j_calls->log_meth);
6315 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
6316 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
6317 LDKRecord record_var = *record;
6318 uint64_t record_ref = 0;
6319 record_var = Record_clone(record);
6320 CHECK((((uint64_t)record_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6321 CHECK((((uint64_t)&record_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6322 CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
6323 record_ref = (uint64_t)record_var.inner;
6324 if (record_var.is_owned) {
6327 js_invoke_function_1(j_calls->log_meth, (uint32_t)record_ref);
6329 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
6330 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
6331 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6333 static inline LDKLogger LDKLogger_init (/*TODO: JS Object Reference */void* o) {
6334 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
6335 atomic_init(&calls->refcnt, 1);
6336 //TODO: Assign calls->o from o
6339 .this_arg = (void*) calls,
6340 .log = log_LDKLogger_jcall,
6341 .free = LDKLogger_JCalls_free,
6345 long __attribute__((visibility("default"))) TS_LDKLogger_new(/*TODO: JS Object Reference */void* o) {
6346 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
6347 *res_ptr = LDKLogger_init(o);
6348 return (long)res_ptr;
6350 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
6351 return ThirtyTwoBytes_clone(&owner->a);
6353 int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_get_a(uint32_t owner) {
6354 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
6355 int8_tArray ret_arr = init_int8_tArray(32);
6356 memcpy(ret_arr->elems, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data, 32);
6360 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
6363 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_get_b(uint32_t owner) {
6364 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
6365 LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
6366 uint64_t ret_ref = 0;
6367 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6368 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6369 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6370 ret_ref = (uint64_t)ret_var.inner & ~1;
6374 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6375 CHECK(owner->result_ok);
6376 return &*owner->contents.result;
6378 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint32_t owner) {
6379 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
6380 uint64_t ret_ret = (uint64_t)CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv);
6384 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6385 CHECK(!owner->result_ok);
6386 return DecodeError_clone(&*owner->contents.err);
6388 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint32_t owner) {
6389 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
6390 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
6391 uint64_t ret_ref = 0;
6392 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6393 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6394 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6395 ret_ref = (uint64_t)ret_var.inner;
6396 if (ret_var.is_owned) {
6402 typedef struct LDKMessageSendEventsProvider_JCalls {
6403 atomic_size_t refcnt;
6404 uint32_t get_and_clear_pending_msg_events_meth;
6405 } LDKMessageSendEventsProvider_JCalls;
6406 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
6407 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
6408 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6409 js_free_function_ptr(j_calls->get_and_clear_pending_msg_events_meth);
6413 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
6414 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
6415 uint32_tArray ret = (uint32_tArray)js_invoke_function_0(j_calls->get_and_clear_pending_msg_events_meth);
6416 LDKCVec_MessageSendEventZ ret_constr;
6417 ret_constr.datalen = ret->arr_len;
6418 if (ret_constr.datalen > 0)
6419 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
6421 ret_constr.data = NULL;
6422 uint32_t* ret_vals = ret->elems;
6423 for (size_t s = 0; s < ret_constr.datalen; s++) {
6424 uint32_t ret_conv_18 = ret_vals[s];
6425 void* ret_conv_18_ptr = (void*)(((uint64_t)ret_conv_18) & ~1);
6426 CHECK_ACCESS(ret_conv_18_ptr);
6427 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
6428 FREE((void*)ret_conv_18);
6429 ret_constr.data[s] = ret_conv_18_conv;
6433 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
6434 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
6435 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6437 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (/*TODO: JS Object Reference */void* o) {
6438 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
6439 atomic_init(&calls->refcnt, 1);
6440 //TODO: Assign calls->o from o
6442 LDKMessageSendEventsProvider ret = {
6443 .this_arg = (void*) calls,
6444 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
6445 .free = LDKMessageSendEventsProvider_JCalls_free,
6449 long __attribute__((visibility("default"))) TS_LDKMessageSendEventsProvider_new(/*TODO: JS Object Reference */void* o) {
6450 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
6451 *res_ptr = LDKMessageSendEventsProvider_init(o);
6452 return (long)res_ptr;
6454 uint32_tArray __attribute__((visibility("default"))) TS_MessageSendEventsProvider_get_and_clear_pending_msg_events(uint32_t this_arg) {
6455 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6456 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6457 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
6458 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
6459 uint32_tArray ret_arr = NULL;
6460 ret_arr = init_uint32_tArray(ret_var.datalen);
6461 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
6462 for (size_t s = 0; s < ret_var.datalen; s++) {
6463 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
6464 *ret_conv_18_copy = ret_var.data[s];
6465 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_copy;
6466 ret_arr_ptr[s] = ret_conv_18_ref;
6473 typedef struct LDKEventHandler_JCalls {
6474 atomic_size_t refcnt;
6475 uint32_t handle_event_meth;
6476 } LDKEventHandler_JCalls;
6477 static void LDKEventHandler_JCalls_free(void* this_arg) {
6478 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6479 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6480 js_free_function_ptr(j_calls->handle_event_meth);
6484 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
6485 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6486 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
6487 *ret_event = Event_clone(event);
6488 js_invoke_function_1(j_calls->handle_event_meth, (uint32_t)(uint64_t)ret_event);
6490 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
6491 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
6492 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6494 static inline LDKEventHandler LDKEventHandler_init (/*TODO: JS Object Reference */void* o) {
6495 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
6496 atomic_init(&calls->refcnt, 1);
6497 //TODO: Assign calls->o from o
6499 LDKEventHandler ret = {
6500 .this_arg = (void*) calls,
6501 .handle_event = handle_event_LDKEventHandler_jcall,
6502 .free = LDKEventHandler_JCalls_free,
6506 long __attribute__((visibility("default"))) TS_LDKEventHandler_new(/*TODO: JS Object Reference */void* o) {
6507 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
6508 *res_ptr = LDKEventHandler_init(o);
6509 return (long)res_ptr;
6511 void __attribute__((visibility("default"))) TS_EventHandler_handle_event(uint32_t this_arg, uint32_t event) {
6512 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6513 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6514 LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
6515 LDKEvent* event_conv = (LDKEvent*)event;
6516 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
6519 typedef struct LDKEventsProvider_JCalls {
6520 atomic_size_t refcnt;
6521 uint32_t process_pending_events_meth;
6522 } LDKEventsProvider_JCalls;
6523 static void LDKEventsProvider_JCalls_free(void* this_arg) {
6524 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6525 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6526 js_free_function_ptr(j_calls->process_pending_events_meth);
6530 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
6531 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6532 LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
6533 *handler_ret = handler;
6534 js_invoke_function_1(j_calls->process_pending_events_meth, (uint32_t)(uint64_t)handler_ret);
6536 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
6537 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
6538 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6540 static inline LDKEventsProvider LDKEventsProvider_init (/*TODO: JS Object Reference */void* o) {
6541 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
6542 atomic_init(&calls->refcnt, 1);
6543 //TODO: Assign calls->o from o
6545 LDKEventsProvider ret = {
6546 .this_arg = (void*) calls,
6547 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
6548 .free = LDKEventsProvider_JCalls_free,
6552 long __attribute__((visibility("default"))) TS_LDKEventsProvider_new(/*TODO: JS Object Reference */void* o) {
6553 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6554 *res_ptr = LDKEventsProvider_init(o);
6555 return (long)res_ptr;
6557 void __attribute__((visibility("default"))) TS_EventsProvider_process_pending_events(uint32_t this_arg, uint32_t handler) {
6558 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6559 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6560 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
6561 void* handler_ptr = (void*)(((uint64_t)handler) & ~1);
6562 CHECK_ACCESS(handler_ptr);
6563 LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
6564 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
6567 typedef struct LDKListen_JCalls {
6568 atomic_size_t refcnt;
6569 uint32_t block_connected_meth;
6570 uint32_t block_disconnected_meth;
6572 static void LDKListen_JCalls_free(void* this_arg) {
6573 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6574 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6575 js_free_function_ptr(j_calls->block_connected_meth);
6576 js_free_function_ptr(j_calls->block_disconnected_meth);
6580 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
6581 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6582 LDKu8slice block_var = block;
6583 int8_tArray block_arr = init_int8_tArray(block_var.datalen);
6584 memcpy(block_arr->elems, block_var.data, block_var.datalen);
6585 js_invoke_function_2(j_calls->block_connected_meth, (uint32_t)block_arr, (uint32_t)height);
6587 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
6588 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6589 int8_tArray header_arr = init_int8_tArray(80);
6590 memcpy(header_arr->elems, *header, 80);
6591 js_invoke_function_2(j_calls->block_disconnected_meth, (uint32_t)header_arr, (uint32_t)height);
6593 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
6594 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
6595 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6597 static inline LDKListen LDKListen_init (/*TODO: JS Object Reference */void* o) {
6598 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
6599 atomic_init(&calls->refcnt, 1);
6600 //TODO: Assign calls->o from o
6603 .this_arg = (void*) calls,
6604 .block_connected = block_connected_LDKListen_jcall,
6605 .block_disconnected = block_disconnected_LDKListen_jcall,
6606 .free = LDKListen_JCalls_free,
6610 long __attribute__((visibility("default"))) TS_LDKListen_new(/*TODO: JS Object Reference */void* o) {
6611 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
6612 *res_ptr = LDKListen_init(o);
6613 return (long)res_ptr;
6615 void __attribute__((visibility("default"))) TS_Listen_block_connected(uint32_t this_arg, int8_tArray block, int32_t height) {
6616 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6617 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6618 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
6619 LDKu8slice block_ref;
6620 block_ref.datalen = block->arr_len;
6621 block_ref.data = block->elems;
6622 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
6625 void __attribute__((visibility("default"))) TS_Listen_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height) {
6626 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6627 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6628 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
6629 unsigned char header_arr[80];
6630 CHECK(header->arr_len == 80);
6631 memcpy(header_arr, header->elems, 80);
6632 unsigned char (*header_ref)[80] = &header_arr;
6633 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
6636 typedef struct LDKConfirm_JCalls {
6637 atomic_size_t refcnt;
6638 uint32_t transactions_confirmed_meth;
6639 uint32_t transaction_unconfirmed_meth;
6640 uint32_t best_block_updated_meth;
6641 uint32_t get_relevant_txids_meth;
6642 } LDKConfirm_JCalls;
6643 static void LDKConfirm_JCalls_free(void* this_arg) {
6644 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6645 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6646 js_free_function_ptr(j_calls->transactions_confirmed_meth);
6647 js_free_function_ptr(j_calls->transaction_unconfirmed_meth);
6648 js_free_function_ptr(j_calls->best_block_updated_meth);
6649 js_free_function_ptr(j_calls->get_relevant_txids_meth);
6653 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
6654 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6655 int8_tArray header_arr = init_int8_tArray(80);
6656 memcpy(header_arr->elems, *header, 80);
6657 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
6658 uint32_tArray txdata_arr = NULL;
6659 txdata_arr = init_uint32_tArray(txdata_var.datalen);
6660 uint32_t *txdata_arr_ptr = (uint32_t*)(txdata_arr + 4);
6661 for (size_t c = 0; c < txdata_var.datalen; c++) {
6662 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
6663 *txdata_conv_28_conv = txdata_var.data[c];
6664 txdata_arr_ptr[c] = ((uint64_t)txdata_conv_28_conv);
6667 FREE(txdata_var.data);
6668 js_invoke_function_3(j_calls->transactions_confirmed_meth, (uint32_t)header_arr, (uint32_t)txdata_arr, (uint32_t)height);
6670 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
6671 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6672 int8_tArray txid_arr = init_int8_tArray(32);
6673 memcpy(txid_arr->elems, *txid, 32);
6674 js_invoke_function_1(j_calls->transaction_unconfirmed_meth, (uint32_t)txid_arr);
6676 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
6677 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6678 int8_tArray header_arr = init_int8_tArray(80);
6679 memcpy(header_arr->elems, *header, 80);
6680 js_invoke_function_2(j_calls->best_block_updated_meth, (uint32_t)header_arr, (uint32_t)height);
6682 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
6683 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6684 ptrArray ret = (ptrArray)js_invoke_function_0(j_calls->get_relevant_txids_meth);
6685 LDKCVec_TxidZ ret_constr;
6686 ret_constr.datalen = ret->arr_len;
6687 if (ret_constr.datalen > 0)
6688 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
6690 ret_constr.data = NULL;
6691 int8_tArray* ret_vals = (void*) ret->elems;
6692 for (size_t m = 0; m < ret_constr.datalen; m++) {
6693 int8_tArray ret_conv_12 = ret_vals[m];
6694 LDKThirtyTwoBytes ret_conv_12_ref;
6695 CHECK(ret_conv_12->arr_len == 32);
6696 memcpy(ret_conv_12_ref.data, ret_conv_12->elems, 32);
6697 ret_constr.data[m] = ret_conv_12_ref;
6701 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
6702 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
6703 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6705 static inline LDKConfirm LDKConfirm_init (/*TODO: JS Object Reference */void* o) {
6706 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
6707 atomic_init(&calls->refcnt, 1);
6708 //TODO: Assign calls->o from o
6711 .this_arg = (void*) calls,
6712 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
6713 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
6714 .best_block_updated = best_block_updated_LDKConfirm_jcall,
6715 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
6716 .free = LDKConfirm_JCalls_free,
6720 long __attribute__((visibility("default"))) TS_LDKConfirm_new(/*TODO: JS Object Reference */void* o) {
6721 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
6722 *res_ptr = LDKConfirm_init(o);
6723 return (long)res_ptr;
6725 void __attribute__((visibility("default"))) TS_Confirm_transactions_confirmed(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
6726 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6727 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6728 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
6729 unsigned char header_arr[80];
6730 CHECK(header->arr_len == 80);
6731 memcpy(header_arr, header->elems, 80);
6732 unsigned char (*header_ref)[80] = &header_arr;
6733 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6734 txdata_constr.datalen = txdata->arr_len;
6735 if (txdata_constr.datalen > 0)
6736 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6738 txdata_constr.data = NULL;
6739 uint32_t* txdata_vals = txdata->elems;
6740 for (size_t c = 0; c < txdata_constr.datalen; c++) {
6741 uint32_t txdata_conv_28 = txdata_vals[c];
6742 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
6743 CHECK_ACCESS(txdata_conv_28_ptr);
6744 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
6745 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
6746 txdata_constr.data[c] = txdata_conv_28_conv;
6748 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
6751 void __attribute__((visibility("default"))) TS_Confirm_transaction_unconfirmed(uint32_t this_arg, int8_tArray txid) {
6752 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6753 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6754 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
6755 unsigned char txid_arr[32];
6756 CHECK(txid->arr_len == 32);
6757 memcpy(txid_arr, txid->elems, 32);
6758 unsigned char (*txid_ref)[32] = &txid_arr;
6759 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
6762 void __attribute__((visibility("default"))) TS_Confirm_best_block_updated(uint32_t this_arg, int8_tArray header, int32_t height) {
6763 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6764 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6765 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
6766 unsigned char header_arr[80];
6767 CHECK(header->arr_len == 80);
6768 memcpy(header_arr, header->elems, 80);
6769 unsigned char (*header_ref)[80] = &header_arr;
6770 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
6773 ptrArray __attribute__((visibility("default"))) TS_Confirm_get_relevant_txids(uint32_t this_arg) {
6774 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6775 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6776 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
6777 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
6778 ptrArray ret_arr = NULL;
6779 ret_arr = init_ptrArray(ret_var.datalen);
6780 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
6781 for (size_t m = 0; m < ret_var.datalen; m++) {
6782 int8_tArray ret_conv_12_arr = init_int8_tArray(32);
6783 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
6784 ret_arr_ptr[m] = ret_conv_12_arr;
6791 typedef struct LDKPersist_JCalls {
6792 atomic_size_t refcnt;
6793 uint32_t persist_new_channel_meth;
6794 uint32_t update_persisted_channel_meth;
6795 } LDKPersist_JCalls;
6796 static void LDKPersist_JCalls_free(void* this_arg) {
6797 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6798 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6799 js_free_function_ptr(j_calls->persist_new_channel_meth);
6800 js_free_function_ptr(j_calls->update_persisted_channel_meth);
6804 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
6805 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6806 LDKOutPoint channel_id_var = channel_id;
6807 uint64_t channel_id_ref = 0;
6808 CHECK((((uint64_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6809 CHECK((((uint64_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6810 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
6811 channel_id_ref = (uint64_t)channel_id_var.inner;
6812 if (channel_id_var.is_owned) {
6813 channel_id_ref |= 1;
6815 LDKChannelMonitor data_var = *data;
6816 uint64_t data_ref = 0;
6817 data_var = ChannelMonitor_clone(data);
6818 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6819 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6820 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
6821 data_ref = (uint64_t)data_var.inner;
6822 if (data_var.is_owned) {
6825 LDKMonitorUpdateId update_id_var = update_id;
6826 uint64_t update_id_ref = 0;
6827 CHECK((((uint64_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6828 CHECK((((uint64_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6829 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
6830 update_id_ref = (uint64_t)update_id_var.inner;
6831 if (update_id_var.is_owned) {
6834 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);
6835 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6836 CHECK_ACCESS(ret_ptr);
6837 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
6841 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
6842 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6843 LDKOutPoint channel_id_var = channel_id;
6844 uint64_t channel_id_ref = 0;
6845 CHECK((((uint64_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6846 CHECK((((uint64_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6847 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
6848 channel_id_ref = (uint64_t)channel_id_var.inner;
6849 if (channel_id_var.is_owned) {
6850 channel_id_ref |= 1;
6852 LDKChannelMonitorUpdate update_var = *update;
6853 uint64_t update_ref = 0;
6854 if ((uint64_t)update_var.inner > 4096) {
6855 update_var = ChannelMonitorUpdate_clone(update);
6856 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6857 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6858 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
6859 update_ref = (uint64_t)update_var.inner;
6860 if (update_var.is_owned) {
6864 LDKChannelMonitor data_var = *data;
6865 uint64_t data_ref = 0;
6866 data_var = ChannelMonitor_clone(data);
6867 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6868 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6869 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
6870 data_ref = (uint64_t)data_var.inner;
6871 if (data_var.is_owned) {
6874 LDKMonitorUpdateId update_id_var = update_id;
6875 uint64_t update_id_ref = 0;
6876 CHECK((((uint64_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6877 CHECK((((uint64_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6878 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
6879 update_id_ref = (uint64_t)update_id_var.inner;
6880 if (update_id_var.is_owned) {
6883 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);
6884 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
6885 CHECK_ACCESS(ret_ptr);
6886 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
6890 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
6891 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
6892 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6894 static inline LDKPersist LDKPersist_init (/*TODO: JS Object Reference */void* o) {
6895 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
6896 atomic_init(&calls->refcnt, 1);
6897 //TODO: Assign calls->o from o
6900 .this_arg = (void*) calls,
6901 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
6902 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
6903 .free = LDKPersist_JCalls_free,
6907 long __attribute__((visibility("default"))) TS_LDKPersist_new(/*TODO: JS Object Reference */void* o) {
6908 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
6909 *res_ptr = LDKPersist_init(o);
6910 return (long)res_ptr;
6912 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) {
6913 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6914 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6915 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
6916 LDKOutPoint channel_id_conv;
6917 channel_id_conv.inner = (void*)(channel_id & (~1));
6918 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
6919 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
6920 channel_id_conv = OutPoint_clone(&channel_id_conv);
6921 LDKChannelMonitor data_conv;
6922 data_conv.inner = (void*)(data & (~1));
6923 data_conv.is_owned = false;
6924 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
6925 LDKMonitorUpdateId update_id_conv;
6926 update_id_conv.inner = (void*)(update_id & (~1));
6927 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
6928 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
6929 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
6930 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6931 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv);
6932 return (uint64_t)ret_conv;
6935 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) {
6936 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
6937 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6938 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
6939 LDKOutPoint channel_id_conv;
6940 channel_id_conv.inner = (void*)(channel_id & (~1));
6941 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
6942 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
6943 channel_id_conv = OutPoint_clone(&channel_id_conv);
6944 LDKChannelMonitorUpdate update_conv;
6945 update_conv.inner = (void*)(update & (~1));
6946 update_conv.is_owned = false;
6947 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
6948 LDKChannelMonitor data_conv;
6949 data_conv.inner = (void*)(data & (~1));
6950 data_conv.is_owned = false;
6951 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
6952 LDKMonitorUpdateId update_id_conv;
6953 update_id_conv.inner = (void*)(update_id & (~1));
6954 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
6955 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
6956 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
6957 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6958 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv);
6959 return (uint64_t)ret_conv;
6962 typedef struct LDKChannelMessageHandler_JCalls {
6963 atomic_size_t refcnt;
6964 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
6965 uint32_t handle_open_channel_meth;
6966 uint32_t handle_accept_channel_meth;
6967 uint32_t handle_funding_created_meth;
6968 uint32_t handle_funding_signed_meth;
6969 uint32_t handle_funding_locked_meth;
6970 uint32_t handle_shutdown_meth;
6971 uint32_t handle_closing_signed_meth;
6972 uint32_t handle_update_add_htlc_meth;
6973 uint32_t handle_update_fulfill_htlc_meth;
6974 uint32_t handle_update_fail_htlc_meth;
6975 uint32_t handle_update_fail_malformed_htlc_meth;
6976 uint32_t handle_commitment_signed_meth;
6977 uint32_t handle_revoke_and_ack_meth;
6978 uint32_t handle_update_fee_meth;
6979 uint32_t handle_announcement_signatures_meth;
6980 uint32_t peer_disconnected_meth;
6981 uint32_t peer_connected_meth;
6982 uint32_t handle_channel_reestablish_meth;
6983 uint32_t handle_channel_update_meth;
6984 uint32_t handle_error_meth;
6985 } LDKChannelMessageHandler_JCalls;
6986 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
6987 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6988 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6989 js_free_function_ptr(j_calls->handle_open_channel_meth);
6990 js_free_function_ptr(j_calls->handle_accept_channel_meth);
6991 js_free_function_ptr(j_calls->handle_funding_created_meth);
6992 js_free_function_ptr(j_calls->handle_funding_signed_meth);
6993 js_free_function_ptr(j_calls->handle_funding_locked_meth);
6994 js_free_function_ptr(j_calls->handle_shutdown_meth);
6995 js_free_function_ptr(j_calls->handle_closing_signed_meth);
6996 js_free_function_ptr(j_calls->handle_update_add_htlc_meth);
6997 js_free_function_ptr(j_calls->handle_update_fulfill_htlc_meth);
6998 js_free_function_ptr(j_calls->handle_update_fail_htlc_meth);
6999 js_free_function_ptr(j_calls->handle_update_fail_malformed_htlc_meth);
7000 js_free_function_ptr(j_calls->handle_commitment_signed_meth);
7001 js_free_function_ptr(j_calls->handle_revoke_and_ack_meth);
7002 js_free_function_ptr(j_calls->handle_update_fee_meth);
7003 js_free_function_ptr(j_calls->handle_announcement_signatures_meth);
7004 js_free_function_ptr(j_calls->peer_disconnected_meth);
7005 js_free_function_ptr(j_calls->peer_connected_meth);
7006 js_free_function_ptr(j_calls->handle_channel_reestablish_meth);
7007 js_free_function_ptr(j_calls->handle_channel_update_meth);
7008 js_free_function_ptr(j_calls->handle_error_meth);
7012 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
7013 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7014 int8_tArray their_node_id_arr = init_int8_tArray(33);
7015 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7016 LDKInitFeatures their_features_var = their_features;
7017 uint64_t their_features_ref = 0;
7018 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7019 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7020 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
7021 their_features_ref = (uint64_t)their_features_var.inner;
7022 if (their_features_var.is_owned) {
7023 their_features_ref |= 1;
7025 LDKOpenChannel msg_var = *msg;
7026 uint64_t msg_ref = 0;
7027 msg_var = OpenChannel_clone(msg);
7028 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7029 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7030 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7031 msg_ref = (uint64_t)msg_var.inner;
7032 if (msg_var.is_owned) {
7035 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);
7037 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
7038 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7039 int8_tArray their_node_id_arr = init_int8_tArray(33);
7040 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7041 LDKInitFeatures their_features_var = their_features;
7042 uint64_t their_features_ref = 0;
7043 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7044 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7045 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
7046 their_features_ref = (uint64_t)their_features_var.inner;
7047 if (their_features_var.is_owned) {
7048 their_features_ref |= 1;
7050 LDKAcceptChannel msg_var = *msg;
7051 uint64_t msg_ref = 0;
7052 msg_var = AcceptChannel_clone(msg);
7053 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7054 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7055 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7056 msg_ref = (uint64_t)msg_var.inner;
7057 if (msg_var.is_owned) {
7060 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);
7062 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
7063 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7064 int8_tArray their_node_id_arr = init_int8_tArray(33);
7065 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7066 LDKFundingCreated msg_var = *msg;
7067 uint64_t msg_ref = 0;
7068 msg_var = FundingCreated_clone(msg);
7069 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7070 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7071 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7072 msg_ref = (uint64_t)msg_var.inner;
7073 if (msg_var.is_owned) {
7076 js_invoke_function_2(j_calls->handle_funding_created_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7078 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
7079 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7080 int8_tArray their_node_id_arr = init_int8_tArray(33);
7081 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7082 LDKFundingSigned msg_var = *msg;
7083 uint64_t msg_ref = 0;
7084 msg_var = FundingSigned_clone(msg);
7085 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7086 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7087 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7088 msg_ref = (uint64_t)msg_var.inner;
7089 if (msg_var.is_owned) {
7092 js_invoke_function_2(j_calls->handle_funding_signed_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7094 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
7095 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7096 int8_tArray their_node_id_arr = init_int8_tArray(33);
7097 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7098 LDKFundingLocked msg_var = *msg;
7099 uint64_t msg_ref = 0;
7100 msg_var = FundingLocked_clone(msg);
7101 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7102 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7103 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7104 msg_ref = (uint64_t)msg_var.inner;
7105 if (msg_var.is_owned) {
7108 js_invoke_function_2(j_calls->handle_funding_locked_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7110 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
7111 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7112 int8_tArray their_node_id_arr = init_int8_tArray(33);
7113 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7114 LDKInitFeatures their_features_var = *their_features;
7115 uint64_t their_features_ref = 0;
7116 their_features_var = InitFeatures_clone(their_features);
7117 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7118 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7119 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
7120 their_features_ref = (uint64_t)their_features_var.inner;
7121 if (their_features_var.is_owned) {
7122 their_features_ref |= 1;
7124 LDKShutdown msg_var = *msg;
7125 uint64_t msg_ref = 0;
7126 msg_var = Shutdown_clone(msg);
7127 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7128 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7129 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7130 msg_ref = (uint64_t)msg_var.inner;
7131 if (msg_var.is_owned) {
7134 js_invoke_function_3(j_calls->handle_shutdown_meth, (uint32_t)their_node_id_arr, (uint32_t)their_features_ref, (uint32_t)msg_ref);
7136 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
7137 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7138 int8_tArray their_node_id_arr = init_int8_tArray(33);
7139 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7140 LDKClosingSigned msg_var = *msg;
7141 uint64_t msg_ref = 0;
7142 msg_var = ClosingSigned_clone(msg);
7143 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7144 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7145 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7146 msg_ref = (uint64_t)msg_var.inner;
7147 if (msg_var.is_owned) {
7150 js_invoke_function_2(j_calls->handle_closing_signed_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7152 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
7153 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7154 int8_tArray their_node_id_arr = init_int8_tArray(33);
7155 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7156 LDKUpdateAddHTLC msg_var = *msg;
7157 uint64_t msg_ref = 0;
7158 msg_var = UpdateAddHTLC_clone(msg);
7159 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7160 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7161 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7162 msg_ref = (uint64_t)msg_var.inner;
7163 if (msg_var.is_owned) {
7166 js_invoke_function_2(j_calls->handle_update_add_htlc_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7168 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
7169 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7170 int8_tArray their_node_id_arr = init_int8_tArray(33);
7171 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7172 LDKUpdateFulfillHTLC msg_var = *msg;
7173 uint64_t msg_ref = 0;
7174 msg_var = UpdateFulfillHTLC_clone(msg);
7175 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7176 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7177 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7178 msg_ref = (uint64_t)msg_var.inner;
7179 if (msg_var.is_owned) {
7182 js_invoke_function_2(j_calls->handle_update_fulfill_htlc_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7184 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
7185 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7186 int8_tArray their_node_id_arr = init_int8_tArray(33);
7187 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7188 LDKUpdateFailHTLC msg_var = *msg;
7189 uint64_t msg_ref = 0;
7190 msg_var = UpdateFailHTLC_clone(msg);
7191 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7192 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7193 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7194 msg_ref = (uint64_t)msg_var.inner;
7195 if (msg_var.is_owned) {
7198 js_invoke_function_2(j_calls->handle_update_fail_htlc_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7200 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
7201 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7202 int8_tArray their_node_id_arr = init_int8_tArray(33);
7203 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7204 LDKUpdateFailMalformedHTLC msg_var = *msg;
7205 uint64_t msg_ref = 0;
7206 msg_var = UpdateFailMalformedHTLC_clone(msg);
7207 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7208 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7209 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7210 msg_ref = (uint64_t)msg_var.inner;
7211 if (msg_var.is_owned) {
7214 js_invoke_function_2(j_calls->handle_update_fail_malformed_htlc_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7216 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
7217 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7218 int8_tArray their_node_id_arr = init_int8_tArray(33);
7219 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7220 LDKCommitmentSigned msg_var = *msg;
7221 uint64_t msg_ref = 0;
7222 msg_var = CommitmentSigned_clone(msg);
7223 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7224 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7225 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7226 msg_ref = (uint64_t)msg_var.inner;
7227 if (msg_var.is_owned) {
7230 js_invoke_function_2(j_calls->handle_commitment_signed_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7232 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
7233 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7234 int8_tArray their_node_id_arr = init_int8_tArray(33);
7235 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7236 LDKRevokeAndACK msg_var = *msg;
7237 uint64_t msg_ref = 0;
7238 msg_var = RevokeAndACK_clone(msg);
7239 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7240 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7241 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7242 msg_ref = (uint64_t)msg_var.inner;
7243 if (msg_var.is_owned) {
7246 js_invoke_function_2(j_calls->handle_revoke_and_ack_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7248 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
7249 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7250 int8_tArray their_node_id_arr = init_int8_tArray(33);
7251 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7252 LDKUpdateFee msg_var = *msg;
7253 uint64_t msg_ref = 0;
7254 msg_var = UpdateFee_clone(msg);
7255 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7256 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7257 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7258 msg_ref = (uint64_t)msg_var.inner;
7259 if (msg_var.is_owned) {
7262 js_invoke_function_2(j_calls->handle_update_fee_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7264 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
7265 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7266 int8_tArray their_node_id_arr = init_int8_tArray(33);
7267 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7268 LDKAnnouncementSignatures msg_var = *msg;
7269 uint64_t msg_ref = 0;
7270 msg_var = AnnouncementSignatures_clone(msg);
7271 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7272 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7273 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7274 msg_ref = (uint64_t)msg_var.inner;
7275 if (msg_var.is_owned) {
7278 js_invoke_function_2(j_calls->handle_announcement_signatures_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7280 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
7281 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7282 int8_tArray their_node_id_arr = init_int8_tArray(33);
7283 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7284 js_invoke_function_2(j_calls->peer_disconnected_meth, (uint32_t)their_node_id_arr, (uint32_t)no_connection_possible);
7286 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
7287 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7288 int8_tArray their_node_id_arr = init_int8_tArray(33);
7289 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7290 LDKInit msg_var = *msg;
7291 uint64_t msg_ref = 0;
7292 msg_var = Init_clone(msg);
7293 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7294 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7295 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7296 msg_ref = (uint64_t)msg_var.inner;
7297 if (msg_var.is_owned) {
7300 js_invoke_function_2(j_calls->peer_connected_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7302 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
7303 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7304 int8_tArray their_node_id_arr = init_int8_tArray(33);
7305 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7306 LDKChannelReestablish msg_var = *msg;
7307 uint64_t msg_ref = 0;
7308 msg_var = ChannelReestablish_clone(msg);
7309 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7310 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7311 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7312 msg_ref = (uint64_t)msg_var.inner;
7313 if (msg_var.is_owned) {
7316 js_invoke_function_2(j_calls->handle_channel_reestablish_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7318 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
7319 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7320 int8_tArray their_node_id_arr = init_int8_tArray(33);
7321 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7322 LDKChannelUpdate msg_var = *msg;
7323 uint64_t msg_ref = 0;
7324 msg_var = ChannelUpdate_clone(msg);
7325 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7326 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7327 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7328 msg_ref = (uint64_t)msg_var.inner;
7329 if (msg_var.is_owned) {
7332 js_invoke_function_2(j_calls->handle_channel_update_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7334 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
7335 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7336 int8_tArray their_node_id_arr = init_int8_tArray(33);
7337 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7338 LDKErrorMessage msg_var = *msg;
7339 uint64_t msg_ref = 0;
7340 msg_var = ErrorMessage_clone(msg);
7341 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7342 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7343 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7344 msg_ref = (uint64_t)msg_var.inner;
7345 if (msg_var.is_owned) {
7348 js_invoke_function_2(j_calls->handle_error_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7350 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
7351 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
7352 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7353 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
7355 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
7356 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
7357 atomic_init(&calls->refcnt, 1);
7358 //TODO: Assign calls->o from o
7360 LDKChannelMessageHandler ret = {
7361 .this_arg = (void*) calls,
7362 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
7363 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
7364 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
7365 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
7366 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
7367 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
7368 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
7369 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
7370 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
7371 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
7372 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
7373 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
7374 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
7375 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
7376 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
7377 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
7378 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
7379 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
7380 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
7381 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
7382 .free = LDKChannelMessageHandler_JCalls_free,
7383 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
7385 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
7388 long __attribute__((visibility("default"))) TS_LDKChannelMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
7389 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
7390 *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
7391 return (long)res_ptr;
7393 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) {
7394 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7395 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7396 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7397 LDKPublicKey their_node_id_ref;
7398 CHECK(their_node_id->arr_len == 33);
7399 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7400 LDKInitFeatures their_features_conv;
7401 their_features_conv.inner = (void*)(their_features & (~1));
7402 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
7403 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
7404 their_features_conv = InitFeatures_clone(&their_features_conv);
7405 LDKOpenChannel msg_conv;
7406 msg_conv.inner = (void*)(msg & (~1));
7407 msg_conv.is_owned = false;
7408 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7409 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
7412 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) {
7413 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7414 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7415 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7416 LDKPublicKey their_node_id_ref;
7417 CHECK(their_node_id->arr_len == 33);
7418 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7419 LDKInitFeatures their_features_conv;
7420 their_features_conv.inner = (void*)(their_features & (~1));
7421 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
7422 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
7423 their_features_conv = InitFeatures_clone(&their_features_conv);
7424 LDKAcceptChannel msg_conv;
7425 msg_conv.inner = (void*)(msg & (~1));
7426 msg_conv.is_owned = false;
7427 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7428 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
7431 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_created(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7432 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7433 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7434 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7435 LDKPublicKey their_node_id_ref;
7436 CHECK(their_node_id->arr_len == 33);
7437 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7438 LDKFundingCreated msg_conv;
7439 msg_conv.inner = (void*)(msg & (~1));
7440 msg_conv.is_owned = false;
7441 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7442 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7445 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7446 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7447 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7448 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7449 LDKPublicKey their_node_id_ref;
7450 CHECK(their_node_id->arr_len == 33);
7451 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7452 LDKFundingSigned msg_conv;
7453 msg_conv.inner = (void*)(msg & (~1));
7454 msg_conv.is_owned = false;
7455 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7456 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7459 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_locked(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7460 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7461 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7462 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7463 LDKPublicKey their_node_id_ref;
7464 CHECK(their_node_id->arr_len == 33);
7465 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7466 LDKFundingLocked msg_conv;
7467 msg_conv.inner = (void*)(msg & (~1));
7468 msg_conv.is_owned = false;
7469 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7470 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7473 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_shutdown(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
7474 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7475 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7476 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7477 LDKPublicKey their_node_id_ref;
7478 CHECK(their_node_id->arr_len == 33);
7479 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7480 LDKInitFeatures their_features_conv;
7481 their_features_conv.inner = (void*)(their_features & (~1));
7482 their_features_conv.is_owned = false;
7483 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
7484 LDKShutdown msg_conv;
7485 msg_conv.inner = (void*)(msg & (~1));
7486 msg_conv.is_owned = false;
7487 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7488 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
7491 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_closing_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7492 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7493 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7494 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7495 LDKPublicKey their_node_id_ref;
7496 CHECK(their_node_id->arr_len == 33);
7497 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7498 LDKClosingSigned msg_conv;
7499 msg_conv.inner = (void*)(msg & (~1));
7500 msg_conv.is_owned = false;
7501 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7502 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7505 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_add_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7506 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7507 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7508 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7509 LDKPublicKey their_node_id_ref;
7510 CHECK(their_node_id->arr_len == 33);
7511 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7512 LDKUpdateAddHTLC msg_conv;
7513 msg_conv.inner = (void*)(msg & (~1));
7514 msg_conv.is_owned = false;
7515 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7516 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7519 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fulfill_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7520 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7521 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7522 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7523 LDKPublicKey their_node_id_ref;
7524 CHECK(their_node_id->arr_len == 33);
7525 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7526 LDKUpdateFulfillHTLC msg_conv;
7527 msg_conv.inner = (void*)(msg & (~1));
7528 msg_conv.is_owned = false;
7529 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7530 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7533 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7534 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7535 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7536 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7537 LDKPublicKey their_node_id_ref;
7538 CHECK(their_node_id->arr_len == 33);
7539 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7540 LDKUpdateFailHTLC msg_conv;
7541 msg_conv.inner = (void*)(msg & (~1));
7542 msg_conv.is_owned = false;
7543 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7544 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7547 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_malformed_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7548 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7549 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7550 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7551 LDKPublicKey their_node_id_ref;
7552 CHECK(their_node_id->arr_len == 33);
7553 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7554 LDKUpdateFailMalformedHTLC msg_conv;
7555 msg_conv.inner = (void*)(msg & (~1));
7556 msg_conv.is_owned = false;
7557 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7558 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7561 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_commitment_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7562 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7563 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7564 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7565 LDKPublicKey their_node_id_ref;
7566 CHECK(their_node_id->arr_len == 33);
7567 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7568 LDKCommitmentSigned msg_conv;
7569 msg_conv.inner = (void*)(msg & (~1));
7570 msg_conv.is_owned = false;
7571 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7572 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7575 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_revoke_and_ack(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7576 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7577 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7578 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7579 LDKPublicKey their_node_id_ref;
7580 CHECK(their_node_id->arr_len == 33);
7581 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7582 LDKRevokeAndACK msg_conv;
7583 msg_conv.inner = (void*)(msg & (~1));
7584 msg_conv.is_owned = false;
7585 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7586 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7589 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fee(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7590 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7591 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7592 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7593 LDKPublicKey their_node_id_ref;
7594 CHECK(their_node_id->arr_len == 33);
7595 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7596 LDKUpdateFee msg_conv;
7597 msg_conv.inner = (void*)(msg & (~1));
7598 msg_conv.is_owned = false;
7599 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7600 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7603 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_announcement_signatures(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7604 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7605 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7606 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7607 LDKPublicKey their_node_id_ref;
7608 CHECK(their_node_id->arr_len == 33);
7609 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7610 LDKAnnouncementSignatures msg_conv;
7611 msg_conv.inner = (void*)(msg & (~1));
7612 msg_conv.is_owned = false;
7613 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7614 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7617 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_disconnected(uint32_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
7618 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7619 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7620 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7621 LDKPublicKey their_node_id_ref;
7622 CHECK(their_node_id->arr_len == 33);
7623 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7624 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
7627 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7628 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7629 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7630 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7631 LDKPublicKey their_node_id_ref;
7632 CHECK(their_node_id->arr_len == 33);
7633 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7635 msg_conv.inner = (void*)(msg & (~1));
7636 msg_conv.is_owned = false;
7637 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7638 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7641 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_reestablish(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7642 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7643 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7644 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7645 LDKPublicKey their_node_id_ref;
7646 CHECK(their_node_id->arr_len == 33);
7647 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7648 LDKChannelReestablish msg_conv;
7649 msg_conv.inner = (void*)(msg & (~1));
7650 msg_conv.is_owned = false;
7651 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7652 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7655 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_update(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7656 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7657 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7658 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7659 LDKPublicKey their_node_id_ref;
7660 CHECK(their_node_id->arr_len == 33);
7661 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7662 LDKChannelUpdate msg_conv;
7663 msg_conv.inner = (void*)(msg & (~1));
7664 msg_conv.is_owned = false;
7665 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7666 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7669 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_error(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
7670 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7671 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7672 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
7673 LDKPublicKey their_node_id_ref;
7674 CHECK(their_node_id->arr_len == 33);
7675 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
7676 LDKErrorMessage msg_conv;
7677 msg_conv.inner = (void*)(msg & (~1));
7678 msg_conv.is_owned = false;
7679 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7680 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7683 typedef struct LDKRoutingMessageHandler_JCalls {
7684 atomic_size_t refcnt;
7685 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
7686 uint32_t handle_node_announcement_meth;
7687 uint32_t handle_channel_announcement_meth;
7688 uint32_t handle_channel_update_meth;
7689 uint32_t get_next_channel_announcements_meth;
7690 uint32_t get_next_node_announcements_meth;
7691 uint32_t sync_routing_table_meth;
7692 uint32_t handle_reply_channel_range_meth;
7693 uint32_t handle_reply_short_channel_ids_end_meth;
7694 uint32_t handle_query_channel_range_meth;
7695 uint32_t handle_query_short_channel_ids_meth;
7696 } LDKRoutingMessageHandler_JCalls;
7697 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
7698 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7699 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7700 js_free_function_ptr(j_calls->handle_node_announcement_meth);
7701 js_free_function_ptr(j_calls->handle_channel_announcement_meth);
7702 js_free_function_ptr(j_calls->handle_channel_update_meth);
7703 js_free_function_ptr(j_calls->get_next_channel_announcements_meth);
7704 js_free_function_ptr(j_calls->get_next_node_announcements_meth);
7705 js_free_function_ptr(j_calls->sync_routing_table_meth);
7706 js_free_function_ptr(j_calls->handle_reply_channel_range_meth);
7707 js_free_function_ptr(j_calls->handle_reply_short_channel_ids_end_meth);
7708 js_free_function_ptr(j_calls->handle_query_channel_range_meth);
7709 js_free_function_ptr(j_calls->handle_query_short_channel_ids_meth);
7713 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
7714 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7715 LDKNodeAnnouncement msg_var = *msg;
7716 uint64_t msg_ref = 0;
7717 msg_var = NodeAnnouncement_clone(msg);
7718 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7719 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7720 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7721 msg_ref = (uint64_t)msg_var.inner;
7722 if (msg_var.is_owned) {
7725 uint32_t ret = js_invoke_function_1(j_calls->handle_node_announcement_meth, (uint32_t)msg_ref);
7726 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7727 CHECK_ACCESS(ret_ptr);
7728 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
7732 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
7733 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7734 LDKChannelAnnouncement msg_var = *msg;
7735 uint64_t msg_ref = 0;
7736 msg_var = ChannelAnnouncement_clone(msg);
7737 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7738 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7739 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7740 msg_ref = (uint64_t)msg_var.inner;
7741 if (msg_var.is_owned) {
7744 uint32_t ret = js_invoke_function_1(j_calls->handle_channel_announcement_meth, (uint32_t)msg_ref);
7745 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7746 CHECK_ACCESS(ret_ptr);
7747 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
7751 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
7752 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7753 LDKChannelUpdate msg_var = *msg;
7754 uint64_t msg_ref = 0;
7755 msg_var = ChannelUpdate_clone(msg);
7756 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7757 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7758 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7759 msg_ref = (uint64_t)msg_var.inner;
7760 if (msg_var.is_owned) {
7763 uint32_t ret = js_invoke_function_1(j_calls->handle_channel_update_meth, (uint32_t)msg_ref);
7764 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7765 CHECK_ACCESS(ret_ptr);
7766 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
7770 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
7771 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7772 uint32_tArray ret = (uint32_tArray)js_invoke_function_2(j_calls->get_next_channel_announcements_meth, (uint32_t)starting_point, (uint32_t)batch_amount);
7773 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
7774 ret_constr.datalen = ret->arr_len;
7775 if (ret_constr.datalen > 0)
7776 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
7778 ret_constr.data = NULL;
7779 uint32_t* ret_vals = ret->elems;
7780 for (size_t h = 0; h < ret_constr.datalen; h++) {
7781 uint32_t ret_conv_59 = ret_vals[h];
7782 void* ret_conv_59_ptr = (void*)(((uint64_t)ret_conv_59) & ~1);
7783 CHECK_ACCESS(ret_conv_59_ptr);
7784 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ret_conv_59_ptr);
7785 FREE((void*)ret_conv_59);
7786 ret_constr.data[h] = ret_conv_59_conv;
7790 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
7791 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7792 int8_tArray starting_point_arr = init_int8_tArray(33);
7793 memcpy(starting_point_arr->elems, starting_point.compressed_form, 33);
7794 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);
7795 LDKCVec_NodeAnnouncementZ ret_constr;
7796 ret_constr.datalen = ret->arr_len;
7797 if (ret_constr.datalen > 0)
7798 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
7800 ret_constr.data = NULL;
7801 uint32_t* ret_vals = ret->elems;
7802 for (size_t s = 0; s < ret_constr.datalen; s++) {
7803 uint32_t ret_conv_18 = ret_vals[s];
7804 LDKNodeAnnouncement ret_conv_18_conv;
7805 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
7806 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
7807 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_conv);
7808 ret_constr.data[s] = ret_conv_18_conv;
7812 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
7813 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7814 int8_tArray their_node_id_arr = init_int8_tArray(33);
7815 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7816 LDKInit init_var = *init;
7817 uint64_t init_ref = 0;
7818 init_var = Init_clone(init);
7819 CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7820 CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7821 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
7822 init_ref = (uint64_t)init_var.inner;
7823 if (init_var.is_owned) {
7826 js_invoke_function_2(j_calls->sync_routing_table_meth, (uint32_t)their_node_id_arr, (uint32_t)init_ref);
7828 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
7829 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7830 int8_tArray their_node_id_arr = init_int8_tArray(33);
7831 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7832 LDKReplyChannelRange msg_var = msg;
7833 uint64_t msg_ref = 0;
7834 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7835 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7836 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7837 msg_ref = (uint64_t)msg_var.inner;
7838 if (msg_var.is_owned) {
7841 uint32_t ret = js_invoke_function_2(j_calls->handle_reply_channel_range_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7842 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7843 CHECK_ACCESS(ret_ptr);
7844 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
7848 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
7849 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7850 int8_tArray their_node_id_arr = init_int8_tArray(33);
7851 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7852 LDKReplyShortChannelIdsEnd msg_var = msg;
7853 uint64_t msg_ref = 0;
7854 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7855 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7856 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7857 msg_ref = (uint64_t)msg_var.inner;
7858 if (msg_var.is_owned) {
7861 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);
7862 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7863 CHECK_ACCESS(ret_ptr);
7864 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
7868 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
7869 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7870 int8_tArray their_node_id_arr = init_int8_tArray(33);
7871 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7872 LDKQueryChannelRange msg_var = msg;
7873 uint64_t msg_ref = 0;
7874 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7875 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7876 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7877 msg_ref = (uint64_t)msg_var.inner;
7878 if (msg_var.is_owned) {
7881 uint32_t ret = js_invoke_function_2(j_calls->handle_query_channel_range_meth, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
7882 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7883 CHECK_ACCESS(ret_ptr);
7884 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
7888 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
7889 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7890 int8_tArray their_node_id_arr = init_int8_tArray(33);
7891 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
7892 LDKQueryShortChannelIds msg_var = msg;
7893 uint64_t msg_ref = 0;
7894 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7895 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7896 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7897 msg_ref = (uint64_t)msg_var.inner;
7898 if (msg_var.is_owned) {
7901 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);
7902 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
7903 CHECK_ACCESS(ret_ptr);
7904 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
7908 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
7909 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
7910 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7911 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
7913 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
7914 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
7915 atomic_init(&calls->refcnt, 1);
7916 //TODO: Assign calls->o from o
7918 LDKRoutingMessageHandler ret = {
7919 .this_arg = (void*) calls,
7920 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
7921 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
7922 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
7923 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
7924 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
7925 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
7926 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
7927 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
7928 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
7929 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
7930 .free = LDKRoutingMessageHandler_JCalls_free,
7931 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
7933 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
7936 long __attribute__((visibility("default"))) TS_LDKRoutingMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
7937 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
7938 *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
7939 return (long)res_ptr;
7941 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_node_announcement(uint32_t this_arg, uint32_t msg) {
7942 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7943 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7944 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7945 LDKNodeAnnouncement msg_conv;
7946 msg_conv.inner = (void*)(msg & (~1));
7947 msg_conv.is_owned = false;
7948 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7949 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
7950 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
7951 return (uint64_t)ret_conv;
7954 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_announcement(uint32_t this_arg, uint32_t msg) {
7955 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7956 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7957 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7958 LDKChannelAnnouncement msg_conv;
7959 msg_conv.inner = (void*)(msg & (~1));
7960 msg_conv.is_owned = false;
7961 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7962 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
7963 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
7964 return (uint64_t)ret_conv;
7967 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_update(uint32_t this_arg, uint32_t msg) {
7968 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7969 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7970 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7971 LDKChannelUpdate msg_conv;
7972 msg_conv.inner = (void*)(msg & (~1));
7973 msg_conv.is_owned = false;
7974 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
7975 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
7976 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
7977 return (uint64_t)ret_conv;
7980 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_channel_announcements(uint32_t this_arg, int64_t starting_point, int8_t batch_amount) {
7981 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
7982 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7983 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
7984 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
7985 uint32_tArray ret_arr = NULL;
7986 ret_arr = init_uint32_tArray(ret_var.datalen);
7987 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
7988 for (size_t h = 0; h < ret_var.datalen; h++) {
7989 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
7990 *ret_conv_59_conv = ret_var.data[h];
7991 ret_arr_ptr[h] = ((uint64_t)ret_conv_59_conv);
7998 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_node_announcements(uint32_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
7999 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8000 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8001 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
8002 LDKPublicKey starting_point_ref;
8003 CHECK(starting_point->arr_len == 33);
8004 memcpy(starting_point_ref.compressed_form, starting_point->elems, 33);
8005 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
8006 uint32_tArray ret_arr = NULL;
8007 ret_arr = init_uint32_tArray(ret_var.datalen);
8008 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
8009 for (size_t s = 0; s < ret_var.datalen; s++) {
8010 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
8011 uint64_t ret_conv_18_ref = 0;
8012 CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8013 CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8014 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_var);
8015 ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
8016 if (ret_conv_18_var.is_owned) {
8017 ret_conv_18_ref |= 1;
8019 ret_arr_ptr[s] = ret_conv_18_ref;
8026 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_sync_routing_table(uint32_t this_arg, int8_tArray their_node_id, uint32_t init) {
8027 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8028 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8029 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
8030 LDKPublicKey their_node_id_ref;
8031 CHECK(their_node_id->arr_len == 33);
8032 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
8034 init_conv.inner = (void*)(init & (~1));
8035 init_conv.is_owned = false;
8036 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
8037 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
8040 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_reply_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
8041 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8042 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8043 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
8044 LDKPublicKey their_node_id_ref;
8045 CHECK(their_node_id->arr_len == 33);
8046 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
8047 LDKReplyChannelRange msg_conv;
8048 msg_conv.inner = (void*)(msg & (~1));
8049 msg_conv.is_owned = (msg & 1) || (msg == 0);
8050 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8051 msg_conv = ReplyChannelRange_clone(&msg_conv);
8052 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8053 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8054 return (uint64_t)ret_conv;
8057 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) {
8058 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8059 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8060 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
8061 LDKPublicKey their_node_id_ref;
8062 CHECK(their_node_id->arr_len == 33);
8063 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
8064 LDKReplyShortChannelIdsEnd msg_conv;
8065 msg_conv.inner = (void*)(msg & (~1));
8066 msg_conv.is_owned = (msg & 1) || (msg == 0);
8067 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8068 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
8069 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8070 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8071 return (uint64_t)ret_conv;
8074 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
8075 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8076 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8077 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
8078 LDKPublicKey their_node_id_ref;
8079 CHECK(their_node_id->arr_len == 33);
8080 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
8081 LDKQueryChannelRange msg_conv;
8082 msg_conv.inner = (void*)(msg & (~1));
8083 msg_conv.is_owned = (msg & 1) || (msg == 0);
8084 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8085 msg_conv = QueryChannelRange_clone(&msg_conv);
8086 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8087 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8088 return (uint64_t)ret_conv;
8091 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_short_channel_ids(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
8092 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8093 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8094 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
8095 LDKPublicKey their_node_id_ref;
8096 CHECK(their_node_id->arr_len == 33);
8097 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
8098 LDKQueryShortChannelIds msg_conv;
8099 msg_conv.inner = (void*)(msg & (~1));
8100 msg_conv.is_owned = (msg & 1) || (msg == 0);
8101 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8102 msg_conv = QueryShortChannelIds_clone(&msg_conv);
8103 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8104 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8105 return (uint64_t)ret_conv;
8108 typedef struct LDKCustomMessageReader_JCalls {
8109 atomic_size_t refcnt;
8111 } LDKCustomMessageReader_JCalls;
8112 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
8113 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
8114 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8115 js_free_function_ptr(j_calls->read_meth);
8119 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
8120 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
8121 LDKu8slice buffer_var = buffer;
8122 int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen);
8123 memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
8124 uint32_t ret = js_invoke_function_2(j_calls->read_meth, (uint32_t)message_type, (uint32_t)buffer_arr);
8125 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8126 CHECK_ACCESS(ret_ptr);
8127 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
8131 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
8132 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
8133 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8135 static inline LDKCustomMessageReader LDKCustomMessageReader_init (/*TODO: JS Object Reference */void* o) {
8136 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
8137 atomic_init(&calls->refcnt, 1);
8138 //TODO: Assign calls->o from o
8140 LDKCustomMessageReader ret = {
8141 .this_arg = (void*) calls,
8142 .read = read_LDKCustomMessageReader_jcall,
8143 .free = LDKCustomMessageReader_JCalls_free,
8147 long __attribute__((visibility("default"))) TS_LDKCustomMessageReader_new(/*TODO: JS Object Reference */void* o) {
8148 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
8149 *res_ptr = LDKCustomMessageReader_init(o);
8150 return (long)res_ptr;
8152 uint32_t __attribute__((visibility("default"))) TS_CustomMessageReader_read(uint32_t this_arg, int16_t message_type, int8_tArray buffer) {
8153 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8154 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8155 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
8156 LDKu8slice buffer_ref;
8157 buffer_ref.datalen = buffer->arr_len;
8158 buffer_ref.data = buffer->elems;
8159 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
8160 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
8161 return (uint64_t)ret_conv;
8164 typedef struct LDKCustomMessageHandler_JCalls {
8165 atomic_size_t refcnt;
8166 LDKCustomMessageReader_JCalls* CustomMessageReader;
8167 uint32_t handle_custom_message_meth;
8168 uint32_t get_and_clear_pending_msg_meth;
8169 } LDKCustomMessageHandler_JCalls;
8170 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
8171 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
8172 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8173 js_free_function_ptr(j_calls->handle_custom_message_meth);
8174 js_free_function_ptr(j_calls->get_and_clear_pending_msg_meth);
8178 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
8179 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
8180 LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
8182 int8_tArray sender_node_id_arr = init_int8_tArray(33);
8183 memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
8184 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);
8185 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8186 CHECK_ACCESS(ret_ptr);
8187 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
8191 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
8192 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
8193 uint32_tArray ret = (uint32_tArray)js_invoke_function_0(j_calls->get_and_clear_pending_msg_meth);
8194 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
8195 ret_constr.datalen = ret->arr_len;
8196 if (ret_constr.datalen > 0)
8197 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
8199 ret_constr.data = NULL;
8200 uint32_t* ret_vals = ret->elems;
8201 for (size_t z = 0; z < ret_constr.datalen; z++) {
8202 uint32_t ret_conv_25 = ret_vals[z];
8203 void* ret_conv_25_ptr = (void*)(((uint64_t)ret_conv_25) & ~1);
8204 CHECK_ACCESS(ret_conv_25_ptr);
8205 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
8206 FREE((void*)ret_conv_25);
8207 ret_constr.data[z] = ret_conv_25_conv;
8211 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
8212 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
8213 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8214 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
8216 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* CustomMessageReader) {
8217 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
8218 atomic_init(&calls->refcnt, 1);
8219 //TODO: Assign calls->o from o
8221 LDKCustomMessageHandler ret = {
8222 .this_arg = (void*) calls,
8223 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
8224 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
8225 .free = LDKCustomMessageHandler_JCalls_free,
8226 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
8228 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
8231 long __attribute__((visibility("default"))) TS_LDKCustomMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* CustomMessageReader) {
8232 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
8233 *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
8234 return (long)res_ptr;
8236 uint32_t __attribute__((visibility("default"))) TS_CustomMessageHandler_handle_custom_message(uint32_t this_arg, uint32_t msg, int8_tArray sender_node_id) {
8237 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8238 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8239 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
8240 void* msg_ptr = (void*)(((uint64_t)msg) & ~1);
8241 CHECK_ACCESS(msg_ptr);
8242 LDKType msg_conv = *(LDKType*)(msg_ptr);
8243 LDKPublicKey sender_node_id_ref;
8244 CHECK(sender_node_id->arr_len == 33);
8245 memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33);
8246 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8247 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
8248 return (uint64_t)ret_conv;
8251 uint32_tArray __attribute__((visibility("default"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint32_t this_arg) {
8252 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8253 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8254 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
8255 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
8256 uint32_tArray ret_arr = NULL;
8257 ret_arr = init_uint32_tArray(ret_var.datalen);
8258 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
8259 for (size_t z = 0; z < ret_var.datalen; z++) {
8260 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
8261 *ret_conv_25_conv = ret_var.data[z];
8262 ret_arr_ptr[z] = ((uint64_t)ret_conv_25_conv);
8269 typedef struct LDKSocketDescriptor_JCalls {
8270 atomic_size_t refcnt;
8271 uint32_t send_data_meth;
8272 uint32_t disconnect_socket_meth;
8275 } LDKSocketDescriptor_JCalls;
8276 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
8277 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8278 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8279 js_free_function_ptr(j_calls->send_data_meth);
8280 js_free_function_ptr(j_calls->disconnect_socket_meth);
8281 js_free_function_ptr(j_calls->eq_meth);
8282 js_free_function_ptr(j_calls->hash_meth);
8286 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
8287 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8288 LDKu8slice data_var = data;
8289 int8_tArray data_arr = init_int8_tArray(data_var.datalen);
8290 memcpy(data_arr->elems, data_var.data, data_var.datalen);
8291 return js_invoke_function_2(j_calls->send_data_meth, (uint32_t)data_arr, (uint32_t)resume_read);
8293 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
8294 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8295 js_invoke_function_0(j_calls->disconnect_socket_meth);
8297 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
8298 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8299 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
8300 *other_arg_clone = SocketDescriptor_clone(other_arg);
8301 return js_invoke_function_1(j_calls->eq_meth, (uint32_t)(uint64_t)other_arg_clone);
8303 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
8304 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8305 return js_invoke_function_0(j_calls->hash_meth);
8307 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
8308 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
8309 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8311 static inline LDKSocketDescriptor LDKSocketDescriptor_init (/*TODO: JS Object Reference */void* o) {
8312 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
8313 atomic_init(&calls->refcnt, 1);
8314 //TODO: Assign calls->o from o
8316 LDKSocketDescriptor ret = {
8317 .this_arg = (void*) calls,
8318 .send_data = send_data_LDKSocketDescriptor_jcall,
8319 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
8320 .eq = eq_LDKSocketDescriptor_jcall,
8321 .hash = hash_LDKSocketDescriptor_jcall,
8322 .cloned = LDKSocketDescriptor_JCalls_cloned,
8323 .free = LDKSocketDescriptor_JCalls_free,
8327 long __attribute__((visibility("default"))) TS_LDKSocketDescriptor_new(/*TODO: JS Object Reference */void* o) {
8328 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
8329 *res_ptr = LDKSocketDescriptor_init(o);
8330 return (long)res_ptr;
8332 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_send_data(uint32_t this_arg, int8_tArray data, jboolean resume_read) {
8333 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8334 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8335 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
8336 LDKu8slice data_ref;
8337 data_ref.datalen = data->arr_len;
8338 data_ref.data = data->elems;
8339 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
8343 void __attribute__((visibility("default"))) TS_SocketDescriptor_disconnect_socket(uint32_t this_arg) {
8344 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8345 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8346 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
8347 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
8350 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_hash(uint32_t this_arg) {
8351 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8352 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8353 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
8354 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
8358 typedef struct LDKScore_JCalls {
8359 atomic_size_t refcnt;
8360 uint32_t channel_penalty_msat_meth;
8361 uint32_t payment_path_failed_meth;
8362 uint32_t payment_path_successful_meth;
8363 uint32_t write_meth;
8365 static void LDKScore_JCalls_free(void* this_arg) {
8366 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8367 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8368 js_free_function_ptr(j_calls->channel_penalty_msat_meth);
8369 js_free_function_ptr(j_calls->payment_path_failed_meth);
8370 js_free_function_ptr(j_calls->payment_path_successful_meth);
8371 js_free_function_ptr(j_calls->write_meth);
8375 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) {
8376 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8377 LDKCOption_u64Z *channel_capacity_msat_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
8378 *channel_capacity_msat_copy = channel_capacity_msat;
8379 uint64_t channel_capacity_msat_ref = (uint64_t)channel_capacity_msat_copy;
8380 LDKNodeId source_var = *source;
8381 uint64_t source_ref = 0;
8382 source_var = NodeId_clone(source);
8383 CHECK((((uint64_t)source_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8384 CHECK((((uint64_t)&source_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8385 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
8386 source_ref = (uint64_t)source_var.inner;
8387 if (source_var.is_owned) {
8390 LDKNodeId target_var = *target;
8391 uint64_t target_ref = 0;
8392 target_var = NodeId_clone(target);
8393 CHECK((((uint64_t)target_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8394 CHECK((((uint64_t)&target_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8395 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
8396 target_ref = (uint64_t)target_var.inner;
8397 if (target_var.is_owned) {
8400 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);
8402 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
8403 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8404 LDKCVec_RouteHopZ path_var = path;
8405 uint32_tArray path_arr = NULL;
8406 path_arr = init_uint32_tArray(path_var.datalen);
8407 uint32_t *path_arr_ptr = (uint32_t*)(path_arr + 4);
8408 for (size_t k = 0; k < path_var.datalen; k++) {
8409 LDKRouteHop path_conv_10_var = path_var.data[k];
8410 uint64_t path_conv_10_ref = 0;
8411 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8412 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8413 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8414 path_conv_10_ref = (uint64_t)path_conv_10_var.inner;
8415 if (path_conv_10_var.is_owned) {
8416 path_conv_10_ref |= 1;
8418 path_arr_ptr[k] = path_conv_10_ref;
8421 FREE(path_var.data);
8422 js_invoke_function_2(j_calls->payment_path_failed_meth, (uint32_t)path_arr, (uint32_t)short_channel_id);
8424 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
8425 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8426 LDKCVec_RouteHopZ path_var = path;
8427 uint32_tArray path_arr = NULL;
8428 path_arr = init_uint32_tArray(path_var.datalen);
8429 uint32_t *path_arr_ptr = (uint32_t*)(path_arr + 4);
8430 for (size_t k = 0; k < path_var.datalen; k++) {
8431 LDKRouteHop path_conv_10_var = path_var.data[k];
8432 uint64_t path_conv_10_ref = 0;
8433 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8434 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8435 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8436 path_conv_10_ref = (uint64_t)path_conv_10_var.inner;
8437 if (path_conv_10_var.is_owned) {
8438 path_conv_10_ref |= 1;
8440 path_arr_ptr[k] = path_conv_10_ref;
8443 FREE(path_var.data);
8444 js_invoke_function_1(j_calls->payment_path_successful_meth, (uint32_t)path_arr);
8446 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
8447 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8448 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->write_meth);
8449 LDKCVec_u8Z ret_ref;
8450 ret_ref.datalen = ret->arr_len;
8451 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8452 memcpy(ret_ref.data, ret->elems, ret_ref.datalen);
8455 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
8456 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
8457 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8459 static inline LDKScore LDKScore_init (/*TODO: JS Object Reference */void* o) {
8460 LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
8461 atomic_init(&calls->refcnt, 1);
8462 //TODO: Assign calls->o from o
8465 .this_arg = (void*) calls,
8466 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
8467 .payment_path_failed = payment_path_failed_LDKScore_jcall,
8468 .payment_path_successful = payment_path_successful_LDKScore_jcall,
8469 .write = write_LDKScore_jcall,
8470 .free = LDKScore_JCalls_free,
8474 long __attribute__((visibility("default"))) TS_LDKScore_new(/*TODO: JS Object Reference */void* o) {
8475 LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
8476 *res_ptr = LDKScore_init(o);
8477 return (long)res_ptr;
8479 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) {
8480 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8481 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8482 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8483 void* channel_capacity_msat_ptr = (void*)(((uint64_t)channel_capacity_msat) & ~1);
8484 CHECK_ACCESS(channel_capacity_msat_ptr);
8485 LDKCOption_u64Z channel_capacity_msat_conv = *(LDKCOption_u64Z*)(channel_capacity_msat_ptr);
8486 channel_capacity_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)channel_capacity_msat) & ~1));
8487 LDKNodeId source_conv;
8488 source_conv.inner = (void*)(source & (~1));
8489 source_conv.is_owned = false;
8490 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
8491 LDKNodeId target_conv;
8492 target_conv.inner = (void*)(target & (~1));
8493 target_conv.is_owned = false;
8494 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
8495 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);
8499 void __attribute__((visibility("default"))) TS_Score_payment_path_failed(uint32_t this_arg, uint32_tArray path, int64_t short_channel_id) {
8500 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8501 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8502 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8503 LDKCVec_RouteHopZ path_constr;
8504 path_constr.datalen = path->arr_len;
8505 if (path_constr.datalen > 0)
8506 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8508 path_constr.data = NULL;
8509 uint32_t* path_vals = path->elems;
8510 for (size_t k = 0; k < path_constr.datalen; k++) {
8511 uint32_t path_conv_10 = path_vals[k];
8512 LDKRouteHop path_conv_10_conv;
8513 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
8514 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
8515 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8516 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8517 path_constr.data[k] = path_conv_10_conv;
8519 (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
8522 void __attribute__((visibility("default"))) TS_Score_payment_path_successful(uint32_t this_arg, uint32_tArray path) {
8523 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8524 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8525 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8526 LDKCVec_RouteHopZ path_constr;
8527 path_constr.datalen = path->arr_len;
8528 if (path_constr.datalen > 0)
8529 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8531 path_constr.data = NULL;
8532 uint32_t* path_vals = path->elems;
8533 for (size_t k = 0; k < path_constr.datalen; k++) {
8534 uint32_t path_conv_10 = path_vals[k];
8535 LDKRouteHop path_conv_10_conv;
8536 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
8537 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
8538 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8539 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8540 path_constr.data[k] = path_conv_10_conv;
8542 (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
8545 int8_tArray __attribute__((visibility("default"))) TS_Score_write(uint32_t this_arg) {
8546 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8547 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8548 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8549 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8550 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
8551 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8552 CVec_u8Z_free(ret_var);
8556 typedef struct LDKLockableScore_JCalls {
8557 atomic_size_t refcnt;
8559 } LDKLockableScore_JCalls;
8560 static void LDKLockableScore_JCalls_free(void* this_arg) {
8561 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
8562 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8563 js_free_function_ptr(j_calls->lock_meth);
8567 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
8568 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
8569 uint32_t ret = js_invoke_function_0(j_calls->lock_meth);
8570 void* ret_ptr = (void*)(((uint64_t)ret) & ~1);
8571 CHECK_ACCESS(ret_ptr);
8572 LDKScore ret_conv = *(LDKScore*)(ret_ptr);// Warning: we may need a move here but no clone is available for LDKScore
8576 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
8577 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
8578 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8580 static inline LDKLockableScore LDKLockableScore_init (/*TODO: JS Object Reference */void* o) {
8581 LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
8582 atomic_init(&calls->refcnt, 1);
8583 //TODO: Assign calls->o from o
8585 LDKLockableScore ret = {
8586 .this_arg = (void*) calls,
8587 .lock = lock_LDKLockableScore_jcall,
8588 .free = LDKLockableScore_JCalls_free,
8592 long __attribute__((visibility("default"))) TS_LDKLockableScore_new(/*TODO: JS Object Reference */void* o) {
8593 LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
8594 *res_ptr = LDKLockableScore_init(o);
8595 return (long)res_ptr;
8597 uint32_t __attribute__((visibility("default"))) TS_LockableScore_lock(uint32_t this_arg) {
8598 void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1);
8599 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8600 LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
8601 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
8602 *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
8603 return (uint64_t)ret_ret;
8606 jstring __attribute__((visibility("default"))) TS__ldk_get_compiled_version() {
8607 LDKStr ret_str = _ldk_get_compiled_version();
8608 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
8613 jstring __attribute__((visibility("default"))) TS__ldk_c_bindings_get_compiled_version() {
8614 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
8615 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
8620 void __attribute__((visibility("default"))) TS_Transaction_free(int8_tArray _res) {
8621 LDKTransaction _res_ref;
8622 _res_ref.datalen = _res->arr_len;
8623 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
8624 memcpy(_res_ref.data, _res->elems, _res_ref.datalen);
8625 _res_ref.data_is_owned = true;
8626 Transaction_free(_res_ref);
8629 uint32_t __attribute__((visibility("default"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
8630 LDKCVec_u8Z script_pubkey_ref;
8631 script_pubkey_ref.datalen = script_pubkey->arr_len;
8632 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
8633 memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen);
8634 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8635 *ret_ref = TxOut_new(script_pubkey_ref, value);
8636 return (uint64_t)ret_ref;
8639 void __attribute__((visibility("default"))) TS_TxOut_free(uint32_t _res) {
8640 if ((_res & 1) != 0) return;
8641 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8642 CHECK_ACCESS(_res_ptr);
8643 LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
8645 TxOut_free(_res_conv);
8648 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
8649 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8650 *ret_ref = TxOut_clone(arg);
8651 return (uint64_t)ret_ref;
8653 int64_t __attribute__((visibility("default"))) TS_TxOut_clone_ptr(uint32_t arg) {
8654 LDKTxOut* arg_conv = (LDKTxOut*)(arg & ~1);
8655 int64_t ret_val = TxOut_clone_ptr(arg_conv);
8659 uint32_t __attribute__((visibility("default"))) TS_TxOut_clone(uint32_t orig) {
8660 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
8661 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8662 *ret_ref = TxOut_clone(orig_conv);
8663 return (uint64_t)ret_ref;
8666 void __attribute__((visibility("default"))) TS_Str_free(jstring _res) {
8667 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
8671 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint32_t o) {
8672 LDKChannelConfig o_conv;
8673 o_conv.inner = (void*)(o & (~1));
8674 o_conv.is_owned = (o & 1) || (o == 0);
8675 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8676 o_conv = ChannelConfig_clone(&o_conv);
8677 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
8678 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
8679 return (uint64_t)ret_conv;
8682 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint32_t e) {
8683 LDKDecodeError e_conv;
8684 e_conv.inner = (void*)(e & (~1));
8685 e_conv.is_owned = (e & 1) || (e == 0);
8686 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8687 e_conv = DecodeError_clone(&e_conv);
8688 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
8689 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
8690 return (uint64_t)ret_conv;
8693 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint32_t o) {
8694 LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(o & ~1);
8695 jboolean ret_val = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
8699 void __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint32_t _res) {
8700 if ((_res & 1) != 0) return;
8701 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8702 CHECK_ACCESS(_res_ptr);
8703 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
8705 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
8708 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
8709 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
8710 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
8711 return (uint64_t)ret_conv;
8713 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint32_t arg) {
8714 LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
8715 int64_t ret_val = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
8719 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint32_t orig) {
8720 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
8721 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
8722 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
8723 return (uint64_t)ret_conv;
8726 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_ok(uint32_t o) {
8728 o_conv.inner = (void*)(o & (~1));
8729 o_conv.is_owned = (o & 1) || (o == 0);
8730 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8731 o_conv = OutPoint_clone(&o_conv);
8732 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
8733 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
8734 return (uint64_t)ret_conv;
8737 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_err(uint32_t e) {
8738 LDKDecodeError e_conv;
8739 e_conv.inner = (void*)(e & (~1));
8740 e_conv.is_owned = (e & 1) || (e == 0);
8741 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8742 e_conv = DecodeError_clone(&e_conv);
8743 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
8744 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
8745 return (uint64_t)ret_conv;
8748 jboolean __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint32_t o) {
8749 LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)(o & ~1);
8750 jboolean ret_val = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
8754 void __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_free(uint32_t _res) {
8755 if ((_res & 1) != 0) return;
8756 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8757 CHECK_ACCESS(_res_ptr);
8758 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
8760 CResult_OutPointDecodeErrorZ_free(_res_conv);
8763 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
8764 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
8765 *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
8766 return (uint64_t)ret_conv;
8768 int64_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint32_t arg) {
8769 LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
8770 int64_t ret_val = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
8774 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_clone(uint32_t orig) {
8775 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
8776 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
8777 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
8778 return (uint64_t)ret_conv;
8781 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
8783 CHECK(o->arr_len == 32);
8784 memcpy(o_ref.bytes, o->elems, 32);
8785 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
8786 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
8787 return (uint64_t)ret_conv;
8790 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
8791 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
8792 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
8793 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
8794 return (uint64_t)ret_conv;
8797 jboolean __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_is_ok(uint32_t o) {
8798 LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)(o & ~1);
8799 jboolean ret_val = CResult_SecretKeyErrorZ_is_ok(o_conv);
8803 void __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_free(uint32_t _res) {
8804 if ((_res & 1) != 0) return;
8805 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8806 CHECK_ACCESS(_res_ptr);
8807 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
8809 CResult_SecretKeyErrorZ_free(_res_conv);
8812 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
8814 CHECK(o->arr_len == 33);
8815 memcpy(o_ref.compressed_form, o->elems, 33);
8816 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8817 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
8818 return (uint64_t)ret_conv;
8821 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
8822 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
8823 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8824 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
8825 return (uint64_t)ret_conv;
8828 jboolean __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_is_ok(uint32_t o) {
8829 LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)(o & ~1);
8830 jboolean ret_val = CResult_PublicKeyErrorZ_is_ok(o_conv);
8834 void __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_free(uint32_t _res) {
8835 if ((_res & 1) != 0) return;
8836 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8837 CHECK_ACCESS(_res_ptr);
8838 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
8840 CResult_PublicKeyErrorZ_free(_res_conv);
8843 static inline uint64_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
8844 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8845 *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
8846 return (uint64_t)ret_conv;
8848 int64_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_clone_ptr(uint32_t arg) {
8849 LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
8850 int64_t ret_val = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
8854 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_clone(uint32_t orig) {
8855 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
8856 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8857 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
8858 return (uint64_t)ret_conv;
8861 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint32_t o) {
8862 LDKTxCreationKeys o_conv;
8863 o_conv.inner = (void*)(o & (~1));
8864 o_conv.is_owned = (o & 1) || (o == 0);
8865 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8866 o_conv = TxCreationKeys_clone(&o_conv);
8867 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8868 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
8869 return (uint64_t)ret_conv;
8872 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint32_t e) {
8873 LDKDecodeError e_conv;
8874 e_conv.inner = (void*)(e & (~1));
8875 e_conv.is_owned = (e & 1) || (e == 0);
8876 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8877 e_conv = DecodeError_clone(&e_conv);
8878 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8879 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
8880 return (uint64_t)ret_conv;
8883 jboolean __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint32_t o) {
8884 LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(o & ~1);
8885 jboolean ret_val = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
8889 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint32_t _res) {
8890 if ((_res & 1) != 0) return;
8891 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8892 CHECK_ACCESS(_res_ptr);
8893 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
8895 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
8898 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
8899 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8900 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
8901 return (uint64_t)ret_conv;
8903 int64_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint32_t arg) {
8904 LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
8905 int64_t ret_val = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
8909 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint32_t orig) {
8910 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
8911 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8912 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
8913 return (uint64_t)ret_conv;
8916 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint32_t o) {
8917 LDKChannelPublicKeys o_conv;
8918 o_conv.inner = (void*)(o & (~1));
8919 o_conv.is_owned = (o & 1) || (o == 0);
8920 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8921 o_conv = ChannelPublicKeys_clone(&o_conv);
8922 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8923 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
8924 return (uint64_t)ret_conv;
8927 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint32_t e) {
8928 LDKDecodeError e_conv;
8929 e_conv.inner = (void*)(e & (~1));
8930 e_conv.is_owned = (e & 1) || (e == 0);
8931 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
8932 e_conv = DecodeError_clone(&e_conv);
8933 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8934 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
8935 return (uint64_t)ret_conv;
8938 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint32_t o) {
8939 LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(o & ~1);
8940 jboolean ret_val = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
8944 void __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint32_t _res) {
8945 if ((_res & 1) != 0) return;
8946 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8947 CHECK_ACCESS(_res_ptr);
8948 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
8950 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
8953 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
8954 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8955 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
8956 return (uint64_t)ret_conv;
8958 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint32_t arg) {
8959 LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
8960 int64_t ret_val = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
8964 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint32_t orig) {
8965 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
8966 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8967 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
8968 return (uint64_t)ret_conv;
8971 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_ok(uint32_t o) {
8972 LDKTxCreationKeys o_conv;
8973 o_conv.inner = (void*)(o & (~1));
8974 o_conv.is_owned = (o & 1) || (o == 0);
8975 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
8976 o_conv = TxCreationKeys_clone(&o_conv);
8977 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
8978 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
8979 return (uint64_t)ret_conv;
8982 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
8983 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
8984 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
8985 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
8986 return (uint64_t)ret_conv;
8989 jboolean __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_is_ok(uint32_t o) {
8990 LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)(o & ~1);
8991 jboolean ret_val = CResult_TxCreationKeysErrorZ_is_ok(o_conv);
8995 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_free(uint32_t _res) {
8996 if ((_res & 1) != 0) return;
8997 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
8998 CHECK_ACCESS(_res_ptr);
8999 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
9001 CResult_TxCreationKeysErrorZ_free(_res_conv);
9004 static inline uint64_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) {
9005 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
9006 *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg);
9007 return (uint64_t)ret_conv;
9009 int64_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_clone_ptr(uint32_t arg) {
9010 LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
9011 int64_t ret_val = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv);
9015 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_clone(uint32_t orig) {
9016 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
9017 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
9018 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
9019 return (uint64_t)ret_conv;
9022 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_some(int32_t o) {
9023 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
9024 *ret_copy = COption_u32Z_some(o);
9025 uint64_t ret_ref = (uint64_t)ret_copy;
9029 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_none() {
9030 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
9031 *ret_copy = COption_u32Z_none();
9032 uint64_t ret_ref = (uint64_t)ret_copy;
9036 void __attribute__((visibility("default"))) TS_COption_u32Z_free(uint32_t _res) {
9037 if ((_res & 1) != 0) return;
9038 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9039 CHECK_ACCESS(_res_ptr);
9040 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
9042 COption_u32Z_free(_res_conv);
9045 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
9046 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
9047 *ret_copy = COption_u32Z_clone(arg);
9048 uint64_t ret_ref = (uint64_t)ret_copy;
9051 int64_t __attribute__((visibility("default"))) TS_COption_u32Z_clone_ptr(uint32_t arg) {
9052 LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)arg;
9053 int64_t ret_val = COption_u32Z_clone_ptr(arg_conv);
9057 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_clone(uint32_t orig) {
9058 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
9059 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
9060 *ret_copy = COption_u32Z_clone(orig_conv);
9061 uint64_t ret_ref = (uint64_t)ret_copy;
9065 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint32_t o) {
9066 LDKHTLCOutputInCommitment o_conv;
9067 o_conv.inner = (void*)(o & (~1));
9068 o_conv.is_owned = (o & 1) || (o == 0);
9069 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9070 o_conv = HTLCOutputInCommitment_clone(&o_conv);
9071 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
9072 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
9073 return (uint64_t)ret_conv;
9076 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint32_t e) {
9077 LDKDecodeError e_conv;
9078 e_conv.inner = (void*)(e & (~1));
9079 e_conv.is_owned = (e & 1) || (e == 0);
9080 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9081 e_conv = DecodeError_clone(&e_conv);
9082 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
9083 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
9084 return (uint64_t)ret_conv;
9087 jboolean __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint32_t o) {
9088 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(o & ~1);
9089 jboolean ret_val = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
9093 void __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint32_t _res) {
9094 if ((_res & 1) != 0) return;
9095 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9096 CHECK_ACCESS(_res_ptr);
9097 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
9099 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
9102 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
9103 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
9104 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
9105 return (uint64_t)ret_conv;
9107 int64_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint32_t arg) {
9108 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
9109 int64_t ret_val = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
9113 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint32_t orig) {
9114 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
9115 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
9116 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
9117 return (uint64_t)ret_conv;
9120 uint32_t __attribute__((visibility("default"))) TS_COption_NoneZ_some() {
9121 uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
9125 uint32_t __attribute__((visibility("default"))) TS_COption_NoneZ_none() {
9126 uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
9130 void __attribute__((visibility("default"))) TS_COption_NoneZ_free(uint32_t _res) {
9131 LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
9132 COption_NoneZ_free(_res_conv);
9135 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
9136 LDKCounterpartyChannelTransactionParameters o_conv;
9137 o_conv.inner = (void*)(o & (~1));
9138 o_conv.is_owned = (o & 1) || (o == 0);
9139 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9140 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
9141 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
9142 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
9143 return (uint64_t)ret_conv;
9146 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
9147 LDKDecodeError e_conv;
9148 e_conv.inner = (void*)(e & (~1));
9149 e_conv.is_owned = (e & 1) || (e == 0);
9150 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9151 e_conv = DecodeError_clone(&e_conv);
9152 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
9153 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
9154 return (uint64_t)ret_conv;
9157 jboolean __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint32_t o) {
9158 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(o & ~1);
9159 jboolean ret_val = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
9163 void __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
9164 if ((_res & 1) != 0) return;
9165 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9166 CHECK_ACCESS(_res_ptr);
9167 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
9169 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
9172 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
9173 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
9174 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
9175 return (uint64_t)ret_conv;
9177 int64_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
9178 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
9179 int64_t ret_val = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
9183 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
9184 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
9185 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
9186 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
9187 return (uint64_t)ret_conv;
9190 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
9191 LDKChannelTransactionParameters o_conv;
9192 o_conv.inner = (void*)(o & (~1));
9193 o_conv.is_owned = (o & 1) || (o == 0);
9194 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9195 o_conv = ChannelTransactionParameters_clone(&o_conv);
9196 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
9197 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
9198 return (uint64_t)ret_conv;
9201 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
9202 LDKDecodeError e_conv;
9203 e_conv.inner = (void*)(e & (~1));
9204 e_conv.is_owned = (e & 1) || (e == 0);
9205 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9206 e_conv = DecodeError_clone(&e_conv);
9207 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
9208 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
9209 return (uint64_t)ret_conv;
9212 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint32_t o) {
9213 LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(o & ~1);
9214 jboolean ret_val = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
9218 void __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
9219 if ((_res & 1) != 0) return;
9220 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9221 CHECK_ACCESS(_res_ptr);
9222 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
9224 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
9227 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
9228 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
9229 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
9230 return (uint64_t)ret_conv;
9232 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
9233 LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
9234 int64_t ret_val = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
9238 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
9239 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
9240 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
9241 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
9242 return (uint64_t)ret_conv;
9245 void __attribute__((visibility("default"))) TS_CVec_SignatureZ_free(ptrArray _res) {
9246 LDKCVec_SignatureZ _res_constr;
9247 _res_constr.datalen = _res->arr_len;
9248 if (_res_constr.datalen > 0)
9249 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9251 _res_constr.data = NULL;
9252 int8_tArray* _res_vals = (void*) _res->elems;
9253 for (size_t m = 0; m < _res_constr.datalen; m++) {
9254 int8_tArray _res_conv_12 = _res_vals[m];
9255 LDKSignature _res_conv_12_ref;
9256 CHECK(_res_conv_12->arr_len == 64);
9257 memcpy(_res_conv_12_ref.compact_form, _res_conv_12->elems, 64);
9258 _res_constr.data[m] = _res_conv_12_ref;
9260 CVec_SignatureZ_free(_res_constr);
9263 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
9264 LDKHolderCommitmentTransaction o_conv;
9265 o_conv.inner = (void*)(o & (~1));
9266 o_conv.is_owned = (o & 1) || (o == 0);
9267 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9268 o_conv = HolderCommitmentTransaction_clone(&o_conv);
9269 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
9270 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
9271 return (uint64_t)ret_conv;
9274 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
9275 LDKDecodeError e_conv;
9276 e_conv.inner = (void*)(e & (~1));
9277 e_conv.is_owned = (e & 1) || (e == 0);
9278 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9279 e_conv = DecodeError_clone(&e_conv);
9280 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
9281 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
9282 return (uint64_t)ret_conv;
9285 jboolean __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
9286 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(o & ~1);
9287 jboolean ret_val = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
9291 void __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
9292 if ((_res & 1) != 0) return;
9293 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9294 CHECK_ACCESS(_res_ptr);
9295 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
9297 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
9300 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
9301 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
9302 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
9303 return (uint64_t)ret_conv;
9305 int64_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
9306 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
9307 int64_t ret_val = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
9311 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
9312 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
9313 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
9314 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
9315 return (uint64_t)ret_conv;
9318 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
9319 LDKBuiltCommitmentTransaction o_conv;
9320 o_conv.inner = (void*)(o & (~1));
9321 o_conv.is_owned = (o & 1) || (o == 0);
9322 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9323 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
9324 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
9325 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
9326 return (uint64_t)ret_conv;
9329 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
9330 LDKDecodeError e_conv;
9331 e_conv.inner = (void*)(e & (~1));
9332 e_conv.is_owned = (e & 1) || (e == 0);
9333 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9334 e_conv = DecodeError_clone(&e_conv);
9335 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
9336 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
9337 return (uint64_t)ret_conv;
9340 jboolean __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
9341 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(o & ~1);
9342 jboolean ret_val = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
9346 void __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
9347 if ((_res & 1) != 0) return;
9348 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9349 CHECK_ACCESS(_res_ptr);
9350 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
9352 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
9355 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
9356 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
9357 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
9358 return (uint64_t)ret_conv;
9360 int64_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
9361 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
9362 int64_t ret_val = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
9366 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
9367 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
9368 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
9369 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
9370 return (uint64_t)ret_conv;
9373 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint32_t o) {
9374 LDKTrustedClosingTransaction o_conv;
9375 o_conv.inner = (void*)(o & (~1));
9376 o_conv.is_owned = (o & 1) || (o == 0);
9377 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9378 // Warning: we need a move here but no clone is available for LDKTrustedClosingTransaction
9379 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
9380 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
9381 return (uint64_t)ret_conv;
9384 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
9385 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
9386 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
9387 return (uint64_t)ret_conv;
9390 jboolean __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint32_t o) {
9391 LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(o & ~1);
9392 jboolean ret_val = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
9396 void __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint32_t _res) {
9397 if ((_res & 1) != 0) return;
9398 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9399 CHECK_ACCESS(_res_ptr);
9400 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
9402 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
9405 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
9406 LDKCommitmentTransaction o_conv;
9407 o_conv.inner = (void*)(o & (~1));
9408 o_conv.is_owned = (o & 1) || (o == 0);
9409 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9410 o_conv = CommitmentTransaction_clone(&o_conv);
9411 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9412 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
9413 return (uint64_t)ret_conv;
9416 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint32_t e) {
9417 LDKDecodeError e_conv;
9418 e_conv.inner = (void*)(e & (~1));
9419 e_conv.is_owned = (e & 1) || (e == 0);
9420 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9421 e_conv = DecodeError_clone(&e_conv);
9422 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9423 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
9424 return (uint64_t)ret_conv;
9427 jboolean __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
9428 LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(o & ~1);
9429 jboolean ret_val = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
9433 void __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
9434 if ((_res & 1) != 0) return;
9435 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9436 CHECK_ACCESS(_res_ptr);
9437 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
9439 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
9442 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
9443 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9444 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
9445 return (uint64_t)ret_conv;
9447 int64_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
9448 LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
9449 int64_t ret_val = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
9453 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
9454 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
9455 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9456 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
9457 return (uint64_t)ret_conv;
9460 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint32_t o) {
9461 LDKTrustedCommitmentTransaction o_conv;
9462 o_conv.inner = (void*)(o & (~1));
9463 o_conv.is_owned = (o & 1) || (o == 0);
9464 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9465 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
9466 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
9467 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
9468 return (uint64_t)ret_conv;
9471 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
9472 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
9473 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
9474 return (uint64_t)ret_conv;
9477 jboolean __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint32_t o) {
9478 LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(o & ~1);
9479 jboolean ret_val = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
9483 void __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint32_t _res) {
9484 if ((_res & 1) != 0) return;
9485 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9486 CHECK_ACCESS(_res_ptr);
9487 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
9489 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
9492 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
9493 LDKCVec_SignatureZ o_constr;
9494 o_constr.datalen = o->arr_len;
9495 if (o_constr.datalen > 0)
9496 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9498 o_constr.data = NULL;
9499 int8_tArray* o_vals = (void*) o->elems;
9500 for (size_t m = 0; m < o_constr.datalen; m++) {
9501 int8_tArray o_conv_12 = o_vals[m];
9502 LDKSignature o_conv_12_ref;
9503 CHECK(o_conv_12->arr_len == 64);
9504 memcpy(o_conv_12_ref.compact_form, o_conv_12->elems, 64);
9505 o_constr.data[m] = o_conv_12_ref;
9507 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9508 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
9509 return (uint64_t)ret_conv;
9512 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_err() {
9513 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9514 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
9515 return (uint64_t)ret_conv;
9518 jboolean __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_is_ok(uint32_t o) {
9519 LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)(o & ~1);
9520 jboolean ret_val = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
9524 void __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_free(uint32_t _res) {
9525 if ((_res & 1) != 0) return;
9526 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9527 CHECK_ACCESS(_res_ptr);
9528 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
9530 CResult_CVec_SignatureZNoneZ_free(_res_conv);
9533 static inline uint64_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
9534 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9535 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
9536 return (uint64_t)ret_conv;
9538 int64_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_clone_ptr(uint32_t arg) {
9539 LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
9540 int64_t ret_val = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
9544 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint32_t orig) {
9545 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
9546 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9547 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
9548 return (uint64_t)ret_conv;
9551 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint32_t o) {
9552 LDKShutdownScript o_conv;
9553 o_conv.inner = (void*)(o & (~1));
9554 o_conv.is_owned = (o & 1) || (o == 0);
9555 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9556 o_conv = ShutdownScript_clone(&o_conv);
9557 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
9558 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
9559 return (uint64_t)ret_conv;
9562 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint32_t e) {
9563 LDKDecodeError e_conv;
9564 e_conv.inner = (void*)(e & (~1));
9565 e_conv.is_owned = (e & 1) || (e == 0);
9566 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9567 e_conv = DecodeError_clone(&e_conv);
9568 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
9569 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
9570 return (uint64_t)ret_conv;
9573 jboolean __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint32_t o) {
9574 LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(o & ~1);
9575 jboolean ret_val = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
9579 void __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint32_t _res) {
9580 if ((_res & 1) != 0) return;
9581 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9582 CHECK_ACCESS(_res_ptr);
9583 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
9585 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
9588 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
9589 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
9590 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
9591 return (uint64_t)ret_conv;
9593 int64_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint32_t arg) {
9594 LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
9595 int64_t ret_val = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
9599 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint32_t orig) {
9600 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
9601 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
9602 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
9603 return (uint64_t)ret_conv;
9606 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint32_t o) {
9607 LDKShutdownScript o_conv;
9608 o_conv.inner = (void*)(o & (~1));
9609 o_conv.is_owned = (o & 1) || (o == 0);
9610 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9611 o_conv = ShutdownScript_clone(&o_conv);
9612 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
9613 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
9614 return (uint64_t)ret_conv;
9617 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint32_t e) {
9618 LDKInvalidShutdownScript e_conv;
9619 e_conv.inner = (void*)(e & (~1));
9620 e_conv.is_owned = (e & 1) || (e == 0);
9621 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9622 e_conv = InvalidShutdownScript_clone(&e_conv);
9623 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
9624 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
9625 return (uint64_t)ret_conv;
9628 jboolean __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint32_t o) {
9629 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(o & ~1);
9630 jboolean ret_val = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
9634 void __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint32_t _res) {
9635 if ((_res & 1) != 0) return;
9636 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9637 CHECK_ACCESS(_res_ptr);
9638 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
9640 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
9643 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
9644 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
9645 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
9646 return (uint64_t)ret_conv;
9648 int64_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint32_t arg) {
9649 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
9650 int64_t ret_val = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
9654 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint32_t orig) {
9655 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(orig & ~1);
9656 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
9657 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
9658 return (uint64_t)ret_conv;
9661 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_some(uint32_t o) {
9662 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9663 CHECK_ACCESS(o_ptr);
9664 LDKType o_conv = *(LDKType*)(o_ptr);
9665 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
9666 *ret_copy = COption_TypeZ_some(o_conv);
9667 uint64_t ret_ref = (uint64_t)ret_copy;
9671 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_none() {
9672 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
9673 *ret_copy = COption_TypeZ_none();
9674 uint64_t ret_ref = (uint64_t)ret_copy;
9678 void __attribute__((visibility("default"))) TS_COption_TypeZ_free(uint32_t _res) {
9679 if ((_res & 1) != 0) return;
9680 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9681 CHECK_ACCESS(_res_ptr);
9682 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
9684 COption_TypeZ_free(_res_conv);
9687 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
9688 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
9689 *ret_copy = COption_TypeZ_clone(arg);
9690 uint64_t ret_ref = (uint64_t)ret_copy;
9693 int64_t __attribute__((visibility("default"))) TS_COption_TypeZ_clone_ptr(uint32_t arg) {
9694 LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)arg;
9695 int64_t ret_val = COption_TypeZ_clone_ptr(arg_conv);
9699 uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_clone(uint32_t orig) {
9700 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
9701 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
9702 *ret_copy = COption_TypeZ_clone(orig_conv);
9703 uint64_t ret_ref = (uint64_t)ret_copy;
9707 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint32_t o) {
9708 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9709 CHECK_ACCESS(o_ptr);
9710 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
9711 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uint64_t)o) & ~1));
9712 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9713 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
9714 return (uint64_t)ret_conv;
9717 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint32_t e) {
9718 LDKDecodeError e_conv;
9719 e_conv.inner = (void*)(e & (~1));
9720 e_conv.is_owned = (e & 1) || (e == 0);
9721 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9722 e_conv = DecodeError_clone(&e_conv);
9723 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9724 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
9725 return (uint64_t)ret_conv;
9728 jboolean __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint32_t o) {
9729 LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(o & ~1);
9730 jboolean ret_val = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
9734 void __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint32_t _res) {
9735 if ((_res & 1) != 0) return;
9736 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9737 CHECK_ACCESS(_res_ptr);
9738 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
9740 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
9743 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
9744 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9745 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
9746 return (uint64_t)ret_conv;
9748 int64_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint32_t arg) {
9749 LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
9750 int64_t ret_val = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
9754 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint32_t orig) {
9755 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
9756 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9757 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
9758 return (uint64_t)ret_conv;
9761 uint32_t __attribute__((visibility("default"))) TS_CResult_StringErrorZ_ok(jstring o) {
9762 LDKStr o_conv = str_ref_to_owned_c(o);
9763 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
9764 *ret_conv = CResult_StringErrorZ_ok(o_conv);
9765 return (uint64_t)ret_conv;
9768 uint32_t __attribute__((visibility("default"))) TS_CResult_StringErrorZ_err(uint32_t e) {
9769 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
9770 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
9771 *ret_conv = CResult_StringErrorZ_err(e_conv);
9772 return (uint64_t)ret_conv;
9775 jboolean __attribute__((visibility("default"))) TS_CResult_StringErrorZ_is_ok(uint32_t o) {
9776 LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)(o & ~1);
9777 jboolean ret_val = CResult_StringErrorZ_is_ok(o_conv);
9781 void __attribute__((visibility("default"))) TS_CResult_StringErrorZ_free(uint32_t _res) {
9782 if ((_res & 1) != 0) return;
9783 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9784 CHECK_ACCESS(_res_ptr);
9785 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
9787 CResult_StringErrorZ_free(_res_conv);
9790 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint32_t o) {
9791 LDKChannelMonitorUpdate o_conv;
9792 o_conv.inner = (void*)(o & (~1));
9793 o_conv.is_owned = (o & 1) || (o == 0);
9794 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9795 o_conv = ChannelMonitorUpdate_clone(&o_conv);
9796 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
9797 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
9798 return (uint64_t)ret_conv;
9801 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint32_t e) {
9802 LDKDecodeError e_conv;
9803 e_conv.inner = (void*)(e & (~1));
9804 e_conv.is_owned = (e & 1) || (e == 0);
9805 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9806 e_conv = DecodeError_clone(&e_conv);
9807 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
9808 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
9809 return (uint64_t)ret_conv;
9812 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint32_t o) {
9813 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(o & ~1);
9814 jboolean ret_val = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
9818 void __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint32_t _res) {
9819 if ((_res & 1) != 0) return;
9820 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9821 CHECK_ACCESS(_res_ptr);
9822 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
9824 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
9827 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
9828 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
9829 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
9830 return (uint64_t)ret_conv;
9832 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
9833 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
9834 int64_t ret_val = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
9838 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint32_t orig) {
9839 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
9840 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
9841 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
9842 return (uint64_t)ret_conv;
9845 uint32_t __attribute__((visibility("default"))) TS_COption_MonitorEventZ_some(uint32_t o) {
9846 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9847 CHECK_ACCESS(o_ptr);
9848 LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
9849 o_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)o) & ~1));
9850 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
9851 *ret_copy = COption_MonitorEventZ_some(o_conv);
9852 uint64_t ret_ref = (uint64_t)ret_copy;
9856 uint32_t __attribute__((visibility("default"))) TS_COption_MonitorEventZ_none() {
9857 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
9858 *ret_copy = COption_MonitorEventZ_none();
9859 uint64_t ret_ref = (uint64_t)ret_copy;
9863 void __attribute__((visibility("default"))) TS_COption_MonitorEventZ_free(uint32_t _res) {
9864 if ((_res & 1) != 0) return;
9865 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9866 CHECK_ACCESS(_res_ptr);
9867 LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
9869 COption_MonitorEventZ_free(_res_conv);
9872 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
9873 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
9874 *ret_copy = COption_MonitorEventZ_clone(arg);
9875 uint64_t ret_ref = (uint64_t)ret_copy;
9878 int64_t __attribute__((visibility("default"))) TS_COption_MonitorEventZ_clone_ptr(uint32_t arg) {
9879 LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)arg;
9880 int64_t ret_val = COption_MonitorEventZ_clone_ptr(arg_conv);
9884 uint32_t __attribute__((visibility("default"))) TS_COption_MonitorEventZ_clone(uint32_t orig) {
9885 LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)orig;
9886 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
9887 *ret_copy = COption_MonitorEventZ_clone(orig_conv);
9888 uint64_t ret_ref = (uint64_t)ret_copy;
9892 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint32_t o) {
9893 void* o_ptr = (void*)(((uint64_t)o) & ~1);
9894 CHECK_ACCESS(o_ptr);
9895 LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
9896 o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)(((uint64_t)o) & ~1));
9897 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
9898 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
9899 return (uint64_t)ret_conv;
9902 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint32_t e) {
9903 LDKDecodeError e_conv;
9904 e_conv.inner = (void*)(e & (~1));
9905 e_conv.is_owned = (e & 1) || (e == 0);
9906 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9907 e_conv = DecodeError_clone(&e_conv);
9908 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
9909 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
9910 return (uint64_t)ret_conv;
9913 jboolean __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint32_t o) {
9914 LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(o & ~1);
9915 jboolean ret_val = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
9919 void __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint32_t _res) {
9920 if ((_res & 1) != 0) return;
9921 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9922 CHECK_ACCESS(_res_ptr);
9923 LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
9925 CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
9928 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
9929 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
9930 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
9931 return (uint64_t)ret_conv;
9933 int64_t __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint32_t arg) {
9934 LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(arg & ~1);
9935 int64_t ret_val = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
9939 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint32_t orig) {
9940 LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(orig & ~1);
9941 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
9942 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
9943 return (uint64_t)ret_conv;
9946 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint32_t o) {
9947 LDKHTLCUpdate o_conv;
9948 o_conv.inner = (void*)(o & (~1));
9949 o_conv.is_owned = (o & 1) || (o == 0);
9950 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
9951 o_conv = HTLCUpdate_clone(&o_conv);
9952 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
9953 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
9954 return (uint64_t)ret_conv;
9957 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint32_t e) {
9958 LDKDecodeError e_conv;
9959 e_conv.inner = (void*)(e & (~1));
9960 e_conv.is_owned = (e & 1) || (e == 0);
9961 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
9962 e_conv = DecodeError_clone(&e_conv);
9963 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
9964 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
9965 return (uint64_t)ret_conv;
9968 jboolean __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint32_t o) {
9969 LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(o & ~1);
9970 jboolean ret_val = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
9974 void __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint32_t _res) {
9975 if ((_res & 1) != 0) return;
9976 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
9977 CHECK_ACCESS(_res_ptr);
9978 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
9980 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
9983 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
9984 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
9985 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
9986 return (uint64_t)ret_conv;
9988 int64_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
9989 LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
9990 int64_t ret_val = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
9994 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint32_t orig) {
9995 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
9996 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
9997 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
9998 return (uint64_t)ret_conv;
10001 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_ok() {
10002 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10003 *ret_conv = CResult_NoneNoneZ_ok();
10004 return (uint64_t)ret_conv;
10007 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_err() {
10008 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10009 *ret_conv = CResult_NoneNoneZ_err();
10010 return (uint64_t)ret_conv;
10013 jboolean __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_is_ok(uint32_t o) {
10014 LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)(o & ~1);
10015 jboolean ret_val = CResult_NoneNoneZ_is_ok(o_conv);
10019 void __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_free(uint32_t _res) {
10020 if ((_res & 1) != 0) return;
10021 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10022 CHECK_ACCESS(_res_ptr);
10023 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
10025 CResult_NoneNoneZ_free(_res_conv);
10028 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
10029 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10030 *ret_conv = CResult_NoneNoneZ_clone(arg);
10031 return (uint64_t)ret_conv;
10033 int64_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_clone_ptr(uint32_t arg) {
10034 LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)(arg & ~1);
10035 int64_t ret_val = CResult_NoneNoneZ_clone_ptr(arg_conv);
10039 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_clone(uint32_t orig) {
10040 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
10041 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10042 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
10043 return (uint64_t)ret_conv;
10046 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
10047 LDKOutPoint a_conv;
10048 a_conv.inner = (void*)(a & (~1));
10049 a_conv.is_owned = (a & 1) || (a == 0);
10050 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
10051 a_conv = OutPoint_clone(&a_conv);
10053 b_ref.datalen = b->arr_len;
10054 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
10055 memcpy(b_ref.data, b->elems, b_ref.datalen);
10056 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
10057 *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
10058 return ((uint64_t)ret_conv);
10061 void __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_free(uint32_t _res) {
10062 if ((_res & 1) != 0) return;
10063 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10064 CHECK_ACCESS(_res_ptr);
10065 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
10067 C2Tuple_OutPointScriptZ_free(_res_conv);
10070 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
10072 b_ref.datalen = b->arr_len;
10073 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
10074 memcpy(b_ref.data, b->elems, b_ref.datalen);
10075 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
10076 *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
10077 return ((uint64_t)ret_conv);
10080 void __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_free(uint32_t _res) {
10081 if ((_res & 1) != 0) return;
10082 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10083 CHECK_ACCESS(_res_ptr);
10084 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
10086 C2Tuple_u32ScriptZ_free(_res_conv);
10089 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint32_tArray _res) {
10090 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
10091 _res_constr.datalen = _res->arr_len;
10092 if (_res_constr.datalen > 0)
10093 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
10095 _res_constr.data = NULL;
10096 uint32_t* _res_vals = _res->elems;
10097 for (size_t v = 0; v < _res_constr.datalen; v++) {
10098 uint32_t _res_conv_21 = _res_vals[v];
10099 void* _res_conv_21_ptr = (void*)(((uint64_t)_res_conv_21) & ~1);
10100 CHECK_ACCESS(_res_conv_21_ptr);
10101 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
10102 FREE((void*)_res_conv_21);
10103 _res_constr.data[v] = _res_conv_21_conv;
10105 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
10108 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
10109 LDKThirtyTwoBytes a_ref;
10110 CHECK(a->arr_len == 32);
10111 memcpy(a_ref.data, a->elems, 32);
10112 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
10113 b_constr.datalen = b->arr_len;
10114 if (b_constr.datalen > 0)
10115 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
10117 b_constr.data = NULL;
10118 uint32_t* b_vals = b->elems;
10119 for (size_t v = 0; v < b_constr.datalen; v++) {
10120 uint32_t b_conv_21 = b_vals[v];
10121 void* b_conv_21_ptr = (void*)(((uint64_t)b_conv_21) & ~1);
10122 CHECK_ACCESS(b_conv_21_ptr);
10123 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
10124 // Warning: we may need a move here but no clone is available for LDKC2Tuple_u32ScriptZ
10125 b_constr.data[v] = b_conv_21_conv;
10127 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
10128 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
10129 return ((uint64_t)ret_conv);
10132 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint32_t _res) {
10133 if ((_res & 1) != 0) return;
10134 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10135 CHECK_ACCESS(_res_ptr);
10136 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
10138 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
10141 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint32_tArray _res) {
10142 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
10143 _res_constr.datalen = _res->arr_len;
10144 if (_res_constr.datalen > 0)
10145 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
10147 _res_constr.data = NULL;
10148 uint32_t* _res_vals = _res->elems;
10149 for (size_t o = 0; o < _res_constr.datalen; o++) {
10150 uint32_t _res_conv_40 = _res_vals[o];
10151 void* _res_conv_40_ptr = (void*)(((uint64_t)_res_conv_40) & ~1);
10152 CHECK_ACCESS(_res_conv_40_ptr);
10153 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
10154 FREE((void*)_res_conv_40);
10155 _res_constr.data[o] = _res_conv_40_conv;
10157 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
10160 void __attribute__((visibility("default"))) TS_CVec_MonitorEventZ_free(uint32_tArray _res) {
10161 LDKCVec_MonitorEventZ _res_constr;
10162 _res_constr.datalen = _res->arr_len;
10163 if (_res_constr.datalen > 0)
10164 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
10166 _res_constr.data = NULL;
10167 uint32_t* _res_vals = _res->elems;
10168 for (size_t o = 0; o < _res_constr.datalen; o++) {
10169 uint32_t _res_conv_14 = _res_vals[o];
10170 void* _res_conv_14_ptr = (void*)(((uint64_t)_res_conv_14) & ~1);
10171 CHECK_ACCESS(_res_conv_14_ptr);
10172 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
10173 FREE((void*)_res_conv_14);
10174 _res_constr.data[o] = _res_conv_14_conv;
10176 CVec_MonitorEventZ_free(_res_constr);
10179 void __attribute__((visibility("default"))) TS_CVec_EventZ_free(uint32_tArray _res) {
10180 LDKCVec_EventZ _res_constr;
10181 _res_constr.datalen = _res->arr_len;
10182 if (_res_constr.datalen > 0)
10183 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
10185 _res_constr.data = NULL;
10186 uint32_t* _res_vals = _res->elems;
10187 for (size_t h = 0; h < _res_constr.datalen; h++) {
10188 uint32_t _res_conv_7 = _res_vals[h];
10189 void* _res_conv_7_ptr = (void*)(((uint64_t)_res_conv_7) & ~1);
10190 CHECK_ACCESS(_res_conv_7_ptr);
10191 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
10192 FREE((void*)_res_conv_7);
10193 _res_constr.data[h] = _res_conv_7_conv;
10195 CVec_EventZ_free(_res_constr);
10198 void __attribute__((visibility("default"))) TS_CVec_TransactionZ_free(ptrArray _res) {
10199 LDKCVec_TransactionZ _res_constr;
10200 _res_constr.datalen = _res->arr_len;
10201 if (_res_constr.datalen > 0)
10202 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
10204 _res_constr.data = NULL;
10205 int8_tArray* _res_vals = (void*) _res->elems;
10206 for (size_t m = 0; m < _res_constr.datalen; m++) {
10207 int8_tArray _res_conv_12 = _res_vals[m];
10208 LDKTransaction _res_conv_12_ref;
10209 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
10210 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
10211 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen);
10212 _res_conv_12_ref.data_is_owned = true;
10213 _res_constr.data[m] = _res_conv_12_ref;
10215 CVec_TransactionZ_free(_res_constr);
10218 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
10219 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
10220 *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
10221 return ((uint64_t)ret_conv);
10223 int64_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint32_t arg) {
10224 LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)(arg & ~1);
10225 int64_t ret_val = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
10229 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_clone(uint32_t orig) {
10230 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
10231 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
10232 *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
10233 return ((uint64_t)ret_conv);
10236 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
10237 LDKTransaction b_ref;
10238 b_ref.datalen = b->arr_len;
10239 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
10240 memcpy(b_ref.data, b->elems, b_ref.datalen);
10241 b_ref.data_is_owned = true;
10242 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
10243 *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
10244 return ((uint64_t)ret_conv);
10247 void __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_free(uint32_t _res) {
10248 if ((_res & 1) != 0) return;
10249 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10250 CHECK_ACCESS(_res_ptr);
10251 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
10253 C2Tuple_usizeTransactionZ_free(_res_conv);
10256 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint32_tArray _res) {
10257 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
10258 _res_constr.datalen = _res->arr_len;
10259 if (_res_constr.datalen > 0)
10260 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
10262 _res_constr.data = NULL;
10263 uint32_t* _res_vals = _res->elems;
10264 for (size_t c = 0; c < _res_constr.datalen; c++) {
10265 uint32_t _res_conv_28 = _res_vals[c];
10266 void* _res_conv_28_ptr = (void*)(((uint64_t)_res_conv_28) & ~1);
10267 CHECK_ACCESS(_res_conv_28_ptr);
10268 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
10269 FREE((void*)_res_conv_28);
10270 _res_constr.data[c] = _res_conv_28_conv;
10272 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
10275 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
10276 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
10277 *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
10278 return ((uint64_t)ret_conv);
10280 int64_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint32_t arg) {
10281 LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)(arg & ~1);
10282 int64_t ret_val = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
10286 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_clone(uint32_t orig) {
10287 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
10288 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
10289 *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
10290 return ((uint64_t)ret_conv);
10293 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
10294 void* b_ptr = (void*)(((uint64_t)b) & ~1);
10295 CHECK_ACCESS(b_ptr);
10296 LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
10297 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
10298 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
10299 *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
10300 return ((uint64_t)ret_conv);
10303 void __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_free(uint32_t _res) {
10304 if ((_res & 1) != 0) return;
10305 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10306 CHECK_ACCESS(_res_ptr);
10307 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
10309 C2Tuple_u32TxOutZ_free(_res_conv);
10312 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint32_tArray _res) {
10313 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
10314 _res_constr.datalen = _res->arr_len;
10315 if (_res_constr.datalen > 0)
10316 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
10318 _res_constr.data = NULL;
10319 uint32_t* _res_vals = _res->elems;
10320 for (size_t u = 0; u < _res_constr.datalen; u++) {
10321 uint32_t _res_conv_20 = _res_vals[u];
10322 void* _res_conv_20_ptr = (void*)(((uint64_t)_res_conv_20) & ~1);
10323 CHECK_ACCESS(_res_conv_20_ptr);
10324 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
10325 FREE((void*)_res_conv_20);
10326 _res_constr.data[u] = _res_conv_20_conv;
10328 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
10331 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
10332 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
10333 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
10334 return ((uint64_t)ret_conv);
10336 int64_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint32_t arg) {
10337 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(arg & ~1);
10338 int64_t ret_val = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
10342 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint32_t orig) {
10343 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
10344 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
10345 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
10346 return ((uint64_t)ret_conv);
10349 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
10350 LDKThirtyTwoBytes a_ref;
10351 CHECK(a->arr_len == 32);
10352 memcpy(a_ref.data, a->elems, 32);
10353 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
10354 b_constr.datalen = b->arr_len;
10355 if (b_constr.datalen > 0)
10356 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
10358 b_constr.data = NULL;
10359 uint32_t* b_vals = b->elems;
10360 for (size_t u = 0; u < b_constr.datalen; u++) {
10361 uint32_t b_conv_20 = b_vals[u];
10362 void* b_conv_20_ptr = (void*)(((uint64_t)b_conv_20) & ~1);
10363 CHECK_ACCESS(b_conv_20_ptr);
10364 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
10365 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_20) & ~1));
10366 b_constr.data[u] = b_conv_20_conv;
10368 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
10369 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
10370 return ((uint64_t)ret_conv);
10373 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint32_t _res) {
10374 if ((_res & 1) != 0) return;
10375 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10376 CHECK_ACCESS(_res_ptr);
10377 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
10379 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
10382 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint32_tArray _res) {
10383 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
10384 _res_constr.datalen = _res->arr_len;
10385 if (_res_constr.datalen > 0)
10386 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
10388 _res_constr.data = NULL;
10389 uint32_t* _res_vals = _res->elems;
10390 for (size_t n = 0; n < _res_constr.datalen; n++) {
10391 uint32_t _res_conv_39 = _res_vals[n];
10392 void* _res_conv_39_ptr = (void*)(((uint64_t)_res_conv_39) & ~1);
10393 CHECK_ACCESS(_res_conv_39_ptr);
10394 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
10395 FREE((void*)_res_conv_39);
10396 _res_constr.data[n] = _res_conv_39_conv;
10398 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
10401 void __attribute__((visibility("default"))) TS_CVec_TxidZ_free(ptrArray _res) {
10402 LDKCVec_TxidZ _res_constr;
10403 _res_constr.datalen = _res->arr_len;
10404 if (_res_constr.datalen > 0)
10405 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
10407 _res_constr.data = NULL;
10408 int8_tArray* _res_vals = (void*) _res->elems;
10409 for (size_t m = 0; m < _res_constr.datalen; m++) {
10410 int8_tArray _res_conv_12 = _res_vals[m];
10411 LDKThirtyTwoBytes _res_conv_12_ref;
10412 CHECK(_res_conv_12->arr_len == 32);
10413 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32);
10414 _res_constr.data[m] = _res_conv_12_ref;
10416 CVec_TxidZ_free(_res_constr);
10419 void __attribute__((visibility("default"))) TS_CVec_BalanceZ_free(uint32_tArray _res) {
10420 LDKCVec_BalanceZ _res_constr;
10421 _res_constr.datalen = _res->arr_len;
10422 if (_res_constr.datalen > 0)
10423 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
10425 _res_constr.data = NULL;
10426 uint32_t* _res_vals = _res->elems;
10427 for (size_t j = 0; j < _res_constr.datalen; j++) {
10428 uint32_t _res_conv_9 = _res_vals[j];
10429 void* _res_conv_9_ptr = (void*)(((uint64_t)_res_conv_9) & ~1);
10430 CHECK_ACCESS(_res_conv_9_ptr);
10431 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
10432 FREE((void*)_res_conv_9);
10433 _res_constr.data[j] = _res_conv_9_conv;
10435 CVec_BalanceZ_free(_res_constr);
10438 static inline uint64_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
10439 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
10440 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
10441 return ((uint64_t)ret_conv);
10443 int64_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr(uint32_t arg) {
10444 LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(arg & ~1);
10445 int64_t ret_val = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
10449 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint32_t orig) {
10450 LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(orig & ~1);
10451 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
10452 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
10453 return ((uint64_t)ret_conv);
10456 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
10457 LDKThirtyTwoBytes a_ref;
10458 CHECK(a->arr_len == 32);
10459 memcpy(a_ref.data, a->elems, 32);
10460 LDKChannelMonitor b_conv;
10461 b_conv.inner = (void*)(b & (~1));
10462 b_conv.is_owned = (b & 1) || (b == 0);
10463 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
10464 b_conv = ChannelMonitor_clone(&b_conv);
10465 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
10466 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
10467 return ((uint64_t)ret_conv);
10470 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint32_t _res) {
10471 if ((_res & 1) != 0) return;
10472 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10473 CHECK_ACCESS(_res_ptr);
10474 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
10476 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
10479 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint32_t o) {
10480 void* o_ptr = (void*)(((uint64_t)o) & ~1);
10481 CHECK_ACCESS(o_ptr);
10482 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
10483 o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1));
10484 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10485 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
10486 return (uint64_t)ret_conv;
10489 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint32_t e) {
10490 LDKDecodeError e_conv;
10491 e_conv.inner = (void*)(e & (~1));
10492 e_conv.is_owned = (e & 1) || (e == 0);
10493 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10494 e_conv = DecodeError_clone(&e_conv);
10495 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10496 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
10497 return (uint64_t)ret_conv;
10500 jboolean __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(uint32_t o) {
10501 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(o & ~1);
10502 jboolean ret_val = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
10506 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint32_t _res) {
10507 if ((_res & 1) != 0) return;
10508 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10509 CHECK_ACCESS(_res_ptr);
10510 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
10512 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
10515 static inline uint64_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
10516 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10517 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
10518 return (uint64_t)ret_conv;
10520 int64_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(uint32_t arg) {
10521 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
10522 int64_t ret_val = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
10526 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint32_t orig) {
10527 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(orig & ~1);
10528 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10529 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
10530 return (uint64_t)ret_conv;
10533 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint32_t o) {
10534 LDKRouteHop o_conv;
10535 o_conv.inner = (void*)(o & (~1));
10536 o_conv.is_owned = (o & 1) || (o == 0);
10537 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10538 o_conv = RouteHop_clone(&o_conv);
10539 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
10540 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
10541 return (uint64_t)ret_conv;
10544 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_err(uint32_t e) {
10545 LDKDecodeError e_conv;
10546 e_conv.inner = (void*)(e & (~1));
10547 e_conv.is_owned = (e & 1) || (e == 0);
10548 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10549 e_conv = DecodeError_clone(&e_conv);
10550 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
10551 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
10552 return (uint64_t)ret_conv;
10555 jboolean __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint32_t o) {
10556 LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)(o & ~1);
10557 jboolean ret_val = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
10561 void __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_free(uint32_t _res) {
10562 if ((_res & 1) != 0) return;
10563 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10564 CHECK_ACCESS(_res_ptr);
10565 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
10567 CResult_RouteHopDecodeErrorZ_free(_res_conv);
10570 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
10571 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
10572 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
10573 return (uint64_t)ret_conv;
10575 int64_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint32_t arg) {
10576 LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
10577 int64_t ret_val = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
10581 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint32_t orig) {
10582 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
10583 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
10584 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
10585 return (uint64_t)ret_conv;
10588 void __attribute__((visibility("default"))) TS_CVec_RouteHopZ_free(uint32_tArray _res) {
10589 LDKCVec_RouteHopZ _res_constr;
10590 _res_constr.datalen = _res->arr_len;
10591 if (_res_constr.datalen > 0)
10592 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10594 _res_constr.data = NULL;
10595 uint32_t* _res_vals = _res->elems;
10596 for (size_t k = 0; k < _res_constr.datalen; k++) {
10597 uint32_t _res_conv_10 = _res_vals[k];
10598 LDKRouteHop _res_conv_10_conv;
10599 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
10600 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
10601 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
10602 _res_constr.data[k] = _res_conv_10_conv;
10604 CVec_RouteHopZ_free(_res_constr);
10607 void __attribute__((visibility("default"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
10608 LDKCVec_CVec_RouteHopZZ _res_constr;
10609 _res_constr.datalen = _res->arr_len;
10610 if (_res_constr.datalen > 0)
10611 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
10613 _res_constr.data = NULL;
10614 uint32_tArray* _res_vals = (void*) _res->elems;
10615 for (size_t m = 0; m < _res_constr.datalen; m++) {
10616 uint32_tArray _res_conv_12 = _res_vals[m];
10617 LDKCVec_RouteHopZ _res_conv_12_constr;
10618 _res_conv_12_constr.datalen = _res_conv_12->arr_len;
10619 if (_res_conv_12_constr.datalen > 0)
10620 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10622 _res_conv_12_constr.data = NULL;
10623 uint32_t* _res_conv_12_vals = _res_conv_12->elems;
10624 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
10625 uint32_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
10626 LDKRouteHop _res_conv_12_conv_10_conv;
10627 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
10628 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
10629 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
10630 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
10632 _res_constr.data[m] = _res_conv_12_constr;
10634 CVec_CVec_RouteHopZZ_free(_res_constr);
10637 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_ok(uint32_t o) {
10639 o_conv.inner = (void*)(o & (~1));
10640 o_conv.is_owned = (o & 1) || (o == 0);
10641 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10642 o_conv = Route_clone(&o_conv);
10643 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
10644 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
10645 return (uint64_t)ret_conv;
10648 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_err(uint32_t e) {
10649 LDKDecodeError e_conv;
10650 e_conv.inner = (void*)(e & (~1));
10651 e_conv.is_owned = (e & 1) || (e == 0);
10652 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10653 e_conv = DecodeError_clone(&e_conv);
10654 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
10655 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
10656 return (uint64_t)ret_conv;
10659 jboolean __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint32_t o) {
10660 LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)(o & ~1);
10661 jboolean ret_val = CResult_RouteDecodeErrorZ_is_ok(o_conv);
10665 void __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_free(uint32_t _res) {
10666 if ((_res & 1) != 0) return;
10667 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10668 CHECK_ACCESS(_res_ptr);
10669 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
10671 CResult_RouteDecodeErrorZ_free(_res_conv);
10674 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
10675 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
10676 *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
10677 return (uint64_t)ret_conv;
10679 int64_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint32_t arg) {
10680 LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
10681 int64_t ret_val = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
10685 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_clone(uint32_t orig) {
10686 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
10687 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
10688 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
10689 return (uint64_t)ret_conv;
10692 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint32_t o) {
10693 LDKRouteParameters o_conv;
10694 o_conv.inner = (void*)(o & (~1));
10695 o_conv.is_owned = (o & 1) || (o == 0);
10696 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10697 o_conv = RouteParameters_clone(&o_conv);
10698 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
10699 *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
10700 return (uint64_t)ret_conv;
10703 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint32_t e) {
10704 LDKDecodeError e_conv;
10705 e_conv.inner = (void*)(e & (~1));
10706 e_conv.is_owned = (e & 1) || (e == 0);
10707 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10708 e_conv = DecodeError_clone(&e_conv);
10709 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
10710 *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
10711 return (uint64_t)ret_conv;
10714 jboolean __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint32_t o) {
10715 LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(o & ~1);
10716 jboolean ret_val = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
10720 void __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint32_t _res) {
10721 if ((_res & 1) != 0) return;
10722 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10723 CHECK_ACCESS(_res_ptr);
10724 LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
10726 CResult_RouteParametersDecodeErrorZ_free(_res_conv);
10729 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
10730 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
10731 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
10732 return (uint64_t)ret_conv;
10734 int64_t __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
10735 LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
10736 int64_t ret_val = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
10740 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint32_t orig) {
10741 LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(orig & ~1);
10742 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
10743 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
10744 return (uint64_t)ret_conv;
10747 void __attribute__((visibility("default"))) TS_CVec_RouteHintZ_free(uint32_tArray _res) {
10748 LDKCVec_RouteHintZ _res_constr;
10749 _res_constr.datalen = _res->arr_len;
10750 if (_res_constr.datalen > 0)
10751 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
10753 _res_constr.data = NULL;
10754 uint32_t* _res_vals = _res->elems;
10755 for (size_t l = 0; l < _res_constr.datalen; l++) {
10756 uint32_t _res_conv_11 = _res_vals[l];
10757 LDKRouteHint _res_conv_11_conv;
10758 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
10759 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
10760 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
10761 _res_constr.data[l] = _res_conv_11_conv;
10763 CVec_RouteHintZ_free(_res_constr);
10766 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_some(int64_t o) {
10767 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
10768 *ret_copy = COption_u64Z_some(o);
10769 uint64_t ret_ref = (uint64_t)ret_copy;
10773 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_none() {
10774 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
10775 *ret_copy = COption_u64Z_none();
10776 uint64_t ret_ref = (uint64_t)ret_copy;
10780 void __attribute__((visibility("default"))) TS_COption_u64Z_free(uint32_t _res) {
10781 if ((_res & 1) != 0) return;
10782 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10783 CHECK_ACCESS(_res_ptr);
10784 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
10786 COption_u64Z_free(_res_conv);
10789 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
10790 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
10791 *ret_copy = COption_u64Z_clone(arg);
10792 uint64_t ret_ref = (uint64_t)ret_copy;
10795 int64_t __attribute__((visibility("default"))) TS_COption_u64Z_clone_ptr(uint32_t arg) {
10796 LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)arg;
10797 int64_t ret_val = COption_u64Z_clone_ptr(arg_conv);
10801 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_clone(uint32_t orig) {
10802 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
10803 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
10804 *ret_copy = COption_u64Z_clone(orig_conv);
10805 uint64_t ret_ref = (uint64_t)ret_copy;
10809 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_ok(uint32_t o) {
10811 o_conv.inner = (void*)(o & (~1));
10812 o_conv.is_owned = (o & 1) || (o == 0);
10813 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10814 o_conv = Payee_clone(&o_conv);
10815 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
10816 *ret_conv = CResult_PayeeDecodeErrorZ_ok(o_conv);
10817 return (uint64_t)ret_conv;
10820 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_err(uint32_t e) {
10821 LDKDecodeError e_conv;
10822 e_conv.inner = (void*)(e & (~1));
10823 e_conv.is_owned = (e & 1) || (e == 0);
10824 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10825 e_conv = DecodeError_clone(&e_conv);
10826 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
10827 *ret_conv = CResult_PayeeDecodeErrorZ_err(e_conv);
10828 return (uint64_t)ret_conv;
10831 jboolean __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_is_ok(uint32_t o) {
10832 LDKCResult_PayeeDecodeErrorZ* o_conv = (LDKCResult_PayeeDecodeErrorZ*)(o & ~1);
10833 jboolean ret_val = CResult_PayeeDecodeErrorZ_is_ok(o_conv);
10837 void __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_free(uint32_t _res) {
10838 if ((_res & 1) != 0) return;
10839 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10840 CHECK_ACCESS(_res_ptr);
10841 LDKCResult_PayeeDecodeErrorZ _res_conv = *(LDKCResult_PayeeDecodeErrorZ*)(_res_ptr);
10843 CResult_PayeeDecodeErrorZ_free(_res_conv);
10846 static inline uint64_t CResult_PayeeDecodeErrorZ_clone_ptr(LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR arg) {
10847 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
10848 *ret_conv = CResult_PayeeDecodeErrorZ_clone(arg);
10849 return (uint64_t)ret_conv;
10851 int64_t __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_clone_ptr(uint32_t arg) {
10852 LDKCResult_PayeeDecodeErrorZ* arg_conv = (LDKCResult_PayeeDecodeErrorZ*)(arg & ~1);
10853 int64_t ret_val = CResult_PayeeDecodeErrorZ_clone_ptr(arg_conv);
10857 uint32_t __attribute__((visibility("default"))) TS_CResult_PayeeDecodeErrorZ_clone(uint32_t orig) {
10858 LDKCResult_PayeeDecodeErrorZ* orig_conv = (LDKCResult_PayeeDecodeErrorZ*)(orig & ~1);
10859 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
10860 *ret_conv = CResult_PayeeDecodeErrorZ_clone(orig_conv);
10861 return (uint64_t)ret_conv;
10864 void __attribute__((visibility("default"))) TS_CVec_RouteHintHopZ_free(uint32_tArray _res) {
10865 LDKCVec_RouteHintHopZ _res_constr;
10866 _res_constr.datalen = _res->arr_len;
10867 if (_res_constr.datalen > 0)
10868 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
10870 _res_constr.data = NULL;
10871 uint32_t* _res_vals = _res->elems;
10872 for (size_t o = 0; o < _res_constr.datalen; o++) {
10873 uint32_t _res_conv_14 = _res_vals[o];
10874 LDKRouteHintHop _res_conv_14_conv;
10875 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
10876 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
10877 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
10878 _res_constr.data[o] = _res_conv_14_conv;
10880 CVec_RouteHintHopZ_free(_res_constr);
10883 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint32_t o) {
10884 LDKRouteHint o_conv;
10885 o_conv.inner = (void*)(o & (~1));
10886 o_conv.is_owned = (o & 1) || (o == 0);
10887 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10888 o_conv = RouteHint_clone(&o_conv);
10889 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
10890 *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
10891 return (uint64_t)ret_conv;
10894 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_err(uint32_t e) {
10895 LDKDecodeError e_conv;
10896 e_conv.inner = (void*)(e & (~1));
10897 e_conv.is_owned = (e & 1) || (e == 0);
10898 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10899 e_conv = DecodeError_clone(&e_conv);
10900 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
10901 *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
10902 return (uint64_t)ret_conv;
10905 jboolean __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint32_t o) {
10906 LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)(o & ~1);
10907 jboolean ret_val = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
10911 void __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_free(uint32_t _res) {
10912 if ((_res & 1) != 0) return;
10913 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10914 CHECK_ACCESS(_res_ptr);
10915 LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
10917 CResult_RouteHintDecodeErrorZ_free(_res_conv);
10920 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
10921 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
10922 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
10923 return (uint64_t)ret_conv;
10925 int64_t __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint32_t arg) {
10926 LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
10927 int64_t ret_val = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
10931 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint32_t orig) {
10932 LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)(orig & ~1);
10933 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
10934 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
10935 return (uint64_t)ret_conv;
10938 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint32_t o) {
10939 LDKRouteHintHop o_conv;
10940 o_conv.inner = (void*)(o & (~1));
10941 o_conv.is_owned = (o & 1) || (o == 0);
10942 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10943 o_conv = RouteHintHop_clone(&o_conv);
10944 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
10945 *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
10946 return (uint64_t)ret_conv;
10949 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint32_t e) {
10950 LDKDecodeError e_conv;
10951 e_conv.inner = (void*)(e & (~1));
10952 e_conv.is_owned = (e & 1) || (e == 0);
10953 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10954 e_conv = DecodeError_clone(&e_conv);
10955 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
10956 *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
10957 return (uint64_t)ret_conv;
10960 jboolean __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint32_t o) {
10961 LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(o & ~1);
10962 jboolean ret_val = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
10966 void __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint32_t _res) {
10967 if ((_res & 1) != 0) return;
10968 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
10969 CHECK_ACCESS(_res_ptr);
10970 LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
10972 CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
10975 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
10976 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
10977 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
10978 return (uint64_t)ret_conv;
10980 int64_t __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint32_t arg) {
10981 LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
10982 int64_t ret_val = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
10986 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint32_t orig) {
10987 LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(orig & ~1);
10988 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
10989 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
10990 return (uint64_t)ret_conv;
10993 void __attribute__((visibility("default"))) TS_CVec_ChannelDetailsZ_free(uint32_tArray _res) {
10994 LDKCVec_ChannelDetailsZ _res_constr;
10995 _res_constr.datalen = _res->arr_len;
10996 if (_res_constr.datalen > 0)
10997 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
10999 _res_constr.data = NULL;
11000 uint32_t* _res_vals = _res->elems;
11001 for (size_t q = 0; q < _res_constr.datalen; q++) {
11002 uint32_t _res_conv_16 = _res_vals[q];
11003 LDKChannelDetails _res_conv_16_conv;
11004 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
11005 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
11006 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
11007 _res_constr.data[q] = _res_conv_16_conv;
11009 CVec_ChannelDetailsZ_free(_res_constr);
11012 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_ok(uint32_t o) {
11014 o_conv.inner = (void*)(o & (~1));
11015 o_conv.is_owned = (o & 1) || (o == 0);
11016 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11017 o_conv = Route_clone(&o_conv);
11018 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11019 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
11020 return (uint64_t)ret_conv;
11023 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_err(uint32_t e) {
11024 LDKLightningError e_conv;
11025 e_conv.inner = (void*)(e & (~1));
11026 e_conv.is_owned = (e & 1) || (e == 0);
11027 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11028 e_conv = LightningError_clone(&e_conv);
11029 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11030 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
11031 return (uint64_t)ret_conv;
11034 jboolean __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_is_ok(uint32_t o) {
11035 LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)(o & ~1);
11036 jboolean ret_val = CResult_RouteLightningErrorZ_is_ok(o_conv);
11040 void __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_free(uint32_t _res) {
11041 if ((_res & 1) != 0) return;
11042 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11043 CHECK_ACCESS(_res_ptr);
11044 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
11046 CResult_RouteLightningErrorZ_free(_res_conv);
11049 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
11050 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11051 *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
11052 return (uint64_t)ret_conv;
11054 int64_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint32_t arg) {
11055 LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
11056 int64_t ret_val = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
11060 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_clone(uint32_t orig) {
11061 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
11062 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11063 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
11064 return (uint64_t)ret_conv;
11067 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_ok() {
11068 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11069 *ret_conv = CResult_NoneLightningErrorZ_ok();
11070 return (uint64_t)ret_conv;
11073 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
11074 LDKLightningError e_conv;
11075 e_conv.inner = (void*)(e & (~1));
11076 e_conv.is_owned = (e & 1) || (e == 0);
11077 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11078 e_conv = LightningError_clone(&e_conv);
11079 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11080 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
11081 return (uint64_t)ret_conv;
11084 jboolean __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_is_ok(uint32_t o) {
11085 LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)(o & ~1);
11086 jboolean ret_val = CResult_NoneLightningErrorZ_is_ok(o_conv);
11090 void __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
11091 if ((_res & 1) != 0) return;
11092 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11093 CHECK_ACCESS(_res_ptr);
11094 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
11096 CResult_NoneLightningErrorZ_free(_res_conv);
11099 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
11100 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11101 *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
11102 return (uint64_t)ret_conv;
11104 int64_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint32_t arg) {
11105 LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
11106 int64_t ret_val = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
11110 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
11111 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
11112 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11113 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
11114 return (uint64_t)ret_conv;
11117 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
11118 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
11119 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
11120 return ((uint64_t)ret_conv);
11122 int64_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint32_t arg) {
11123 LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)(arg & ~1);
11124 int64_t ret_val = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
11128 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint32_t orig) {
11129 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
11130 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
11131 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
11132 return ((uint64_t)ret_conv);
11135 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint32_t b) {
11136 LDKPublicKey a_ref;
11137 CHECK(a->arr_len == 33);
11138 memcpy(a_ref.compressed_form, a->elems, 33);
11139 void* b_ptr = (void*)(((uint64_t)b) & ~1);
11140 CHECK_ACCESS(b_ptr);
11141 LDKType b_conv = *(LDKType*)(b_ptr);
11142 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
11143 *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
11144 return ((uint64_t)ret_conv);
11147 void __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_free(uint32_t _res) {
11148 if ((_res & 1) != 0) return;
11149 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11150 CHECK_ACCESS(_res_ptr);
11151 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
11153 C2Tuple_PublicKeyTypeZ_free(_res_conv);
11156 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint32_tArray _res) {
11157 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
11158 _res_constr.datalen = _res->arr_len;
11159 if (_res_constr.datalen > 0)
11160 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
11162 _res_constr.data = NULL;
11163 uint32_t* _res_vals = _res->elems;
11164 for (size_t z = 0; z < _res_constr.datalen; z++) {
11165 uint32_t _res_conv_25 = _res_vals[z];
11166 void* _res_conv_25_ptr = (void*)(((uint64_t)_res_conv_25) & ~1);
11167 CHECK_ACCESS(_res_conv_25_ptr);
11168 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
11169 FREE((void*)_res_conv_25);
11170 _res_constr.data[z] = _res_conv_25_conv;
11172 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
11175 void __attribute__((visibility("default"))) TS_CVec_MessageSendEventZ_free(uint32_tArray _res) {
11176 LDKCVec_MessageSendEventZ _res_constr;
11177 _res_constr.datalen = _res->arr_len;
11178 if (_res_constr.datalen > 0)
11179 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
11181 _res_constr.data = NULL;
11182 uint32_t* _res_vals = _res->elems;
11183 for (size_t s = 0; s < _res_constr.datalen; s++) {
11184 uint32_t _res_conv_18 = _res_vals[s];
11185 void* _res_conv_18_ptr = (void*)(((uint64_t)_res_conv_18) & ~1);
11186 CHECK_ACCESS(_res_conv_18_ptr);
11187 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
11188 FREE((void*)_res_conv_18);
11189 _res_constr.data[s] = _res_conv_18_conv;
11191 CVec_MessageSendEventZ_free(_res_constr);
11194 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
11195 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11196 *ret_conv = CResult_boolLightningErrorZ_ok(o);
11197 return (uint64_t)ret_conv;
11200 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
11201 LDKLightningError e_conv;
11202 e_conv.inner = (void*)(e & (~1));
11203 e_conv.is_owned = (e & 1) || (e == 0);
11204 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11205 e_conv = LightningError_clone(&e_conv);
11206 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11207 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
11208 return (uint64_t)ret_conv;
11211 jboolean __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_is_ok(uint32_t o) {
11212 LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)(o & ~1);
11213 jboolean ret_val = CResult_boolLightningErrorZ_is_ok(o_conv);
11217 void __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_free(uint32_t _res) {
11218 if ((_res & 1) != 0) return;
11219 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11220 CHECK_ACCESS(_res_ptr);
11221 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
11223 CResult_boolLightningErrorZ_free(_res_conv);
11226 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
11227 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11228 *ret_conv = CResult_boolLightningErrorZ_clone(arg);
11229 return (uint64_t)ret_conv;
11231 int64_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint32_t arg) {
11232 LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
11233 int64_t ret_val = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
11237 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
11238 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
11239 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11240 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
11241 return (uint64_t)ret_conv;
11244 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
11245 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11246 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
11247 return ((uint64_t)ret_conv);
11249 int64_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint32_t arg) {
11250 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(arg & ~1);
11251 int64_t ret_val = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
11255 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
11256 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
11257 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11258 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
11259 return ((uint64_t)ret_conv);
11262 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
11263 LDKChannelAnnouncement a_conv;
11264 a_conv.inner = (void*)(a & (~1));
11265 a_conv.is_owned = (a & 1) || (a == 0);
11266 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
11267 a_conv = ChannelAnnouncement_clone(&a_conv);
11268 LDKChannelUpdate b_conv;
11269 b_conv.inner = (void*)(b & (~1));
11270 b_conv.is_owned = (b & 1) || (b == 0);
11271 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
11272 b_conv = ChannelUpdate_clone(&b_conv);
11273 LDKChannelUpdate c_conv;
11274 c_conv.inner = (void*)(c & (~1));
11275 c_conv.is_owned = (c & 1) || (c == 0);
11276 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
11277 c_conv = ChannelUpdate_clone(&c_conv);
11278 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11279 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
11280 return ((uint64_t)ret_conv);
11283 void __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint32_t _res) {
11284 if ((_res & 1) != 0) return;
11285 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11286 CHECK_ACCESS(_res_ptr);
11287 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
11289 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
11292 void __attribute__((visibility("default"))) TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint32_tArray _res) {
11293 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
11294 _res_constr.datalen = _res->arr_len;
11295 if (_res_constr.datalen > 0)
11296 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
11298 _res_constr.data = NULL;
11299 uint32_t* _res_vals = _res->elems;
11300 for (size_t h = 0; h < _res_constr.datalen; h++) {
11301 uint32_t _res_conv_59 = _res_vals[h];
11302 void* _res_conv_59_ptr = (void*)(((uint64_t)_res_conv_59) & ~1);
11303 CHECK_ACCESS(_res_conv_59_ptr);
11304 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_conv_59_ptr);
11305 FREE((void*)_res_conv_59);
11306 _res_constr.data[h] = _res_conv_59_conv;
11308 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
11311 void __attribute__((visibility("default"))) TS_CVec_NodeAnnouncementZ_free(uint32_tArray _res) {
11312 LDKCVec_NodeAnnouncementZ _res_constr;
11313 _res_constr.datalen = _res->arr_len;
11314 if (_res_constr.datalen > 0)
11315 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
11317 _res_constr.data = NULL;
11318 uint32_t* _res_vals = _res->elems;
11319 for (size_t s = 0; s < _res_constr.datalen; s++) {
11320 uint32_t _res_conv_18 = _res_vals[s];
11321 LDKNodeAnnouncement _res_conv_18_conv;
11322 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
11323 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
11324 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_18_conv);
11325 _res_constr.data[s] = _res_conv_18_conv;
11327 CVec_NodeAnnouncementZ_free(_res_constr);
11330 void __attribute__((visibility("default"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
11331 LDKCVec_PublicKeyZ _res_constr;
11332 _res_constr.datalen = _res->arr_len;
11333 if (_res_constr.datalen > 0)
11334 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
11336 _res_constr.data = NULL;
11337 int8_tArray* _res_vals = (void*) _res->elems;
11338 for (size_t m = 0; m < _res_constr.datalen; m++) {
11339 int8_tArray _res_conv_12 = _res_vals[m];
11340 LDKPublicKey _res_conv_12_ref;
11341 CHECK(_res_conv_12->arr_len == 33);
11342 memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33);
11343 _res_constr.data[m] = _res_conv_12_ref;
11345 CVec_PublicKeyZ_free(_res_constr);
11348 void __attribute__((visibility("default"))) TS_CVec_u8Z_free(int8_tArray _res) {
11349 LDKCVec_u8Z _res_ref;
11350 _res_ref.datalen = _res->arr_len;
11351 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
11352 memcpy(_res_ref.data, _res->elems, _res_ref.datalen);
11353 CVec_u8Z_free(_res_ref);
11356 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
11358 o_ref.datalen = o->arr_len;
11359 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
11360 memcpy(o_ref.data, o->elems, o_ref.datalen);
11361 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11362 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
11363 return (uint64_t)ret_conv;
11366 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint32_t e) {
11367 LDKPeerHandleError e_conv;
11368 e_conv.inner = (void*)(e & (~1));
11369 e_conv.is_owned = (e & 1) || (e == 0);
11370 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11371 e_conv = PeerHandleError_clone(&e_conv);
11372 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11373 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
11374 return (uint64_t)ret_conv;
11377 jboolean __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint32_t o) {
11378 LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(o & ~1);
11379 jboolean ret_val = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
11383 void __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint32_t _res) {
11384 if ((_res & 1) != 0) return;
11385 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11386 CHECK_ACCESS(_res_ptr);
11387 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
11389 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
11392 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
11393 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11394 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
11395 return (uint64_t)ret_conv;
11397 int64_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint32_t arg) {
11398 LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
11399 int64_t ret_val = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
11403 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint32_t orig) {
11404 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
11405 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11406 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
11407 return (uint64_t)ret_conv;
11410 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_ok() {
11411 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11412 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
11413 return (uint64_t)ret_conv;
11416 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_err(uint32_t e) {
11417 LDKPeerHandleError e_conv;
11418 e_conv.inner = (void*)(e & (~1));
11419 e_conv.is_owned = (e & 1) || (e == 0);
11420 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11421 e_conv = PeerHandleError_clone(&e_conv);
11422 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11423 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
11424 return (uint64_t)ret_conv;
11427 jboolean __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint32_t o) {
11428 LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)(o & ~1);
11429 jboolean ret_val = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
11433 void __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_free(uint32_t _res) {
11434 if ((_res & 1) != 0) return;
11435 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11436 CHECK_ACCESS(_res_ptr);
11437 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
11439 CResult_NonePeerHandleErrorZ_free(_res_conv);
11442 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
11443 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11444 *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
11445 return (uint64_t)ret_conv;
11447 int64_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint32_t arg) {
11448 LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
11449 int64_t ret_val = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
11453 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_clone(uint32_t orig) {
11454 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
11455 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11456 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
11457 return (uint64_t)ret_conv;
11460 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
11461 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11462 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
11463 return (uint64_t)ret_conv;
11466 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_err(uint32_t e) {
11467 LDKPeerHandleError e_conv;
11468 e_conv.inner = (void*)(e & (~1));
11469 e_conv.is_owned = (e & 1) || (e == 0);
11470 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11471 e_conv = PeerHandleError_clone(&e_conv);
11472 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11473 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
11474 return (uint64_t)ret_conv;
11477 jboolean __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint32_t o) {
11478 LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)(o & ~1);
11479 jboolean ret_val = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
11483 void __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_free(uint32_t _res) {
11484 if ((_res & 1) != 0) return;
11485 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11486 CHECK_ACCESS(_res_ptr);
11487 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
11489 CResult_boolPeerHandleErrorZ_free(_res_conv);
11492 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
11493 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11494 *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
11495 return (uint64_t)ret_conv;
11497 int64_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint32_t arg) {
11498 LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
11499 int64_t ret_val = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
11503 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_clone(uint32_t orig) {
11504 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
11505 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11506 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
11507 return (uint64_t)ret_conv;
11510 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_ok(uint32_t o) {
11511 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11512 CHECK_ACCESS(o_ptr);
11513 LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
11514 o_conv = TxOut_clone((LDKTxOut*)(((uint64_t)o) & ~1));
11515 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
11516 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
11517 return (uint64_t)ret_conv;
11520 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
11521 LDKAccessError e_conv = LDKAccessError_from_js(e);
11522 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
11523 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
11524 return (uint64_t)ret_conv;
11527 jboolean __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_is_ok(uint32_t o) {
11528 LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)(o & ~1);
11529 jboolean ret_val = CResult_TxOutAccessErrorZ_is_ok(o_conv);
11533 void __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_free(uint32_t _res) {
11534 if ((_res & 1) != 0) return;
11535 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11536 CHECK_ACCESS(_res_ptr);
11537 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
11539 CResult_TxOutAccessErrorZ_free(_res_conv);
11542 static inline uint64_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
11543 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
11544 *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
11545 return (uint64_t)ret_conv;
11547 int64_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_clone_ptr(uint32_t arg) {
11548 LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
11549 int64_t ret_val = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
11553 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_clone(uint32_t orig) {
11554 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
11555 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
11556 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
11557 return (uint64_t)ret_conv;
11560 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
11561 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11562 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
11563 return (uint64_t)ret_conv;
11566 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
11567 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
11568 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11569 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
11570 return (uint64_t)ret_conv;
11573 jboolean __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_is_ok(uint32_t o) {
11574 LDKCResult_NoneChannelMonitorUpdateErrZ* o_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(o & ~1);
11575 jboolean ret_val = CResult_NoneChannelMonitorUpdateErrZ_is_ok(o_conv);
11579 void __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint32_t _res) {
11580 if ((_res & 1) != 0) return;
11581 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11582 CHECK_ACCESS(_res_ptr);
11583 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
11585 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
11588 static inline uint64_t CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR arg) {
11589 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11590 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(arg);
11591 return (uint64_t)ret_conv;
11593 int64_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(uint32_t arg) {
11594 LDKCResult_NoneChannelMonitorUpdateErrZ* arg_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
11595 int64_t ret_val = CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(arg_conv);
11599 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint32_t orig) {
11600 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
11601 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11602 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
11603 return (uint64_t)ret_conv;
11606 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_some(uint32_t o) {
11607 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11608 CHECK_ACCESS(o_ptr);
11609 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(o_ptr);
11610 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1));
11611 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
11612 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
11613 uint64_t ret_ref = (uint64_t)ret_copy;
11617 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_none() {
11618 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
11619 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
11620 uint64_t ret_ref = (uint64_t)ret_copy;
11624 void __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_free(uint32_t _res) {
11625 if ((_res & 1) != 0) return;
11626 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11627 CHECK_ACCESS(_res_ptr);
11628 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(_res_ptr);
11630 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
11633 static inline uint64_t COption_C2Tuple_usizeTransactionZZ_clone_ptr(LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR arg) {
11634 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
11635 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(arg);
11636 uint64_t ret_ref = (uint64_t)ret_copy;
11639 int64_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_clone_ptr(uint32_t arg) {
11640 LDKCOption_C2Tuple_usizeTransactionZZ* arg_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)arg;
11641 int64_t ret_val = COption_C2Tuple_usizeTransactionZZ_clone_ptr(arg_conv);
11645 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_clone(uint32_t orig) {
11646 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
11647 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
11648 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
11649 uint64_t ret_ref = (uint64_t)ret_copy;
11653 uint32_t __attribute__((visibility("default"))) TS_COption_ClosureReasonZ_some(uint32_t o) {
11654 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11655 CHECK_ACCESS(o_ptr);
11656 LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
11657 o_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)o) & ~1));
11658 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
11659 *ret_copy = COption_ClosureReasonZ_some(o_conv);
11660 uint64_t ret_ref = (uint64_t)ret_copy;
11664 uint32_t __attribute__((visibility("default"))) TS_COption_ClosureReasonZ_none() {
11665 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
11666 *ret_copy = COption_ClosureReasonZ_none();
11667 uint64_t ret_ref = (uint64_t)ret_copy;
11671 void __attribute__((visibility("default"))) TS_COption_ClosureReasonZ_free(uint32_t _res) {
11672 if ((_res & 1) != 0) return;
11673 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11674 CHECK_ACCESS(_res_ptr);
11675 LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
11677 COption_ClosureReasonZ_free(_res_conv);
11680 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
11681 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
11682 *ret_copy = COption_ClosureReasonZ_clone(arg);
11683 uint64_t ret_ref = (uint64_t)ret_copy;
11686 int64_t __attribute__((visibility("default"))) TS_COption_ClosureReasonZ_clone_ptr(uint32_t arg) {
11687 LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)arg;
11688 int64_t ret_val = COption_ClosureReasonZ_clone_ptr(arg_conv);
11692 uint32_t __attribute__((visibility("default"))) TS_COption_ClosureReasonZ_clone(uint32_t orig) {
11693 LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)orig;
11694 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
11695 *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
11696 uint64_t ret_ref = (uint64_t)ret_copy;
11700 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint32_t o) {
11701 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11702 CHECK_ACCESS(o_ptr);
11703 LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
11704 o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)(((uint64_t)o) & ~1));
11705 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
11706 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
11707 return (uint64_t)ret_conv;
11710 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint32_t e) {
11711 LDKDecodeError e_conv;
11712 e_conv.inner = (void*)(e & (~1));
11713 e_conv.is_owned = (e & 1) || (e == 0);
11714 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11715 e_conv = DecodeError_clone(&e_conv);
11716 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
11717 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
11718 return (uint64_t)ret_conv;
11721 jboolean __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint32_t o) {
11722 LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(o & ~1);
11723 jboolean ret_val = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
11727 void __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint32_t _res) {
11728 if ((_res & 1) != 0) return;
11729 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11730 CHECK_ACCESS(_res_ptr);
11731 LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
11733 CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
11736 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
11737 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
11738 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
11739 return (uint64_t)ret_conv;
11741 int64_t __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint32_t arg) {
11742 LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(arg & ~1);
11743 int64_t ret_val = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
11747 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint32_t orig) {
11748 LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(orig & ~1);
11749 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
11750 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
11751 return (uint64_t)ret_conv;
11754 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_some(uint32_t o) {
11755 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11756 CHECK_ACCESS(o_ptr);
11757 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
11758 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uint64_t)o) & ~1));
11759 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
11760 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
11761 uint64_t ret_ref = (uint64_t)ret_copy;
11765 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_none() {
11766 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
11767 *ret_copy = COption_NetworkUpdateZ_none();
11768 uint64_t ret_ref = (uint64_t)ret_copy;
11772 void __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_free(uint32_t _res) {
11773 if ((_res & 1) != 0) return;
11774 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11775 CHECK_ACCESS(_res_ptr);
11776 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
11778 COption_NetworkUpdateZ_free(_res_conv);
11781 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
11782 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
11783 *ret_copy = COption_NetworkUpdateZ_clone(arg);
11784 uint64_t ret_ref = (uint64_t)ret_copy;
11787 int64_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_clone_ptr(uint32_t arg) {
11788 LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)arg;
11789 int64_t ret_val = COption_NetworkUpdateZ_clone_ptr(arg_conv);
11793 uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_clone(uint32_t orig) {
11794 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
11795 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
11796 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
11797 uint64_t ret_ref = (uint64_t)ret_copy;
11801 void __attribute__((visibility("default"))) TS_CVec_SpendableOutputDescriptorZ_free(uint32_tArray _res) {
11802 LDKCVec_SpendableOutputDescriptorZ _res_constr;
11803 _res_constr.datalen = _res->arr_len;
11804 if (_res_constr.datalen > 0)
11805 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
11807 _res_constr.data = NULL;
11808 uint32_t* _res_vals = _res->elems;
11809 for (size_t b = 0; b < _res_constr.datalen; b++) {
11810 uint32_t _res_conv_27 = _res_vals[b];
11811 void* _res_conv_27_ptr = (void*)(((uint64_t)_res_conv_27) & ~1);
11812 CHECK_ACCESS(_res_conv_27_ptr);
11813 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
11814 FREE((void*)_res_conv_27);
11815 _res_constr.data[b] = _res_conv_27_conv;
11817 CVec_SpendableOutputDescriptorZ_free(_res_constr);
11820 uint32_t __attribute__((visibility("default"))) TS_COption_EventZ_some(uint32_t o) {
11821 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11822 CHECK_ACCESS(o_ptr);
11823 LDKEvent o_conv = *(LDKEvent*)(o_ptr);
11824 o_conv = Event_clone((LDKEvent*)(((uint64_t)o) & ~1));
11825 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
11826 *ret_copy = COption_EventZ_some(o_conv);
11827 uint64_t ret_ref = (uint64_t)ret_copy;
11831 uint32_t __attribute__((visibility("default"))) TS_COption_EventZ_none() {
11832 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
11833 *ret_copy = COption_EventZ_none();
11834 uint64_t ret_ref = (uint64_t)ret_copy;
11838 void __attribute__((visibility("default"))) TS_COption_EventZ_free(uint32_t _res) {
11839 if ((_res & 1) != 0) return;
11840 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11841 CHECK_ACCESS(_res_ptr);
11842 LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
11844 COption_EventZ_free(_res_conv);
11847 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
11848 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
11849 *ret_copy = COption_EventZ_clone(arg);
11850 uint64_t ret_ref = (uint64_t)ret_copy;
11853 int64_t __attribute__((visibility("default"))) TS_COption_EventZ_clone_ptr(uint32_t arg) {
11854 LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)arg;
11855 int64_t ret_val = COption_EventZ_clone_ptr(arg_conv);
11859 uint32_t __attribute__((visibility("default"))) TS_COption_EventZ_clone(uint32_t orig) {
11860 LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)orig;
11861 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
11862 *ret_copy = COption_EventZ_clone(orig_conv);
11863 uint64_t ret_ref = (uint64_t)ret_copy;
11867 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint32_t o) {
11868 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11869 CHECK_ACCESS(o_ptr);
11870 LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
11871 o_conv = COption_EventZ_clone((LDKCOption_EventZ*)(((uint64_t)o) & ~1));
11872 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
11873 *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
11874 return (uint64_t)ret_conv;
11877 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint32_t e) {
11878 LDKDecodeError e_conv;
11879 e_conv.inner = (void*)(e & (~1));
11880 e_conv.is_owned = (e & 1) || (e == 0);
11881 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11882 e_conv = DecodeError_clone(&e_conv);
11883 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
11884 *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
11885 return (uint64_t)ret_conv;
11888 jboolean __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint32_t o) {
11889 LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(o & ~1);
11890 jboolean ret_val = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
11894 void __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint32_t _res) {
11895 if ((_res & 1) != 0) return;
11896 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11897 CHECK_ACCESS(_res_ptr);
11898 LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
11900 CResult_COption_EventZDecodeErrorZ_free(_res_conv);
11903 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
11904 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
11905 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
11906 return (uint64_t)ret_conv;
11908 int64_t __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint32_t arg) {
11909 LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(arg & ~1);
11910 int64_t ret_val = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
11914 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint32_t orig) {
11915 LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(orig & ~1);
11916 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
11917 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
11918 return (uint64_t)ret_conv;
11921 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint32_t o) {
11923 o_conv.inner = (void*)(o & (~1));
11924 o_conv.is_owned = (o & 1) || (o == 0);
11925 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11926 o_conv = NodeId_clone(&o_conv);
11927 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
11928 *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
11929 return (uint64_t)ret_conv;
11932 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_err(uint32_t e) {
11933 LDKDecodeError e_conv;
11934 e_conv.inner = (void*)(e & (~1));
11935 e_conv.is_owned = (e & 1) || (e == 0);
11936 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11937 e_conv = DecodeError_clone(&e_conv);
11938 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
11939 *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
11940 return (uint64_t)ret_conv;
11943 jboolean __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint32_t o) {
11944 LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)(o & ~1);
11945 jboolean ret_val = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
11949 void __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_free(uint32_t _res) {
11950 if ((_res & 1) != 0) return;
11951 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
11952 CHECK_ACCESS(_res_ptr);
11953 LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
11955 CResult_NodeIdDecodeErrorZ_free(_res_conv);
11958 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
11959 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
11960 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
11961 return (uint64_t)ret_conv;
11963 int64_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint32_t arg) {
11964 LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
11965 int64_t ret_val = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
11969 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint32_t orig) {
11970 LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1);
11971 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
11972 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
11973 return (uint64_t)ret_conv;
11976 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint32_t o) {
11977 void* o_ptr = (void*)(((uint64_t)o) & ~1);
11978 CHECK_ACCESS(o_ptr);
11979 LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
11980 o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uint64_t)o) & ~1));
11981 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
11982 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
11983 return (uint64_t)ret_conv;
11986 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint32_t e) {
11987 LDKDecodeError e_conv;
11988 e_conv.inner = (void*)(e & (~1));
11989 e_conv.is_owned = (e & 1) || (e == 0);
11990 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11991 e_conv = DecodeError_clone(&e_conv);
11992 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
11993 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
11994 return (uint64_t)ret_conv;
11997 jboolean __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint32_t o) {
11998 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(o & ~1);
11999 jboolean ret_val = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
12003 void __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint32_t _res) {
12004 if ((_res & 1) != 0) return;
12005 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12006 CHECK_ACCESS(_res_ptr);
12007 LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
12009 CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
12012 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
12013 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
12014 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
12015 return (uint64_t)ret_conv;
12017 int64_t __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint32_t arg) {
12018 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(arg & ~1);
12019 int64_t ret_val = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
12023 uint32_t __attribute__((visibility("default"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint32_t orig) {
12024 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(orig & ~1);
12025 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
12026 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
12027 return (uint64_t)ret_conv;
12030 uint32_t __attribute__((visibility("default"))) TS_COption_AccessZ_some(uint32_t o) {
12031 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12032 CHECK_ACCESS(o_ptr);
12033 LDKAccess o_conv = *(LDKAccess*)(o_ptr);
12034 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
12035 *ret_copy = COption_AccessZ_some(o_conv);
12036 uint64_t ret_ref = (uint64_t)ret_copy;
12040 uint32_t __attribute__((visibility("default"))) TS_COption_AccessZ_none() {
12041 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
12042 *ret_copy = COption_AccessZ_none();
12043 uint64_t ret_ref = (uint64_t)ret_copy;
12047 void __attribute__((visibility("default"))) TS_COption_AccessZ_free(uint32_t _res) {
12048 if ((_res & 1) != 0) return;
12049 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12050 CHECK_ACCESS(_res_ptr);
12051 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
12053 COption_AccessZ_free(_res_conv);
12056 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_ok(uint32_t o) {
12057 LDKDirectionalChannelInfo o_conv;
12058 o_conv.inner = (void*)(o & (~1));
12059 o_conv.is_owned = (o & 1) || (o == 0);
12060 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12061 o_conv = DirectionalChannelInfo_clone(&o_conv);
12062 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
12063 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
12064 return (uint64_t)ret_conv;
12067 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_err(uint32_t e) {
12068 LDKDecodeError e_conv;
12069 e_conv.inner = (void*)(e & (~1));
12070 e_conv.is_owned = (e & 1) || (e == 0);
12071 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12072 e_conv = DecodeError_clone(&e_conv);
12073 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
12074 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
12075 return (uint64_t)ret_conv;
12078 jboolean __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(uint32_t o) {
12079 LDKCResult_DirectionalChannelInfoDecodeErrorZ* o_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(o & ~1);
12080 jboolean ret_val = CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(o_conv);
12084 void __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_free(uint32_t _res) {
12085 if ((_res & 1) != 0) return;
12086 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12087 CHECK_ACCESS(_res_ptr);
12088 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(_res_ptr);
12090 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
12093 static inline uint64_t CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
12094 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
12095 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(arg);
12096 return (uint64_t)ret_conv;
12098 int64_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
12099 LDKCResult_DirectionalChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
12100 int64_t ret_val = CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
12104 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone(uint32_t orig) {
12105 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
12106 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
12107 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
12108 return (uint64_t)ret_conv;
12111 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint32_t o) {
12112 LDKChannelInfo o_conv;
12113 o_conv.inner = (void*)(o & (~1));
12114 o_conv.is_owned = (o & 1) || (o == 0);
12115 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12116 o_conv = ChannelInfo_clone(&o_conv);
12117 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
12118 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
12119 return (uint64_t)ret_conv;
12122 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint32_t e) {
12123 LDKDecodeError e_conv;
12124 e_conv.inner = (void*)(e & (~1));
12125 e_conv.is_owned = (e & 1) || (e == 0);
12126 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12127 e_conv = DecodeError_clone(&e_conv);
12128 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
12129 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
12130 return (uint64_t)ret_conv;
12133 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint32_t o) {
12134 LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(o & ~1);
12135 jboolean ret_val = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
12139 void __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint32_t _res) {
12140 if ((_res & 1) != 0) return;
12141 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12142 CHECK_ACCESS(_res_ptr);
12143 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
12145 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
12148 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
12149 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
12150 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
12151 return (uint64_t)ret_conv;
12153 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
12154 LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
12155 int64_t ret_val = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
12159 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint32_t orig) {
12160 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
12161 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
12162 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
12163 return (uint64_t)ret_conv;
12166 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint32_t o) {
12167 LDKRoutingFees o_conv;
12168 o_conv.inner = (void*)(o & (~1));
12169 o_conv.is_owned = (o & 1) || (o == 0);
12170 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12171 o_conv = RoutingFees_clone(&o_conv);
12172 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
12173 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
12174 return (uint64_t)ret_conv;
12177 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint32_t e) {
12178 LDKDecodeError e_conv;
12179 e_conv.inner = (void*)(e & (~1));
12180 e_conv.is_owned = (e & 1) || (e == 0);
12181 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12182 e_conv = DecodeError_clone(&e_conv);
12183 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
12184 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
12185 return (uint64_t)ret_conv;
12188 jboolean __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint32_t o) {
12189 LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(o & ~1);
12190 jboolean ret_val = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
12194 void __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint32_t _res) {
12195 if ((_res & 1) != 0) return;
12196 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12197 CHECK_ACCESS(_res_ptr);
12198 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
12200 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
12203 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
12204 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
12205 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
12206 return (uint64_t)ret_conv;
12208 int64_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint32_t arg) {
12209 LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
12210 int64_t ret_val = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
12214 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint32_t orig) {
12215 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
12216 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
12217 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
12218 return (uint64_t)ret_conv;
12221 void __attribute__((visibility("default"))) TS_CVec_NetAddressZ_free(uint32_tArray _res) {
12222 LDKCVec_NetAddressZ _res_constr;
12223 _res_constr.datalen = _res->arr_len;
12224 if (_res_constr.datalen > 0)
12225 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
12227 _res_constr.data = NULL;
12228 uint32_t* _res_vals = _res->elems;
12229 for (size_t m = 0; m < _res_constr.datalen; m++) {
12230 uint32_t _res_conv_12 = _res_vals[m];
12231 void* _res_conv_12_ptr = (void*)(((uint64_t)_res_conv_12) & ~1);
12232 CHECK_ACCESS(_res_conv_12_ptr);
12233 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
12234 FREE((void*)_res_conv_12);
12235 _res_constr.data[m] = _res_conv_12_conv;
12237 CVec_NetAddressZ_free(_res_constr);
12240 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint32_t o) {
12241 LDKNodeAnnouncementInfo o_conv;
12242 o_conv.inner = (void*)(o & (~1));
12243 o_conv.is_owned = (o & 1) || (o == 0);
12244 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12245 o_conv = NodeAnnouncementInfo_clone(&o_conv);
12246 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
12247 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
12248 return (uint64_t)ret_conv;
12251 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint32_t e) {
12252 LDKDecodeError e_conv;
12253 e_conv.inner = (void*)(e & (~1));
12254 e_conv.is_owned = (e & 1) || (e == 0);
12255 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12256 e_conv = DecodeError_clone(&e_conv);
12257 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
12258 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
12259 return (uint64_t)ret_conv;
12262 jboolean __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint32_t o) {
12263 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(o & ~1);
12264 jboolean ret_val = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
12268 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint32_t _res) {
12269 if ((_res & 1) != 0) return;
12270 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12271 CHECK_ACCESS(_res_ptr);
12272 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
12274 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
12277 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
12278 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
12279 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
12280 return (uint64_t)ret_conv;
12282 int64_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
12283 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
12284 int64_t ret_val = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
12288 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint32_t orig) {
12289 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
12290 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
12291 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
12292 return (uint64_t)ret_conv;
12295 void __attribute__((visibility("default"))) TS_CVec_u64Z_free(int64_tArray _res) {
12296 LDKCVec_u64Z _res_constr;
12297 _res_constr.datalen = _res->arr_len;
12298 if (_res_constr.datalen > 0)
12299 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
12301 _res_constr.data = NULL;
12302 int64_t* _res_vals = _res->elems;
12303 for (size_t i = 0; i < _res_constr.datalen; i++) {
12304 int64_t _res_conv_8 = _res_vals[i];
12305 _res_constr.data[i] = _res_conv_8;
12307 CVec_u64Z_free(_res_constr);
12310 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint32_t o) {
12311 LDKNodeInfo o_conv;
12312 o_conv.inner = (void*)(o & (~1));
12313 o_conv.is_owned = (o & 1) || (o == 0);
12314 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12315 o_conv = NodeInfo_clone(&o_conv);
12316 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
12317 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
12318 return (uint64_t)ret_conv;
12321 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint32_t e) {
12322 LDKDecodeError e_conv;
12323 e_conv.inner = (void*)(e & (~1));
12324 e_conv.is_owned = (e & 1) || (e == 0);
12325 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12326 e_conv = DecodeError_clone(&e_conv);
12327 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
12328 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
12329 return (uint64_t)ret_conv;
12332 jboolean __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint32_t o) {
12333 LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(o & ~1);
12334 jboolean ret_val = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
12338 void __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint32_t _res) {
12339 if ((_res & 1) != 0) return;
12340 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12341 CHECK_ACCESS(_res_ptr);
12342 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
12344 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
12347 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
12348 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
12349 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
12350 return (uint64_t)ret_conv;
12352 int64_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
12353 LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
12354 int64_t ret_val = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
12358 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint32_t orig) {
12359 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
12360 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
12361 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
12362 return (uint64_t)ret_conv;
12365 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint32_t o) {
12366 LDKNetworkGraph o_conv;
12367 o_conv.inner = (void*)(o & (~1));
12368 o_conv.is_owned = (o & 1) || (o == 0);
12369 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12370 o_conv = NetworkGraph_clone(&o_conv);
12371 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
12372 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
12373 return (uint64_t)ret_conv;
12376 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint32_t e) {
12377 LDKDecodeError e_conv;
12378 e_conv.inner = (void*)(e & (~1));
12379 e_conv.is_owned = (e & 1) || (e == 0);
12380 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12381 e_conv = DecodeError_clone(&e_conv);
12382 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
12383 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
12384 return (uint64_t)ret_conv;
12387 jboolean __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint32_t o) {
12388 LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(o & ~1);
12389 jboolean ret_val = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
12393 void __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint32_t _res) {
12394 if ((_res & 1) != 0) return;
12395 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12396 CHECK_ACCESS(_res_ptr);
12397 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
12399 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
12402 static inline uint64_t CResult_NetworkGraphDecodeErrorZ_clone_ptr(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR arg) {
12403 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
12404 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(arg);
12405 return (uint64_t)ret_conv;
12407 int64_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_clone_ptr(uint32_t arg) {
12408 LDKCResult_NetworkGraphDecodeErrorZ* arg_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
12409 int64_t ret_val = CResult_NetworkGraphDecodeErrorZ_clone_ptr(arg_conv);
12413 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_clone(uint32_t orig) {
12414 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
12415 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
12416 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
12417 return (uint64_t)ret_conv;
12420 uint32_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_some(uint32_tArray o) {
12421 LDKCVec_NetAddressZ o_constr;
12422 o_constr.datalen = o->arr_len;
12423 if (o_constr.datalen > 0)
12424 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
12426 o_constr.data = NULL;
12427 uint32_t* o_vals = o->elems;
12428 for (size_t m = 0; m < o_constr.datalen; m++) {
12429 uint32_t o_conv_12 = o_vals[m];
12430 void* o_conv_12_ptr = (void*)(((uint64_t)o_conv_12) & ~1);
12431 CHECK_ACCESS(o_conv_12_ptr);
12432 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
12433 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o_conv_12) & ~1));
12434 o_constr.data[m] = o_conv_12_conv;
12436 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
12437 *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
12438 uint64_t ret_ref = (uint64_t)ret_copy;
12442 uint32_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_none() {
12443 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
12444 *ret_copy = COption_CVec_NetAddressZZ_none();
12445 uint64_t ret_ref = (uint64_t)ret_copy;
12449 void __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_free(uint32_t _res) {
12450 if ((_res & 1) != 0) return;
12451 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12452 CHECK_ACCESS(_res_ptr);
12453 LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
12455 COption_CVec_NetAddressZZ_free(_res_conv);
12458 static inline uint64_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
12459 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
12460 *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
12461 uint64_t ret_ref = (uint64_t)ret_copy;
12464 int64_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_clone_ptr(uint32_t arg) {
12465 LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)arg;
12466 int64_t ret_val = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
12470 uint32_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_clone(uint32_t orig) {
12471 LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig;
12472 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
12473 *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
12474 uint64_t ret_ref = (uint64_t)ret_copy;
12478 uint32_t __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_ok(uint32_t o) {
12479 LDKScoringParameters o_conv;
12480 o_conv.inner = (void*)(o & (~1));
12481 o_conv.is_owned = (o & 1) || (o == 0);
12482 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12483 // Warning: we need a move here but no clone is available for LDKScoringParameters
12484 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
12485 *ret_conv = CResult_ScoringParametersDecodeErrorZ_ok(o_conv);
12486 return (uint64_t)ret_conv;
12489 uint32_t __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_err(uint32_t e) {
12490 LDKDecodeError e_conv;
12491 e_conv.inner = (void*)(e & (~1));
12492 e_conv.is_owned = (e & 1) || (e == 0);
12493 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12494 e_conv = DecodeError_clone(&e_conv);
12495 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
12496 *ret_conv = CResult_ScoringParametersDecodeErrorZ_err(e_conv);
12497 return (uint64_t)ret_conv;
12500 jboolean __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_is_ok(uint32_t o) {
12501 LDKCResult_ScoringParametersDecodeErrorZ* o_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(o & ~1);
12502 jboolean ret_val = CResult_ScoringParametersDecodeErrorZ_is_ok(o_conv);
12506 void __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_free(uint32_t _res) {
12507 if ((_res & 1) != 0) return;
12508 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12509 CHECK_ACCESS(_res_ptr);
12510 LDKCResult_ScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ScoringParametersDecodeErrorZ*)(_res_ptr);
12512 CResult_ScoringParametersDecodeErrorZ_free(_res_conv);
12515 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) {
12516 LDKInitFeatures o_conv;
12517 o_conv.inner = (void*)(o & (~1));
12518 o_conv.is_owned = (o & 1) || (o == 0);
12519 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12520 o_conv = InitFeatures_clone(&o_conv);
12521 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
12522 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
12523 return (uint64_t)ret_conv;
12526 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) {
12527 LDKDecodeError e_conv;
12528 e_conv.inner = (void*)(e & (~1));
12529 e_conv.is_owned = (e & 1) || (e == 0);
12530 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12531 e_conv = DecodeError_clone(&e_conv);
12532 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
12533 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
12534 return (uint64_t)ret_conv;
12537 jboolean __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint32_t o) {
12538 LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(o & ~1);
12539 jboolean ret_val = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
12543 void __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) {
12544 if ((_res & 1) != 0) return;
12545 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12546 CHECK_ACCESS(_res_ptr);
12547 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
12549 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
12552 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint32_t o) {
12553 LDKChannelFeatures o_conv;
12554 o_conv.inner = (void*)(o & (~1));
12555 o_conv.is_owned = (o & 1) || (o == 0);
12556 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12557 o_conv = ChannelFeatures_clone(&o_conv);
12558 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
12559 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
12560 return (uint64_t)ret_conv;
12563 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint32_t e) {
12564 LDKDecodeError e_conv;
12565 e_conv.inner = (void*)(e & (~1));
12566 e_conv.is_owned = (e & 1) || (e == 0);
12567 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12568 e_conv = DecodeError_clone(&e_conv);
12569 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
12570 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
12571 return (uint64_t)ret_conv;
12574 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint32_t o) {
12575 LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(o & ~1);
12576 jboolean ret_val = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
12580 void __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint32_t _res) {
12581 if ((_res & 1) != 0) return;
12582 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12583 CHECK_ACCESS(_res_ptr);
12584 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
12586 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
12589 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) {
12590 LDKNodeFeatures o_conv;
12591 o_conv.inner = (void*)(o & (~1));
12592 o_conv.is_owned = (o & 1) || (o == 0);
12593 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12594 o_conv = NodeFeatures_clone(&o_conv);
12595 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
12596 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
12597 return (uint64_t)ret_conv;
12600 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) {
12601 LDKDecodeError e_conv;
12602 e_conv.inner = (void*)(e & (~1));
12603 e_conv.is_owned = (e & 1) || (e == 0);
12604 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12605 e_conv = DecodeError_clone(&e_conv);
12606 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
12607 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
12608 return (uint64_t)ret_conv;
12611 jboolean __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint32_t o) {
12612 LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(o & ~1);
12613 jboolean ret_val = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
12617 void __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) {
12618 if ((_res & 1) != 0) return;
12619 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12620 CHECK_ACCESS(_res_ptr);
12621 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
12623 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
12626 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint32_t o) {
12627 LDKInvoiceFeatures o_conv;
12628 o_conv.inner = (void*)(o & (~1));
12629 o_conv.is_owned = (o & 1) || (o == 0);
12630 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12631 o_conv = InvoiceFeatures_clone(&o_conv);
12632 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
12633 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
12634 return (uint64_t)ret_conv;
12637 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint32_t e) {
12638 LDKDecodeError e_conv;
12639 e_conv.inner = (void*)(e & (~1));
12640 e_conv.is_owned = (e & 1) || (e == 0);
12641 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12642 e_conv = DecodeError_clone(&e_conv);
12643 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
12644 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
12645 return (uint64_t)ret_conv;
12648 jboolean __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok(uint32_t o) {
12649 LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(o & ~1);
12650 jboolean ret_val = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
12654 void __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint32_t _res) {
12655 if ((_res & 1) != 0) return;
12656 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12657 CHECK_ACCESS(_res_ptr);
12658 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
12660 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
12663 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint32_t o) {
12664 LDKChannelTypeFeatures o_conv;
12665 o_conv.inner = (void*)(o & (~1));
12666 o_conv.is_owned = (o & 1) || (o == 0);
12667 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12668 o_conv = ChannelTypeFeatures_clone(&o_conv);
12669 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
12670 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
12671 return (uint64_t)ret_conv;
12674 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint32_t e) {
12675 LDKDecodeError e_conv;
12676 e_conv.inner = (void*)(e & (~1));
12677 e_conv.is_owned = (e & 1) || (e == 0);
12678 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12679 e_conv = DecodeError_clone(&e_conv);
12680 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
12681 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
12682 return (uint64_t)ret_conv;
12685 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint32_t o) {
12686 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(o & ~1);
12687 jboolean ret_val = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
12691 void __attribute__((visibility("default"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint32_t _res) {
12692 if ((_res & 1) != 0) return;
12693 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12694 CHECK_ACCESS(_res_ptr);
12695 LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
12697 CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
12700 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint32_t o) {
12701 void* o_ptr = (void*)(((uint64_t)o) & ~1);
12702 CHECK_ACCESS(o_ptr);
12703 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
12704 o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
12705 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
12706 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
12707 return (uint64_t)ret_conv;
12710 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_err(uint32_t e) {
12711 LDKDecodeError e_conv;
12712 e_conv.inner = (void*)(e & (~1));
12713 e_conv.is_owned = (e & 1) || (e == 0);
12714 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12715 e_conv = DecodeError_clone(&e_conv);
12716 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
12717 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
12718 return (uint64_t)ret_conv;
12721 jboolean __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_is_ok(uint32_t o) {
12722 LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)(o & ~1);
12723 jboolean ret_val = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
12727 void __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_free(uint32_t _res) {
12728 if ((_res & 1) != 0) return;
12729 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12730 CHECK_ACCESS(_res_ptr);
12731 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
12733 CResult_NetAddressDecodeErrorZ_free(_res_conv);
12736 static inline uint64_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
12737 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
12738 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
12739 return (uint64_t)ret_conv;
12741 int64_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_clone_ptr(uint32_t arg) {
12742 LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
12743 int64_t ret_val = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
12747 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint32_t orig) {
12748 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
12749 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
12750 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
12751 return (uint64_t)ret_conv;
12754 void __attribute__((visibility("default"))) TS_CVec_UpdateAddHTLCZ_free(uint32_tArray _res) {
12755 LDKCVec_UpdateAddHTLCZ _res_constr;
12756 _res_constr.datalen = _res->arr_len;
12757 if (_res_constr.datalen > 0)
12758 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
12760 _res_constr.data = NULL;
12761 uint32_t* _res_vals = _res->elems;
12762 for (size_t p = 0; p < _res_constr.datalen; p++) {
12763 uint32_t _res_conv_15 = _res_vals[p];
12764 LDKUpdateAddHTLC _res_conv_15_conv;
12765 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
12766 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
12767 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
12768 _res_constr.data[p] = _res_conv_15_conv;
12770 CVec_UpdateAddHTLCZ_free(_res_constr);
12773 void __attribute__((visibility("default"))) TS_CVec_UpdateFulfillHTLCZ_free(uint32_tArray _res) {
12774 LDKCVec_UpdateFulfillHTLCZ _res_constr;
12775 _res_constr.datalen = _res->arr_len;
12776 if (_res_constr.datalen > 0)
12777 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
12779 _res_constr.data = NULL;
12780 uint32_t* _res_vals = _res->elems;
12781 for (size_t t = 0; t < _res_constr.datalen; t++) {
12782 uint32_t _res_conv_19 = _res_vals[t];
12783 LDKUpdateFulfillHTLC _res_conv_19_conv;
12784 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
12785 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
12786 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
12787 _res_constr.data[t] = _res_conv_19_conv;
12789 CVec_UpdateFulfillHTLCZ_free(_res_constr);
12792 void __attribute__((visibility("default"))) TS_CVec_UpdateFailHTLCZ_free(uint32_tArray _res) {
12793 LDKCVec_UpdateFailHTLCZ _res_constr;
12794 _res_constr.datalen = _res->arr_len;
12795 if (_res_constr.datalen > 0)
12796 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
12798 _res_constr.data = NULL;
12799 uint32_t* _res_vals = _res->elems;
12800 for (size_t q = 0; q < _res_constr.datalen; q++) {
12801 uint32_t _res_conv_16 = _res_vals[q];
12802 LDKUpdateFailHTLC _res_conv_16_conv;
12803 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
12804 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
12805 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
12806 _res_constr.data[q] = _res_conv_16_conv;
12808 CVec_UpdateFailHTLCZ_free(_res_constr);
12811 void __attribute__((visibility("default"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint32_tArray _res) {
12812 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
12813 _res_constr.datalen = _res->arr_len;
12814 if (_res_constr.datalen > 0)
12815 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
12817 _res_constr.data = NULL;
12818 uint32_t* _res_vals = _res->elems;
12819 for (size_t z = 0; z < _res_constr.datalen; z++) {
12820 uint32_t _res_conv_25 = _res_vals[z];
12821 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
12822 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
12823 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
12824 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
12825 _res_constr.data[z] = _res_conv_25_conv;
12827 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
12830 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint32_t o) {
12831 LDKAcceptChannel o_conv;
12832 o_conv.inner = (void*)(o & (~1));
12833 o_conv.is_owned = (o & 1) || (o == 0);
12834 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12835 o_conv = AcceptChannel_clone(&o_conv);
12836 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
12837 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
12838 return (uint64_t)ret_conv;
12841 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint32_t e) {
12842 LDKDecodeError e_conv;
12843 e_conv.inner = (void*)(e & (~1));
12844 e_conv.is_owned = (e & 1) || (e == 0);
12845 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12846 e_conv = DecodeError_clone(&e_conv);
12847 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
12848 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
12849 return (uint64_t)ret_conv;
12852 jboolean __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint32_t o) {
12853 LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(o & ~1);
12854 jboolean ret_val = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
12858 void __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint32_t _res) {
12859 if ((_res & 1) != 0) return;
12860 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12861 CHECK_ACCESS(_res_ptr);
12862 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
12864 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
12867 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
12868 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
12869 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
12870 return (uint64_t)ret_conv;
12872 int64_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint32_t arg) {
12873 LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
12874 int64_t ret_val = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
12878 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint32_t orig) {
12879 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
12880 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
12881 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
12882 return (uint64_t)ret_conv;
12885 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint32_t o) {
12886 LDKAnnouncementSignatures o_conv;
12887 o_conv.inner = (void*)(o & (~1));
12888 o_conv.is_owned = (o & 1) || (o == 0);
12889 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12890 o_conv = AnnouncementSignatures_clone(&o_conv);
12891 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
12892 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
12893 return (uint64_t)ret_conv;
12896 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint32_t e) {
12897 LDKDecodeError e_conv;
12898 e_conv.inner = (void*)(e & (~1));
12899 e_conv.is_owned = (e & 1) || (e == 0);
12900 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12901 e_conv = DecodeError_clone(&e_conv);
12902 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
12903 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
12904 return (uint64_t)ret_conv;
12907 jboolean __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint32_t o) {
12908 LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(o & ~1);
12909 jboolean ret_val = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
12913 void __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint32_t _res) {
12914 if ((_res & 1) != 0) return;
12915 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12916 CHECK_ACCESS(_res_ptr);
12917 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
12919 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
12922 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
12923 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
12924 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
12925 return (uint64_t)ret_conv;
12927 int64_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint32_t arg) {
12928 LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
12929 int64_t ret_val = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
12933 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint32_t orig) {
12934 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
12935 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
12936 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
12937 return (uint64_t)ret_conv;
12940 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint32_t o) {
12941 LDKChannelReestablish o_conv;
12942 o_conv.inner = (void*)(o & (~1));
12943 o_conv.is_owned = (o & 1) || (o == 0);
12944 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12945 o_conv = ChannelReestablish_clone(&o_conv);
12946 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
12947 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
12948 return (uint64_t)ret_conv;
12951 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint32_t e) {
12952 LDKDecodeError e_conv;
12953 e_conv.inner = (void*)(e & (~1));
12954 e_conv.is_owned = (e & 1) || (e == 0);
12955 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12956 e_conv = DecodeError_clone(&e_conv);
12957 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
12958 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
12959 return (uint64_t)ret_conv;
12962 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint32_t o) {
12963 LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(o & ~1);
12964 jboolean ret_val = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
12968 void __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint32_t _res) {
12969 if ((_res & 1) != 0) return;
12970 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
12971 CHECK_ACCESS(_res_ptr);
12972 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
12974 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
12977 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
12978 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
12979 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
12980 return (uint64_t)ret_conv;
12982 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint32_t arg) {
12983 LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
12984 int64_t ret_val = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
12988 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint32_t orig) {
12989 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
12990 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
12991 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
12992 return (uint64_t)ret_conv;
12995 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint32_t o) {
12996 LDKClosingSigned o_conv;
12997 o_conv.inner = (void*)(o & (~1));
12998 o_conv.is_owned = (o & 1) || (o == 0);
12999 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13000 o_conv = ClosingSigned_clone(&o_conv);
13001 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
13002 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
13003 return (uint64_t)ret_conv;
13006 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint32_t e) {
13007 LDKDecodeError e_conv;
13008 e_conv.inner = (void*)(e & (~1));
13009 e_conv.is_owned = (e & 1) || (e == 0);
13010 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13011 e_conv = DecodeError_clone(&e_conv);
13012 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
13013 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
13014 return (uint64_t)ret_conv;
13017 jboolean __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint32_t o) {
13018 LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(o & ~1);
13019 jboolean ret_val = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
13023 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint32_t _res) {
13024 if ((_res & 1) != 0) return;
13025 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13026 CHECK_ACCESS(_res_ptr);
13027 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
13029 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
13032 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
13033 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
13034 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
13035 return (uint64_t)ret_conv;
13037 int64_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
13038 LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
13039 int64_t ret_val = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
13043 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint32_t orig) {
13044 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
13045 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
13046 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
13047 return (uint64_t)ret_conv;
13050 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint32_t o) {
13051 LDKClosingSignedFeeRange o_conv;
13052 o_conv.inner = (void*)(o & (~1));
13053 o_conv.is_owned = (o & 1) || (o == 0);
13054 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13055 o_conv = ClosingSignedFeeRange_clone(&o_conv);
13056 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
13057 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
13058 return (uint64_t)ret_conv;
13061 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint32_t e) {
13062 LDKDecodeError e_conv;
13063 e_conv.inner = (void*)(e & (~1));
13064 e_conv.is_owned = (e & 1) || (e == 0);
13065 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13066 e_conv = DecodeError_clone(&e_conv);
13067 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
13068 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
13069 return (uint64_t)ret_conv;
13072 jboolean __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint32_t o) {
13073 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(o & ~1);
13074 jboolean ret_val = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
13078 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint32_t _res) {
13079 if ((_res & 1) != 0) return;
13080 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13081 CHECK_ACCESS(_res_ptr);
13082 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
13084 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
13087 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
13088 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
13089 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
13090 return (uint64_t)ret_conv;
13092 int64_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
13093 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
13094 int64_t ret_val = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
13098 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint32_t orig) {
13099 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
13100 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
13101 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
13102 return (uint64_t)ret_conv;
13105 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint32_t o) {
13106 LDKCommitmentSigned o_conv;
13107 o_conv.inner = (void*)(o & (~1));
13108 o_conv.is_owned = (o & 1) || (o == 0);
13109 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13110 o_conv = CommitmentSigned_clone(&o_conv);
13111 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
13112 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
13113 return (uint64_t)ret_conv;
13116 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint32_t e) {
13117 LDKDecodeError e_conv;
13118 e_conv.inner = (void*)(e & (~1));
13119 e_conv.is_owned = (e & 1) || (e == 0);
13120 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13121 e_conv = DecodeError_clone(&e_conv);
13122 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
13123 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
13124 return (uint64_t)ret_conv;
13127 jboolean __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint32_t o) {
13128 LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(o & ~1);
13129 jboolean ret_val = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
13133 void __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint32_t _res) {
13134 if ((_res & 1) != 0) return;
13135 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13136 CHECK_ACCESS(_res_ptr);
13137 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
13139 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
13142 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
13143 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
13144 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
13145 return (uint64_t)ret_conv;
13147 int64_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
13148 LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
13149 int64_t ret_val = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
13153 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint32_t orig) {
13154 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
13155 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
13156 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
13157 return (uint64_t)ret_conv;
13160 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint32_t o) {
13161 LDKFundingCreated o_conv;
13162 o_conv.inner = (void*)(o & (~1));
13163 o_conv.is_owned = (o & 1) || (o == 0);
13164 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13165 o_conv = FundingCreated_clone(&o_conv);
13166 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
13167 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
13168 return (uint64_t)ret_conv;
13171 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint32_t e) {
13172 LDKDecodeError e_conv;
13173 e_conv.inner = (void*)(e & (~1));
13174 e_conv.is_owned = (e & 1) || (e == 0);
13175 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13176 e_conv = DecodeError_clone(&e_conv);
13177 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
13178 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
13179 return (uint64_t)ret_conv;
13182 jboolean __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint32_t o) {
13183 LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(o & ~1);
13184 jboolean ret_val = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
13188 void __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint32_t _res) {
13189 if ((_res & 1) != 0) return;
13190 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13191 CHECK_ACCESS(_res_ptr);
13192 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
13194 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
13197 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
13198 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
13199 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
13200 return (uint64_t)ret_conv;
13202 int64_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint32_t arg) {
13203 LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
13204 int64_t ret_val = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
13208 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint32_t orig) {
13209 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
13210 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
13211 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
13212 return (uint64_t)ret_conv;
13215 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint32_t o) {
13216 LDKFundingSigned o_conv;
13217 o_conv.inner = (void*)(o & (~1));
13218 o_conv.is_owned = (o & 1) || (o == 0);
13219 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13220 o_conv = FundingSigned_clone(&o_conv);
13221 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
13222 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
13223 return (uint64_t)ret_conv;
13226 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint32_t e) {
13227 LDKDecodeError e_conv;
13228 e_conv.inner = (void*)(e & (~1));
13229 e_conv.is_owned = (e & 1) || (e == 0);
13230 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13231 e_conv = DecodeError_clone(&e_conv);
13232 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
13233 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
13234 return (uint64_t)ret_conv;
13237 jboolean __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint32_t o) {
13238 LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(o & ~1);
13239 jboolean ret_val = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
13243 void __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint32_t _res) {
13244 if ((_res & 1) != 0) return;
13245 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13246 CHECK_ACCESS(_res_ptr);
13247 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
13249 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
13252 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
13253 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
13254 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
13255 return (uint64_t)ret_conv;
13257 int64_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
13258 LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
13259 int64_t ret_val = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
13263 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint32_t orig) {
13264 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
13265 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
13266 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
13267 return (uint64_t)ret_conv;
13270 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_ok(uint32_t o) {
13271 LDKFundingLocked o_conv;
13272 o_conv.inner = (void*)(o & (~1));
13273 o_conv.is_owned = (o & 1) || (o == 0);
13274 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13275 o_conv = FundingLocked_clone(&o_conv);
13276 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
13277 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
13278 return (uint64_t)ret_conv;
13281 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_err(uint32_t e) {
13282 LDKDecodeError e_conv;
13283 e_conv.inner = (void*)(e & (~1));
13284 e_conv.is_owned = (e & 1) || (e == 0);
13285 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13286 e_conv = DecodeError_clone(&e_conv);
13287 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
13288 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
13289 return (uint64_t)ret_conv;
13292 jboolean __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_is_ok(uint32_t o) {
13293 LDKCResult_FundingLockedDecodeErrorZ* o_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(o & ~1);
13294 jboolean ret_val = CResult_FundingLockedDecodeErrorZ_is_ok(o_conv);
13298 void __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_free(uint32_t _res) {
13299 if ((_res & 1) != 0) return;
13300 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13301 CHECK_ACCESS(_res_ptr);
13302 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(_res_ptr);
13304 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
13307 static inline uint64_t CResult_FundingLockedDecodeErrorZ_clone_ptr(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR arg) {
13308 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
13309 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(arg);
13310 return (uint64_t)ret_conv;
13312 int64_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_clone_ptr(uint32_t arg) {
13313 LDKCResult_FundingLockedDecodeErrorZ* arg_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
13314 int64_t ret_val = CResult_FundingLockedDecodeErrorZ_clone_ptr(arg_conv);
13318 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_clone(uint32_t orig) {
13319 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
13320 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
13321 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
13322 return (uint64_t)ret_conv;
13325 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_ok(uint32_t o) {
13327 o_conv.inner = (void*)(o & (~1));
13328 o_conv.is_owned = (o & 1) || (o == 0);
13329 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13330 o_conv = Init_clone(&o_conv);
13331 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
13332 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
13333 return (uint64_t)ret_conv;
13336 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_err(uint32_t e) {
13337 LDKDecodeError e_conv;
13338 e_conv.inner = (void*)(e & (~1));
13339 e_conv.is_owned = (e & 1) || (e == 0);
13340 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13341 e_conv = DecodeError_clone(&e_conv);
13342 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
13343 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
13344 return (uint64_t)ret_conv;
13347 jboolean __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_is_ok(uint32_t o) {
13348 LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)(o & ~1);
13349 jboolean ret_val = CResult_InitDecodeErrorZ_is_ok(o_conv);
13353 void __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_free(uint32_t _res) {
13354 if ((_res & 1) != 0) return;
13355 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13356 CHECK_ACCESS(_res_ptr);
13357 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
13359 CResult_InitDecodeErrorZ_free(_res_conv);
13362 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
13363 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
13364 *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
13365 return (uint64_t)ret_conv;
13367 int64_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint32_t arg) {
13368 LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
13369 int64_t ret_val = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
13373 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_clone(uint32_t orig) {
13374 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
13375 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
13376 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
13377 return (uint64_t)ret_conv;
13380 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint32_t o) {
13381 LDKOpenChannel o_conv;
13382 o_conv.inner = (void*)(o & (~1));
13383 o_conv.is_owned = (o & 1) || (o == 0);
13384 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13385 o_conv = OpenChannel_clone(&o_conv);
13386 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
13387 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
13388 return (uint64_t)ret_conv;
13391 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint32_t e) {
13392 LDKDecodeError e_conv;
13393 e_conv.inner = (void*)(e & (~1));
13394 e_conv.is_owned = (e & 1) || (e == 0);
13395 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13396 e_conv = DecodeError_clone(&e_conv);
13397 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
13398 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
13399 return (uint64_t)ret_conv;
13402 jboolean __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint32_t o) {
13403 LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(o & ~1);
13404 jboolean ret_val = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
13408 void __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint32_t _res) {
13409 if ((_res & 1) != 0) return;
13410 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13411 CHECK_ACCESS(_res_ptr);
13412 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
13414 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
13417 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
13418 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
13419 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
13420 return (uint64_t)ret_conv;
13422 int64_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint32_t arg) {
13423 LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
13424 int64_t ret_val = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
13428 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint32_t orig) {
13429 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
13430 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
13431 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
13432 return (uint64_t)ret_conv;
13435 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint32_t o) {
13436 LDKRevokeAndACK o_conv;
13437 o_conv.inner = (void*)(o & (~1));
13438 o_conv.is_owned = (o & 1) || (o == 0);
13439 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13440 o_conv = RevokeAndACK_clone(&o_conv);
13441 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
13442 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
13443 return (uint64_t)ret_conv;
13446 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint32_t e) {
13447 LDKDecodeError e_conv;
13448 e_conv.inner = (void*)(e & (~1));
13449 e_conv.is_owned = (e & 1) || (e == 0);
13450 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13451 e_conv = DecodeError_clone(&e_conv);
13452 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
13453 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
13454 return (uint64_t)ret_conv;
13457 jboolean __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint32_t o) {
13458 LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(o & ~1);
13459 jboolean ret_val = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
13463 void __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint32_t _res) {
13464 if ((_res & 1) != 0) return;
13465 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13466 CHECK_ACCESS(_res_ptr);
13467 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
13469 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
13472 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
13473 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
13474 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
13475 return (uint64_t)ret_conv;
13477 int64_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint32_t arg) {
13478 LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
13479 int64_t ret_val = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
13483 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint32_t orig) {
13484 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
13485 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
13486 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
13487 return (uint64_t)ret_conv;
13490 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint32_t o) {
13491 LDKShutdown o_conv;
13492 o_conv.inner = (void*)(o & (~1));
13493 o_conv.is_owned = (o & 1) || (o == 0);
13494 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13495 o_conv = Shutdown_clone(&o_conv);
13496 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
13497 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
13498 return (uint64_t)ret_conv;
13501 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_err(uint32_t e) {
13502 LDKDecodeError e_conv;
13503 e_conv.inner = (void*)(e & (~1));
13504 e_conv.is_owned = (e & 1) || (e == 0);
13505 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13506 e_conv = DecodeError_clone(&e_conv);
13507 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
13508 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
13509 return (uint64_t)ret_conv;
13512 jboolean __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint32_t o) {
13513 LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)(o & ~1);
13514 jboolean ret_val = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
13518 void __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_free(uint32_t _res) {
13519 if ((_res & 1) != 0) return;
13520 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13521 CHECK_ACCESS(_res_ptr);
13522 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
13524 CResult_ShutdownDecodeErrorZ_free(_res_conv);
13527 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
13528 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
13529 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
13530 return (uint64_t)ret_conv;
13532 int64_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint32_t arg) {
13533 LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
13534 int64_t ret_val = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
13538 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint32_t orig) {
13539 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
13540 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
13541 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
13542 return (uint64_t)ret_conv;
13545 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint32_t o) {
13546 LDKUpdateFailHTLC o_conv;
13547 o_conv.inner = (void*)(o & (~1));
13548 o_conv.is_owned = (o & 1) || (o == 0);
13549 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13550 o_conv = UpdateFailHTLC_clone(&o_conv);
13551 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
13552 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
13553 return (uint64_t)ret_conv;
13556 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint32_t e) {
13557 LDKDecodeError e_conv;
13558 e_conv.inner = (void*)(e & (~1));
13559 e_conv.is_owned = (e & 1) || (e == 0);
13560 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13561 e_conv = DecodeError_clone(&e_conv);
13562 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
13563 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
13564 return (uint64_t)ret_conv;
13567 jboolean __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint32_t o) {
13568 LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(o & ~1);
13569 jboolean ret_val = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
13573 void __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint32_t _res) {
13574 if ((_res & 1) != 0) return;
13575 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13576 CHECK_ACCESS(_res_ptr);
13577 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
13579 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
13582 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
13583 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
13584 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
13585 return (uint64_t)ret_conv;
13587 int64_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
13588 LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
13589 int64_t ret_val = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
13593 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint32_t orig) {
13594 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
13595 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
13596 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
13597 return (uint64_t)ret_conv;
13600 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint32_t o) {
13601 LDKUpdateFailMalformedHTLC o_conv;
13602 o_conv.inner = (void*)(o & (~1));
13603 o_conv.is_owned = (o & 1) || (o == 0);
13604 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13605 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
13606 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
13607 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
13608 return (uint64_t)ret_conv;
13611 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint32_t e) {
13612 LDKDecodeError e_conv;
13613 e_conv.inner = (void*)(e & (~1));
13614 e_conv.is_owned = (e & 1) || (e == 0);
13615 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13616 e_conv = DecodeError_clone(&e_conv);
13617 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
13618 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
13619 return (uint64_t)ret_conv;
13622 jboolean __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint32_t o) {
13623 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(o & ~1);
13624 jboolean ret_val = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
13628 void __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint32_t _res) {
13629 if ((_res & 1) != 0) return;
13630 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13631 CHECK_ACCESS(_res_ptr);
13632 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
13634 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
13637 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
13638 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
13639 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
13640 return (uint64_t)ret_conv;
13642 int64_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
13643 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
13644 int64_t ret_val = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
13648 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint32_t orig) {
13649 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
13650 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
13651 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
13652 return (uint64_t)ret_conv;
13655 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint32_t o) {
13656 LDKUpdateFee o_conv;
13657 o_conv.inner = (void*)(o & (~1));
13658 o_conv.is_owned = (o & 1) || (o == 0);
13659 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13660 o_conv = UpdateFee_clone(&o_conv);
13661 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
13662 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
13663 return (uint64_t)ret_conv;
13666 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint32_t e) {
13667 LDKDecodeError e_conv;
13668 e_conv.inner = (void*)(e & (~1));
13669 e_conv.is_owned = (e & 1) || (e == 0);
13670 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13671 e_conv = DecodeError_clone(&e_conv);
13672 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
13673 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
13674 return (uint64_t)ret_conv;
13677 jboolean __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint32_t o) {
13678 LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(o & ~1);
13679 jboolean ret_val = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
13683 void __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint32_t _res) {
13684 if ((_res & 1) != 0) return;
13685 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13686 CHECK_ACCESS(_res_ptr);
13687 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
13689 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
13692 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
13693 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
13694 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
13695 return (uint64_t)ret_conv;
13697 int64_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint32_t arg) {
13698 LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
13699 int64_t ret_val = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
13703 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint32_t orig) {
13704 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
13705 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
13706 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
13707 return (uint64_t)ret_conv;
13710 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint32_t o) {
13711 LDKUpdateFulfillHTLC o_conv;
13712 o_conv.inner = (void*)(o & (~1));
13713 o_conv.is_owned = (o & 1) || (o == 0);
13714 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13715 o_conv = UpdateFulfillHTLC_clone(&o_conv);
13716 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
13717 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
13718 return (uint64_t)ret_conv;
13721 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint32_t e) {
13722 LDKDecodeError e_conv;
13723 e_conv.inner = (void*)(e & (~1));
13724 e_conv.is_owned = (e & 1) || (e == 0);
13725 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13726 e_conv = DecodeError_clone(&e_conv);
13727 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
13728 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
13729 return (uint64_t)ret_conv;
13732 jboolean __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint32_t o) {
13733 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(o & ~1);
13734 jboolean ret_val = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
13738 void __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint32_t _res) {
13739 if ((_res & 1) != 0) return;
13740 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13741 CHECK_ACCESS(_res_ptr);
13742 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
13744 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
13747 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
13748 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
13749 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
13750 return (uint64_t)ret_conv;
13752 int64_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
13753 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
13754 int64_t ret_val = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
13758 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint32_t orig) {
13759 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
13760 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
13761 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
13762 return (uint64_t)ret_conv;
13765 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint32_t o) {
13766 LDKUpdateAddHTLC o_conv;
13767 o_conv.inner = (void*)(o & (~1));
13768 o_conv.is_owned = (o & 1) || (o == 0);
13769 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13770 o_conv = UpdateAddHTLC_clone(&o_conv);
13771 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
13772 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
13773 return (uint64_t)ret_conv;
13776 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint32_t e) {
13777 LDKDecodeError e_conv;
13778 e_conv.inner = (void*)(e & (~1));
13779 e_conv.is_owned = (e & 1) || (e == 0);
13780 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13781 e_conv = DecodeError_clone(&e_conv);
13782 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
13783 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
13784 return (uint64_t)ret_conv;
13787 jboolean __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint32_t o) {
13788 LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(o & ~1);
13789 jboolean ret_val = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
13793 void __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint32_t _res) {
13794 if ((_res & 1) != 0) return;
13795 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13796 CHECK_ACCESS(_res_ptr);
13797 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
13799 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
13802 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
13803 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
13804 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
13805 return (uint64_t)ret_conv;
13807 int64_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
13808 LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
13809 int64_t ret_val = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
13813 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint32_t orig) {
13814 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
13815 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
13816 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
13817 return (uint64_t)ret_conv;
13820 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_ok(uint32_t o) {
13822 o_conv.inner = (void*)(o & (~1));
13823 o_conv.is_owned = (o & 1) || (o == 0);
13824 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13825 o_conv = Ping_clone(&o_conv);
13826 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
13827 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
13828 return (uint64_t)ret_conv;
13831 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_err(uint32_t e) {
13832 LDKDecodeError e_conv;
13833 e_conv.inner = (void*)(e & (~1));
13834 e_conv.is_owned = (e & 1) || (e == 0);
13835 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13836 e_conv = DecodeError_clone(&e_conv);
13837 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
13838 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
13839 return (uint64_t)ret_conv;
13842 jboolean __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_is_ok(uint32_t o) {
13843 LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)(o & ~1);
13844 jboolean ret_val = CResult_PingDecodeErrorZ_is_ok(o_conv);
13848 void __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_free(uint32_t _res) {
13849 if ((_res & 1) != 0) return;
13850 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13851 CHECK_ACCESS(_res_ptr);
13852 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
13854 CResult_PingDecodeErrorZ_free(_res_conv);
13857 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
13858 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
13859 *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
13860 return (uint64_t)ret_conv;
13862 int64_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint32_t arg) {
13863 LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
13864 int64_t ret_val = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
13868 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_clone(uint32_t orig) {
13869 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
13870 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
13871 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
13872 return (uint64_t)ret_conv;
13875 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_ok(uint32_t o) {
13877 o_conv.inner = (void*)(o & (~1));
13878 o_conv.is_owned = (o & 1) || (o == 0);
13879 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13880 o_conv = Pong_clone(&o_conv);
13881 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
13882 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
13883 return (uint64_t)ret_conv;
13886 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_err(uint32_t e) {
13887 LDKDecodeError e_conv;
13888 e_conv.inner = (void*)(e & (~1));
13889 e_conv.is_owned = (e & 1) || (e == 0);
13890 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13891 e_conv = DecodeError_clone(&e_conv);
13892 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
13893 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
13894 return (uint64_t)ret_conv;
13897 jboolean __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_is_ok(uint32_t o) {
13898 LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)(o & ~1);
13899 jboolean ret_val = CResult_PongDecodeErrorZ_is_ok(o_conv);
13903 void __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_free(uint32_t _res) {
13904 if ((_res & 1) != 0) return;
13905 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13906 CHECK_ACCESS(_res_ptr);
13907 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
13909 CResult_PongDecodeErrorZ_free(_res_conv);
13912 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
13913 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
13914 *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
13915 return (uint64_t)ret_conv;
13917 int64_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint32_t arg) {
13918 LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
13919 int64_t ret_val = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
13923 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_clone(uint32_t orig) {
13924 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
13925 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
13926 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
13927 return (uint64_t)ret_conv;
13930 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
13931 LDKUnsignedChannelAnnouncement o_conv;
13932 o_conv.inner = (void*)(o & (~1));
13933 o_conv.is_owned = (o & 1) || (o == 0);
13934 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13935 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
13936 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
13937 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
13938 return (uint64_t)ret_conv;
13941 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
13942 LDKDecodeError e_conv;
13943 e_conv.inner = (void*)(e & (~1));
13944 e_conv.is_owned = (e & 1) || (e == 0);
13945 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13946 e_conv = DecodeError_clone(&e_conv);
13947 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
13948 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
13949 return (uint64_t)ret_conv;
13952 jboolean __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
13953 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(o & ~1);
13954 jboolean ret_val = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
13958 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
13959 if ((_res & 1) != 0) return;
13960 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
13961 CHECK_ACCESS(_res_ptr);
13962 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
13964 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
13967 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
13968 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
13969 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
13970 return (uint64_t)ret_conv;
13972 int64_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
13973 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
13974 int64_t ret_val = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
13978 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
13979 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
13980 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
13981 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
13982 return (uint64_t)ret_conv;
13985 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
13986 LDKChannelAnnouncement o_conv;
13987 o_conv.inner = (void*)(o & (~1));
13988 o_conv.is_owned = (o & 1) || (o == 0);
13989 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13990 o_conv = ChannelAnnouncement_clone(&o_conv);
13991 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
13992 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
13993 return (uint64_t)ret_conv;
13996 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
13997 LDKDecodeError e_conv;
13998 e_conv.inner = (void*)(e & (~1));
13999 e_conv.is_owned = (e & 1) || (e == 0);
14000 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14001 e_conv = DecodeError_clone(&e_conv);
14002 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
14003 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
14004 return (uint64_t)ret_conv;
14007 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
14008 LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(o & ~1);
14009 jboolean ret_val = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
14013 void __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
14014 if ((_res & 1) != 0) return;
14015 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14016 CHECK_ACCESS(_res_ptr);
14017 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
14019 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
14022 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
14023 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
14024 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
14025 return (uint64_t)ret_conv;
14027 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
14028 LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
14029 int64_t ret_val = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
14033 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
14034 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
14035 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
14036 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
14037 return (uint64_t)ret_conv;
14040 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint32_t o) {
14041 LDKUnsignedChannelUpdate o_conv;
14042 o_conv.inner = (void*)(o & (~1));
14043 o_conv.is_owned = (o & 1) || (o == 0);
14044 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14045 o_conv = UnsignedChannelUpdate_clone(&o_conv);
14046 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
14047 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
14048 return (uint64_t)ret_conv;
14051 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint32_t e) {
14052 LDKDecodeError e_conv;
14053 e_conv.inner = (void*)(e & (~1));
14054 e_conv.is_owned = (e & 1) || (e == 0);
14055 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14056 e_conv = DecodeError_clone(&e_conv);
14057 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
14058 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
14059 return (uint64_t)ret_conv;
14062 jboolean __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint32_t o) {
14063 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(o & ~1);
14064 jboolean ret_val = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
14068 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint32_t _res) {
14069 if ((_res & 1) != 0) return;
14070 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14071 CHECK_ACCESS(_res_ptr);
14072 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
14074 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
14077 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
14078 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
14079 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
14080 return (uint64_t)ret_conv;
14082 int64_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
14083 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
14084 int64_t ret_val = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
14088 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
14089 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
14090 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
14091 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
14092 return (uint64_t)ret_conv;
14095 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint32_t o) {
14096 LDKChannelUpdate o_conv;
14097 o_conv.inner = (void*)(o & (~1));
14098 o_conv.is_owned = (o & 1) || (o == 0);
14099 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14100 o_conv = ChannelUpdate_clone(&o_conv);
14101 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
14102 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
14103 return (uint64_t)ret_conv;
14106 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint32_t e) {
14107 LDKDecodeError e_conv;
14108 e_conv.inner = (void*)(e & (~1));
14109 e_conv.is_owned = (e & 1) || (e == 0);
14110 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14111 e_conv = DecodeError_clone(&e_conv);
14112 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
14113 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
14114 return (uint64_t)ret_conv;
14117 jboolean __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint32_t o) {
14118 LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(o & ~1);
14119 jboolean ret_val = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
14123 void __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint32_t _res) {
14124 if ((_res & 1) != 0) return;
14125 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14126 CHECK_ACCESS(_res_ptr);
14127 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
14129 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
14132 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
14133 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
14134 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
14135 return (uint64_t)ret_conv;
14137 int64_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
14138 LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
14139 int64_t ret_val = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
14143 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
14144 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
14145 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
14146 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
14147 return (uint64_t)ret_conv;
14150 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint32_t o) {
14151 LDKErrorMessage o_conv;
14152 o_conv.inner = (void*)(o & (~1));
14153 o_conv.is_owned = (o & 1) || (o == 0);
14154 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14155 o_conv = ErrorMessage_clone(&o_conv);
14156 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
14157 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
14158 return (uint64_t)ret_conv;
14161 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint32_t e) {
14162 LDKDecodeError e_conv;
14163 e_conv.inner = (void*)(e & (~1));
14164 e_conv.is_owned = (e & 1) || (e == 0);
14165 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14166 e_conv = DecodeError_clone(&e_conv);
14167 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
14168 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
14169 return (uint64_t)ret_conv;
14172 jboolean __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint32_t o) {
14173 LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(o & ~1);
14174 jboolean ret_val = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
14178 void __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint32_t _res) {
14179 if ((_res & 1) != 0) return;
14180 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14181 CHECK_ACCESS(_res_ptr);
14182 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
14184 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
14187 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
14188 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
14189 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
14190 return (uint64_t)ret_conv;
14192 int64_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint32_t arg) {
14193 LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
14194 int64_t ret_val = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
14198 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint32_t orig) {
14199 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
14200 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
14201 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
14202 return (uint64_t)ret_conv;
14205 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
14206 LDKUnsignedNodeAnnouncement o_conv;
14207 o_conv.inner = (void*)(o & (~1));
14208 o_conv.is_owned = (o & 1) || (o == 0);
14209 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14210 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
14211 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
14212 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
14213 return (uint64_t)ret_conv;
14216 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint32_t e) {
14217 LDKDecodeError e_conv;
14218 e_conv.inner = (void*)(e & (~1));
14219 e_conv.is_owned = (e & 1) || (e == 0);
14220 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14221 e_conv = DecodeError_clone(&e_conv);
14222 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
14223 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
14224 return (uint64_t)ret_conv;
14227 jboolean __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
14228 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(o & ~1);
14229 jboolean ret_val = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
14233 void __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
14234 if ((_res & 1) != 0) return;
14235 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14236 CHECK_ACCESS(_res_ptr);
14237 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
14239 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
14242 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
14243 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
14244 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
14245 return (uint64_t)ret_conv;
14247 int64_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
14248 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
14249 int64_t ret_val = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
14253 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
14254 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
14255 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
14256 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
14257 return (uint64_t)ret_conv;
14260 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
14261 LDKNodeAnnouncement o_conv;
14262 o_conv.inner = (void*)(o & (~1));
14263 o_conv.is_owned = (o & 1) || (o == 0);
14264 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14265 o_conv = NodeAnnouncement_clone(&o_conv);
14266 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
14267 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
14268 return (uint64_t)ret_conv;
14271 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint32_t e) {
14272 LDKDecodeError e_conv;
14273 e_conv.inner = (void*)(e & (~1));
14274 e_conv.is_owned = (e & 1) || (e == 0);
14275 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14276 e_conv = DecodeError_clone(&e_conv);
14277 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
14278 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
14279 return (uint64_t)ret_conv;
14282 jboolean __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
14283 LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(o & ~1);
14284 jboolean ret_val = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
14288 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
14289 if ((_res & 1) != 0) return;
14290 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14291 CHECK_ACCESS(_res_ptr);
14292 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
14294 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
14297 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
14298 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
14299 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
14300 return (uint64_t)ret_conv;
14302 int64_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
14303 LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
14304 int64_t ret_val = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
14308 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
14309 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
14310 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
14311 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
14312 return (uint64_t)ret_conv;
14315 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint32_t o) {
14316 LDKQueryShortChannelIds o_conv;
14317 o_conv.inner = (void*)(o & (~1));
14318 o_conv.is_owned = (o & 1) || (o == 0);
14319 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14320 o_conv = QueryShortChannelIds_clone(&o_conv);
14321 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
14322 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
14323 return (uint64_t)ret_conv;
14326 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint32_t e) {
14327 LDKDecodeError e_conv;
14328 e_conv.inner = (void*)(e & (~1));
14329 e_conv.is_owned = (e & 1) || (e == 0);
14330 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14331 e_conv = DecodeError_clone(&e_conv);
14332 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
14333 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
14334 return (uint64_t)ret_conv;
14337 jboolean __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint32_t o) {
14338 LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(o & ~1);
14339 jboolean ret_val = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
14343 void __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint32_t _res) {
14344 if ((_res & 1) != 0) return;
14345 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14346 CHECK_ACCESS(_res_ptr);
14347 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
14349 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
14352 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
14353 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
14354 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
14355 return (uint64_t)ret_conv;
14357 int64_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint32_t arg) {
14358 LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
14359 int64_t ret_val = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
14363 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint32_t orig) {
14364 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
14365 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
14366 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
14367 return (uint64_t)ret_conv;
14370 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint32_t o) {
14371 LDKReplyShortChannelIdsEnd o_conv;
14372 o_conv.inner = (void*)(o & (~1));
14373 o_conv.is_owned = (o & 1) || (o == 0);
14374 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14375 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
14376 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
14377 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
14378 return (uint64_t)ret_conv;
14381 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint32_t e) {
14382 LDKDecodeError e_conv;
14383 e_conv.inner = (void*)(e & (~1));
14384 e_conv.is_owned = (e & 1) || (e == 0);
14385 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14386 e_conv = DecodeError_clone(&e_conv);
14387 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
14388 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
14389 return (uint64_t)ret_conv;
14392 jboolean __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint32_t o) {
14393 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(o & ~1);
14394 jboolean ret_val = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
14398 void __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint32_t _res) {
14399 if ((_res & 1) != 0) return;
14400 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14401 CHECK_ACCESS(_res_ptr);
14402 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
14404 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
14407 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
14408 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
14409 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
14410 return (uint64_t)ret_conv;
14412 int64_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint32_t arg) {
14413 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
14414 int64_t ret_val = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
14418 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint32_t orig) {
14419 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
14420 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
14421 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
14422 return (uint64_t)ret_conv;
14425 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint32_t o) {
14426 LDKQueryChannelRange o_conv;
14427 o_conv.inner = (void*)(o & (~1));
14428 o_conv.is_owned = (o & 1) || (o == 0);
14429 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14430 o_conv = QueryChannelRange_clone(&o_conv);
14431 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
14432 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
14433 return (uint64_t)ret_conv;
14436 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint32_t e) {
14437 LDKDecodeError e_conv;
14438 e_conv.inner = (void*)(e & (~1));
14439 e_conv.is_owned = (e & 1) || (e == 0);
14440 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14441 e_conv = DecodeError_clone(&e_conv);
14442 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
14443 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
14444 return (uint64_t)ret_conv;
14447 jboolean __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint32_t o) {
14448 LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(o & ~1);
14449 jboolean ret_val = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
14453 void __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint32_t _res) {
14454 if ((_res & 1) != 0) return;
14455 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14456 CHECK_ACCESS(_res_ptr);
14457 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
14459 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
14462 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
14463 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
14464 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
14465 return (uint64_t)ret_conv;
14467 int64_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
14468 LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
14469 int64_t ret_val = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
14473 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint32_t orig) {
14474 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
14475 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
14476 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
14477 return (uint64_t)ret_conv;
14480 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint32_t o) {
14481 LDKReplyChannelRange o_conv;
14482 o_conv.inner = (void*)(o & (~1));
14483 o_conv.is_owned = (o & 1) || (o == 0);
14484 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14485 o_conv = ReplyChannelRange_clone(&o_conv);
14486 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
14487 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
14488 return (uint64_t)ret_conv;
14491 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint32_t e) {
14492 LDKDecodeError e_conv;
14493 e_conv.inner = (void*)(e & (~1));
14494 e_conv.is_owned = (e & 1) || (e == 0);
14495 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14496 e_conv = DecodeError_clone(&e_conv);
14497 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
14498 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
14499 return (uint64_t)ret_conv;
14502 jboolean __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint32_t o) {
14503 LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(o & ~1);
14504 jboolean ret_val = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
14508 void __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint32_t _res) {
14509 if ((_res & 1) != 0) return;
14510 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14511 CHECK_ACCESS(_res_ptr);
14512 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
14514 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
14517 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
14518 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
14519 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
14520 return (uint64_t)ret_conv;
14522 int64_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
14523 LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
14524 int64_t ret_val = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
14528 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint32_t orig) {
14529 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
14530 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
14531 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
14532 return (uint64_t)ret_conv;
14535 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint32_t o) {
14536 LDKGossipTimestampFilter o_conv;
14537 o_conv.inner = (void*)(o & (~1));
14538 o_conv.is_owned = (o & 1) || (o == 0);
14539 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14540 o_conv = GossipTimestampFilter_clone(&o_conv);
14541 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
14542 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
14543 return (uint64_t)ret_conv;
14546 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint32_t e) {
14547 LDKDecodeError e_conv;
14548 e_conv.inner = (void*)(e & (~1));
14549 e_conv.is_owned = (e & 1) || (e == 0);
14550 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14551 e_conv = DecodeError_clone(&e_conv);
14552 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
14553 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
14554 return (uint64_t)ret_conv;
14557 jboolean __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint32_t o) {
14558 LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(o & ~1);
14559 jboolean ret_val = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
14563 void __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint32_t _res) {
14564 if ((_res & 1) != 0) return;
14565 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14566 CHECK_ACCESS(_res_ptr);
14567 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
14569 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
14572 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
14573 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
14574 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
14575 return (uint64_t)ret_conv;
14577 int64_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint32_t arg) {
14578 LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
14579 int64_t ret_val = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
14583 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint32_t orig) {
14584 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
14585 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
14586 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
14587 return (uint64_t)ret_conv;
14590 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
14591 LDKDelayedPaymentOutputDescriptor o_conv;
14592 o_conv.inner = (void*)(o & (~1));
14593 o_conv.is_owned = (o & 1) || (o == 0);
14594 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14595 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
14596 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14597 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
14598 return (uint64_t)ret_conv;
14601 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
14602 LDKDecodeError e_conv;
14603 e_conv.inner = (void*)(e & (~1));
14604 e_conv.is_owned = (e & 1) || (e == 0);
14605 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14606 e_conv = DecodeError_clone(&e_conv);
14607 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14608 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
14609 return (uint64_t)ret_conv;
14612 jboolean __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
14613 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
14614 jboolean ret_val = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
14618 void __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
14619 if ((_res & 1) != 0) return;
14620 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14621 CHECK_ACCESS(_res_ptr);
14622 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
14624 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
14627 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14628 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14629 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
14630 return (uint64_t)ret_conv;
14632 int64_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
14633 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
14634 int64_t ret_val = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
14638 uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
14639 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
14640 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14641 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
14642 return (uint64_t)ret_conv;
14645 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
14646 LDKStaticPaymentOutputDescriptor o_conv;
14647 o_conv.inner = (void*)(o & (~1));
14648 o_conv.is_owned = (o & 1) || (o == 0);
14649 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14650 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
14651 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14652 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
14653 return (uint64_t)ret_conv;
14656 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
14657 LDKDecodeError e_conv;
14658 e_conv.inner = (void*)(e & (~1));
14659 e_conv.is_owned = (e & 1) || (e == 0);
14660 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14661 e_conv = DecodeError_clone(&e_conv);
14662 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14663 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
14664 return (uint64_t)ret_conv;
14667 jboolean __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
14668 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
14669 jboolean ret_val = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
14673 void __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
14674 if ((_res & 1) != 0) return;
14675 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14676 CHECK_ACCESS(_res_ptr);
14677 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
14679 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
14682 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14683 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14684 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
14685 return (uint64_t)ret_conv;
14687 int64_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
14688 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
14689 int64_t ret_val = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
14693 uint32_t __attribute__((visibility("default"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
14694 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
14695 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14696 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
14697 return (uint64_t)ret_conv;
14700 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
14701 void* o_ptr = (void*)(((uint64_t)o) & ~1);
14702 CHECK_ACCESS(o_ptr);
14703 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
14704 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1));
14705 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14706 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
14707 return (uint64_t)ret_conv;
14710 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint32_t e) {
14711 LDKDecodeError e_conv;
14712 e_conv.inner = (void*)(e & (~1));
14713 e_conv.is_owned = (e & 1) || (e == 0);
14714 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14715 e_conv = DecodeError_clone(&e_conv);
14716 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14717 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
14718 return (uint64_t)ret_conv;
14721 jboolean __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
14722 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(o & ~1);
14723 jboolean ret_val = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
14727 void __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
14728 if ((_res & 1) != 0) return;
14729 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14730 CHECK_ACCESS(_res_ptr);
14731 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
14733 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
14736 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14737 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14738 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
14739 return (uint64_t)ret_conv;
14741 int64_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
14742 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
14743 int64_t ret_val = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
14747 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
14748 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
14749 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14750 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
14751 return (uint64_t)ret_conv;
14754 static inline uint64_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
14755 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
14756 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
14757 return ((uint64_t)ret_conv);
14759 int64_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(uint32_t arg) {
14760 LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(arg & ~1);
14761 int64_t ret_val = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
14765 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint32_t orig) {
14766 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
14767 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
14768 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
14769 return ((uint64_t)ret_conv);
14772 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
14773 LDKSignature a_ref;
14774 CHECK(a->arr_len == 64);
14775 memcpy(a_ref.compact_form, a->elems, 64);
14776 LDKCVec_SignatureZ b_constr;
14777 b_constr.datalen = b->arr_len;
14778 if (b_constr.datalen > 0)
14779 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
14781 b_constr.data = NULL;
14782 int8_tArray* b_vals = (void*) b->elems;
14783 for (size_t m = 0; m < b_constr.datalen; m++) {
14784 int8_tArray b_conv_12 = b_vals[m];
14785 LDKSignature b_conv_12_ref;
14786 CHECK(b_conv_12->arr_len == 64);
14787 memcpy(b_conv_12_ref.compact_form, b_conv_12->elems, 64);
14788 b_constr.data[m] = b_conv_12_ref;
14790 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
14791 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
14792 return ((uint64_t)ret_conv);
14795 void __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint32_t _res) {
14796 if ((_res & 1) != 0) return;
14797 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14798 CHECK_ACCESS(_res_ptr);
14799 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
14801 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
14804 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint32_t o) {
14805 void* o_ptr = (void*)(((uint64_t)o) & ~1);
14806 CHECK_ACCESS(o_ptr);
14807 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
14808 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1));
14809 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
14810 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
14811 return (uint64_t)ret_conv;
14814 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
14815 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
14816 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
14817 return (uint64_t)ret_conv;
14820 jboolean __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(uint32_t o) {
14821 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(o & ~1);
14822 jboolean ret_val = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
14826 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint32_t _res) {
14827 if ((_res & 1) != 0) return;
14828 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14829 CHECK_ACCESS(_res_ptr);
14830 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
14832 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
14835 static inline uint64_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
14836 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
14837 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
14838 return (uint64_t)ret_conv;
14840 int64_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(uint32_t arg) {
14841 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
14842 int64_t ret_val = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
14846 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint32_t orig) {
14847 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
14848 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
14849 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
14850 return (uint64_t)ret_conv;
14853 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
14854 LDKSignature o_ref;
14855 CHECK(o->arr_len == 64);
14856 memcpy(o_ref.compact_form, o->elems, 64);
14857 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
14858 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
14859 return (uint64_t)ret_conv;
14862 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_err() {
14863 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
14864 *ret_conv = CResult_SignatureNoneZ_err();
14865 return (uint64_t)ret_conv;
14868 jboolean __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_is_ok(uint32_t o) {
14869 LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)(o & ~1);
14870 jboolean ret_val = CResult_SignatureNoneZ_is_ok(o_conv);
14874 void __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_free(uint32_t _res) {
14875 if ((_res & 1) != 0) return;
14876 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14877 CHECK_ACCESS(_res_ptr);
14878 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
14880 CResult_SignatureNoneZ_free(_res_conv);
14883 static inline uint64_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
14884 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
14885 *ret_conv = CResult_SignatureNoneZ_clone(arg);
14886 return (uint64_t)ret_conv;
14888 int64_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_clone_ptr(uint32_t arg) {
14889 LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)(arg & ~1);
14890 int64_t ret_val = CResult_SignatureNoneZ_clone_ptr(arg_conv);
14894 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_clone(uint32_t orig) {
14895 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
14896 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
14897 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
14898 return (uint64_t)ret_conv;
14901 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_ok(uint32_t o) {
14902 void* o_ptr = (void*)(((uint64_t)o) & ~1);
14903 CHECK_ACCESS(o_ptr);
14904 LDKSign o_conv = *(LDKSign*)(o_ptr);
14905 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
14906 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
14907 return (uint64_t)ret_conv;
14910 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_err(uint32_t e) {
14911 LDKDecodeError e_conv;
14912 e_conv.inner = (void*)(e & (~1));
14913 e_conv.is_owned = (e & 1) || (e == 0);
14914 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14915 e_conv = DecodeError_clone(&e_conv);
14916 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
14917 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
14918 return (uint64_t)ret_conv;
14921 jboolean __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_is_ok(uint32_t o) {
14922 LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)(o & ~1);
14923 jboolean ret_val = CResult_SignDecodeErrorZ_is_ok(o_conv);
14927 void __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_free(uint32_t _res) {
14928 if ((_res & 1) != 0) return;
14929 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14930 CHECK_ACCESS(_res_ptr);
14931 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
14933 CResult_SignDecodeErrorZ_free(_res_conv);
14936 static inline uint64_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
14937 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
14938 *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
14939 return (uint64_t)ret_conv;
14941 int64_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_clone_ptr(uint32_t arg) {
14942 LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
14943 int64_t ret_val = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
14947 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_clone(uint32_t orig) {
14948 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
14949 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
14950 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
14951 return (uint64_t)ret_conv;
14954 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray arg) {
14955 LDKRecoverableSignature arg_ref;
14956 CHECK(arg->arr_len == 68);
14957 memcpy(arg_ref.serialized_form, arg->elems, 68);
14958 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
14959 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(arg_ref);
14960 return (uint64_t)ret_conv;
14963 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_err() {
14964 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
14965 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
14966 return (uint64_t)ret_conv;
14969 jboolean __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint32_t o) {
14970 LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)(o & ~1);
14971 jboolean ret_val = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
14975 void __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_free(uint32_t _res) {
14976 if ((_res & 1) != 0) return;
14977 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
14978 CHECK_ACCESS(_res_ptr);
14979 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
14981 CResult_RecoverableSignatureNoneZ_free(_res_conv);
14984 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
14985 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
14986 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
14987 return (uint64_t)ret_conv;
14989 int64_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint32_t arg) {
14990 LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
14991 int64_t ret_val = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
14995 uint32_t __attribute__((visibility("default"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint32_t orig) {
14996 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
14997 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
14998 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
14999 return (uint64_t)ret_conv;
15002 void __attribute__((visibility("default"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
15003 LDKCVec_CVec_u8ZZ _res_constr;
15004 _res_constr.datalen = _res->arr_len;
15005 if (_res_constr.datalen > 0)
15006 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
15008 _res_constr.data = NULL;
15009 int8_tArray* _res_vals = (void*) _res->elems;
15010 for (size_t m = 0; m < _res_constr.datalen; m++) {
15011 int8_tArray _res_conv_12 = _res_vals[m];
15012 LDKCVec_u8Z _res_conv_12_ref;
15013 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
15014 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
15015 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen);
15016 _res_constr.data[m] = _res_conv_12_ref;
15018 CVec_CVec_u8ZZ_free(_res_constr);
15021 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
15022 LDKCVec_CVec_u8ZZ o_constr;
15023 o_constr.datalen = o->arr_len;
15024 if (o_constr.datalen > 0)
15025 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
15027 o_constr.data = NULL;
15028 int8_tArray* o_vals = (void*) o->elems;
15029 for (size_t m = 0; m < o_constr.datalen; m++) {
15030 int8_tArray o_conv_12 = o_vals[m];
15031 LDKCVec_u8Z o_conv_12_ref;
15032 o_conv_12_ref.datalen = o_conv_12->arr_len;
15033 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
15034 memcpy(o_conv_12_ref.data, o_conv_12->elems, o_conv_12_ref.datalen);
15035 o_constr.data[m] = o_conv_12_ref;
15037 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15038 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
15039 return (uint64_t)ret_conv;
15042 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
15043 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15044 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
15045 return (uint64_t)ret_conv;
15048 jboolean __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok(uint32_t o) {
15049 LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(o & ~1);
15050 jboolean ret_val = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
15054 void __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint32_t _res) {
15055 if ((_res & 1) != 0) return;
15056 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15057 CHECK_ACCESS(_res_ptr);
15058 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
15060 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
15063 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
15064 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15065 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
15066 return (uint64_t)ret_conv;
15068 int64_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(uint32_t arg) {
15069 LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
15070 int64_t ret_val = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
15074 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint32_t orig) {
15075 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
15076 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15077 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
15078 return (uint64_t)ret_conv;
15081 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint32_t o) {
15082 LDKInMemorySigner o_conv;
15083 o_conv.inner = (void*)(o & (~1));
15084 o_conv.is_owned = (o & 1) || (o == 0);
15085 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15086 o_conv = InMemorySigner_clone(&o_conv);
15087 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15088 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
15089 return (uint64_t)ret_conv;
15092 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint32_t e) {
15093 LDKDecodeError e_conv;
15094 e_conv.inner = (void*)(e & (~1));
15095 e_conv.is_owned = (e & 1) || (e == 0);
15096 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15097 e_conv = DecodeError_clone(&e_conv);
15098 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15099 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
15100 return (uint64_t)ret_conv;
15103 jboolean __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint32_t o) {
15104 LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(o & ~1);
15105 jboolean ret_val = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
15109 void __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint32_t _res) {
15110 if ((_res & 1) != 0) return;
15111 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15112 CHECK_ACCESS(_res_ptr);
15113 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
15115 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
15118 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
15119 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15120 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
15121 return (uint64_t)ret_conv;
15123 int64_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint32_t arg) {
15124 LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
15125 int64_t ret_val = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
15129 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint32_t orig) {
15130 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
15131 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15132 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
15133 return (uint64_t)ret_conv;
15136 void __attribute__((visibility("default"))) TS_CVec_TxOutZ_free(uint32_tArray _res) {
15137 LDKCVec_TxOutZ _res_constr;
15138 _res_constr.datalen = _res->arr_len;
15139 if (_res_constr.datalen > 0)
15140 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
15142 _res_constr.data = NULL;
15143 uint32_t* _res_vals = _res->elems;
15144 for (size_t h = 0; h < _res_constr.datalen; h++) {
15145 uint32_t _res_conv_7 = _res_vals[h];
15146 void* _res_conv_7_ptr = (void*)(((uint64_t)_res_conv_7) & ~1);
15147 CHECK_ACCESS(_res_conv_7_ptr);
15148 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
15149 FREE((void*)_res_conv_7);
15150 _res_constr.data[h] = _res_conv_7_conv;
15152 CVec_TxOutZ_free(_res_constr);
15155 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
15156 LDKTransaction o_ref;
15157 o_ref.datalen = o->arr_len;
15158 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
15159 memcpy(o_ref.data, o->elems, o_ref.datalen);
15160 o_ref.data_is_owned = true;
15161 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15162 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
15163 return (uint64_t)ret_conv;
15166 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_err() {
15167 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15168 *ret_conv = CResult_TransactionNoneZ_err();
15169 return (uint64_t)ret_conv;
15172 jboolean __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_is_ok(uint32_t o) {
15173 LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)(o & ~1);
15174 jboolean ret_val = CResult_TransactionNoneZ_is_ok(o_conv);
15178 void __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_free(uint32_t _res) {
15179 if ((_res & 1) != 0) return;
15180 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15181 CHECK_ACCESS(_res_ptr);
15182 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
15184 CResult_TransactionNoneZ_free(_res_conv);
15187 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
15188 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15189 *ret_conv = CResult_TransactionNoneZ_clone(arg);
15190 return (uint64_t)ret_conv;
15192 int64_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_clone_ptr(uint32_t arg) {
15193 LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)(arg & ~1);
15194 int64_t ret_val = CResult_TransactionNoneZ_clone_ptr(arg_conv);
15198 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_clone(uint32_t orig) {
15199 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
15200 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15201 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
15202 return (uint64_t)ret_conv;
15205 uint32_t __attribute__((visibility("default"))) TS_COption_FilterZ_some(uint32_t o) {
15206 void* o_ptr = (void*)(((uint64_t)o) & ~1);
15207 CHECK_ACCESS(o_ptr);
15208 LDKFilter o_conv = *(LDKFilter*)(o_ptr);
15209 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
15210 *ret_copy = COption_FilterZ_some(o_conv);
15211 uint64_t ret_ref = (uint64_t)ret_copy;
15215 uint32_t __attribute__((visibility("default"))) TS_COption_FilterZ_none() {
15216 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
15217 *ret_copy = COption_FilterZ_none();
15218 uint64_t ret_ref = (uint64_t)ret_copy;
15222 void __attribute__((visibility("default"))) TS_COption_FilterZ_free(uint32_t _res) {
15223 if ((_res & 1) != 0) return;
15224 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15225 CHECK_ACCESS(_res_ptr);
15226 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
15228 COption_FilterZ_free(_res_conv);
15231 uint32_t __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint32_t o) {
15232 LDKLockedChannelMonitor o_conv;
15233 o_conv.inner = (void*)(o & (~1));
15234 o_conv.is_owned = (o & 1) || (o == 0);
15235 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15236 // Warning: we need a move here but no clone is available for LDKLockedChannelMonitor
15237 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
15238 *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
15239 return (uint64_t)ret_conv;
15242 uint32_t __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
15243 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
15244 *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
15245 return (uint64_t)ret_conv;
15248 jboolean __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint32_t o) {
15249 LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(o & ~1);
15250 jboolean ret_val = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
15254 void __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint32_t _res) {
15255 if ((_res & 1) != 0) return;
15256 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15257 CHECK_ACCESS(_res_ptr);
15258 LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
15260 CResult_LockedChannelMonitorNoneZ_free(_res_conv);
15263 void __attribute__((visibility("default"))) TS_CVec_OutPointZ_free(uint32_tArray _res) {
15264 LDKCVec_OutPointZ _res_constr;
15265 _res_constr.datalen = _res->arr_len;
15266 if (_res_constr.datalen > 0)
15267 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
15269 _res_constr.data = NULL;
15270 uint32_t* _res_vals = _res->elems;
15271 for (size_t k = 0; k < _res_constr.datalen; k++) {
15272 uint32_t _res_conv_10 = _res_vals[k];
15273 LDKOutPoint _res_conv_10_conv;
15274 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
15275 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
15276 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
15277 _res_constr.data[k] = _res_conv_10_conv;
15279 CVec_OutPointZ_free(_res_constr);
15282 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_ok() {
15283 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15284 *ret_conv = CResult_NoneAPIErrorZ_ok();
15285 return (uint64_t)ret_conv;
15288 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_err(uint32_t e) {
15289 void* e_ptr = (void*)(((uint64_t)e) & ~1);
15290 CHECK_ACCESS(e_ptr);
15291 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15292 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
15293 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15294 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
15295 return (uint64_t)ret_conv;
15298 jboolean __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_is_ok(uint32_t o) {
15299 LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)(o & ~1);
15300 jboolean ret_val = CResult_NoneAPIErrorZ_is_ok(o_conv);
15304 void __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_free(uint32_t _res) {
15305 if ((_res & 1) != 0) return;
15306 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15307 CHECK_ACCESS(_res_ptr);
15308 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
15310 CResult_NoneAPIErrorZ_free(_res_conv);
15313 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
15314 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15315 *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
15316 return (uint64_t)ret_conv;
15318 int64_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint32_t arg) {
15319 LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
15320 int64_t ret_val = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
15324 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_clone(uint32_t orig) {
15325 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
15326 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15327 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
15328 return (uint64_t)ret_conv;
15331 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_some(int16_t o) {
15332 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15333 *ret_copy = COption_u16Z_some(o);
15334 uint64_t ret_ref = (uint64_t)ret_copy;
15338 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_none() {
15339 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15340 *ret_copy = COption_u16Z_none();
15341 uint64_t ret_ref = (uint64_t)ret_copy;
15345 void __attribute__((visibility("default"))) TS_COption_u16Z_free(uint32_t _res) {
15346 if ((_res & 1) != 0) return;
15347 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15348 CHECK_ACCESS(_res_ptr);
15349 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
15351 COption_u16Z_free(_res_conv);
15354 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
15355 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15356 *ret_copy = COption_u16Z_clone(arg);
15357 uint64_t ret_ref = (uint64_t)ret_copy;
15360 int64_t __attribute__((visibility("default"))) TS_COption_u16Z_clone_ptr(uint32_t arg) {
15361 LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)arg;
15362 int64_t ret_val = COption_u16Z_clone_ptr(arg_conv);
15366 uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_clone(uint32_t orig) {
15367 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
15368 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15369 *ret_copy = COption_u16Z_clone(orig_conv);
15370 uint64_t ret_ref = (uint64_t)ret_copy;
15374 void __attribute__((visibility("default"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint32_tArray _res) {
15375 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
15376 _res_constr.datalen = _res->arr_len;
15377 if (_res_constr.datalen > 0)
15378 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
15380 _res_constr.data = NULL;
15381 uint32_t* _res_vals = _res->elems;
15382 for (size_t w = 0; w < _res_constr.datalen; w++) {
15383 uint32_t _res_conv_22 = _res_vals[w];
15384 void* _res_conv_22_ptr = (void*)(((uint64_t)_res_conv_22) & ~1);
15385 CHECK_ACCESS(_res_conv_22_ptr);
15386 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
15387 FREE((void*)_res_conv_22);
15388 _res_constr.data[w] = _res_conv_22_conv;
15390 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
15393 void __attribute__((visibility("default"))) TS_CVec_APIErrorZ_free(uint32_tArray _res) {
15394 LDKCVec_APIErrorZ _res_constr;
15395 _res_constr.datalen = _res->arr_len;
15396 if (_res_constr.datalen > 0)
15397 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
15399 _res_constr.data = NULL;
15400 uint32_t* _res_vals = _res->elems;
15401 for (size_t k = 0; k < _res_constr.datalen; k++) {
15402 uint32_t _res_conv_10 = _res_vals[k];
15403 void* _res_conv_10_ptr = (void*)(((uint64_t)_res_conv_10) & ~1);
15404 CHECK_ACCESS(_res_conv_10_ptr);
15405 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
15406 FREE((void*)_res_conv_10);
15407 _res_constr.data[k] = _res_conv_10_conv;
15409 CVec_APIErrorZ_free(_res_constr);
15412 uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) {
15413 LDKThirtyTwoBytes o_ref;
15414 CHECK(o->arr_len == 32);
15415 memcpy(o_ref.data, o->elems, 32);
15416 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15417 *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
15418 return (uint64_t)ret_conv;
15421 uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_err(uint32_t e) {
15422 void* e_ptr = (void*)(((uint64_t)e) & ~1);
15423 CHECK_ACCESS(e_ptr);
15424 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15425 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
15426 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15427 *ret_conv = CResult__u832APIErrorZ_err(e_conv);
15428 return (uint64_t)ret_conv;
15431 jboolean __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_is_ok(uint32_t o) {
15432 LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)(o & ~1);
15433 jboolean ret_val = CResult__u832APIErrorZ_is_ok(o_conv);
15437 void __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_free(uint32_t _res) {
15438 if ((_res & 1) != 0) return;
15439 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15440 CHECK_ACCESS(_res_ptr);
15441 LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
15443 CResult__u832APIErrorZ_free(_res_conv);
15446 static inline uint64_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
15447 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15448 *ret_conv = CResult__u832APIErrorZ_clone(arg);
15449 return (uint64_t)ret_conv;
15451 int64_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_clone_ptr(uint32_t arg) {
15452 LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)(arg & ~1);
15453 int64_t ret_val = CResult__u832APIErrorZ_clone_ptr(arg_conv);
15457 uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_clone(uint32_t orig) {
15458 LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1);
15459 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15460 *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
15461 return (uint64_t)ret_conv;
15464 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_ok(int8_tArray o) {
15465 LDKThirtyTwoBytes o_ref;
15466 CHECK(o->arr_len == 32);
15467 memcpy(o_ref.data, o->elems, 32);
15468 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15469 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
15470 return (uint64_t)ret_conv;
15473 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_err(uint32_t e) {
15474 void* e_ptr = (void*)(((uint64_t)e) & ~1);
15475 CHECK_ACCESS(e_ptr);
15476 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
15477 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
15478 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15479 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
15480 return (uint64_t)ret_conv;
15483 jboolean __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_is_ok(uint32_t o) {
15484 LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(o & ~1);
15485 jboolean ret_val = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv);
15489 void __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_free(uint32_t _res) {
15490 if ((_res & 1) != 0) return;
15491 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15492 CHECK_ACCESS(_res_ptr);
15493 LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
15495 CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
15498 static inline uint64_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) {
15499 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15500 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg);
15501 return (uint64_t)ret_conv;
15503 int64_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr(uint32_t arg) {
15504 LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
15505 int64_t ret_val = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv);
15509 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone(uint32_t orig) {
15510 LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1);
15511 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15512 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
15513 return (uint64_t)ret_conv;
15516 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_ok() {
15517 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15518 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
15519 return (uint64_t)ret_conv;
15522 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_err(uint32_t e) {
15523 void* e_ptr = (void*)(((uint64_t)e) & ~1);
15524 CHECK_ACCESS(e_ptr);
15525 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
15526 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
15527 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15528 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
15529 return (uint64_t)ret_conv;
15532 jboolean __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint32_t o) {
15533 LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)(o & ~1);
15534 jboolean ret_val = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
15538 void __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_free(uint32_t _res) {
15539 if ((_res & 1) != 0) return;
15540 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15541 CHECK_ACCESS(_res_ptr);
15542 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
15544 CResult_NonePaymentSendFailureZ_free(_res_conv);
15547 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
15548 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15549 *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
15550 return (uint64_t)ret_conv;
15552 int64_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint32_t arg) {
15553 LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
15554 int64_t ret_val = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
15558 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_clone(uint32_t orig) {
15559 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
15560 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15561 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
15562 return (uint64_t)ret_conv;
15565 static inline uint64_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
15566 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
15567 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
15568 return ((uint64_t)ret_conv);
15570 int64_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr(uint32_t arg) {
15571 LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(arg & ~1);
15572 int64_t ret_val = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
15576 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint32_t orig) {
15577 LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1);
15578 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
15579 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
15580 return ((uint64_t)ret_conv);
15583 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, int8_tArray b) {
15584 LDKThirtyTwoBytes a_ref;
15585 CHECK(a->arr_len == 32);
15586 memcpy(a_ref.data, a->elems, 32);
15587 LDKThirtyTwoBytes b_ref;
15588 CHECK(b->arr_len == 32);
15589 memcpy(b_ref.data, b->elems, 32);
15590 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
15591 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
15592 return ((uint64_t)ret_conv);
15595 void __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint32_t _res) {
15596 if ((_res & 1) != 0) return;
15597 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15598 CHECK_ACCESS(_res_ptr);
15599 LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
15601 C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
15604 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint32_t o) {
15605 void* o_ptr = (void*)(((uint64_t)o) & ~1);
15606 CHECK_ACCESS(o_ptr);
15607 LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
15608 o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uint64_t)o) & ~1));
15609 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15610 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
15611 return (uint64_t)ret_conv;
15614 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint32_t e) {
15615 void* e_ptr = (void*)(((uint64_t)e) & ~1);
15616 CHECK_ACCESS(e_ptr);
15617 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
15618 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
15619 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15620 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
15621 return (uint64_t)ret_conv;
15624 jboolean __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(uint32_t o) {
15625 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(o & ~1);
15626 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
15630 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint32_t _res) {
15631 if ((_res & 1) != 0) return;
15632 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15633 CHECK_ACCESS(_res_ptr);
15634 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
15636 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
15639 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
15640 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15641 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
15642 return (uint64_t)ret_conv;
15644 int64_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(uint32_t arg) {
15645 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
15646 int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
15650 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint32_t orig) {
15651 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1);
15652 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
15653 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
15654 return (uint64_t)ret_conv;
15657 static inline uint64_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
15658 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15659 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
15660 return ((uint64_t)ret_conv);
15662 int64_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(uint32_t arg) {
15663 LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(arg & ~1);
15664 int64_t ret_val = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
15668 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint32_t orig) {
15669 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
15670 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15671 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
15672 return ((uint64_t)ret_conv);
15675 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
15676 LDKThirtyTwoBytes a_ref;
15677 CHECK(a->arr_len == 32);
15678 memcpy(a_ref.data, a->elems, 32);
15679 LDKThirtyTwoBytes b_ref;
15680 CHECK(b->arr_len == 32);
15681 memcpy(b_ref.data, b->elems, 32);
15682 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15683 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
15684 return ((uint64_t)ret_conv);
15687 void __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint32_t _res) {
15688 if ((_res & 1) != 0) return;
15689 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15690 CHECK_ACCESS(_res_ptr);
15691 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
15693 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
15696 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(uint32_t o) {
15697 void* o_ptr = (void*)(((uint64_t)o) & ~1);
15698 CHECK_ACCESS(o_ptr);
15699 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
15700 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)o) & ~1));
15701 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
15702 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
15703 return (uint64_t)ret_conv;
15706 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() {
15707 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
15708 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
15709 return (uint64_t)ret_conv;
15712 jboolean __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(uint32_t o) {
15713 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(o & ~1);
15714 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
15718 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(uint32_t _res) {
15719 if ((_res & 1) != 0) return;
15720 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15721 CHECK_ACCESS(_res_ptr);
15722 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
15724 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
15727 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
15728 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
15729 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
15730 return (uint64_t)ret_conv;
15732 int64_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(uint32_t arg) {
15733 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1);
15734 int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
15738 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(uint32_t orig) {
15739 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(orig & ~1);
15740 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
15741 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
15742 return (uint64_t)ret_conv;
15745 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(uint32_t o) {
15746 void* o_ptr = (void*)(((uint64_t)o) & ~1);
15747 CHECK_ACCESS(o_ptr);
15748 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
15749 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)o) & ~1));
15750 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
15751 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
15752 return (uint64_t)ret_conv;
15755 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(uint32_t e) {
15756 void* e_ptr = (void*)(((uint64_t)e) & ~1);
15757 CHECK_ACCESS(e_ptr);
15758 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15759 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
15760 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
15761 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
15762 return (uint64_t)ret_conv;
15765 jboolean __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(uint32_t o) {
15766 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(o & ~1);
15767 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
15771 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(uint32_t _res) {
15772 if ((_res & 1) != 0) return;
15773 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15774 CHECK_ACCESS(_res_ptr);
15775 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
15777 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
15780 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
15781 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
15782 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
15783 return (uint64_t)ret_conv;
15785 int64_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(uint32_t arg) {
15786 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1);
15787 int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
15791 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(uint32_t orig) {
15792 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(orig & ~1);
15793 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
15794 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
15795 return (uint64_t)ret_conv;
15798 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_ok(int8_tArray o) {
15799 LDKThirtyTwoBytes o_ref;
15800 CHECK(o->arr_len == 32);
15801 memcpy(o_ref.data, o->elems, 32);
15802 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
15803 *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
15804 return (uint64_t)ret_conv;
15807 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_err() {
15808 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
15809 *ret_conv = CResult_PaymentSecretNoneZ_err();
15810 return (uint64_t)ret_conv;
15813 jboolean __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_is_ok(uint32_t o) {
15814 LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)(o & ~1);
15815 jboolean ret_val = CResult_PaymentSecretNoneZ_is_ok(o_conv);
15819 void __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_free(uint32_t _res) {
15820 if ((_res & 1) != 0) return;
15821 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15822 CHECK_ACCESS(_res_ptr);
15823 LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
15825 CResult_PaymentSecretNoneZ_free(_res_conv);
15828 static inline uint64_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
15829 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
15830 *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
15831 return (uint64_t)ret_conv;
15833 int64_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_clone_ptr(uint32_t arg) {
15834 LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1);
15835 int64_t ret_val = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
15839 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_clone(uint32_t orig) {
15840 LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)(orig & ~1);
15841 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
15842 *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
15843 return (uint64_t)ret_conv;
15846 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
15847 LDKThirtyTwoBytes o_ref;
15848 CHECK(o->arr_len == 32);
15849 memcpy(o_ref.data, o->elems, 32);
15850 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15851 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
15852 return (uint64_t)ret_conv;
15855 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint32_t e) {
15856 void* e_ptr = (void*)(((uint64_t)e) & ~1);
15857 CHECK_ACCESS(e_ptr);
15858 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15859 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
15860 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15861 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
15862 return (uint64_t)ret_conv;
15865 jboolean __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_is_ok(uint32_t o) {
15866 LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(o & ~1);
15867 jboolean ret_val = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
15871 void __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint32_t _res) {
15872 if ((_res & 1) != 0) return;
15873 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15874 CHECK_ACCESS(_res_ptr);
15875 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
15877 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
15880 static inline uint64_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
15881 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15882 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
15883 return (uint64_t)ret_conv;
15885 int64_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_clone_ptr(uint32_t arg) {
15886 LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
15887 int64_t ret_val = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
15891 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint32_t orig) {
15892 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
15893 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15894 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
15895 return (uint64_t)ret_conv;
15898 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_ok(int8_tArray o) {
15899 LDKThirtyTwoBytes o_ref;
15900 CHECK(o->arr_len == 32);
15901 memcpy(o_ref.data, o->elems, 32);
15902 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
15903 *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
15904 return (uint64_t)ret_conv;
15907 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_err(uint32_t e) {
15908 void* e_ptr = (void*)(((uint64_t)e) & ~1);
15909 CHECK_ACCESS(e_ptr);
15910 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15911 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
15912 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
15913 *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
15914 return (uint64_t)ret_conv;
15917 jboolean __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_is_ok(uint32_t o) {
15918 LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(o & ~1);
15919 jboolean ret_val = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
15923 void __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_free(uint32_t _res) {
15924 if ((_res & 1) != 0) return;
15925 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15926 CHECK_ACCESS(_res_ptr);
15927 LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
15929 CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
15932 static inline uint64_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
15933 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
15934 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
15935 return (uint64_t)ret_conv;
15937 int64_t __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr(uint32_t arg) {
15938 LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1);
15939 int64_t ret_val = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
15943 uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_clone(uint32_t orig) {
15944 LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(orig & ~1);
15945 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
15946 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
15947 return (uint64_t)ret_conv;
15950 void __attribute__((visibility("default"))) TS_CVec_ChannelMonitorZ_free(uint32_tArray _res) {
15951 LDKCVec_ChannelMonitorZ _res_constr;
15952 _res_constr.datalen = _res->arr_len;
15953 if (_res_constr.datalen > 0)
15954 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
15956 _res_constr.data = NULL;
15957 uint32_t* _res_vals = _res->elems;
15958 for (size_t q = 0; q < _res_constr.datalen; q++) {
15959 uint32_t _res_conv_16 = _res_vals[q];
15960 LDKChannelMonitor _res_conv_16_conv;
15961 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
15962 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
15963 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
15964 _res_constr.data[q] = _res_conv_16_conv;
15966 CVec_ChannelMonitorZ_free(_res_constr);
15969 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
15970 LDKThirtyTwoBytes a_ref;
15971 CHECK(a->arr_len == 32);
15972 memcpy(a_ref.data, a->elems, 32);
15973 LDKChannelManager b_conv;
15974 b_conv.inner = (void*)(b & (~1));
15975 b_conv.is_owned = (b & 1) || (b == 0);
15976 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
15977 // Warning: we need a move here but no clone is available for LDKChannelManager
15978 LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
15979 *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
15980 return ((uint64_t)ret_conv);
15983 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint32_t _res) {
15984 if ((_res & 1) != 0) return;
15985 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
15986 CHECK_ACCESS(_res_ptr);
15987 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
15989 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
15992 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint32_t o) {
15993 void* o_ptr = (void*)(((uint64_t)o) & ~1);
15994 CHECK_ACCESS(o_ptr);
15995 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
15996 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
15997 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
15998 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
15999 return (uint64_t)ret_conv;
16002 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint32_t e) {
16003 LDKDecodeError e_conv;
16004 e_conv.inner = (void*)(e & (~1));
16005 e_conv.is_owned = (e & 1) || (e == 0);
16006 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16007 e_conv = DecodeError_clone(&e_conv);
16008 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16009 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
16010 return (uint64_t)ret_conv;
16013 jboolean __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(uint32_t o) {
16014 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(o & ~1);
16015 jboolean ret_val = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
16019 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint32_t _res) {
16020 if ((_res & 1) != 0) return;
16021 void* _res_ptr = (void*)(((uint64_t)_res) & ~1);
16022 CHECK_ACCESS(_res_ptr);
16023 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
16025 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
16028 void __attribute__((visibility("default"))) TS_PaymentPurpose_free(uint32_t this_ptr) {
16029 if ((this_ptr & 1) != 0) return;
16030 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16031 CHECK_ACCESS(this_ptr_ptr);
16032 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
16033 FREE((void*)this_ptr);
16034 PaymentPurpose_free(this_ptr_conv);
16037 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
16038 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
16039 *ret_copy = PaymentPurpose_clone(arg);
16040 uint64_t ret_ref = (uint64_t)ret_copy;
16043 int64_t __attribute__((visibility("default"))) TS_PaymentPurpose_clone_ptr(uint32_t arg) {
16044 LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)arg;
16045 int64_t ret_val = PaymentPurpose_clone_ptr(arg_conv);
16049 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_clone(uint32_t orig) {
16050 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
16051 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
16052 *ret_copy = PaymentPurpose_clone(orig_conv);
16053 uint64_t ret_ref = (uint64_t)ret_copy;
16057 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret) {
16058 LDKThirtyTwoBytes payment_preimage_ref;
16059 CHECK(payment_preimage->arr_len == 32);
16060 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32);
16061 LDKThirtyTwoBytes payment_secret_ref;
16062 CHECK(payment_secret->arr_len == 32);
16063 memcpy(payment_secret_ref.data, payment_secret->elems, 32);
16064 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
16065 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
16066 uint64_t ret_ref = (uint64_t)ret_copy;
16070 uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
16071 LDKThirtyTwoBytes a_ref;
16072 CHECK(a->arr_len == 32);
16073 memcpy(a_ref.data, a->elems, 32);
16074 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
16075 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
16076 uint64_t ret_ref = (uint64_t)ret_copy;
16080 void __attribute__((visibility("default"))) TS_ClosureReason_free(uint32_t this_ptr) {
16081 if ((this_ptr & 1) != 0) return;
16082 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16083 CHECK_ACCESS(this_ptr_ptr);
16084 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
16085 FREE((void*)this_ptr);
16086 ClosureReason_free(this_ptr_conv);
16089 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
16090 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16091 *ret_copy = ClosureReason_clone(arg);
16092 uint64_t ret_ref = (uint64_t)ret_copy;
16095 int64_t __attribute__((visibility("default"))) TS_ClosureReason_clone_ptr(uint32_t arg) {
16096 LDKClosureReason* arg_conv = (LDKClosureReason*)arg;
16097 int64_t ret_val = ClosureReason_clone_ptr(arg_conv);
16101 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_clone(uint32_t orig) {
16102 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
16103 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16104 *ret_copy = ClosureReason_clone(orig_conv);
16105 uint64_t ret_ref = (uint64_t)ret_copy;
16109 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_counterparty_force_closed(jstring peer_msg) {
16110 LDKStr peer_msg_conv = str_ref_to_owned_c(peer_msg);
16111 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16112 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
16113 uint64_t ret_ref = (uint64_t)ret_copy;
16117 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_holder_force_closed() {
16118 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16119 *ret_copy = ClosureReason_holder_force_closed();
16120 uint64_t ret_ref = (uint64_t)ret_copy;
16124 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_cooperative_closure() {
16125 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16126 *ret_copy = ClosureReason_cooperative_closure();
16127 uint64_t ret_ref = (uint64_t)ret_copy;
16131 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_commitment_tx_confirmed() {
16132 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16133 *ret_copy = ClosureReason_commitment_tx_confirmed();
16134 uint64_t ret_ref = (uint64_t)ret_copy;
16138 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_funding_timed_out() {
16139 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16140 *ret_copy = ClosureReason_funding_timed_out();
16141 uint64_t ret_ref = (uint64_t)ret_copy;
16145 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_processing_error(jstring err) {
16146 LDKStr err_conv = str_ref_to_owned_c(err);
16147 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16148 *ret_copy = ClosureReason_processing_error(err_conv);
16149 uint64_t ret_ref = (uint64_t)ret_copy;
16153 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_disconnected_peer() {
16154 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16155 *ret_copy = ClosureReason_disconnected_peer();
16156 uint64_t ret_ref = (uint64_t)ret_copy;
16160 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_outdated_channel_manager() {
16161 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
16162 *ret_copy = ClosureReason_outdated_channel_manager();
16163 uint64_t ret_ref = (uint64_t)ret_copy;
16167 int8_tArray __attribute__((visibility("default"))) TS_ClosureReason_write(uint32_t obj) {
16168 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
16169 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
16170 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
16171 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
16172 CVec_u8Z_free(ret_var);
16176 uint32_t __attribute__((visibility("default"))) TS_ClosureReason_read(int8_tArray ser) {
16177 LDKu8slice ser_ref;
16178 ser_ref.datalen = ser->arr_len;
16179 ser_ref.data = ser->elems;
16180 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
16181 *ret_conv = ClosureReason_read(ser_ref);
16182 return (uint64_t)ret_conv;
16185 void __attribute__((visibility("default"))) TS_Event_free(uint32_t this_ptr) {
16186 if ((this_ptr & 1) != 0) return;
16187 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16188 CHECK_ACCESS(this_ptr_ptr);
16189 LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
16190 FREE((void*)this_ptr);
16191 Event_free(this_ptr_conv);
16194 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
16195 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16196 *ret_copy = Event_clone(arg);
16197 uint64_t ret_ref = (uint64_t)ret_copy;
16200 int64_t __attribute__((visibility("default"))) TS_Event_clone_ptr(uint32_t arg) {
16201 LDKEvent* arg_conv = (LDKEvent*)arg;
16202 int64_t ret_val = Event_clone_ptr(arg_conv);
16206 uint32_t __attribute__((visibility("default"))) TS_Event_clone(uint32_t orig) {
16207 LDKEvent* orig_conv = (LDKEvent*)orig;
16208 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16209 *ret_copy = Event_clone(orig_conv);
16210 uint64_t ret_ref = (uint64_t)ret_copy;
16214 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) {
16215 LDKThirtyTwoBytes temporary_channel_id_ref;
16216 CHECK(temporary_channel_id->arr_len == 32);
16217 memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32);
16218 LDKCVec_u8Z output_script_ref;
16219 output_script_ref.datalen = output_script->arr_len;
16220 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
16221 memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen);
16222 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16223 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
16224 uint64_t ret_ref = (uint64_t)ret_copy;
16228 uint32_t __attribute__((visibility("default"))) TS_Event_payment_received(int8_tArray payment_hash, int64_t amt, uint32_t purpose) {
16229 LDKThirtyTwoBytes payment_hash_ref;
16230 CHECK(payment_hash->arr_len == 32);
16231 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
16232 void* purpose_ptr = (void*)(((uint64_t)purpose) & ~1);
16233 CHECK_ACCESS(purpose_ptr);
16234 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
16235 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uint64_t)purpose) & ~1));
16236 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16237 *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
16238 uint64_t ret_ref = (uint64_t)ret_copy;
16242 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) {
16243 LDKThirtyTwoBytes payment_id_ref;
16244 CHECK(payment_id->arr_len == 32);
16245 memcpy(payment_id_ref.data, payment_id->elems, 32);
16246 LDKThirtyTwoBytes payment_preimage_ref;
16247 CHECK(payment_preimage->arr_len == 32);
16248 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32);
16249 LDKThirtyTwoBytes payment_hash_ref;
16250 CHECK(payment_hash->arr_len == 32);
16251 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
16252 void* fee_paid_msat_ptr = (void*)(((uint64_t)fee_paid_msat) & ~1);
16253 CHECK_ACCESS(fee_paid_msat_ptr);
16254 LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
16255 fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_paid_msat) & ~1));
16256 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16257 *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
16258 uint64_t ret_ref = (uint64_t)ret_copy;
16262 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) {
16263 LDKThirtyTwoBytes payment_id_ref;
16264 CHECK(payment_id->arr_len == 32);
16265 memcpy(payment_id_ref.data, payment_id->elems, 32);
16266 LDKThirtyTwoBytes payment_hash_ref;
16267 CHECK(payment_hash->arr_len == 32);
16268 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
16269 void* network_update_ptr = (void*)(((uint64_t)network_update) & ~1);
16270 CHECK_ACCESS(network_update_ptr);
16271 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
16272 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1));
16273 LDKCVec_RouteHopZ path_constr;
16274 path_constr.datalen = path->arr_len;
16275 if (path_constr.datalen > 0)
16276 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
16278 path_constr.data = NULL;
16279 uint32_t* path_vals = path->elems;
16280 for (size_t k = 0; k < path_constr.datalen; k++) {
16281 uint32_t path_conv_10 = path_vals[k];
16282 LDKRouteHop path_conv_10_conv;
16283 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
16284 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
16285 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
16286 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
16287 path_constr.data[k] = path_conv_10_conv;
16289 void* short_channel_id_ptr = (void*)(((uint64_t)short_channel_id) & ~1);
16290 CHECK_ACCESS(short_channel_id_ptr);
16291 LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
16292 short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id) & ~1));
16293 LDKRouteParameters retry_conv;
16294 retry_conv.inner = (void*)(retry & (~1));
16295 retry_conv.is_owned = (retry & 1) || (retry == 0);
16296 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
16297 retry_conv = RouteParameters_clone(&retry_conv);
16298 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16299 *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);
16300 uint64_t ret_ref = (uint64_t)ret_copy;
16304 uint32_t __attribute__((visibility("default"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash) {
16305 LDKThirtyTwoBytes payment_id_ref;
16306 CHECK(payment_id->arr_len == 32);
16307 memcpy(payment_id_ref.data, payment_id->elems, 32);
16308 LDKThirtyTwoBytes payment_hash_ref;
16309 CHECK(payment_hash->arr_len == 32);
16310 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
16311 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16312 *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
16313 uint64_t ret_ref = (uint64_t)ret_copy;
16317 uint32_t __attribute__((visibility("default"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
16318 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16319 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
16320 uint64_t ret_ref = (uint64_t)ret_copy;
16324 uint32_t __attribute__((visibility("default"))) TS_Event_spendable_outputs(uint32_tArray outputs) {
16325 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
16326 outputs_constr.datalen = outputs->arr_len;
16327 if (outputs_constr.datalen > 0)
16328 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
16330 outputs_constr.data = NULL;
16331 uint32_t* outputs_vals = outputs->elems;
16332 for (size_t b = 0; b < outputs_constr.datalen; b++) {
16333 uint32_t outputs_conv_27 = outputs_vals[b];
16334 void* outputs_conv_27_ptr = (void*)(((uint64_t)outputs_conv_27) & ~1);
16335 CHECK_ACCESS(outputs_conv_27_ptr);
16336 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
16337 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1));
16338 outputs_constr.data[b] = outputs_conv_27_conv;
16340 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16341 *ret_copy = Event_spendable_outputs(outputs_constr);
16342 uint64_t ret_ref = (uint64_t)ret_copy;
16346 uint32_t __attribute__((visibility("default"))) TS_Event_payment_forwarded(uint32_t fee_earned_msat, jboolean claim_from_onchain_tx) {
16347 void* fee_earned_msat_ptr = (void*)(((uint64_t)fee_earned_msat) & ~1);
16348 CHECK_ACCESS(fee_earned_msat_ptr);
16349 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
16350 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1));
16351 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16352 *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
16353 uint64_t ret_ref = (uint64_t)ret_copy;
16357 uint32_t __attribute__((visibility("default"))) TS_Event_channel_closed(int8_tArray channel_id, int64_t user_channel_id, uint32_t reason) {
16358 LDKThirtyTwoBytes channel_id_ref;
16359 CHECK(channel_id->arr_len == 32);
16360 memcpy(channel_id_ref.data, channel_id->elems, 32);
16361 void* reason_ptr = (void*)(((uint64_t)reason) & ~1);
16362 CHECK_ACCESS(reason_ptr);
16363 LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
16364 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)reason) & ~1));
16365 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16366 *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
16367 uint64_t ret_ref = (uint64_t)ret_copy;
16371 uint32_t __attribute__((visibility("default"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
16372 LDKThirtyTwoBytes channel_id_ref;
16373 CHECK(channel_id->arr_len == 32);
16374 memcpy(channel_id_ref.data, channel_id->elems, 32);
16375 LDKTransaction transaction_ref;
16376 transaction_ref.datalen = transaction->arr_len;
16377 transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
16378 memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen);
16379 transaction_ref.data_is_owned = true;
16380 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16381 *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
16382 uint64_t ret_ref = (uint64_t)ret_copy;
16386 uint32_t __attribute__((visibility("default"))) TS_Event_payment_path_successful(int8_tArray payment_id, int8_tArray payment_hash, uint32_tArray path) {
16387 LDKThirtyTwoBytes payment_id_ref;
16388 CHECK(payment_id->arr_len == 32);
16389 memcpy(payment_id_ref.data, payment_id->elems, 32);
16390 LDKThirtyTwoBytes payment_hash_ref;
16391 CHECK(payment_hash->arr_len == 32);
16392 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
16393 LDKCVec_RouteHopZ path_constr;
16394 path_constr.datalen = path->arr_len;
16395 if (path_constr.datalen > 0)
16396 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
16398 path_constr.data = NULL;
16399 uint32_t* path_vals = path->elems;
16400 for (size_t k = 0; k < path_constr.datalen; k++) {
16401 uint32_t path_conv_10 = path_vals[k];
16402 LDKRouteHop path_conv_10_conv;
16403 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
16404 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
16405 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
16406 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
16407 path_constr.data[k] = path_conv_10_conv;
16409 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16410 *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
16411 uint64_t ret_ref = (uint64_t)ret_copy;
16415 int8_tArray __attribute__((visibility("default"))) TS_Event_write(uint32_t obj) {
16416 LDKEvent* obj_conv = (LDKEvent*)obj;
16417 LDKCVec_u8Z ret_var = Event_write(obj_conv);
16418 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
16419 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
16420 CVec_u8Z_free(ret_var);
16424 uint32_t __attribute__((visibility("default"))) TS_Event_read(int8_tArray ser) {
16425 LDKu8slice ser_ref;
16426 ser_ref.datalen = ser->arr_len;
16427 ser_ref.data = ser->elems;
16428 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
16429 *ret_conv = Event_read(ser_ref);
16430 return (uint64_t)ret_conv;
16433 void __attribute__((visibility("default"))) TS_MessageSendEvent_free(uint32_t this_ptr) {
16434 if ((this_ptr & 1) != 0) return;
16435 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16436 CHECK_ACCESS(this_ptr_ptr);
16437 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
16438 FREE((void*)this_ptr);
16439 MessageSendEvent_free(this_ptr_conv);
16442 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
16443 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16444 *ret_copy = MessageSendEvent_clone(arg);
16445 uint64_t ret_ref = (uint64_t)ret_copy;
16448 int64_t __attribute__((visibility("default"))) TS_MessageSendEvent_clone_ptr(uint32_t arg) {
16449 LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)arg;
16450 int64_t ret_val = MessageSendEvent_clone_ptr(arg_conv);
16454 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_clone(uint32_t orig) {
16455 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
16456 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16457 *ret_copy = MessageSendEvent_clone(orig_conv);
16458 uint64_t ret_ref = (uint64_t)ret_copy;
16462 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint32_t msg) {
16463 LDKPublicKey node_id_ref;
16464 CHECK(node_id->arr_len == 33);
16465 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16466 LDKAcceptChannel msg_conv;
16467 msg_conv.inner = (void*)(msg & (~1));
16468 msg_conv.is_owned = (msg & 1) || (msg == 0);
16469 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16470 msg_conv = AcceptChannel_clone(&msg_conv);
16471 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16472 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
16473 uint64_t ret_ref = (uint64_t)ret_copy;
16477 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint32_t msg) {
16478 LDKPublicKey node_id_ref;
16479 CHECK(node_id->arr_len == 33);
16480 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16481 LDKOpenChannel msg_conv;
16482 msg_conv.inner = (void*)(msg & (~1));
16483 msg_conv.is_owned = (msg & 1) || (msg == 0);
16484 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16485 msg_conv = OpenChannel_clone(&msg_conv);
16486 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16487 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
16488 uint64_t ret_ref = (uint64_t)ret_copy;
16492 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint32_t msg) {
16493 LDKPublicKey node_id_ref;
16494 CHECK(node_id->arr_len == 33);
16495 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16496 LDKFundingCreated msg_conv;
16497 msg_conv.inner = (void*)(msg & (~1));
16498 msg_conv.is_owned = (msg & 1) || (msg == 0);
16499 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16500 msg_conv = FundingCreated_clone(&msg_conv);
16501 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16502 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
16503 uint64_t ret_ref = (uint64_t)ret_copy;
16507 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint32_t msg) {
16508 LDKPublicKey node_id_ref;
16509 CHECK(node_id->arr_len == 33);
16510 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16511 LDKFundingSigned msg_conv;
16512 msg_conv.inner = (void*)(msg & (~1));
16513 msg_conv.is_owned = (msg & 1) || (msg == 0);
16514 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16515 msg_conv = FundingSigned_clone(&msg_conv);
16516 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16517 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
16518 uint64_t ret_ref = (uint64_t)ret_copy;
16522 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_funding_locked(int8_tArray node_id, uint32_t msg) {
16523 LDKPublicKey node_id_ref;
16524 CHECK(node_id->arr_len == 33);
16525 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16526 LDKFundingLocked msg_conv;
16527 msg_conv.inner = (void*)(msg & (~1));
16528 msg_conv.is_owned = (msg & 1) || (msg == 0);
16529 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16530 msg_conv = FundingLocked_clone(&msg_conv);
16531 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16532 *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
16533 uint64_t ret_ref = (uint64_t)ret_copy;
16537 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint32_t msg) {
16538 LDKPublicKey node_id_ref;
16539 CHECK(node_id->arr_len == 33);
16540 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16541 LDKAnnouncementSignatures msg_conv;
16542 msg_conv.inner = (void*)(msg & (~1));
16543 msg_conv.is_owned = (msg & 1) || (msg == 0);
16544 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16545 msg_conv = AnnouncementSignatures_clone(&msg_conv);
16546 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16547 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
16548 uint64_t ret_ref = (uint64_t)ret_copy;
16552 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint32_t updates) {
16553 LDKPublicKey node_id_ref;
16554 CHECK(node_id->arr_len == 33);
16555 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16556 LDKCommitmentUpdate updates_conv;
16557 updates_conv.inner = (void*)(updates & (~1));
16558 updates_conv.is_owned = (updates & 1) || (updates == 0);
16559 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
16560 updates_conv = CommitmentUpdate_clone(&updates_conv);
16561 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16562 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
16563 uint64_t ret_ref = (uint64_t)ret_copy;
16567 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint32_t msg) {
16568 LDKPublicKey node_id_ref;
16569 CHECK(node_id->arr_len == 33);
16570 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16571 LDKRevokeAndACK msg_conv;
16572 msg_conv.inner = (void*)(msg & (~1));
16573 msg_conv.is_owned = (msg & 1) || (msg == 0);
16574 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16575 msg_conv = RevokeAndACK_clone(&msg_conv);
16576 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16577 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
16578 uint64_t ret_ref = (uint64_t)ret_copy;
16582 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint32_t msg) {
16583 LDKPublicKey node_id_ref;
16584 CHECK(node_id->arr_len == 33);
16585 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16586 LDKClosingSigned msg_conv;
16587 msg_conv.inner = (void*)(msg & (~1));
16588 msg_conv.is_owned = (msg & 1) || (msg == 0);
16589 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16590 msg_conv = ClosingSigned_clone(&msg_conv);
16591 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16592 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
16593 uint64_t ret_ref = (uint64_t)ret_copy;
16597 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint32_t msg) {
16598 LDKPublicKey node_id_ref;
16599 CHECK(node_id->arr_len == 33);
16600 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16601 LDKShutdown msg_conv;
16602 msg_conv.inner = (void*)(msg & (~1));
16603 msg_conv.is_owned = (msg & 1) || (msg == 0);
16604 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16605 msg_conv = Shutdown_clone(&msg_conv);
16606 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16607 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
16608 uint64_t ret_ref = (uint64_t)ret_copy;
16612 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint32_t msg) {
16613 LDKPublicKey node_id_ref;
16614 CHECK(node_id->arr_len == 33);
16615 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16616 LDKChannelReestablish msg_conv;
16617 msg_conv.inner = (void*)(msg & (~1));
16618 msg_conv.is_owned = (msg & 1) || (msg == 0);
16619 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16620 msg_conv = ChannelReestablish_clone(&msg_conv);
16621 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16622 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
16623 uint64_t ret_ref = (uint64_t)ret_copy;
16627 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_channel_announcement(uint32_t msg, uint32_t update_msg) {
16628 LDKChannelAnnouncement msg_conv;
16629 msg_conv.inner = (void*)(msg & (~1));
16630 msg_conv.is_owned = (msg & 1) || (msg == 0);
16631 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16632 msg_conv = ChannelAnnouncement_clone(&msg_conv);
16633 LDKChannelUpdate update_msg_conv;
16634 update_msg_conv.inner = (void*)(update_msg & (~1));
16635 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
16636 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
16637 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
16638 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16639 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
16640 uint64_t ret_ref = (uint64_t)ret_copy;
16644 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_node_announcement(uint32_t msg) {
16645 LDKNodeAnnouncement msg_conv;
16646 msg_conv.inner = (void*)(msg & (~1));
16647 msg_conv.is_owned = (msg & 1) || (msg == 0);
16648 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16649 msg_conv = NodeAnnouncement_clone(&msg_conv);
16650 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16651 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
16652 uint64_t ret_ref = (uint64_t)ret_copy;
16656 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_broadcast_channel_update(uint32_t msg) {
16657 LDKChannelUpdate msg_conv;
16658 msg_conv.inner = (void*)(msg & (~1));
16659 msg_conv.is_owned = (msg & 1) || (msg == 0);
16660 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16661 msg_conv = ChannelUpdate_clone(&msg_conv);
16662 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16663 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
16664 uint64_t ret_ref = (uint64_t)ret_copy;
16668 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint32_t msg) {
16669 LDKPublicKey node_id_ref;
16670 CHECK(node_id->arr_len == 33);
16671 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16672 LDKChannelUpdate msg_conv;
16673 msg_conv.inner = (void*)(msg & (~1));
16674 msg_conv.is_owned = (msg & 1) || (msg == 0);
16675 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16676 msg_conv = ChannelUpdate_clone(&msg_conv);
16677 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16678 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
16679 uint64_t ret_ref = (uint64_t)ret_copy;
16683 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint32_t action) {
16684 LDKPublicKey node_id_ref;
16685 CHECK(node_id->arr_len == 33);
16686 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16687 void* action_ptr = (void*)(((uint64_t)action) & ~1);
16688 CHECK_ACCESS(action_ptr);
16689 LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
16690 action_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action) & ~1));
16691 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16692 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
16693 uint64_t ret_ref = (uint64_t)ret_copy;
16697 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint32_t msg) {
16698 LDKPublicKey node_id_ref;
16699 CHECK(node_id->arr_len == 33);
16700 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16701 LDKQueryChannelRange msg_conv;
16702 msg_conv.inner = (void*)(msg & (~1));
16703 msg_conv.is_owned = (msg & 1) || (msg == 0);
16704 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16705 msg_conv = QueryChannelRange_clone(&msg_conv);
16706 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16707 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
16708 uint64_t ret_ref = (uint64_t)ret_copy;
16712 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint32_t msg) {
16713 LDKPublicKey node_id_ref;
16714 CHECK(node_id->arr_len == 33);
16715 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16716 LDKQueryShortChannelIds msg_conv;
16717 msg_conv.inner = (void*)(msg & (~1));
16718 msg_conv.is_owned = (msg & 1) || (msg == 0);
16719 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16720 msg_conv = QueryShortChannelIds_clone(&msg_conv);
16721 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16722 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
16723 uint64_t ret_ref = (uint64_t)ret_copy;
16727 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint32_t msg) {
16728 LDKPublicKey node_id_ref;
16729 CHECK(node_id->arr_len == 33);
16730 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
16731 LDKReplyChannelRange msg_conv;
16732 msg_conv.inner = (void*)(msg & (~1));
16733 msg_conv.is_owned = (msg & 1) || (msg == 0);
16734 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16735 msg_conv = ReplyChannelRange_clone(&msg_conv);
16736 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
16737 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
16738 uint64_t ret_ref = (uint64_t)ret_copy;
16742 void __attribute__((visibility("default"))) TS_MessageSendEventsProvider_free(uint32_t this_ptr) {
16743 if ((this_ptr & 1) != 0) return;
16744 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16745 CHECK_ACCESS(this_ptr_ptr);
16746 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
16747 FREE((void*)this_ptr);
16748 MessageSendEventsProvider_free(this_ptr_conv);
16751 void __attribute__((visibility("default"))) TS_EventsProvider_free(uint32_t this_ptr) {
16752 if ((this_ptr & 1) != 0) return;
16753 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16754 CHECK_ACCESS(this_ptr_ptr);
16755 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
16756 FREE((void*)this_ptr);
16757 EventsProvider_free(this_ptr_conv);
16760 void __attribute__((visibility("default"))) TS_EventHandler_free(uint32_t this_ptr) {
16761 if ((this_ptr & 1) != 0) return;
16762 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16763 CHECK_ACCESS(this_ptr_ptr);
16764 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
16765 FREE((void*)this_ptr);
16766 EventHandler_free(this_ptr_conv);
16769 void __attribute__((visibility("default"))) TS_APIError_free(uint32_t this_ptr) {
16770 if ((this_ptr & 1) != 0) return;
16771 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
16772 CHECK_ACCESS(this_ptr_ptr);
16773 LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
16774 FREE((void*)this_ptr);
16775 APIError_free(this_ptr_conv);
16778 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
16779 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16780 *ret_copy = APIError_clone(arg);
16781 uint64_t ret_ref = (uint64_t)ret_copy;
16784 int64_t __attribute__((visibility("default"))) TS_APIError_clone_ptr(uint32_t arg) {
16785 LDKAPIError* arg_conv = (LDKAPIError*)arg;
16786 int64_t ret_val = APIError_clone_ptr(arg_conv);
16790 uint32_t __attribute__((visibility("default"))) TS_APIError_clone(uint32_t orig) {
16791 LDKAPIError* orig_conv = (LDKAPIError*)orig;
16792 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16793 *ret_copy = APIError_clone(orig_conv);
16794 uint64_t ret_ref = (uint64_t)ret_copy;
16798 uint32_t __attribute__((visibility("default"))) TS_APIError_apimisuse_error(jstring err) {
16799 LDKStr err_conv = str_ref_to_owned_c(err);
16800 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16801 *ret_copy = APIError_apimisuse_error(err_conv);
16802 uint64_t ret_ref = (uint64_t)ret_copy;
16806 uint32_t __attribute__((visibility("default"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
16807 LDKStr err_conv = str_ref_to_owned_c(err);
16808 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16809 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
16810 uint64_t ret_ref = (uint64_t)ret_copy;
16814 uint32_t __attribute__((visibility("default"))) TS_APIError_route_error(jstring err) {
16815 LDKStr err_conv = str_ref_to_owned_c(err);
16816 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16817 *ret_copy = APIError_route_error(err_conv);
16818 uint64_t ret_ref = (uint64_t)ret_copy;
16822 uint32_t __attribute__((visibility("default"))) TS_APIError_channel_unavailable(jstring err) {
16823 LDKStr err_conv = str_ref_to_owned_c(err);
16824 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16825 *ret_copy = APIError_channel_unavailable(err_conv);
16826 uint64_t ret_ref = (uint64_t)ret_copy;
16830 uint32_t __attribute__((visibility("default"))) TS_APIError_monitor_update_failed() {
16831 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16832 *ret_copy = APIError_monitor_update_failed();
16833 uint64_t ret_ref = (uint64_t)ret_copy;
16837 uint32_t __attribute__((visibility("default"))) TS_APIError_incompatible_shutdown_script(uint32_t script) {
16838 LDKShutdownScript script_conv;
16839 script_conv.inner = (void*)(script & (~1));
16840 script_conv.is_owned = (script & 1) || (script == 0);
16841 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
16842 script_conv = ShutdownScript_clone(&script_conv);
16843 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
16844 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
16845 uint64_t ret_ref = (uint64_t)ret_copy;
16849 uint32_t __attribute__((visibility("default"))) TS_sign(int8_tArray msg, int8_tArray sk) {
16850 LDKu8slice msg_ref;
16851 msg_ref.datalen = msg->arr_len;
16852 msg_ref.data = msg->elems;
16853 unsigned char sk_arr[32];
16854 CHECK(sk->arr_len == 32);
16855 memcpy(sk_arr, sk->elems, 32);
16856 unsigned char (*sk_ref)[32] = &sk_arr;
16857 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
16858 *ret_conv = sign(msg_ref, sk_ref);
16859 return (uint64_t)ret_conv;
16862 uint32_t __attribute__((visibility("default"))) TS_recover_pk(int8_tArray msg, jstring sig) {
16863 LDKu8slice msg_ref;
16864 msg_ref.datalen = msg->arr_len;
16865 msg_ref.data = msg->elems;
16866 LDKStr sig_conv = str_ref_to_owned_c(sig);
16867 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
16868 *ret_conv = recover_pk(msg_ref, sig_conv);
16869 return (uint64_t)ret_conv;
16872 jboolean __attribute__((visibility("default"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
16873 LDKu8slice msg_ref;
16874 msg_ref.datalen = msg->arr_len;
16875 msg_ref.data = msg->elems;
16876 LDKStr sig_conv = str_ref_to_owned_c(sig);
16877 LDKPublicKey pk_ref;
16878 CHECK(pk->arr_len == 33);
16879 memcpy(pk_ref.compressed_form, pk->elems, 33);
16880 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
16884 uint32_t __attribute__((visibility("default"))) TS_Level_clone(uint32_t orig) {
16885 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
16886 uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
16890 uint32_t __attribute__((visibility("default"))) TS_Level_gossip() {
16891 uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
16895 uint32_t __attribute__((visibility("default"))) TS_Level_trace() {
16896 uint32_t ret_conv = LDKLevel_to_js(Level_trace());
16900 uint32_t __attribute__((visibility("default"))) TS_Level_debug() {
16901 uint32_t ret_conv = LDKLevel_to_js(Level_debug());
16905 uint32_t __attribute__((visibility("default"))) TS_Level_info() {
16906 uint32_t ret_conv = LDKLevel_to_js(Level_info());
16910 uint32_t __attribute__((visibility("default"))) TS_Level_warn() {
16911 uint32_t ret_conv = LDKLevel_to_js(Level_warn());
16915 uint32_t __attribute__((visibility("default"))) TS_Level_error() {
16916 uint32_t ret_conv = LDKLevel_to_js(Level_error());
16920 jboolean __attribute__((visibility("default"))) TS_Level_eq(uint32_t a, uint32_t b) {
16921 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
16922 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
16923 jboolean ret_val = Level_eq(a_conv, b_conv);
16927 int64_t __attribute__((visibility("default"))) TS_Level_hash(uint32_t o) {
16928 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
16929 int64_t ret_val = Level_hash(o_conv);
16933 uint32_t __attribute__((visibility("default"))) TS_Level_max() {
16934 uint32_t ret_conv = LDKLevel_to_js(Level_max());
16938 void __attribute__((visibility("default"))) TS_Record_free(uint32_t this_obj) {
16939 LDKRecord this_obj_conv;
16940 this_obj_conv.inner = (void*)(this_obj & (~1));
16941 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16942 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
16943 Record_free(this_obj_conv);
16946 uint32_t __attribute__((visibility("default"))) TS_Record_get_level(uint32_t this_ptr) {
16947 LDKRecord this_ptr_conv;
16948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16949 this_ptr_conv.is_owned = false;
16950 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16951 uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
16955 void __attribute__((visibility("default"))) TS_Record_set_level(uint32_t this_ptr, uint32_t val) {
16956 LDKRecord this_ptr_conv;
16957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16958 this_ptr_conv.is_owned = false;
16959 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16960 LDKLevel val_conv = LDKLevel_from_js(val);
16961 Record_set_level(&this_ptr_conv, val_conv);
16964 jstring __attribute__((visibility("default"))) TS_Record_get_args(uint32_t this_ptr) {
16965 LDKRecord this_ptr_conv;
16966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16967 this_ptr_conv.is_owned = false;
16968 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16969 LDKStr ret_str = Record_get_args(&this_ptr_conv);
16970 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
16975 void __attribute__((visibility("default"))) TS_Record_set_args(uint32_t this_ptr, jstring val) {
16976 LDKRecord this_ptr_conv;
16977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16978 this_ptr_conv.is_owned = false;
16979 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16980 LDKStr val_conv = str_ref_to_owned_c(val);
16981 Record_set_args(&this_ptr_conv, val_conv);
16984 jstring __attribute__((visibility("default"))) TS_Record_get_module_path(uint32_t this_ptr) {
16985 LDKRecord this_ptr_conv;
16986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16987 this_ptr_conv.is_owned = false;
16988 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
16989 LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
16990 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
16995 void __attribute__((visibility("default"))) TS_Record_set_module_path(uint32_t this_ptr, jstring val) {
16996 LDKRecord this_ptr_conv;
16997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16998 this_ptr_conv.is_owned = false;
16999 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17000 LDKStr val_conv = str_ref_to_owned_c(val);
17001 Record_set_module_path(&this_ptr_conv, val_conv);
17004 jstring __attribute__((visibility("default"))) TS_Record_get_file(uint32_t this_ptr) {
17005 LDKRecord this_ptr_conv;
17006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17007 this_ptr_conv.is_owned = false;
17008 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17009 LDKStr ret_str = Record_get_file(&this_ptr_conv);
17010 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
17015 void __attribute__((visibility("default"))) TS_Record_set_file(uint32_t this_ptr, jstring val) {
17016 LDKRecord this_ptr_conv;
17017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17018 this_ptr_conv.is_owned = false;
17019 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17020 LDKStr val_conv = str_ref_to_owned_c(val);
17021 Record_set_file(&this_ptr_conv, val_conv);
17024 int32_t __attribute__((visibility("default"))) TS_Record_get_line(uint32_t this_ptr) {
17025 LDKRecord this_ptr_conv;
17026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17027 this_ptr_conv.is_owned = false;
17028 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17029 int32_t ret_val = Record_get_line(&this_ptr_conv);
17033 void __attribute__((visibility("default"))) TS_Record_set_line(uint32_t this_ptr, int32_t val) {
17034 LDKRecord this_ptr_conv;
17035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17036 this_ptr_conv.is_owned = false;
17037 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17038 Record_set_line(&this_ptr_conv, val);
17041 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
17042 LDKRecord ret_var = Record_clone(arg);
17043 uint64_t ret_ref = 0;
17044 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17045 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17046 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17047 ret_ref = (uint64_t)ret_var.inner;
17048 if (ret_var.is_owned) {
17053 int64_t __attribute__((visibility("default"))) TS_Record_clone_ptr(uint32_t arg) {
17054 LDKRecord arg_conv;
17055 arg_conv.inner = (void*)(arg & (~1));
17056 arg_conv.is_owned = false;
17057 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
17058 int64_t ret_val = Record_clone_ptr(&arg_conv);
17062 uint32_t __attribute__((visibility("default"))) TS_Record_clone(uint32_t orig) {
17063 LDKRecord orig_conv;
17064 orig_conv.inner = (void*)(orig & (~1));
17065 orig_conv.is_owned = false;
17066 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
17067 LDKRecord ret_var = Record_clone(&orig_conv);
17068 uint64_t ret_ref = 0;
17069 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17070 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17071 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17072 ret_ref = (uint64_t)ret_var.inner;
17073 if (ret_var.is_owned) {
17079 void __attribute__((visibility("default"))) TS_Logger_free(uint32_t this_ptr) {
17080 if ((this_ptr & 1) != 0) return;
17081 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17082 CHECK_ACCESS(this_ptr_ptr);
17083 LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
17084 FREE((void*)this_ptr);
17085 Logger_free(this_ptr_conv);
17088 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_free(uint32_t this_obj) {
17089 LDKChannelHandshakeConfig this_obj_conv;
17090 this_obj_conv.inner = (void*)(this_obj & (~1));
17091 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17092 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17093 ChannelHandshakeConfig_free(this_obj_conv);
17096 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint32_t this_ptr) {
17097 LDKChannelHandshakeConfig this_ptr_conv;
17098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17099 this_ptr_conv.is_owned = false;
17100 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17101 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
17105 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint32_t this_ptr, int32_t val) {
17106 LDKChannelHandshakeConfig this_ptr_conv;
17107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17108 this_ptr_conv.is_owned = false;
17109 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17110 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
17113 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint32_t this_ptr) {
17114 LDKChannelHandshakeConfig this_ptr_conv;
17115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17116 this_ptr_conv.is_owned = false;
17117 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17118 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
17122 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_to_self_delay(uint32_t this_ptr, int16_t val) {
17123 LDKChannelHandshakeConfig this_ptr_conv;
17124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17125 this_ptr_conv.is_owned = false;
17126 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17127 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
17130 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint32_t this_ptr) {
17131 LDKChannelHandshakeConfig this_ptr_conv;
17132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17133 this_ptr_conv.is_owned = false;
17134 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17135 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
17139 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
17140 LDKChannelHandshakeConfig this_ptr_conv;
17141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17142 this_ptr_conv.is_owned = false;
17143 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17144 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
17147 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) {
17148 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
17149 uint64_t ret_ref = 0;
17150 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17151 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17152 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17153 ret_ref = (uint64_t)ret_var.inner;
17154 if (ret_var.is_owned) {
17160 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
17161 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
17162 uint64_t ret_ref = 0;
17163 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17164 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17165 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17166 ret_ref = (uint64_t)ret_var.inner;
17167 if (ret_var.is_owned) {
17172 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_clone_ptr(uint32_t arg) {
17173 LDKChannelHandshakeConfig arg_conv;
17174 arg_conv.inner = (void*)(arg & (~1));
17175 arg_conv.is_owned = false;
17176 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
17177 int64_t ret_val = ChannelHandshakeConfig_clone_ptr(&arg_conv);
17181 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_clone(uint32_t orig) {
17182 LDKChannelHandshakeConfig orig_conv;
17183 orig_conv.inner = (void*)(orig & (~1));
17184 orig_conv.is_owned = false;
17185 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
17186 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
17187 uint64_t ret_ref = 0;
17188 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17189 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17190 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17191 ret_ref = (uint64_t)ret_var.inner;
17192 if (ret_var.is_owned) {
17198 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_default() {
17199 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
17200 uint64_t ret_ref = 0;
17201 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17202 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17203 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17204 ret_ref = (uint64_t)ret_var.inner;
17205 if (ret_var.is_owned) {
17211 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_free(uint32_t this_obj) {
17212 LDKChannelHandshakeLimits this_obj_conv;
17213 this_obj_conv.inner = (void*)(this_obj & (~1));
17214 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17215 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17216 ChannelHandshakeLimits_free(this_obj_conv);
17219 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint32_t this_ptr) {
17220 LDKChannelHandshakeLimits this_ptr_conv;
17221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17222 this_ptr_conv.is_owned = false;
17223 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17224 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
17228 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint32_t this_ptr, int64_t val) {
17229 LDKChannelHandshakeLimits this_ptr_conv;
17230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17231 this_ptr_conv.is_owned = false;
17232 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17233 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
17236 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint32_t this_ptr) {
17237 LDKChannelHandshakeLimits this_ptr_conv;
17238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17239 this_ptr_conv.is_owned = false;
17240 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17241 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
17245 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
17246 LDKChannelHandshakeLimits this_ptr_conv;
17247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17248 this_ptr_conv.is_owned = false;
17249 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17250 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
17253 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
17254 LDKChannelHandshakeLimits this_ptr_conv;
17255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17256 this_ptr_conv.is_owned = false;
17257 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17258 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
17262 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
17263 LDKChannelHandshakeLimits this_ptr_conv;
17264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17265 this_ptr_conv.is_owned = false;
17266 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17267 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
17270 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint32_t this_ptr) {
17271 LDKChannelHandshakeLimits this_ptr_conv;
17272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17273 this_ptr_conv.is_owned = false;
17274 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17275 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
17279 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
17280 LDKChannelHandshakeLimits this_ptr_conv;
17281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17282 this_ptr_conv.is_owned = false;
17283 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17284 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
17287 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint32_t this_ptr) {
17288 LDKChannelHandshakeLimits this_ptr_conv;
17289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17290 this_ptr_conv.is_owned = false;
17291 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17292 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
17296 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
17297 LDKChannelHandshakeLimits this_ptr_conv;
17298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17299 this_ptr_conv.is_owned = false;
17300 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17301 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
17304 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint32_t this_ptr) {
17305 LDKChannelHandshakeLimits this_ptr_conv;
17306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17307 this_ptr_conv.is_owned = false;
17308 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17309 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
17313 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint32_t this_ptr, int32_t val) {
17314 LDKChannelHandshakeLimits this_ptr_conv;
17315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17316 this_ptr_conv.is_owned = false;
17317 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17318 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
17321 jboolean __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint32_t this_ptr) {
17322 LDKChannelHandshakeLimits this_ptr_conv;
17323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17324 this_ptr_conv.is_owned = false;
17325 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17326 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
17330 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint32_t this_ptr, jboolean val) {
17331 LDKChannelHandshakeLimits this_ptr_conv;
17332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17333 this_ptr_conv.is_owned = false;
17334 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17335 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
17338 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint32_t this_ptr) {
17339 LDKChannelHandshakeLimits this_ptr_conv;
17340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17341 this_ptr_conv.is_owned = false;
17342 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17343 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
17347 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_their_to_self_delay(uint32_t this_ptr, int16_t val) {
17348 LDKChannelHandshakeLimits this_ptr_conv;
17349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17350 this_ptr_conv.is_owned = false;
17351 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17352 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
17355 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) {
17356 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);
17357 uint64_t ret_ref = 0;
17358 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17359 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17360 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17361 ret_ref = (uint64_t)ret_var.inner;
17362 if (ret_var.is_owned) {
17368 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
17369 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
17370 uint64_t ret_ref = 0;
17371 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17372 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17373 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17374 ret_ref = (uint64_t)ret_var.inner;
17375 if (ret_var.is_owned) {
17380 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_clone_ptr(uint32_t arg) {
17381 LDKChannelHandshakeLimits arg_conv;
17382 arg_conv.inner = (void*)(arg & (~1));
17383 arg_conv.is_owned = false;
17384 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
17385 int64_t ret_val = ChannelHandshakeLimits_clone_ptr(&arg_conv);
17389 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_clone(uint32_t orig) {
17390 LDKChannelHandshakeLimits orig_conv;
17391 orig_conv.inner = (void*)(orig & (~1));
17392 orig_conv.is_owned = false;
17393 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
17394 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
17395 uint64_t ret_ref = 0;
17396 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17397 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17398 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17399 ret_ref = (uint64_t)ret_var.inner;
17400 if (ret_var.is_owned) {
17406 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_default() {
17407 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
17408 uint64_t ret_ref = 0;
17409 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17410 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17411 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17412 ret_ref = (uint64_t)ret_var.inner;
17413 if (ret_var.is_owned) {
17419 void __attribute__((visibility("default"))) TS_ChannelConfig_free(uint32_t this_obj) {
17420 LDKChannelConfig this_obj_conv;
17421 this_obj_conv.inner = (void*)(this_obj & (~1));
17422 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17423 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17424 ChannelConfig_free(this_obj_conv);
17427 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint32_t this_ptr) {
17428 LDKChannelConfig this_ptr_conv;
17429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17430 this_ptr_conv.is_owned = false;
17431 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17432 int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
17436 void __attribute__((visibility("default"))) TS_ChannelConfig_set_forwarding_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
17437 LDKChannelConfig this_ptr_conv;
17438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17439 this_ptr_conv.is_owned = false;
17440 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17441 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
17444 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint32_t this_ptr) {
17445 LDKChannelConfig this_ptr_conv;
17446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17447 this_ptr_conv.is_owned = false;
17448 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17449 int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
17453 void __attribute__((visibility("default"))) TS_ChannelConfig_set_forwarding_fee_base_msat(uint32_t this_ptr, int32_t val) {
17454 LDKChannelConfig this_ptr_conv;
17455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17456 this_ptr_conv.is_owned = false;
17457 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17458 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
17461 int16_t __attribute__((visibility("default"))) TS_ChannelConfig_get_cltv_expiry_delta(uint32_t this_ptr) {
17462 LDKChannelConfig this_ptr_conv;
17463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17464 this_ptr_conv.is_owned = false;
17465 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17466 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
17470 void __attribute__((visibility("default"))) TS_ChannelConfig_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
17471 LDKChannelConfig this_ptr_conv;
17472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17473 this_ptr_conv.is_owned = false;
17474 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17475 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
17478 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_announced_channel(uint32_t this_ptr) {
17479 LDKChannelConfig this_ptr_conv;
17480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17481 this_ptr_conv.is_owned = false;
17482 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17483 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
17487 void __attribute__((visibility("default"))) TS_ChannelConfig_set_announced_channel(uint32_t this_ptr, jboolean val) {
17488 LDKChannelConfig this_ptr_conv;
17489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17490 this_ptr_conv.is_owned = false;
17491 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17492 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
17495 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_commit_upfront_shutdown_pubkey(uint32_t this_ptr) {
17496 LDKChannelConfig this_ptr_conv;
17497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17498 this_ptr_conv.is_owned = false;
17499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17500 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
17504 void __attribute__((visibility("default"))) TS_ChannelConfig_set_commit_upfront_shutdown_pubkey(uint32_t this_ptr, jboolean val) {
17505 LDKChannelConfig this_ptr_conv;
17506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17507 this_ptr_conv.is_owned = false;
17508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17509 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
17512 int64_t __attribute__((visibility("default"))) TS_ChannelConfig_get_max_dust_htlc_exposure_msat(uint32_t this_ptr) {
17513 LDKChannelConfig this_ptr_conv;
17514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17515 this_ptr_conv.is_owned = false;
17516 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17517 int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
17521 void __attribute__((visibility("default"))) TS_ChannelConfig_set_max_dust_htlc_exposure_msat(uint32_t this_ptr, int64_t val) {
17522 LDKChannelConfig this_ptr_conv;
17523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17524 this_ptr_conv.is_owned = false;
17525 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17526 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
17529 int64_t __attribute__((visibility("default"))) TS_ChannelConfig_get_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr) {
17530 LDKChannelConfig this_ptr_conv;
17531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17532 this_ptr_conv.is_owned = false;
17533 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17534 int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
17538 void __attribute__((visibility("default"))) TS_ChannelConfig_set_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
17539 LDKChannelConfig this_ptr_conv;
17540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17541 this_ptr_conv.is_owned = false;
17542 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17543 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
17546 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) {
17547 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);
17548 uint64_t ret_ref = 0;
17549 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17550 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17551 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17552 ret_ref = (uint64_t)ret_var.inner;
17553 if (ret_var.is_owned) {
17559 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
17560 LDKChannelConfig ret_var = ChannelConfig_clone(arg);
17561 uint64_t ret_ref = 0;
17562 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17563 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17564 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17565 ret_ref = (uint64_t)ret_var.inner;
17566 if (ret_var.is_owned) {
17571 int64_t __attribute__((visibility("default"))) TS_ChannelConfig_clone_ptr(uint32_t arg) {
17572 LDKChannelConfig arg_conv;
17573 arg_conv.inner = (void*)(arg & (~1));
17574 arg_conv.is_owned = false;
17575 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
17576 int64_t ret_val = ChannelConfig_clone_ptr(&arg_conv);
17580 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_clone(uint32_t orig) {
17581 LDKChannelConfig orig_conv;
17582 orig_conv.inner = (void*)(orig & (~1));
17583 orig_conv.is_owned = false;
17584 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
17585 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
17586 uint64_t ret_ref = 0;
17587 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17588 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17589 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17590 ret_ref = (uint64_t)ret_var.inner;
17591 if (ret_var.is_owned) {
17597 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_default() {
17598 LDKChannelConfig ret_var = ChannelConfig_default();
17599 uint64_t ret_ref = 0;
17600 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17601 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17602 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17603 ret_ref = (uint64_t)ret_var.inner;
17604 if (ret_var.is_owned) {
17610 int8_tArray __attribute__((visibility("default"))) TS_ChannelConfig_write(uint32_t obj) {
17611 LDKChannelConfig obj_conv;
17612 obj_conv.inner = (void*)(obj & (~1));
17613 obj_conv.is_owned = false;
17614 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
17615 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
17616 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
17617 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
17618 CVec_u8Z_free(ret_var);
17622 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_read(int8_tArray ser) {
17623 LDKu8slice ser_ref;
17624 ser_ref.datalen = ser->arr_len;
17625 ser_ref.data = ser->elems;
17626 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
17627 *ret_conv = ChannelConfig_read(ser_ref);
17628 return (uint64_t)ret_conv;
17631 void __attribute__((visibility("default"))) TS_UserConfig_free(uint32_t this_obj) {
17632 LDKUserConfig this_obj_conv;
17633 this_obj_conv.inner = (void*)(this_obj & (~1));
17634 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17635 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17636 UserConfig_free(this_obj_conv);
17639 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_own_channel_config(uint32_t this_ptr) {
17640 LDKUserConfig this_ptr_conv;
17641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17642 this_ptr_conv.is_owned = false;
17643 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17644 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
17645 uint64_t ret_ref = 0;
17646 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17647 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17648 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17649 ret_ref = (uint64_t)ret_var.inner;
17650 if (ret_var.is_owned) {
17656 void __attribute__((visibility("default"))) TS_UserConfig_set_own_channel_config(uint32_t this_ptr, uint32_t val) {
17657 LDKUserConfig this_ptr_conv;
17658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17659 this_ptr_conv.is_owned = false;
17660 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17661 LDKChannelHandshakeConfig val_conv;
17662 val_conv.inner = (void*)(val & (~1));
17663 val_conv.is_owned = (val & 1) || (val == 0);
17664 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
17665 val_conv = ChannelHandshakeConfig_clone(&val_conv);
17666 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
17669 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_peer_channel_config_limits(uint32_t this_ptr) {
17670 LDKUserConfig this_ptr_conv;
17671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17672 this_ptr_conv.is_owned = false;
17673 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17674 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
17675 uint64_t ret_ref = 0;
17676 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17677 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17678 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17679 ret_ref = (uint64_t)ret_var.inner;
17680 if (ret_var.is_owned) {
17686 void __attribute__((visibility("default"))) TS_UserConfig_set_peer_channel_config_limits(uint32_t this_ptr, uint32_t val) {
17687 LDKUserConfig this_ptr_conv;
17688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17689 this_ptr_conv.is_owned = false;
17690 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17691 LDKChannelHandshakeLimits val_conv;
17692 val_conv.inner = (void*)(val & (~1));
17693 val_conv.is_owned = (val & 1) || (val == 0);
17694 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
17695 val_conv = ChannelHandshakeLimits_clone(&val_conv);
17696 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
17699 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_channel_options(uint32_t this_ptr) {
17700 LDKUserConfig this_ptr_conv;
17701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17702 this_ptr_conv.is_owned = false;
17703 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17704 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
17705 uint64_t ret_ref = 0;
17706 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17707 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17708 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17709 ret_ref = (uint64_t)ret_var.inner;
17710 if (ret_var.is_owned) {
17716 void __attribute__((visibility("default"))) TS_UserConfig_set_channel_options(uint32_t this_ptr, uint32_t val) {
17717 LDKUserConfig this_ptr_conv;
17718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17719 this_ptr_conv.is_owned = false;
17720 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17721 LDKChannelConfig val_conv;
17722 val_conv.inner = (void*)(val & (~1));
17723 val_conv.is_owned = (val & 1) || (val == 0);
17724 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
17725 val_conv = ChannelConfig_clone(&val_conv);
17726 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
17729 jboolean __attribute__((visibility("default"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint32_t this_ptr) {
17730 LDKUserConfig this_ptr_conv;
17731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17732 this_ptr_conv.is_owned = false;
17733 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17734 jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
17738 void __attribute__((visibility("default"))) TS_UserConfig_set_accept_forwards_to_priv_channels(uint32_t this_ptr, jboolean val) {
17739 LDKUserConfig this_ptr_conv;
17740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17741 this_ptr_conv.is_owned = false;
17742 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17743 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
17746 jboolean __attribute__((visibility("default"))) TS_UserConfig_get_accept_inbound_channels(uint32_t this_ptr) {
17747 LDKUserConfig this_ptr_conv;
17748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17749 this_ptr_conv.is_owned = false;
17750 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17751 jboolean ret_val = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
17755 void __attribute__((visibility("default"))) TS_UserConfig_set_accept_inbound_channels(uint32_t this_ptr, jboolean val) {
17756 LDKUserConfig this_ptr_conv;
17757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17758 this_ptr_conv.is_owned = false;
17759 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
17760 UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
17763 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) {
17764 LDKChannelHandshakeConfig own_channel_config_arg_conv;
17765 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
17766 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
17767 CHECK_INNER_FIELD_ACCESS_OR_NULL(own_channel_config_arg_conv);
17768 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
17769 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
17770 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
17771 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
17772 CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_channel_config_limits_arg_conv);
17773 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
17774 LDKChannelConfig channel_options_arg_conv;
17775 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
17776 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
17777 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_options_arg_conv);
17778 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
17779 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);
17780 uint64_t ret_ref = 0;
17781 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17782 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17783 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17784 ret_ref = (uint64_t)ret_var.inner;
17785 if (ret_var.is_owned) {
17791 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
17792 LDKUserConfig ret_var = UserConfig_clone(arg);
17793 uint64_t ret_ref = 0;
17794 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17795 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17796 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17797 ret_ref = (uint64_t)ret_var.inner;
17798 if (ret_var.is_owned) {
17803 int64_t __attribute__((visibility("default"))) TS_UserConfig_clone_ptr(uint32_t arg) {
17804 LDKUserConfig arg_conv;
17805 arg_conv.inner = (void*)(arg & (~1));
17806 arg_conv.is_owned = false;
17807 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
17808 int64_t ret_val = UserConfig_clone_ptr(&arg_conv);
17812 uint32_t __attribute__((visibility("default"))) TS_UserConfig_clone(uint32_t orig) {
17813 LDKUserConfig orig_conv;
17814 orig_conv.inner = (void*)(orig & (~1));
17815 orig_conv.is_owned = false;
17816 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
17817 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
17818 uint64_t ret_ref = 0;
17819 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17820 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17821 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17822 ret_ref = (uint64_t)ret_var.inner;
17823 if (ret_var.is_owned) {
17829 uint32_t __attribute__((visibility("default"))) TS_UserConfig_default() {
17830 LDKUserConfig ret_var = UserConfig_default();
17831 uint64_t ret_ref = 0;
17832 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17833 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17834 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17835 ret_ref = (uint64_t)ret_var.inner;
17836 if (ret_var.is_owned) {
17842 void __attribute__((visibility("default"))) TS_BestBlock_free(uint32_t this_obj) {
17843 LDKBestBlock this_obj_conv;
17844 this_obj_conv.inner = (void*)(this_obj & (~1));
17845 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17846 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
17847 BestBlock_free(this_obj_conv);
17850 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
17851 LDKBestBlock ret_var = BestBlock_clone(arg);
17852 uint64_t ret_ref = 0;
17853 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17854 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17855 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17856 ret_ref = (uint64_t)ret_var.inner;
17857 if (ret_var.is_owned) {
17862 int64_t __attribute__((visibility("default"))) TS_BestBlock_clone_ptr(uint32_t arg) {
17863 LDKBestBlock arg_conv;
17864 arg_conv.inner = (void*)(arg & (~1));
17865 arg_conv.is_owned = false;
17866 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
17867 int64_t ret_val = BestBlock_clone_ptr(&arg_conv);
17871 uint32_t __attribute__((visibility("default"))) TS_BestBlock_clone(uint32_t orig) {
17872 LDKBestBlock orig_conv;
17873 orig_conv.inner = (void*)(orig & (~1));
17874 orig_conv.is_owned = false;
17875 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
17876 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
17877 uint64_t ret_ref = 0;
17878 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17879 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17880 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17881 ret_ref = (uint64_t)ret_var.inner;
17882 if (ret_var.is_owned) {
17888 uint32_t __attribute__((visibility("default"))) TS_BestBlock_from_genesis(uint32_t network) {
17889 LDKNetwork network_conv = LDKNetwork_from_js(network);
17890 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
17891 uint64_t ret_ref = 0;
17892 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17893 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17894 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17895 ret_ref = (uint64_t)ret_var.inner;
17896 if (ret_var.is_owned) {
17902 uint32_t __attribute__((visibility("default"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
17903 LDKThirtyTwoBytes block_hash_ref;
17904 CHECK(block_hash->arr_len == 32);
17905 memcpy(block_hash_ref.data, block_hash->elems, 32);
17906 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
17907 uint64_t ret_ref = 0;
17908 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17909 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17910 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17911 ret_ref = (uint64_t)ret_var.inner;
17912 if (ret_var.is_owned) {
17918 int8_tArray __attribute__((visibility("default"))) TS_BestBlock_block_hash(uint32_t this_arg) {
17919 LDKBestBlock this_arg_conv;
17920 this_arg_conv.inner = (void*)(this_arg & (~1));
17921 this_arg_conv.is_owned = false;
17922 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
17923 int8_tArray ret_arr = init_int8_tArray(32);
17924 memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
17928 int32_t __attribute__((visibility("default"))) TS_BestBlock_height(uint32_t this_arg) {
17929 LDKBestBlock this_arg_conv;
17930 this_arg_conv.inner = (void*)(this_arg & (~1));
17931 this_arg_conv.is_owned = false;
17932 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
17933 int32_t ret_val = BestBlock_height(&this_arg_conv);
17937 uint32_t __attribute__((visibility("default"))) TS_AccessError_clone(uint32_t orig) {
17938 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
17939 uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
17943 uint32_t __attribute__((visibility("default"))) TS_AccessError_unknown_chain() {
17944 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_chain());
17948 uint32_t __attribute__((visibility("default"))) TS_AccessError_unknown_tx() {
17949 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_tx());
17953 void __attribute__((visibility("default"))) TS_Access_free(uint32_t this_ptr) {
17954 if ((this_ptr & 1) != 0) return;
17955 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17956 CHECK_ACCESS(this_ptr_ptr);
17957 LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
17958 FREE((void*)this_ptr);
17959 Access_free(this_ptr_conv);
17962 void __attribute__((visibility("default"))) TS_Listen_free(uint32_t this_ptr) {
17963 if ((this_ptr & 1) != 0) return;
17964 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17965 CHECK_ACCESS(this_ptr_ptr);
17966 LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
17967 FREE((void*)this_ptr);
17968 Listen_free(this_ptr_conv);
17971 void __attribute__((visibility("default"))) TS_Confirm_free(uint32_t this_ptr) {
17972 if ((this_ptr & 1) != 0) return;
17973 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17974 CHECK_ACCESS(this_ptr_ptr);
17975 LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
17976 FREE((void*)this_ptr);
17977 Confirm_free(this_ptr_conv);
17980 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) {
17981 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
17982 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
17986 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_temporary_failure() {
17987 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_temporary_failure());
17991 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_permanent_failure() {
17992 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_permanent_failure());
17996 void __attribute__((visibility("default"))) TS_Watch_free(uint32_t this_ptr) {
17997 if ((this_ptr & 1) != 0) return;
17998 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
17999 CHECK_ACCESS(this_ptr_ptr);
18000 LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
18001 FREE((void*)this_ptr);
18002 Watch_free(this_ptr_conv);
18005 void __attribute__((visibility("default"))) TS_Filter_free(uint32_t this_ptr) {
18006 if ((this_ptr & 1) != 0) return;
18007 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18008 CHECK_ACCESS(this_ptr_ptr);
18009 LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
18010 FREE((void*)this_ptr);
18011 Filter_free(this_ptr_conv);
18014 void __attribute__((visibility("default"))) TS_WatchedOutput_free(uint32_t this_obj) {
18015 LDKWatchedOutput this_obj_conv;
18016 this_obj_conv.inner = (void*)(this_obj & (~1));
18017 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18019 WatchedOutput_free(this_obj_conv);
18022 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_block_hash(uint32_t this_ptr) {
18023 LDKWatchedOutput this_ptr_conv;
18024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18025 this_ptr_conv.is_owned = false;
18026 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18027 int8_tArray ret_arr = init_int8_tArray(32);
18028 memcpy(ret_arr->elems, WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
18032 void __attribute__((visibility("default"))) TS_WatchedOutput_set_block_hash(uint32_t this_ptr, int8_tArray val) {
18033 LDKWatchedOutput this_ptr_conv;
18034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18035 this_ptr_conv.is_owned = false;
18036 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18037 LDKThirtyTwoBytes val_ref;
18038 CHECK(val->arr_len == 32);
18039 memcpy(val_ref.data, val->elems, 32);
18040 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
18043 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_get_outpoint(uint32_t this_ptr) {
18044 LDKWatchedOutput this_ptr_conv;
18045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18046 this_ptr_conv.is_owned = false;
18047 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18048 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
18049 uint64_t ret_ref = 0;
18050 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18051 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18052 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18053 ret_ref = (uint64_t)ret_var.inner;
18054 if (ret_var.is_owned) {
18060 void __attribute__((visibility("default"))) TS_WatchedOutput_set_outpoint(uint32_t this_ptr, uint32_t val) {
18061 LDKWatchedOutput this_ptr_conv;
18062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18063 this_ptr_conv.is_owned = false;
18064 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18065 LDKOutPoint val_conv;
18066 val_conv.inner = (void*)(val & (~1));
18067 val_conv.is_owned = (val & 1) || (val == 0);
18068 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
18069 val_conv = OutPoint_clone(&val_conv);
18070 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
18073 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_script_pubkey(uint32_t this_ptr) {
18074 LDKWatchedOutput this_ptr_conv;
18075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18076 this_ptr_conv.is_owned = false;
18077 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18078 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
18079 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
18080 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
18084 void __attribute__((visibility("default"))) TS_WatchedOutput_set_script_pubkey(uint32_t this_ptr, int8_tArray val) {
18085 LDKWatchedOutput this_ptr_conv;
18086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18087 this_ptr_conv.is_owned = false;
18088 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18089 LDKCVec_u8Z val_ref;
18090 val_ref.datalen = val->arr_len;
18091 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
18092 memcpy(val_ref.data, val->elems, val_ref.datalen);
18093 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
18096 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_new(int8_tArray block_hash_arg, uint32_t outpoint_arg, int8_tArray script_pubkey_arg) {
18097 LDKThirtyTwoBytes block_hash_arg_ref;
18098 CHECK(block_hash_arg->arr_len == 32);
18099 memcpy(block_hash_arg_ref.data, block_hash_arg->elems, 32);
18100 LDKOutPoint outpoint_arg_conv;
18101 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
18102 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
18103 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
18104 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
18105 LDKCVec_u8Z script_pubkey_arg_ref;
18106 script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
18107 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
18108 memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen);
18109 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
18110 uint64_t ret_ref = 0;
18111 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18112 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18113 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18114 ret_ref = (uint64_t)ret_var.inner;
18115 if (ret_var.is_owned) {
18121 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
18122 LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
18123 uint64_t ret_ref = 0;
18124 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18125 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18126 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18127 ret_ref = (uint64_t)ret_var.inner;
18128 if (ret_var.is_owned) {
18133 int64_t __attribute__((visibility("default"))) TS_WatchedOutput_clone_ptr(uint32_t arg) {
18134 LDKWatchedOutput arg_conv;
18135 arg_conv.inner = (void*)(arg & (~1));
18136 arg_conv.is_owned = false;
18137 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18138 int64_t ret_val = WatchedOutput_clone_ptr(&arg_conv);
18142 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_clone(uint32_t orig) {
18143 LDKWatchedOutput orig_conv;
18144 orig_conv.inner = (void*)(orig & (~1));
18145 orig_conv.is_owned = false;
18146 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18147 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
18148 uint64_t ret_ref = 0;
18149 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18150 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18151 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18152 ret_ref = (uint64_t)ret_var.inner;
18153 if (ret_var.is_owned) {
18159 int64_t __attribute__((visibility("default"))) TS_WatchedOutput_hash(uint32_t o) {
18160 LDKWatchedOutput o_conv;
18161 o_conv.inner = (void*)(o & (~1));
18162 o_conv.is_owned = false;
18163 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18164 int64_t ret_val = WatchedOutput_hash(&o_conv);
18168 void __attribute__((visibility("default"))) TS_BroadcasterInterface_free(uint32_t this_ptr) {
18169 if ((this_ptr & 1) != 0) return;
18170 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18171 CHECK_ACCESS(this_ptr_ptr);
18172 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
18173 FREE((void*)this_ptr);
18174 BroadcasterInterface_free(this_ptr_conv);
18177 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_clone(uint32_t orig) {
18178 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
18179 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
18183 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_background() {
18184 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
18188 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_normal() {
18189 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
18193 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_high_priority() {
18194 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
18198 jboolean __attribute__((visibility("default"))) TS_ConfirmationTarget_eq(uint32_t a, uint32_t b) {
18199 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
18200 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
18201 jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
18205 void __attribute__((visibility("default"))) TS_FeeEstimator_free(uint32_t this_ptr) {
18206 if ((this_ptr & 1) != 0) return;
18207 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18208 CHECK_ACCESS(this_ptr_ptr);
18209 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
18210 FREE((void*)this_ptr);
18211 FeeEstimator_free(this_ptr_conv);
18214 void __attribute__((visibility("default"))) TS_MonitorUpdateId_free(uint32_t this_obj) {
18215 LDKMonitorUpdateId this_obj_conv;
18216 this_obj_conv.inner = (void*)(this_obj & (~1));
18217 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18218 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18219 MonitorUpdateId_free(this_obj_conv);
18222 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
18223 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
18224 uint64_t ret_ref = 0;
18225 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18226 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18227 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18228 ret_ref = (uint64_t)ret_var.inner;
18229 if (ret_var.is_owned) {
18234 int64_t __attribute__((visibility("default"))) TS_MonitorUpdateId_clone_ptr(uint32_t arg) {
18235 LDKMonitorUpdateId arg_conv;
18236 arg_conv.inner = (void*)(arg & (~1));
18237 arg_conv.is_owned = false;
18238 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18239 int64_t ret_val = MonitorUpdateId_clone_ptr(&arg_conv);
18243 uint32_t __attribute__((visibility("default"))) TS_MonitorUpdateId_clone(uint32_t orig) {
18244 LDKMonitorUpdateId orig_conv;
18245 orig_conv.inner = (void*)(orig & (~1));
18246 orig_conv.is_owned = false;
18247 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18248 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
18249 uint64_t ret_ref = 0;
18250 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18251 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18252 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18253 ret_ref = (uint64_t)ret_var.inner;
18254 if (ret_var.is_owned) {
18260 int64_t __attribute__((visibility("default"))) TS_MonitorUpdateId_hash(uint32_t o) {
18261 LDKMonitorUpdateId o_conv;
18262 o_conv.inner = (void*)(o & (~1));
18263 o_conv.is_owned = false;
18264 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18265 int64_t ret_val = MonitorUpdateId_hash(&o_conv);
18269 jboolean __attribute__((visibility("default"))) TS_MonitorUpdateId_eq(uint32_t a, uint32_t b) {
18270 LDKMonitorUpdateId a_conv;
18271 a_conv.inner = (void*)(a & (~1));
18272 a_conv.is_owned = false;
18273 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18274 LDKMonitorUpdateId b_conv;
18275 b_conv.inner = (void*)(b & (~1));
18276 b_conv.is_owned = false;
18277 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
18278 jboolean ret_val = MonitorUpdateId_eq(&a_conv, &b_conv);
18282 void __attribute__((visibility("default"))) TS_Persist_free(uint32_t this_ptr) {
18283 if ((this_ptr & 1) != 0) return;
18284 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18285 CHECK_ACCESS(this_ptr_ptr);
18286 LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
18287 FREE((void*)this_ptr);
18288 Persist_free(this_ptr_conv);
18291 void __attribute__((visibility("default"))) TS_LockedChannelMonitor_free(uint32_t this_obj) {
18292 LDKLockedChannelMonitor this_obj_conv;
18293 this_obj_conv.inner = (void*)(this_obj & (~1));
18294 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18295 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18296 LockedChannelMonitor_free(this_obj_conv);
18299 void __attribute__((visibility("default"))) TS_ChainMonitor_free(uint32_t this_obj) {
18300 LDKChainMonitor this_obj_conv;
18301 this_obj_conv.inner = (void*)(this_obj & (~1));
18302 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18303 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18304 ChainMonitor_free(this_obj_conv);
18307 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_new(uint32_t chain_source, uint32_t broadcaster, uint32_t logger, uint32_t feeest, uint32_t persister) {
18308 void* chain_source_ptr = (void*)(((uint64_t)chain_source) & ~1);
18309 CHECK_ACCESS(chain_source_ptr);
18310 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
18311 // Warning: we may need a move here but no clone is available for LDKCOption_FilterZ
18312 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
18313 // Manually implement clone for Java trait instances
18315 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
18316 CHECK_ACCESS(broadcaster_ptr);
18317 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
18318 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
18319 CHECK_ACCESS(logger_ptr);
18320 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
18321 void* feeest_ptr = (void*)(((uint64_t)feeest) & ~1);
18322 CHECK_ACCESS(feeest_ptr);
18323 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
18324 void* persister_ptr = (void*)(((uint64_t)persister) & ~1);
18325 CHECK_ACCESS(persister_ptr);
18326 LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
18327 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
18328 uint64_t ret_ref = 0;
18329 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18330 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18331 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18332 ret_ref = (uint64_t)ret_var.inner;
18333 if (ret_var.is_owned) {
18339 uint32_tArray __attribute__((visibility("default"))) TS_ChainMonitor_get_claimable_balances(uint32_t this_arg, uint32_tArray ignored_channels) {
18340 LDKChainMonitor this_arg_conv;
18341 this_arg_conv.inner = (void*)(this_arg & (~1));
18342 this_arg_conv.is_owned = false;
18343 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18344 LDKCVec_ChannelDetailsZ ignored_channels_constr;
18345 ignored_channels_constr.datalen = ignored_channels->arr_len;
18346 if (ignored_channels_constr.datalen > 0)
18347 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
18349 ignored_channels_constr.data = NULL;
18350 uint32_t* ignored_channels_vals = ignored_channels->elems;
18351 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
18352 uint32_t ignored_channels_conv_16 = ignored_channels_vals[q];
18353 LDKChannelDetails ignored_channels_conv_16_conv;
18354 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
18355 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
18356 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
18357 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
18358 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
18360 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
18361 uint32_tArray ret_arr = NULL;
18362 ret_arr = init_uint32_tArray(ret_var.datalen);
18363 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
18364 for (size_t j = 0; j < ret_var.datalen; j++) {
18365 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
18366 *ret_conv_9_copy = ret_var.data[j];
18367 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
18368 ret_arr_ptr[j] = ret_conv_9_ref;
18371 FREE(ret_var.data);
18375 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_get_monitor(uint32_t this_arg, uint32_t funding_txo) {
18376 LDKChainMonitor this_arg_conv;
18377 this_arg_conv.inner = (void*)(this_arg & (~1));
18378 this_arg_conv.is_owned = false;
18379 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18380 LDKOutPoint funding_txo_conv;
18381 funding_txo_conv.inner = (void*)(funding_txo & (~1));
18382 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
18383 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
18384 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
18385 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
18386 *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
18387 return (uint64_t)ret_conv;
18390 uint32_tArray __attribute__((visibility("default"))) TS_ChainMonitor_list_monitors(uint32_t this_arg) {
18391 LDKChainMonitor this_arg_conv;
18392 this_arg_conv.inner = (void*)(this_arg & (~1));
18393 this_arg_conv.is_owned = false;
18394 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18395 LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
18396 uint32_tArray ret_arr = NULL;
18397 ret_arr = init_uint32_tArray(ret_var.datalen);
18398 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
18399 for (size_t k = 0; k < ret_var.datalen; k++) {
18400 LDKOutPoint ret_conv_10_var = ret_var.data[k];
18401 uint64_t ret_conv_10_ref = 0;
18402 CHECK((((uint64_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18403 CHECK((((uint64_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18404 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
18405 ret_conv_10_ref = (uint64_t)ret_conv_10_var.inner;
18406 if (ret_conv_10_var.is_owned) {
18407 ret_conv_10_ref |= 1;
18409 ret_arr_ptr[k] = ret_conv_10_ref;
18412 FREE(ret_var.data);
18416 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_channel_monitor_updated(uint32_t this_arg, uint32_t funding_txo, uint32_t completed_update_id) {
18417 LDKChainMonitor this_arg_conv;
18418 this_arg_conv.inner = (void*)(this_arg & (~1));
18419 this_arg_conv.is_owned = false;
18420 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18421 LDKOutPoint funding_txo_conv;
18422 funding_txo_conv.inner = (void*)(funding_txo & (~1));
18423 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
18424 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
18425 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
18426 LDKMonitorUpdateId completed_update_id_conv;
18427 completed_update_id_conv.inner = (void*)(completed_update_id & (~1));
18428 completed_update_id_conv.is_owned = (completed_update_id & 1) || (completed_update_id == 0);
18429 CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
18430 completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
18431 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18432 *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
18433 return (uint64_t)ret_conv;
18436 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Listen(uint32_t this_arg) {
18437 LDKChainMonitor this_arg_conv;
18438 this_arg_conv.inner = (void*)(this_arg & (~1));
18439 this_arg_conv.is_owned = false;
18440 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18441 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
18442 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
18443 return (uint64_t)ret_ret;
18446 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Confirm(uint32_t this_arg) {
18447 LDKChainMonitor this_arg_conv;
18448 this_arg_conv.inner = (void*)(this_arg & (~1));
18449 this_arg_conv.is_owned = false;
18450 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18451 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
18452 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
18453 return (uint64_t)ret_ret;
18456 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Watch(uint32_t this_arg) {
18457 LDKChainMonitor this_arg_conv;
18458 this_arg_conv.inner = (void*)(this_arg & (~1));
18459 this_arg_conv.is_owned = false;
18460 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18461 LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
18462 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
18463 return (uint64_t)ret_ret;
18466 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_EventsProvider(uint32_t this_arg) {
18467 LDKChainMonitor this_arg_conv;
18468 this_arg_conv.inner = (void*)(this_arg & (~1));
18469 this_arg_conv.is_owned = false;
18470 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18471 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
18472 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
18473 return (uint64_t)ret_ret;
18476 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_free(uint32_t this_obj) {
18477 LDKChannelMonitorUpdate this_obj_conv;
18478 this_obj_conv.inner = (void*)(this_obj & (~1));
18479 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18480 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18481 ChannelMonitorUpdate_free(this_obj_conv);
18484 int64_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_get_update_id(uint32_t this_ptr) {
18485 LDKChannelMonitorUpdate this_ptr_conv;
18486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18487 this_ptr_conv.is_owned = false;
18488 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18489 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
18493 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_set_update_id(uint32_t this_ptr, int64_t val) {
18494 LDKChannelMonitorUpdate this_ptr_conv;
18495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18496 this_ptr_conv.is_owned = false;
18497 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
18498 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
18501 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
18502 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
18503 uint64_t ret_ref = 0;
18504 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18505 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18506 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18507 ret_ref = (uint64_t)ret_var.inner;
18508 if (ret_var.is_owned) {
18513 int64_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_clone_ptr(uint32_t arg) {
18514 LDKChannelMonitorUpdate arg_conv;
18515 arg_conv.inner = (void*)(arg & (~1));
18516 arg_conv.is_owned = false;
18517 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18518 int64_t ret_val = ChannelMonitorUpdate_clone_ptr(&arg_conv);
18522 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_clone(uint32_t orig) {
18523 LDKChannelMonitorUpdate orig_conv;
18524 orig_conv.inner = (void*)(orig & (~1));
18525 orig_conv.is_owned = false;
18526 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18527 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
18528 uint64_t ret_ref = 0;
18529 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18530 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18531 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18532 ret_ref = (uint64_t)ret_var.inner;
18533 if (ret_var.is_owned) {
18539 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_write(uint32_t obj) {
18540 LDKChannelMonitorUpdate obj_conv;
18541 obj_conv.inner = (void*)(obj & (~1));
18542 obj_conv.is_owned = false;
18543 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
18544 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
18545 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
18546 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
18547 CVec_u8Z_free(ret_var);
18551 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
18552 LDKu8slice ser_ref;
18553 ser_ref.datalen = ser->arr_len;
18554 ser_ref.data = ser->elems;
18555 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
18556 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
18557 return (uint64_t)ret_conv;
18560 void __attribute__((visibility("default"))) TS_MonitorEvent_free(uint32_t this_ptr) {
18561 if ((this_ptr & 1) != 0) return;
18562 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18563 CHECK_ACCESS(this_ptr_ptr);
18564 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
18565 FREE((void*)this_ptr);
18566 MonitorEvent_free(this_ptr_conv);
18569 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
18570 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18571 *ret_copy = MonitorEvent_clone(arg);
18572 uint64_t ret_ref = (uint64_t)ret_copy;
18575 int64_t __attribute__((visibility("default"))) TS_MonitorEvent_clone_ptr(uint32_t arg) {
18576 LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)arg;
18577 int64_t ret_val = MonitorEvent_clone_ptr(arg_conv);
18581 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_clone(uint32_t orig) {
18582 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
18583 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18584 *ret_copy = MonitorEvent_clone(orig_conv);
18585 uint64_t ret_ref = (uint64_t)ret_copy;
18589 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_htlcevent(uint32_t a) {
18590 LDKHTLCUpdate a_conv;
18591 a_conv.inner = (void*)(a & (~1));
18592 a_conv.is_owned = (a & 1) || (a == 0);
18593 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18594 a_conv = HTLCUpdate_clone(&a_conv);
18595 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18596 *ret_copy = MonitorEvent_htlcevent(a_conv);
18597 uint64_t ret_ref = (uint64_t)ret_copy;
18601 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_commitment_tx_confirmed(uint32_t a) {
18602 LDKOutPoint a_conv;
18603 a_conv.inner = (void*)(a & (~1));
18604 a_conv.is_owned = (a & 1) || (a == 0);
18605 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18606 a_conv = OutPoint_clone(&a_conv);
18607 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18608 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
18609 uint64_t ret_ref = (uint64_t)ret_copy;
18613 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_update_completed(uint32_t funding_txo, int64_t monitor_update_id) {
18614 LDKOutPoint funding_txo_conv;
18615 funding_txo_conv.inner = (void*)(funding_txo & (~1));
18616 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
18617 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
18618 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
18619 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18620 *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id);
18621 uint64_t ret_ref = (uint64_t)ret_copy;
18625 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_update_failed(uint32_t a) {
18626 LDKOutPoint a_conv;
18627 a_conv.inner = (void*)(a & (~1));
18628 a_conv.is_owned = (a & 1) || (a == 0);
18629 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18630 a_conv = OutPoint_clone(&a_conv);
18631 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18632 *ret_copy = MonitorEvent_update_failed(a_conv);
18633 uint64_t ret_ref = (uint64_t)ret_copy;
18637 int8_tArray __attribute__((visibility("default"))) TS_MonitorEvent_write(uint32_t obj) {
18638 LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)obj;
18639 LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
18640 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
18641 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
18642 CVec_u8Z_free(ret_var);
18646 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_read(int8_tArray ser) {
18647 LDKu8slice ser_ref;
18648 ser_ref.datalen = ser->arr_len;
18649 ser_ref.data = ser->elems;
18650 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
18651 *ret_conv = MonitorEvent_read(ser_ref);
18652 return (uint64_t)ret_conv;
18655 void __attribute__((visibility("default"))) TS_HTLCUpdate_free(uint32_t this_obj) {
18656 LDKHTLCUpdate this_obj_conv;
18657 this_obj_conv.inner = (void*)(this_obj & (~1));
18658 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18659 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18660 HTLCUpdate_free(this_obj_conv);
18663 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
18664 LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
18665 uint64_t ret_ref = 0;
18666 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18667 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18668 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18669 ret_ref = (uint64_t)ret_var.inner;
18670 if (ret_var.is_owned) {
18675 int64_t __attribute__((visibility("default"))) TS_HTLCUpdate_clone_ptr(uint32_t arg) {
18676 LDKHTLCUpdate arg_conv;
18677 arg_conv.inner = (void*)(arg & (~1));
18678 arg_conv.is_owned = false;
18679 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18680 int64_t ret_val = HTLCUpdate_clone_ptr(&arg_conv);
18684 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_clone(uint32_t orig) {
18685 LDKHTLCUpdate orig_conv;
18686 orig_conv.inner = (void*)(orig & (~1));
18687 orig_conv.is_owned = false;
18688 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18689 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
18690 uint64_t ret_ref = 0;
18691 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18692 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18693 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18694 ret_ref = (uint64_t)ret_var.inner;
18695 if (ret_var.is_owned) {
18701 int8_tArray __attribute__((visibility("default"))) TS_HTLCUpdate_write(uint32_t obj) {
18702 LDKHTLCUpdate obj_conv;
18703 obj_conv.inner = (void*)(obj & (~1));
18704 obj_conv.is_owned = false;
18705 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
18706 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
18707 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
18708 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
18709 CVec_u8Z_free(ret_var);
18713 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_read(int8_tArray ser) {
18714 LDKu8slice ser_ref;
18715 ser_ref.datalen = ser->arr_len;
18716 ser_ref.data = ser->elems;
18717 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
18718 *ret_conv = HTLCUpdate_read(ser_ref);
18719 return (uint64_t)ret_conv;
18722 void __attribute__((visibility("default"))) TS_Balance_free(uint32_t this_ptr) {
18723 if ((this_ptr & 1) != 0) return;
18724 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
18725 CHECK_ACCESS(this_ptr_ptr);
18726 LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
18727 FREE((void*)this_ptr);
18728 Balance_free(this_ptr_conv);
18731 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
18732 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
18733 *ret_copy = Balance_clone(arg);
18734 uint64_t ret_ref = (uint64_t)ret_copy;
18737 int64_t __attribute__((visibility("default"))) TS_Balance_clone_ptr(uint32_t arg) {
18738 LDKBalance* arg_conv = (LDKBalance*)arg;
18739 int64_t ret_val = Balance_clone_ptr(arg_conv);
18743 uint32_t __attribute__((visibility("default"))) TS_Balance_clone(uint32_t orig) {
18744 LDKBalance* orig_conv = (LDKBalance*)orig;
18745 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
18746 *ret_copy = Balance_clone(orig_conv);
18747 uint64_t ret_ref = (uint64_t)ret_copy;
18751 uint32_t __attribute__((visibility("default"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
18752 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
18753 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
18754 uint64_t ret_ref = (uint64_t)ret_copy;
18758 uint32_t __attribute__((visibility("default"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
18759 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
18760 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
18761 uint64_t ret_ref = (uint64_t)ret_copy;
18765 uint32_t __attribute__((visibility("default"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
18766 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
18767 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
18768 uint64_t ret_ref = (uint64_t)ret_copy;
18772 uint32_t __attribute__((visibility("default"))) TS_Balance_maybe_claimable_htlcawaiting_timeout(int64_t claimable_amount_satoshis, int32_t claimable_height) {
18773 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
18774 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
18775 uint64_t ret_ref = (uint64_t)ret_copy;
18779 jboolean __attribute__((visibility("default"))) TS_Balance_eq(uint32_t a, uint32_t b) {
18780 LDKBalance* a_conv = (LDKBalance*)a;
18781 LDKBalance* b_conv = (LDKBalance*)b;
18782 jboolean ret_val = Balance_eq(a_conv, b_conv);
18786 void __attribute__((visibility("default"))) TS_ChannelMonitor_free(uint32_t this_obj) {
18787 LDKChannelMonitor this_obj_conv;
18788 this_obj_conv.inner = (void*)(this_obj & (~1));
18789 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18790 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
18791 ChannelMonitor_free(this_obj_conv);
18794 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
18795 LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
18796 uint64_t ret_ref = 0;
18797 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18798 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18799 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18800 ret_ref = (uint64_t)ret_var.inner;
18801 if (ret_var.is_owned) {
18806 int64_t __attribute__((visibility("default"))) TS_ChannelMonitor_clone_ptr(uint32_t arg) {
18807 LDKChannelMonitor arg_conv;
18808 arg_conv.inner = (void*)(arg & (~1));
18809 arg_conv.is_owned = false;
18810 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
18811 int64_t ret_val = ChannelMonitor_clone_ptr(&arg_conv);
18815 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_clone(uint32_t orig) {
18816 LDKChannelMonitor orig_conv;
18817 orig_conv.inner = (void*)(orig & (~1));
18818 orig_conv.is_owned = false;
18819 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
18820 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
18821 uint64_t ret_ref = 0;
18822 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18823 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18824 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18825 ret_ref = (uint64_t)ret_var.inner;
18826 if (ret_var.is_owned) {
18832 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_write(uint32_t obj) {
18833 LDKChannelMonitor obj_conv;
18834 obj_conv.inner = (void*)(obj & (~1));
18835 obj_conv.is_owned = false;
18836 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
18837 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
18838 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
18839 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
18840 CVec_u8Z_free(ret_var);
18844 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) {
18845 LDKChannelMonitor this_arg_conv;
18846 this_arg_conv.inner = (void*)(this_arg & (~1));
18847 this_arg_conv.is_owned = false;
18848 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18849 LDKChannelMonitorUpdate updates_conv;
18850 updates_conv.inner = (void*)(updates & (~1));
18851 updates_conv.is_owned = false;
18852 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
18853 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
18854 if (!(broadcaster & 1)) { CHECK_ACCESS(broadcaster_ptr); }
18855 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
18856 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
18857 if (!(fee_estimator & 1)) { CHECK_ACCESS(fee_estimator_ptr); }
18858 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
18859 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
18860 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
18861 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
18862 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
18863 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
18864 return (uint64_t)ret_conv;
18867 int64_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_update_id(uint32_t this_arg) {
18868 LDKChannelMonitor this_arg_conv;
18869 this_arg_conv.inner = (void*)(this_arg & (~1));
18870 this_arg_conv.is_owned = false;
18871 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18872 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
18876 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_funding_txo(uint32_t this_arg) {
18877 LDKChannelMonitor this_arg_conv;
18878 this_arg_conv.inner = (void*)(this_arg & (~1));
18879 this_arg_conv.is_owned = false;
18880 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18881 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
18882 *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
18883 return ((uint64_t)ret_conv);
18886 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_outputs_to_watch(uint32_t this_arg) {
18887 LDKChannelMonitor this_arg_conv;
18888 this_arg_conv.inner = (void*)(this_arg & (~1));
18889 this_arg_conv.is_owned = false;
18890 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18891 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
18892 uint32_tArray ret_arr = NULL;
18893 ret_arr = init_uint32_tArray(ret_var.datalen);
18894 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
18895 for (size_t o = 0; o < ret_var.datalen; o++) {
18896 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
18897 *ret_conv_40_conv = ret_var.data[o];
18898 ret_arr_ptr[o] = ((uint64_t)ret_conv_40_conv);
18901 FREE(ret_var.data);
18905 void __attribute__((visibility("default"))) TS_ChannelMonitor_load_outputs_to_watch(uint32_t this_arg, uint32_t filter) {
18906 LDKChannelMonitor this_arg_conv;
18907 this_arg_conv.inner = (void*)(this_arg & (~1));
18908 this_arg_conv.is_owned = false;
18909 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18910 void* filter_ptr = (void*)(((uint64_t)filter) & ~1);
18911 if (!(filter & 1)) { CHECK_ACCESS(filter_ptr); }
18912 LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
18913 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
18916 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_monitor_events(uint32_t this_arg) {
18917 LDKChannelMonitor this_arg_conv;
18918 this_arg_conv.inner = (void*)(this_arg & (~1));
18919 this_arg_conv.is_owned = false;
18920 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18921 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
18922 uint32_tArray ret_arr = NULL;
18923 ret_arr = init_uint32_tArray(ret_var.datalen);
18924 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
18925 for (size_t o = 0; o < ret_var.datalen; o++) {
18926 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
18927 *ret_conv_14_copy = ret_var.data[o];
18928 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
18929 ret_arr_ptr[o] = ret_conv_14_ref;
18932 FREE(ret_var.data);
18936 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_events(uint32_t this_arg) {
18937 LDKChannelMonitor this_arg_conv;
18938 this_arg_conv.inner = (void*)(this_arg & (~1));
18939 this_arg_conv.is_owned = false;
18940 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18941 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
18942 uint32_tArray ret_arr = NULL;
18943 ret_arr = init_uint32_tArray(ret_var.datalen);
18944 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
18945 for (size_t h = 0; h < ret_var.datalen; h++) {
18946 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
18947 *ret_conv_7_copy = ret_var.data[h];
18948 uint64_t ret_conv_7_ref = (uint64_t)ret_conv_7_copy;
18949 ret_arr_ptr[h] = ret_conv_7_ref;
18952 FREE(ret_var.data);
18956 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_holder_commitment_txn(uint32_t this_arg, uint32_t logger) {
18957 LDKChannelMonitor this_arg_conv;
18958 this_arg_conv.inner = (void*)(this_arg & (~1));
18959 this_arg_conv.is_owned = false;
18960 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18961 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
18962 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
18963 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
18964 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
18965 ptrArray ret_arr = NULL;
18966 ret_arr = init_ptrArray(ret_var.datalen);
18967 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
18968 for (size_t m = 0; m < ret_var.datalen; m++) {
18969 LDKTransaction ret_conv_12_var = ret_var.data[m];
18970 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen);
18971 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
18972 Transaction_free(ret_conv_12_var);
18973 ret_arr_ptr[m] = ret_conv_12_arr;
18976 FREE(ret_var.data);
18980 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) {
18981 LDKChannelMonitor this_arg_conv;
18982 this_arg_conv.inner = (void*)(this_arg & (~1));
18983 this_arg_conv.is_owned = false;
18984 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
18985 unsigned char header_arr[80];
18986 CHECK(header->arr_len == 80);
18987 memcpy(header_arr, header->elems, 80);
18988 unsigned char (*header_ref)[80] = &header_arr;
18989 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
18990 txdata_constr.datalen = txdata->arr_len;
18991 if (txdata_constr.datalen > 0)
18992 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
18994 txdata_constr.data = NULL;
18995 uint32_t* txdata_vals = txdata->elems;
18996 for (size_t c = 0; c < txdata_constr.datalen; c++) {
18997 uint32_t txdata_conv_28 = txdata_vals[c];
18998 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
18999 CHECK_ACCESS(txdata_conv_28_ptr);
19000 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
19001 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
19002 txdata_constr.data[c] = txdata_conv_28_conv;
19004 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19005 CHECK_ACCESS(broadcaster_ptr);
19006 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19007 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19008 CHECK_ACCESS(fee_estimator_ptr);
19009 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19010 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19011 CHECK_ACCESS(logger_ptr);
19012 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19013 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);
19014 uint32_tArray ret_arr = NULL;
19015 ret_arr = init_uint32_tArray(ret_var.datalen);
19016 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
19017 for (size_t n = 0; n < ret_var.datalen; n++) {
19018 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19019 *ret_conv_39_conv = ret_var.data[n];
19020 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
19023 FREE(ret_var.data);
19027 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) {
19028 LDKChannelMonitor this_arg_conv;
19029 this_arg_conv.inner = (void*)(this_arg & (~1));
19030 this_arg_conv.is_owned = false;
19031 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19032 unsigned char header_arr[80];
19033 CHECK(header->arr_len == 80);
19034 memcpy(header_arr, header->elems, 80);
19035 unsigned char (*header_ref)[80] = &header_arr;
19036 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19037 CHECK_ACCESS(broadcaster_ptr);
19038 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19039 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19040 CHECK_ACCESS(fee_estimator_ptr);
19041 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19042 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19043 CHECK_ACCESS(logger_ptr);
19044 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19045 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
19048 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) {
19049 LDKChannelMonitor this_arg_conv;
19050 this_arg_conv.inner = (void*)(this_arg & (~1));
19051 this_arg_conv.is_owned = false;
19052 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19053 unsigned char header_arr[80];
19054 CHECK(header->arr_len == 80);
19055 memcpy(header_arr, header->elems, 80);
19056 unsigned char (*header_ref)[80] = &header_arr;
19057 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
19058 txdata_constr.datalen = txdata->arr_len;
19059 if (txdata_constr.datalen > 0)
19060 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
19062 txdata_constr.data = NULL;
19063 uint32_t* txdata_vals = txdata->elems;
19064 for (size_t c = 0; c < txdata_constr.datalen; c++) {
19065 uint32_t txdata_conv_28 = txdata_vals[c];
19066 void* txdata_conv_28_ptr = (void*)(((uint64_t)txdata_conv_28) & ~1);
19067 CHECK_ACCESS(txdata_conv_28_ptr);
19068 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
19069 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
19070 txdata_constr.data[c] = txdata_conv_28_conv;
19072 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19073 CHECK_ACCESS(broadcaster_ptr);
19074 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19075 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19076 CHECK_ACCESS(fee_estimator_ptr);
19077 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19078 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19079 CHECK_ACCESS(logger_ptr);
19080 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19081 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);
19082 uint32_tArray ret_arr = NULL;
19083 ret_arr = init_uint32_tArray(ret_var.datalen);
19084 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
19085 for (size_t n = 0; n < ret_var.datalen; n++) {
19086 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19087 *ret_conv_39_conv = ret_var.data[n];
19088 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
19091 FREE(ret_var.data);
19095 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) {
19096 LDKChannelMonitor this_arg_conv;
19097 this_arg_conv.inner = (void*)(this_arg & (~1));
19098 this_arg_conv.is_owned = false;
19099 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19100 unsigned char txid_arr[32];
19101 CHECK(txid->arr_len == 32);
19102 memcpy(txid_arr, txid->elems, 32);
19103 unsigned char (*txid_ref)[32] = &txid_arr;
19104 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19105 CHECK_ACCESS(broadcaster_ptr);
19106 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19107 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19108 CHECK_ACCESS(fee_estimator_ptr);
19109 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19110 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19111 CHECK_ACCESS(logger_ptr);
19112 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19113 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
19116 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) {
19117 LDKChannelMonitor this_arg_conv;
19118 this_arg_conv.inner = (void*)(this_arg & (~1));
19119 this_arg_conv.is_owned = false;
19120 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19121 unsigned char header_arr[80];
19122 CHECK(header->arr_len == 80);
19123 memcpy(header_arr, header->elems, 80);
19124 unsigned char (*header_ref)[80] = &header_arr;
19125 void* broadcaster_ptr = (void*)(((uint64_t)broadcaster) & ~1);
19126 CHECK_ACCESS(broadcaster_ptr);
19127 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
19128 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
19129 CHECK_ACCESS(fee_estimator_ptr);
19130 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
19131 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
19132 CHECK_ACCESS(logger_ptr);
19133 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
19134 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
19135 uint32_tArray ret_arr = NULL;
19136 ret_arr = init_uint32_tArray(ret_var.datalen);
19137 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
19138 for (size_t n = 0; n < ret_var.datalen; n++) {
19139 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19140 *ret_conv_39_conv = ret_var.data[n];
19141 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
19144 FREE(ret_var.data);
19148 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_relevant_txids(uint32_t this_arg) {
19149 LDKChannelMonitor this_arg_conv;
19150 this_arg_conv.inner = (void*)(this_arg & (~1));
19151 this_arg_conv.is_owned = false;
19152 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19153 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
19154 ptrArray ret_arr = NULL;
19155 ret_arr = init_ptrArray(ret_var.datalen);
19156 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
19157 for (size_t m = 0; m < ret_var.datalen; m++) {
19158 int8_tArray ret_conv_12_arr = init_int8_tArray(32);
19159 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
19160 ret_arr_ptr[m] = ret_conv_12_arr;
19163 FREE(ret_var.data);
19167 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_current_best_block(uint32_t this_arg) {
19168 LDKChannelMonitor this_arg_conv;
19169 this_arg_conv.inner = (void*)(this_arg & (~1));
19170 this_arg_conv.is_owned = false;
19171 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19172 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
19173 uint64_t ret_ref = 0;
19174 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19175 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19176 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19177 ret_ref = (uint64_t)ret_var.inner;
19178 if (ret_var.is_owned) {
19184 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_claimable_balances(uint32_t this_arg) {
19185 LDKChannelMonitor this_arg_conv;
19186 this_arg_conv.inner = (void*)(this_arg & (~1));
19187 this_arg_conv.is_owned = false;
19188 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19189 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
19190 uint32_tArray ret_arr = NULL;
19191 ret_arr = init_uint32_tArray(ret_var.datalen);
19192 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
19193 for (size_t j = 0; j < ret_var.datalen; j++) {
19194 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
19195 *ret_conv_9_copy = ret_var.data[j];
19196 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
19197 ret_arr_ptr[j] = ret_conv_9_ref;
19200 FREE(ret_var.data);
19204 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint32_t arg) {
19205 LDKu8slice ser_ref;
19206 ser_ref.datalen = ser->arr_len;
19207 ser_ref.data = ser->elems;
19208 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
19209 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
19210 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
19211 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19212 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
19213 return (uint64_t)ret_conv;
19216 void __attribute__((visibility("default"))) TS_OutPoint_free(uint32_t this_obj) {
19217 LDKOutPoint this_obj_conv;
19218 this_obj_conv.inner = (void*)(this_obj & (~1));
19219 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19220 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
19221 OutPoint_free(this_obj_conv);
19224 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_get_txid(uint32_t this_ptr) {
19225 LDKOutPoint this_ptr_conv;
19226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19227 this_ptr_conv.is_owned = false;
19228 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19229 int8_tArray ret_arr = init_int8_tArray(32);
19230 memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
19234 void __attribute__((visibility("default"))) TS_OutPoint_set_txid(uint32_t this_ptr, int8_tArray val) {
19235 LDKOutPoint this_ptr_conv;
19236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19237 this_ptr_conv.is_owned = false;
19238 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19239 LDKThirtyTwoBytes val_ref;
19240 CHECK(val->arr_len == 32);
19241 memcpy(val_ref.data, val->elems, 32);
19242 OutPoint_set_txid(&this_ptr_conv, val_ref);
19245 int16_t __attribute__((visibility("default"))) TS_OutPoint_get_index(uint32_t this_ptr) {
19246 LDKOutPoint this_ptr_conv;
19247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19248 this_ptr_conv.is_owned = false;
19249 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19250 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
19254 void __attribute__((visibility("default"))) TS_OutPoint_set_index(uint32_t this_ptr, int16_t val) {
19255 LDKOutPoint this_ptr_conv;
19256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19257 this_ptr_conv.is_owned = false;
19258 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19259 OutPoint_set_index(&this_ptr_conv, val);
19262 uint32_t __attribute__((visibility("default"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
19263 LDKThirtyTwoBytes txid_arg_ref;
19264 CHECK(txid_arg->arr_len == 32);
19265 memcpy(txid_arg_ref.data, txid_arg->elems, 32);
19266 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
19267 uint64_t ret_ref = 0;
19268 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19269 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19270 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19271 ret_ref = (uint64_t)ret_var.inner;
19272 if (ret_var.is_owned) {
19278 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
19279 LDKOutPoint ret_var = OutPoint_clone(arg);
19280 uint64_t ret_ref = 0;
19281 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19282 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19283 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19284 ret_ref = (uint64_t)ret_var.inner;
19285 if (ret_var.is_owned) {
19290 int64_t __attribute__((visibility("default"))) TS_OutPoint_clone_ptr(uint32_t arg) {
19291 LDKOutPoint arg_conv;
19292 arg_conv.inner = (void*)(arg & (~1));
19293 arg_conv.is_owned = false;
19294 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
19295 int64_t ret_val = OutPoint_clone_ptr(&arg_conv);
19299 uint32_t __attribute__((visibility("default"))) TS_OutPoint_clone(uint32_t orig) {
19300 LDKOutPoint orig_conv;
19301 orig_conv.inner = (void*)(orig & (~1));
19302 orig_conv.is_owned = false;
19303 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
19304 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
19305 uint64_t ret_ref = 0;
19306 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19307 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19308 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19309 ret_ref = (uint64_t)ret_var.inner;
19310 if (ret_var.is_owned) {
19316 jboolean __attribute__((visibility("default"))) TS_OutPoint_eq(uint32_t a, uint32_t b) {
19317 LDKOutPoint a_conv;
19318 a_conv.inner = (void*)(a & (~1));
19319 a_conv.is_owned = false;
19320 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19321 LDKOutPoint b_conv;
19322 b_conv.inner = (void*)(b & (~1));
19323 b_conv.is_owned = false;
19324 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
19325 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
19329 int64_t __attribute__((visibility("default"))) TS_OutPoint_hash(uint32_t o) {
19330 LDKOutPoint o_conv;
19331 o_conv.inner = (void*)(o & (~1));
19332 o_conv.is_owned = false;
19333 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19334 int64_t ret_val = OutPoint_hash(&o_conv);
19338 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_to_channel_id(uint32_t this_arg) {
19339 LDKOutPoint this_arg_conv;
19340 this_arg_conv.inner = (void*)(this_arg & (~1));
19341 this_arg_conv.is_owned = false;
19342 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
19343 int8_tArray ret_arr = init_int8_tArray(32);
19344 memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
19348 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_write(uint32_t obj) {
19349 LDKOutPoint obj_conv;
19350 obj_conv.inner = (void*)(obj & (~1));
19351 obj_conv.is_owned = false;
19352 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
19353 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
19354 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
19355 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
19356 CVec_u8Z_free(ret_var);
19360 uint32_t __attribute__((visibility("default"))) TS_OutPoint_read(int8_tArray ser) {
19361 LDKu8slice ser_ref;
19362 ser_ref.datalen = ser->arr_len;
19363 ser_ref.data = ser->elems;
19364 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
19365 *ret_conv = OutPoint_read(ser_ref);
19366 return (uint64_t)ret_conv;
19369 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_free(uint32_t this_obj) {
19370 LDKDelayedPaymentOutputDescriptor this_obj_conv;
19371 this_obj_conv.inner = (void*)(this_obj & (~1));
19372 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19373 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
19374 DelayedPaymentOutputDescriptor_free(this_obj_conv);
19377 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
19378 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19380 this_ptr_conv.is_owned = false;
19381 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19382 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
19383 uint64_t ret_ref = 0;
19384 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19385 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19386 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19387 ret_ref = (uint64_t)ret_var.inner;
19388 if (ret_var.is_owned) {
19394 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
19395 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19397 this_ptr_conv.is_owned = false;
19398 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19399 LDKOutPoint val_conv;
19400 val_conv.inner = (void*)(val & (~1));
19401 val_conv.is_owned = (val & 1) || (val == 0);
19402 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
19403 val_conv = OutPoint_clone(&val_conv);
19404 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
19407 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint32_t this_ptr) {
19408 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19410 this_ptr_conv.is_owned = false;
19411 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19412 int8_tArray ret_arr = init_int8_tArray(33);
19413 memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
19417 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
19418 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19420 this_ptr_conv.is_owned = false;
19421 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19422 LDKPublicKey val_ref;
19423 CHECK(val->arr_len == 33);
19424 memcpy(val_ref.compressed_form, val->elems, 33);
19425 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
19428 int16_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint32_t this_ptr) {
19429 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19431 this_ptr_conv.is_owned = false;
19432 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19433 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
19437 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint32_t this_ptr, int16_t val) {
19438 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19440 this_ptr_conv.is_owned = false;
19441 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19442 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
19445 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
19446 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19448 this_ptr_conv.is_owned = false;
19449 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19450 void* val_ptr = (void*)(((uint64_t)val) & ~1);
19451 CHECK_ACCESS(val_ptr);
19452 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
19453 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
19454 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
19457 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint32_t this_ptr) {
19458 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19460 this_ptr_conv.is_owned = false;
19461 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19462 int8_tArray ret_arr = init_int8_tArray(33);
19463 memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
19467 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint32_t this_ptr, int8_tArray val) {
19468 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19470 this_ptr_conv.is_owned = false;
19471 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19472 LDKPublicKey val_ref;
19473 CHECK(val->arr_len == 33);
19474 memcpy(val_ref.compressed_form, val->elems, 33);
19475 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
19478 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
19479 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19481 this_ptr_conv.is_owned = false;
19482 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19483 int8_tArray ret_arr = init_int8_tArray(32);
19484 memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
19488 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
19489 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19491 this_ptr_conv.is_owned = false;
19492 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19493 LDKThirtyTwoBytes val_ref;
19494 CHECK(val->arr_len == 32);
19495 memcpy(val_ref.data, val->elems, 32);
19496 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
19499 int64_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
19500 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19502 this_ptr_conv.is_owned = false;
19503 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19504 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
19508 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
19509 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
19510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19511 this_ptr_conv.is_owned = false;
19512 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19513 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
19516 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) {
19517 LDKOutPoint outpoint_arg_conv;
19518 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
19519 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
19520 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
19521 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
19522 LDKPublicKey per_commitment_point_arg_ref;
19523 CHECK(per_commitment_point_arg->arr_len == 33);
19524 memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33);
19525 void* output_arg_ptr = (void*)(((uint64_t)output_arg) & ~1);
19526 CHECK_ACCESS(output_arg_ptr);
19527 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
19528 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
19529 LDKPublicKey revocation_pubkey_arg_ref;
19530 CHECK(revocation_pubkey_arg->arr_len == 33);
19531 memcpy(revocation_pubkey_arg_ref.compressed_form, revocation_pubkey_arg->elems, 33);
19532 LDKThirtyTwoBytes channel_keys_id_arg_ref;
19533 CHECK(channel_keys_id_arg->arr_len == 32);
19534 memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32);
19535 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);
19536 uint64_t ret_ref = 0;
19537 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19538 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19539 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19540 ret_ref = (uint64_t)ret_var.inner;
19541 if (ret_var.is_owned) {
19547 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
19548 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
19549 uint64_t ret_ref = 0;
19550 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19551 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19552 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19553 ret_ref = (uint64_t)ret_var.inner;
19554 if (ret_var.is_owned) {
19559 int64_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint32_t arg) {
19560 LDKDelayedPaymentOutputDescriptor arg_conv;
19561 arg_conv.inner = (void*)(arg & (~1));
19562 arg_conv.is_owned = false;
19563 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
19564 int64_t ret_val = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
19568 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_clone(uint32_t orig) {
19569 LDKDelayedPaymentOutputDescriptor orig_conv;
19570 orig_conv.inner = (void*)(orig & (~1));
19571 orig_conv.is_owned = false;
19572 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
19573 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
19574 uint64_t ret_ref = 0;
19575 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19576 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19577 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19578 ret_ref = (uint64_t)ret_var.inner;
19579 if (ret_var.is_owned) {
19585 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_write(uint32_t obj) {
19586 LDKDelayedPaymentOutputDescriptor obj_conv;
19587 obj_conv.inner = (void*)(obj & (~1));
19588 obj_conv.is_owned = false;
19589 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
19590 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
19591 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
19592 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
19593 CVec_u8Z_free(ret_var);
19597 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
19598 LDKu8slice ser_ref;
19599 ser_ref.datalen = ser->arr_len;
19600 ser_ref.data = ser->elems;
19601 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19602 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
19603 return (uint64_t)ret_conv;
19606 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_free(uint32_t this_obj) {
19607 LDKStaticPaymentOutputDescriptor this_obj_conv;
19608 this_obj_conv.inner = (void*)(this_obj & (~1));
19609 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19610 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
19611 StaticPaymentOutputDescriptor_free(this_obj_conv);
19614 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
19615 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19617 this_ptr_conv.is_owned = false;
19618 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19619 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
19620 uint64_t ret_ref = 0;
19621 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19622 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19623 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19624 ret_ref = (uint64_t)ret_var.inner;
19625 if (ret_var.is_owned) {
19631 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
19632 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19634 this_ptr_conv.is_owned = false;
19635 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19636 LDKOutPoint val_conv;
19637 val_conv.inner = (void*)(val & (~1));
19638 val_conv.is_owned = (val & 1) || (val == 0);
19639 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
19640 val_conv = OutPoint_clone(&val_conv);
19641 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
19644 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
19645 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19647 this_ptr_conv.is_owned = false;
19648 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19649 void* val_ptr = (void*)(((uint64_t)val) & ~1);
19650 CHECK_ACCESS(val_ptr);
19651 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
19652 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
19653 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
19656 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
19657 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19659 this_ptr_conv.is_owned = false;
19660 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19661 int8_tArray ret_arr = init_int8_tArray(32);
19662 memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
19666 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
19667 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19669 this_ptr_conv.is_owned = false;
19670 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19671 LDKThirtyTwoBytes val_ref;
19672 CHECK(val->arr_len == 32);
19673 memcpy(val_ref.data, val->elems, 32);
19674 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
19677 int64_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
19678 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19680 this_ptr_conv.is_owned = false;
19681 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19682 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
19686 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
19687 LDKStaticPaymentOutputDescriptor this_ptr_conv;
19688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19689 this_ptr_conv.is_owned = false;
19690 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19691 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
19694 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) {
19695 LDKOutPoint outpoint_arg_conv;
19696 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
19697 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
19698 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
19699 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
19700 void* output_arg_ptr = (void*)(((uint64_t)output_arg) & ~1);
19701 CHECK_ACCESS(output_arg_ptr);
19702 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
19703 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
19704 LDKThirtyTwoBytes channel_keys_id_arg_ref;
19705 CHECK(channel_keys_id_arg->arr_len == 32);
19706 memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32);
19707 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
19708 uint64_t ret_ref = 0;
19709 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19710 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19711 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19712 ret_ref = (uint64_t)ret_var.inner;
19713 if (ret_var.is_owned) {
19719 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
19720 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
19721 uint64_t ret_ref = 0;
19722 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19723 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19724 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19725 ret_ref = (uint64_t)ret_var.inner;
19726 if (ret_var.is_owned) {
19731 int64_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint32_t arg) {
19732 LDKStaticPaymentOutputDescriptor arg_conv;
19733 arg_conv.inner = (void*)(arg & (~1));
19734 arg_conv.is_owned = false;
19735 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
19736 int64_t ret_val = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
19740 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_clone(uint32_t orig) {
19741 LDKStaticPaymentOutputDescriptor orig_conv;
19742 orig_conv.inner = (void*)(orig & (~1));
19743 orig_conv.is_owned = false;
19744 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
19745 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
19746 uint64_t ret_ref = 0;
19747 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19748 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19749 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
19750 ret_ref = (uint64_t)ret_var.inner;
19751 if (ret_var.is_owned) {
19757 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_write(uint32_t obj) {
19758 LDKStaticPaymentOutputDescriptor obj_conv;
19759 obj_conv.inner = (void*)(obj & (~1));
19760 obj_conv.is_owned = false;
19761 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
19762 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
19763 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
19764 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
19765 CVec_u8Z_free(ret_var);
19769 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
19770 LDKu8slice ser_ref;
19771 ser_ref.datalen = ser->arr_len;
19772 ser_ref.data = ser->elems;
19773 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19774 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
19775 return (uint64_t)ret_conv;
19778 void __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_free(uint32_t this_ptr) {
19779 if ((this_ptr & 1) != 0) return;
19780 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
19781 CHECK_ACCESS(this_ptr_ptr);
19782 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
19783 FREE((void*)this_ptr);
19784 SpendableOutputDescriptor_free(this_ptr_conv);
19787 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
19788 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
19789 *ret_copy = SpendableOutputDescriptor_clone(arg);
19790 uint64_t ret_ref = (uint64_t)ret_copy;
19793 int64_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_clone_ptr(uint32_t arg) {
19794 LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)arg;
19795 int64_t ret_val = SpendableOutputDescriptor_clone_ptr(arg_conv);
19799 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_clone(uint32_t orig) {
19800 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
19801 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
19802 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
19803 uint64_t ret_ref = (uint64_t)ret_copy;
19807 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_static_output(uint32_t outpoint, uint32_t output) {
19808 LDKOutPoint outpoint_conv;
19809 outpoint_conv.inner = (void*)(outpoint & (~1));
19810 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
19811 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
19812 outpoint_conv = OutPoint_clone(&outpoint_conv);
19813 void* output_ptr = (void*)(((uint64_t)output) & ~1);
19814 CHECK_ACCESS(output_ptr);
19815 LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
19816 output_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output) & ~1));
19817 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
19818 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
19819 uint64_t ret_ref = (uint64_t)ret_copy;
19823 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint32_t a) {
19824 LDKDelayedPaymentOutputDescriptor a_conv;
19825 a_conv.inner = (void*)(a & (~1));
19826 a_conv.is_owned = (a & 1) || (a == 0);
19827 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19828 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
19829 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
19830 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
19831 uint64_t ret_ref = (uint64_t)ret_copy;
19835 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_static_payment_output(uint32_t a) {
19836 LDKStaticPaymentOutputDescriptor a_conv;
19837 a_conv.inner = (void*)(a & (~1));
19838 a_conv.is_owned = (a & 1) || (a == 0);
19839 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19840 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
19841 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
19842 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
19843 uint64_t ret_ref = (uint64_t)ret_copy;
19847 int8_tArray __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_write(uint32_t obj) {
19848 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
19849 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
19850 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
19851 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
19852 CVec_u8Z_free(ret_var);
19856 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
19857 LDKu8slice ser_ref;
19858 ser_ref.datalen = ser->arr_len;
19859 ser_ref.data = ser->elems;
19860 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19861 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
19862 return (uint64_t)ret_conv;
19865 void __attribute__((visibility("default"))) TS_BaseSign_free(uint32_t this_ptr) {
19866 if ((this_ptr & 1) != 0) return;
19867 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
19868 CHECK_ACCESS(this_ptr_ptr);
19869 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
19870 FREE((void*)this_ptr);
19871 BaseSign_free(this_ptr_conv);
19874 static inline uint64_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
19875 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
19876 *ret_ret = Sign_clone(arg);
19877 return (uint64_t)ret_ret;
19879 int64_t __attribute__((visibility("default"))) TS_Sign_clone_ptr(uint32_t arg) {
19880 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
19881 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
19882 LDKSign* arg_conv = (LDKSign*)arg_ptr;
19883 int64_t ret_val = Sign_clone_ptr(arg_conv);
19887 uint32_t __attribute__((visibility("default"))) TS_Sign_clone(uint32_t orig) {
19888 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
19889 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
19890 LDKSign* orig_conv = (LDKSign*)orig_ptr;
19891 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
19892 *ret_ret = Sign_clone(orig_conv);
19893 return (uint64_t)ret_ret;
19896 void __attribute__((visibility("default"))) TS_Sign_free(uint32_t this_ptr) {
19897 if ((this_ptr & 1) != 0) return;
19898 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
19899 CHECK_ACCESS(this_ptr_ptr);
19900 LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
19901 FREE((void*)this_ptr);
19902 Sign_free(this_ptr_conv);
19905 void __attribute__((visibility("default"))) TS_KeysInterface_free(uint32_t this_ptr) {
19906 if ((this_ptr & 1) != 0) return;
19907 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
19908 CHECK_ACCESS(this_ptr_ptr);
19909 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
19910 FREE((void*)this_ptr);
19911 KeysInterface_free(this_ptr_conv);
19914 void __attribute__((visibility("default"))) TS_InMemorySigner_free(uint32_t this_obj) {
19915 LDKInMemorySigner this_obj_conv;
19916 this_obj_conv.inner = (void*)(this_obj & (~1));
19917 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19918 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
19919 InMemorySigner_free(this_obj_conv);
19922 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_funding_key(uint32_t this_ptr) {
19923 LDKInMemorySigner this_ptr_conv;
19924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19925 this_ptr_conv.is_owned = false;
19926 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19927 int8_tArray ret_arr = init_int8_tArray(32);
19928 memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
19932 void __attribute__((visibility("default"))) TS_InMemorySigner_set_funding_key(uint32_t this_ptr, int8_tArray val) {
19933 LDKInMemorySigner this_ptr_conv;
19934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19935 this_ptr_conv.is_owned = false;
19936 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19937 LDKSecretKey val_ref;
19938 CHECK(val->arr_len == 32);
19939 memcpy(val_ref.bytes, val->elems, 32);
19940 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
19943 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_revocation_base_key(uint32_t this_ptr) {
19944 LDKInMemorySigner this_ptr_conv;
19945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19946 this_ptr_conv.is_owned = false;
19947 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19948 int8_tArray ret_arr = init_int8_tArray(32);
19949 memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
19953 void __attribute__((visibility("default"))) TS_InMemorySigner_set_revocation_base_key(uint32_t this_ptr, int8_tArray val) {
19954 LDKInMemorySigner this_ptr_conv;
19955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19956 this_ptr_conv.is_owned = false;
19957 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19958 LDKSecretKey val_ref;
19959 CHECK(val->arr_len == 32);
19960 memcpy(val_ref.bytes, val->elems, 32);
19961 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
19964 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_payment_key(uint32_t this_ptr) {
19965 LDKInMemorySigner this_ptr_conv;
19966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19967 this_ptr_conv.is_owned = false;
19968 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19969 int8_tArray ret_arr = init_int8_tArray(32);
19970 memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
19974 void __attribute__((visibility("default"))) TS_InMemorySigner_set_payment_key(uint32_t this_ptr, int8_tArray val) {
19975 LDKInMemorySigner this_ptr_conv;
19976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19977 this_ptr_conv.is_owned = false;
19978 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19979 LDKSecretKey val_ref;
19980 CHECK(val->arr_len == 32);
19981 memcpy(val_ref.bytes, val->elems, 32);
19982 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
19985 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_delayed_payment_base_key(uint32_t this_ptr) {
19986 LDKInMemorySigner this_ptr_conv;
19987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19988 this_ptr_conv.is_owned = false;
19989 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
19990 int8_tArray ret_arr = init_int8_tArray(32);
19991 memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
19995 void __attribute__((visibility("default"))) TS_InMemorySigner_set_delayed_payment_base_key(uint32_t this_ptr, int8_tArray val) {
19996 LDKInMemorySigner this_ptr_conv;
19997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19998 this_ptr_conv.is_owned = false;
19999 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20000 LDKSecretKey val_ref;
20001 CHECK(val->arr_len == 32);
20002 memcpy(val_ref.bytes, val->elems, 32);
20003 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
20006 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_htlc_base_key(uint32_t this_ptr) {
20007 LDKInMemorySigner this_ptr_conv;
20008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20009 this_ptr_conv.is_owned = false;
20010 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20011 int8_tArray ret_arr = init_int8_tArray(32);
20012 memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
20016 void __attribute__((visibility("default"))) TS_InMemorySigner_set_htlc_base_key(uint32_t this_ptr, int8_tArray val) {
20017 LDKInMemorySigner this_ptr_conv;
20018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20019 this_ptr_conv.is_owned = false;
20020 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20021 LDKSecretKey val_ref;
20022 CHECK(val->arr_len == 32);
20023 memcpy(val_ref.bytes, val->elems, 32);
20024 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
20027 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_commitment_seed(uint32_t this_ptr) {
20028 LDKInMemorySigner this_ptr_conv;
20029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20030 this_ptr_conv.is_owned = false;
20031 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20032 int8_tArray ret_arr = init_int8_tArray(32);
20033 memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
20037 void __attribute__((visibility("default"))) TS_InMemorySigner_set_commitment_seed(uint32_t this_ptr, int8_tArray val) {
20038 LDKInMemorySigner this_ptr_conv;
20039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20040 this_ptr_conv.is_owned = false;
20041 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20042 LDKThirtyTwoBytes val_ref;
20043 CHECK(val->arr_len == 32);
20044 memcpy(val_ref.data, val->elems, 32);
20045 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
20048 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
20049 LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
20050 uint64_t ret_ref = 0;
20051 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20052 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20053 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20054 ret_ref = (uint64_t)ret_var.inner;
20055 if (ret_var.is_owned) {
20060 int64_t __attribute__((visibility("default"))) TS_InMemorySigner_clone_ptr(uint32_t arg) {
20061 LDKInMemorySigner arg_conv;
20062 arg_conv.inner = (void*)(arg & (~1));
20063 arg_conv.is_owned = false;
20064 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20065 int64_t ret_val = InMemorySigner_clone_ptr(&arg_conv);
20069 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_clone(uint32_t orig) {
20070 LDKInMemorySigner orig_conv;
20071 orig_conv.inner = (void*)(orig & (~1));
20072 orig_conv.is_owned = false;
20073 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20074 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
20075 uint64_t ret_ref = 0;
20076 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20077 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20078 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20079 ret_ref = (uint64_t)ret_var.inner;
20080 if (ret_var.is_owned) {
20086 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) {
20087 LDKSecretKey funding_key_ref;
20088 CHECK(funding_key->arr_len == 32);
20089 memcpy(funding_key_ref.bytes, funding_key->elems, 32);
20090 LDKSecretKey revocation_base_key_ref;
20091 CHECK(revocation_base_key->arr_len == 32);
20092 memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32);
20093 LDKSecretKey payment_key_ref;
20094 CHECK(payment_key->arr_len == 32);
20095 memcpy(payment_key_ref.bytes, payment_key->elems, 32);
20096 LDKSecretKey delayed_payment_base_key_ref;
20097 CHECK(delayed_payment_base_key->arr_len == 32);
20098 memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32);
20099 LDKSecretKey htlc_base_key_ref;
20100 CHECK(htlc_base_key->arr_len == 32);
20101 memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32);
20102 LDKThirtyTwoBytes commitment_seed_ref;
20103 CHECK(commitment_seed->arr_len == 32);
20104 memcpy(commitment_seed_ref.data, commitment_seed->elems, 32);
20105 LDKThirtyTwoBytes channel_keys_id_ref;
20106 CHECK(channel_keys_id->arr_len == 32);
20107 memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32);
20108 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);
20109 uint64_t ret_ref = 0;
20110 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20111 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20112 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20113 ret_ref = (uint64_t)ret_var.inner;
20114 if (ret_var.is_owned) {
20120 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_pubkeys(uint32_t this_arg) {
20121 LDKInMemorySigner this_arg_conv;
20122 this_arg_conv.inner = (void*)(this_arg & (~1));
20123 this_arg_conv.is_owned = false;
20124 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20125 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
20126 uint64_t ret_ref = 0;
20127 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20128 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20129 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20130 ret_ref = (uint64_t)ret_var.inner;
20131 if (ret_var.is_owned) {
20137 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint32_t this_arg) {
20138 LDKInMemorySigner this_arg_conv;
20139 this_arg_conv.inner = (void*)(this_arg & (~1));
20140 this_arg_conv.is_owned = false;
20141 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20142 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
20146 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_holder_selected_contest_delay(uint32_t this_arg) {
20147 LDKInMemorySigner this_arg_conv;
20148 this_arg_conv.inner = (void*)(this_arg & (~1));
20149 this_arg_conv.is_owned = false;
20150 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20151 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
20155 jboolean __attribute__((visibility("default"))) TS_InMemorySigner_is_outbound(uint32_t this_arg) {
20156 LDKInMemorySigner this_arg_conv;
20157 this_arg_conv.inner = (void*)(this_arg & (~1));
20158 this_arg_conv.is_owned = false;
20159 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20160 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
20164 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_funding_outpoint(uint32_t this_arg) {
20165 LDKInMemorySigner this_arg_conv;
20166 this_arg_conv.inner = (void*)(this_arg & (~1));
20167 this_arg_conv.is_owned = false;
20168 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20169 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
20170 uint64_t ret_ref = 0;
20171 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20172 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20173 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20174 ret_ref = (uint64_t)ret_var.inner;
20175 if (ret_var.is_owned) {
20181 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_get_channel_parameters(uint32_t this_arg) {
20182 LDKInMemorySigner this_arg_conv;
20183 this_arg_conv.inner = (void*)(this_arg & (~1));
20184 this_arg_conv.is_owned = false;
20185 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20186 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
20187 uint64_t ret_ref = 0;
20188 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20189 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20190 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20191 ret_ref = (uint64_t)ret_var.inner;
20192 if (ret_var.is_owned) {
20198 jboolean __attribute__((visibility("default"))) TS_InMemorySigner_opt_anchors(uint32_t this_arg) {
20199 LDKInMemorySigner this_arg_conv;
20200 this_arg_conv.inner = (void*)(this_arg & (~1));
20201 this_arg_conv.is_owned = false;
20202 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20203 jboolean ret_val = InMemorySigner_opt_anchors(&this_arg_conv);
20207 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) {
20208 LDKInMemorySigner this_arg_conv;
20209 this_arg_conv.inner = (void*)(this_arg & (~1));
20210 this_arg_conv.is_owned = false;
20211 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20212 LDKTransaction spend_tx_ref;
20213 spend_tx_ref.datalen = spend_tx->arr_len;
20214 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
20215 memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen);
20216 spend_tx_ref.data_is_owned = true;
20217 LDKStaticPaymentOutputDescriptor descriptor_conv;
20218 descriptor_conv.inner = (void*)(descriptor & (~1));
20219 descriptor_conv.is_owned = false;
20220 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
20221 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
20222 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
20223 return (uint64_t)ret_conv;
20226 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) {
20227 LDKInMemorySigner this_arg_conv;
20228 this_arg_conv.inner = (void*)(this_arg & (~1));
20229 this_arg_conv.is_owned = false;
20230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20231 LDKTransaction spend_tx_ref;
20232 spend_tx_ref.datalen = spend_tx->arr_len;
20233 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
20234 memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen);
20235 spend_tx_ref.data_is_owned = true;
20236 LDKDelayedPaymentOutputDescriptor descriptor_conv;
20237 descriptor_conv.inner = (void*)(descriptor & (~1));
20238 descriptor_conv.is_owned = false;
20239 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
20240 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
20241 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
20242 return (uint64_t)ret_conv;
20245 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_BaseSign(uint32_t this_arg) {
20246 LDKInMemorySigner this_arg_conv;
20247 this_arg_conv.inner = (void*)(this_arg & (~1));
20248 this_arg_conv.is_owned = false;
20249 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20250 LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
20251 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
20252 return (uint64_t)ret_ret;
20255 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_Sign(uint32_t this_arg) {
20256 LDKInMemorySigner this_arg_conv;
20257 this_arg_conv.inner = (void*)(this_arg & (~1));
20258 this_arg_conv.is_owned = false;
20259 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20260 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
20261 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
20262 return (uint64_t)ret_ret;
20265 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_write(uint32_t obj) {
20266 LDKInMemorySigner obj_conv;
20267 obj_conv.inner = (void*)(obj & (~1));
20268 obj_conv.is_owned = false;
20269 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
20270 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
20271 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
20272 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20273 CVec_u8Z_free(ret_var);
20277 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_read(int8_tArray ser) {
20278 LDKu8slice ser_ref;
20279 ser_ref.datalen = ser->arr_len;
20280 ser_ref.data = ser->elems;
20281 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20282 *ret_conv = InMemorySigner_read(ser_ref);
20283 return (uint64_t)ret_conv;
20286 void __attribute__((visibility("default"))) TS_KeysManager_free(uint32_t this_obj) {
20287 LDKKeysManager this_obj_conv;
20288 this_obj_conv.inner = (void*)(this_obj & (~1));
20289 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20290 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20291 KeysManager_free(this_obj_conv);
20294 uint32_t __attribute__((visibility("default"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
20295 unsigned char seed_arr[32];
20296 CHECK(seed->arr_len == 32);
20297 memcpy(seed_arr, seed->elems, 32);
20298 unsigned char (*seed_ref)[32] = &seed_arr;
20299 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
20300 uint64_t ret_ref = 0;
20301 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20302 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20303 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20304 ret_ref = (uint64_t)ret_var.inner;
20305 if (ret_var.is_owned) {
20311 uint32_t __attribute__((visibility("default"))) TS_KeysManager_derive_channel_keys(uint32_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
20312 LDKKeysManager this_arg_conv;
20313 this_arg_conv.inner = (void*)(this_arg & (~1));
20314 this_arg_conv.is_owned = false;
20315 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20316 unsigned char params_arr[32];
20317 CHECK(params->arr_len == 32);
20318 memcpy(params_arr, params->elems, 32);
20319 unsigned char (*params_ref)[32] = ¶ms_arr;
20320 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
20321 uint64_t ret_ref = 0;
20322 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20323 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20324 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20325 ret_ref = (uint64_t)ret_var.inner;
20326 if (ret_var.is_owned) {
20332 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) {
20333 LDKKeysManager this_arg_conv;
20334 this_arg_conv.inner = (void*)(this_arg & (~1));
20335 this_arg_conv.is_owned = false;
20336 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20337 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
20338 descriptors_constr.datalen = descriptors->arr_len;
20339 if (descriptors_constr.datalen > 0)
20340 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
20342 descriptors_constr.data = NULL;
20343 uint32_t* descriptors_vals = descriptors->elems;
20344 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
20345 uint32_t descriptors_conv_27 = descriptors_vals[b];
20346 void* descriptors_conv_27_ptr = (void*)(((uint64_t)descriptors_conv_27) & ~1);
20347 CHECK_ACCESS(descriptors_conv_27_ptr);
20348 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
20349 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
20350 descriptors_constr.data[b] = descriptors_conv_27_conv;
20352 LDKCVec_TxOutZ outputs_constr;
20353 outputs_constr.datalen = outputs->arr_len;
20354 if (outputs_constr.datalen > 0)
20355 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
20357 outputs_constr.data = NULL;
20358 uint32_t* outputs_vals = outputs->elems;
20359 for (size_t h = 0; h < outputs_constr.datalen; h++) {
20360 uint32_t outputs_conv_7 = outputs_vals[h];
20361 void* outputs_conv_7_ptr = (void*)(((uint64_t)outputs_conv_7) & ~1);
20362 CHECK_ACCESS(outputs_conv_7_ptr);
20363 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
20364 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
20365 outputs_constr.data[h] = outputs_conv_7_conv;
20367 LDKCVec_u8Z change_destination_script_ref;
20368 change_destination_script_ref.datalen = change_destination_script->arr_len;
20369 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
20370 memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen);
20371 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20372 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
20373 return (uint64_t)ret_conv;
20376 uint32_t __attribute__((visibility("default"))) TS_KeysManager_as_KeysInterface(uint32_t this_arg) {
20377 LDKKeysManager this_arg_conv;
20378 this_arg_conv.inner = (void*)(this_arg & (~1));
20379 this_arg_conv.is_owned = false;
20380 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
20381 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
20382 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
20383 return (uint64_t)ret_ret;
20386 void __attribute__((visibility("default"))) TS_ChannelManager_free(uint32_t this_obj) {
20387 LDKChannelManager this_obj_conv;
20388 this_obj_conv.inner = (void*)(this_obj & (~1));
20389 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20390 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20391 ChannelManager_free(this_obj_conv);
20394 void __attribute__((visibility("default"))) TS_ChainParameters_free(uint32_t this_obj) {
20395 LDKChainParameters this_obj_conv;
20396 this_obj_conv.inner = (void*)(this_obj & (~1));
20397 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20398 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20399 ChainParameters_free(this_obj_conv);
20402 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_network(uint32_t this_ptr) {
20403 LDKChainParameters this_ptr_conv;
20404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20405 this_ptr_conv.is_owned = false;
20406 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20407 uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
20411 void __attribute__((visibility("default"))) TS_ChainParameters_set_network(uint32_t this_ptr, uint32_t val) {
20412 LDKChainParameters this_ptr_conv;
20413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20414 this_ptr_conv.is_owned = false;
20415 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20416 LDKNetwork val_conv = LDKNetwork_from_js(val);
20417 ChainParameters_set_network(&this_ptr_conv, val_conv);
20420 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_best_block(uint32_t this_ptr) {
20421 LDKChainParameters this_ptr_conv;
20422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20423 this_ptr_conv.is_owned = false;
20424 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20425 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
20426 uint64_t ret_ref = 0;
20427 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20428 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20429 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20430 ret_ref = (uint64_t)ret_var.inner;
20431 if (ret_var.is_owned) {
20437 void __attribute__((visibility("default"))) TS_ChainParameters_set_best_block(uint32_t this_ptr, uint32_t val) {
20438 LDKChainParameters this_ptr_conv;
20439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20440 this_ptr_conv.is_owned = false;
20441 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20442 LDKBestBlock val_conv;
20443 val_conv.inner = (void*)(val & (~1));
20444 val_conv.is_owned = (val & 1) || (val == 0);
20445 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
20446 val_conv = BestBlock_clone(&val_conv);
20447 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
20450 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_new(uint32_t network_arg, uint32_t best_block_arg) {
20451 LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
20452 LDKBestBlock best_block_arg_conv;
20453 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
20454 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
20455 CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
20456 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
20457 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
20458 uint64_t ret_ref = 0;
20459 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20460 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20461 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20462 ret_ref = (uint64_t)ret_var.inner;
20463 if (ret_var.is_owned) {
20469 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
20470 LDKChainParameters ret_var = ChainParameters_clone(arg);
20471 uint64_t ret_ref = 0;
20472 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20473 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20474 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20475 ret_ref = (uint64_t)ret_var.inner;
20476 if (ret_var.is_owned) {
20481 int64_t __attribute__((visibility("default"))) TS_ChainParameters_clone_ptr(uint32_t arg) {
20482 LDKChainParameters arg_conv;
20483 arg_conv.inner = (void*)(arg & (~1));
20484 arg_conv.is_owned = false;
20485 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20486 int64_t ret_val = ChainParameters_clone_ptr(&arg_conv);
20490 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_clone(uint32_t orig) {
20491 LDKChainParameters orig_conv;
20492 orig_conv.inner = (void*)(orig & (~1));
20493 orig_conv.is_owned = false;
20494 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20495 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
20496 uint64_t ret_ref = 0;
20497 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20498 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20499 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20500 ret_ref = (uint64_t)ret_var.inner;
20501 if (ret_var.is_owned) {
20507 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_free(uint32_t this_obj) {
20508 LDKCounterpartyForwardingInfo this_obj_conv;
20509 this_obj_conv.inner = (void*)(this_obj & (~1));
20510 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20511 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20512 CounterpartyForwardingInfo_free(this_obj_conv);
20515 int32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint32_t this_ptr) {
20516 LDKCounterpartyForwardingInfo this_ptr_conv;
20517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20518 this_ptr_conv.is_owned = false;
20519 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20520 int32_t ret_val = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
20524 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
20525 LDKCounterpartyForwardingInfo this_ptr_conv;
20526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20527 this_ptr_conv.is_owned = false;
20528 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20529 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
20532 int32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint32_t this_ptr) {
20533 LDKCounterpartyForwardingInfo this_ptr_conv;
20534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20535 this_ptr_conv.is_owned = false;
20536 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20537 int32_t ret_val = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
20541 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
20542 LDKCounterpartyForwardingInfo this_ptr_conv;
20543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20544 this_ptr_conv.is_owned = false;
20545 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20546 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
20549 int16_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
20550 LDKCounterpartyForwardingInfo this_ptr_conv;
20551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20552 this_ptr_conv.is_owned = false;
20553 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20554 int16_t ret_val = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
20558 void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
20559 LDKCounterpartyForwardingInfo this_ptr_conv;
20560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20561 this_ptr_conv.is_owned = false;
20562 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20563 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
20566 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) {
20567 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
20568 uint64_t ret_ref = 0;
20569 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20570 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20571 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20572 ret_ref = (uint64_t)ret_var.inner;
20573 if (ret_var.is_owned) {
20579 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
20580 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
20581 uint64_t ret_ref = 0;
20582 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20583 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20584 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20585 ret_ref = (uint64_t)ret_var.inner;
20586 if (ret_var.is_owned) {
20591 int64_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_clone_ptr(uint32_t arg) {
20592 LDKCounterpartyForwardingInfo arg_conv;
20593 arg_conv.inner = (void*)(arg & (~1));
20594 arg_conv.is_owned = false;
20595 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20596 int64_t ret_val = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
20600 uint32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_clone(uint32_t orig) {
20601 LDKCounterpartyForwardingInfo orig_conv;
20602 orig_conv.inner = (void*)(orig & (~1));
20603 orig_conv.is_owned = false;
20604 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20605 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
20606 uint64_t ret_ref = 0;
20607 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20608 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20609 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20610 ret_ref = (uint64_t)ret_var.inner;
20611 if (ret_var.is_owned) {
20617 void __attribute__((visibility("default"))) TS_ChannelCounterparty_free(uint32_t this_obj) {
20618 LDKChannelCounterparty this_obj_conv;
20619 this_obj_conv.inner = (void*)(this_obj & (~1));
20620 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20621 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20622 ChannelCounterparty_free(this_obj_conv);
20625 int8_tArray __attribute__((visibility("default"))) TS_ChannelCounterparty_get_node_id(uint32_t this_ptr) {
20626 LDKChannelCounterparty this_ptr_conv;
20627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20628 this_ptr_conv.is_owned = false;
20629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20630 int8_tArray ret_arr = init_int8_tArray(33);
20631 memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
20635 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_node_id(uint32_t this_ptr, int8_tArray val) {
20636 LDKChannelCounterparty this_ptr_conv;
20637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20638 this_ptr_conv.is_owned = false;
20639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20640 LDKPublicKey val_ref;
20641 CHECK(val->arr_len == 33);
20642 memcpy(val_ref.compressed_form, val->elems, 33);
20643 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
20646 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_features(uint32_t this_ptr) {
20647 LDKChannelCounterparty this_ptr_conv;
20648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20649 this_ptr_conv.is_owned = false;
20650 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20651 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
20652 uint64_t ret_ref = 0;
20653 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20654 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20655 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20656 ret_ref = (uint64_t)ret_var.inner;
20657 if (ret_var.is_owned) {
20663 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_features(uint32_t this_ptr, uint32_t val) {
20664 LDKChannelCounterparty this_ptr_conv;
20665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20666 this_ptr_conv.is_owned = false;
20667 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20668 LDKInitFeatures val_conv;
20669 val_conv.inner = (void*)(val & (~1));
20670 val_conv.is_owned = (val & 1) || (val == 0);
20671 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
20672 val_conv = InitFeatures_clone(&val_conv);
20673 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
20676 int64_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint32_t this_ptr) {
20677 LDKChannelCounterparty this_ptr_conv;
20678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20679 this_ptr_conv.is_owned = false;
20680 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20681 int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
20685 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint32_t this_ptr, int64_t val) {
20686 LDKChannelCounterparty this_ptr_conv;
20687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20688 this_ptr_conv.is_owned = false;
20689 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20690 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
20693 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_forwarding_info(uint32_t this_ptr) {
20694 LDKChannelCounterparty this_ptr_conv;
20695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20696 this_ptr_conv.is_owned = false;
20697 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20698 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
20699 uint64_t ret_ref = 0;
20700 if ((uint64_t)ret_var.inner > 4096) {
20701 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20702 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20703 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20704 ret_ref = (uint64_t)ret_var.inner;
20705 if (ret_var.is_owned) {
20712 void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_forwarding_info(uint32_t this_ptr, uint32_t val) {
20713 LDKChannelCounterparty this_ptr_conv;
20714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20715 this_ptr_conv.is_owned = false;
20716 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20717 LDKCounterpartyForwardingInfo val_conv;
20718 val_conv.inner = (void*)(val & (~1));
20719 val_conv.is_owned = (val & 1) || (val == 0);
20720 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
20721 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
20722 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
20725 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) {
20726 LDKPublicKey node_id_arg_ref;
20727 CHECK(node_id_arg->arr_len == 33);
20728 memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33);
20729 LDKInitFeatures features_arg_conv;
20730 features_arg_conv.inner = (void*)(features_arg & (~1));
20731 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
20732 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
20733 features_arg_conv = InitFeatures_clone(&features_arg_conv);
20734 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
20735 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
20736 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
20737 CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
20738 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
20739 LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv);
20740 uint64_t ret_ref = 0;
20741 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20742 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20743 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20744 ret_ref = (uint64_t)ret_var.inner;
20745 if (ret_var.is_owned) {
20751 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
20752 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
20753 uint64_t ret_ref = 0;
20754 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20755 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20756 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20757 ret_ref = (uint64_t)ret_var.inner;
20758 if (ret_var.is_owned) {
20763 int64_t __attribute__((visibility("default"))) TS_ChannelCounterparty_clone_ptr(uint32_t arg) {
20764 LDKChannelCounterparty arg_conv;
20765 arg_conv.inner = (void*)(arg & (~1));
20766 arg_conv.is_owned = false;
20767 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20768 int64_t ret_val = ChannelCounterparty_clone_ptr(&arg_conv);
20772 uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_clone(uint32_t orig) {
20773 LDKChannelCounterparty orig_conv;
20774 orig_conv.inner = (void*)(orig & (~1));
20775 orig_conv.is_owned = false;
20776 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20777 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
20778 uint64_t ret_ref = 0;
20779 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20780 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20781 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20782 ret_ref = (uint64_t)ret_var.inner;
20783 if (ret_var.is_owned) {
20789 void __attribute__((visibility("default"))) TS_ChannelDetails_free(uint32_t this_obj) {
20790 LDKChannelDetails this_obj_conv;
20791 this_obj_conv.inner = (void*)(this_obj & (~1));
20792 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20793 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20794 ChannelDetails_free(this_obj_conv);
20797 int8_tArray __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_id(uint32_t this_ptr) {
20798 LDKChannelDetails this_ptr_conv;
20799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20800 this_ptr_conv.is_owned = false;
20801 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20802 int8_tArray ret_arr = init_int8_tArray(32);
20803 memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
20807 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_id(uint32_t this_ptr, int8_tArray val) {
20808 LDKChannelDetails this_ptr_conv;
20809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20810 this_ptr_conv.is_owned = false;
20811 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20812 LDKThirtyTwoBytes val_ref;
20813 CHECK(val->arr_len == 32);
20814 memcpy(val_ref.data, val->elems, 32);
20815 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
20818 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_counterparty(uint32_t this_ptr) {
20819 LDKChannelDetails this_ptr_conv;
20820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20821 this_ptr_conv.is_owned = false;
20822 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20823 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
20824 uint64_t ret_ref = 0;
20825 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20826 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20827 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20828 ret_ref = (uint64_t)ret_var.inner;
20829 if (ret_var.is_owned) {
20835 void __attribute__((visibility("default"))) TS_ChannelDetails_set_counterparty(uint32_t this_ptr, uint32_t val) {
20836 LDKChannelDetails this_ptr_conv;
20837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20838 this_ptr_conv.is_owned = false;
20839 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20840 LDKChannelCounterparty val_conv;
20841 val_conv.inner = (void*)(val & (~1));
20842 val_conv.is_owned = (val & 1) || (val == 0);
20843 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
20844 val_conv = ChannelCounterparty_clone(&val_conv);
20845 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
20848 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_funding_txo(uint32_t this_ptr) {
20849 LDKChannelDetails this_ptr_conv;
20850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20851 this_ptr_conv.is_owned = false;
20852 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20853 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
20854 uint64_t ret_ref = 0;
20855 if ((uint64_t)ret_var.inner > 4096) {
20856 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20857 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20858 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20859 ret_ref = (uint64_t)ret_var.inner;
20860 if (ret_var.is_owned) {
20867 void __attribute__((visibility("default"))) TS_ChannelDetails_set_funding_txo(uint32_t this_ptr, uint32_t val) {
20868 LDKChannelDetails this_ptr_conv;
20869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20870 this_ptr_conv.is_owned = false;
20871 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20872 LDKOutPoint val_conv;
20873 val_conv.inner = (void*)(val & (~1));
20874 val_conv.is_owned = (val & 1) || (val == 0);
20875 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
20876 val_conv = OutPoint_clone(&val_conv);
20877 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
20880 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_short_channel_id(uint32_t this_ptr) {
20881 LDKChannelDetails this_ptr_conv;
20882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20883 this_ptr_conv.is_owned = false;
20884 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20885 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
20886 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
20887 uint64_t ret_ref = (uint64_t)ret_copy;
20891 void __attribute__((visibility("default"))) TS_ChannelDetails_set_short_channel_id(uint32_t this_ptr, uint32_t val) {
20892 LDKChannelDetails this_ptr_conv;
20893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20894 this_ptr_conv.is_owned = false;
20895 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20896 void* val_ptr = (void*)(((uint64_t)val) & ~1);
20897 CHECK_ACCESS(val_ptr);
20898 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
20899 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
20900 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
20903 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_value_satoshis(uint32_t this_ptr) {
20904 LDKChannelDetails this_ptr_conv;
20905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20906 this_ptr_conv.is_owned = false;
20907 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20908 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
20912 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
20913 LDKChannelDetails this_ptr_conv;
20914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20915 this_ptr_conv.is_owned = false;
20916 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20917 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
20920 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint32_t this_ptr) {
20921 LDKChannelDetails this_ptr_conv;
20922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20923 this_ptr_conv.is_owned = false;
20924 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20925 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
20926 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
20927 uint64_t ret_ref = (uint64_t)ret_copy;
20931 void __attribute__((visibility("default"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint32_t this_ptr, uint32_t val) {
20932 LDKChannelDetails this_ptr_conv;
20933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20934 this_ptr_conv.is_owned = false;
20935 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20936 void* val_ptr = (void*)(((uint64_t)val) & ~1);
20937 CHECK_ACCESS(val_ptr);
20938 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
20939 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
20940 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
20943 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_user_channel_id(uint32_t this_ptr) {
20944 LDKChannelDetails this_ptr_conv;
20945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20946 this_ptr_conv.is_owned = false;
20947 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20948 int64_t ret_val = ChannelDetails_get_user_channel_id(&this_ptr_conv);
20952 void __attribute__((visibility("default"))) TS_ChannelDetails_set_user_channel_id(uint32_t this_ptr, int64_t val) {
20953 LDKChannelDetails this_ptr_conv;
20954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20955 this_ptr_conv.is_owned = false;
20956 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20957 ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
20960 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_balance_msat(uint32_t this_ptr) {
20961 LDKChannelDetails this_ptr_conv;
20962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20963 this_ptr_conv.is_owned = false;
20964 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20965 int64_t ret_val = ChannelDetails_get_balance_msat(&this_ptr_conv);
20969 void __attribute__((visibility("default"))) TS_ChannelDetails_set_balance_msat(uint32_t this_ptr, int64_t val) {
20970 LDKChannelDetails this_ptr_conv;
20971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20972 this_ptr_conv.is_owned = false;
20973 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20974 ChannelDetails_set_balance_msat(&this_ptr_conv, val);
20977 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) {
20978 LDKChannelDetails this_ptr_conv;
20979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20980 this_ptr_conv.is_owned = false;
20981 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20982 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
20986 void __attribute__((visibility("default"))) TS_ChannelDetails_set_outbound_capacity_msat(uint32_t this_ptr, int64_t val) {
20987 LDKChannelDetails this_ptr_conv;
20988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20989 this_ptr_conv.is_owned = false;
20990 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20991 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
20994 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_inbound_capacity_msat(uint32_t this_ptr) {
20995 LDKChannelDetails this_ptr_conv;
20996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20997 this_ptr_conv.is_owned = false;
20998 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20999 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
21003 void __attribute__((visibility("default"))) TS_ChannelDetails_set_inbound_capacity_msat(uint32_t this_ptr, int64_t val) {
21004 LDKChannelDetails this_ptr_conv;
21005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21006 this_ptr_conv.is_owned = false;
21007 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21008 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
21011 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_confirmations_required(uint32_t this_ptr) {
21012 LDKChannelDetails this_ptr_conv;
21013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21014 this_ptr_conv.is_owned = false;
21015 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21016 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21017 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
21018 uint64_t ret_ref = (uint64_t)ret_copy;
21022 void __attribute__((visibility("default"))) TS_ChannelDetails_set_confirmations_required(uint32_t this_ptr, uint32_t val) {
21023 LDKChannelDetails this_ptr_conv;
21024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21025 this_ptr_conv.is_owned = false;
21026 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21027 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21028 CHECK_ACCESS(val_ptr);
21029 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
21030 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
21031 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
21034 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_force_close_spend_delay(uint32_t this_ptr) {
21035 LDKChannelDetails this_ptr_conv;
21036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21037 this_ptr_conv.is_owned = false;
21038 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21039 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
21040 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
21041 uint64_t ret_ref = (uint64_t)ret_copy;
21045 void __attribute__((visibility("default"))) TS_ChannelDetails_set_force_close_spend_delay(uint32_t this_ptr, uint32_t val) {
21046 LDKChannelDetails this_ptr_conv;
21047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21048 this_ptr_conv.is_owned = false;
21049 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21050 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21051 CHECK_ACCESS(val_ptr);
21052 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
21053 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)val) & ~1));
21054 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
21057 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_outbound(uint32_t this_ptr) {
21058 LDKChannelDetails this_ptr_conv;
21059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21060 this_ptr_conv.is_owned = false;
21061 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21062 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
21066 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_outbound(uint32_t this_ptr, jboolean val) {
21067 LDKChannelDetails this_ptr_conv;
21068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21069 this_ptr_conv.is_owned = false;
21070 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21071 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
21074 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_funding_locked(uint32_t this_ptr) {
21075 LDKChannelDetails this_ptr_conv;
21076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21077 this_ptr_conv.is_owned = false;
21078 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21079 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
21083 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_funding_locked(uint32_t this_ptr, jboolean val) {
21084 LDKChannelDetails this_ptr_conv;
21085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21086 this_ptr_conv.is_owned = false;
21087 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21088 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
21091 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_usable(uint32_t this_ptr) {
21092 LDKChannelDetails this_ptr_conv;
21093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21094 this_ptr_conv.is_owned = false;
21095 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21096 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
21100 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_usable(uint32_t this_ptr, jboolean val) {
21101 LDKChannelDetails this_ptr_conv;
21102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21103 this_ptr_conv.is_owned = false;
21104 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21105 ChannelDetails_set_is_usable(&this_ptr_conv, val);
21108 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_public(uint32_t this_ptr) {
21109 LDKChannelDetails this_ptr_conv;
21110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21111 this_ptr_conv.is_owned = false;
21112 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21113 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
21117 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_public(uint32_t this_ptr, jboolean val) {
21118 LDKChannelDetails this_ptr_conv;
21119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21120 this_ptr_conv.is_owned = false;
21121 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21122 ChannelDetails_set_is_public(&this_ptr_conv, val);
21125 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) {
21126 LDKThirtyTwoBytes channel_id_arg_ref;
21127 CHECK(channel_id_arg->arr_len == 32);
21128 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
21129 LDKChannelCounterparty counterparty_arg_conv;
21130 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
21131 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
21132 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
21133 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
21134 LDKOutPoint funding_txo_arg_conv;
21135 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
21136 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
21137 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
21138 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
21139 void* short_channel_id_arg_ptr = (void*)(((uint64_t)short_channel_id_arg) & ~1);
21140 CHECK_ACCESS(short_channel_id_arg_ptr);
21141 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
21142 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1));
21143 void* unspendable_punishment_reserve_arg_ptr = (void*)(((uint64_t)unspendable_punishment_reserve_arg) & ~1);
21144 CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
21145 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
21146 void* confirmations_required_arg_ptr = (void*)(((uint64_t)confirmations_required_arg) & ~1);
21147 CHECK_ACCESS(confirmations_required_arg_ptr);
21148 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
21149 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1));
21150 void* force_close_spend_delay_arg_ptr = (void*)(((uint64_t)force_close_spend_delay_arg) & ~1);
21151 CHECK_ACCESS(force_close_spend_delay_arg_ptr);
21152 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
21153 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1));
21154 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);
21155 uint64_t ret_ref = 0;
21156 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21157 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21158 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21159 ret_ref = (uint64_t)ret_var.inner;
21160 if (ret_var.is_owned) {
21166 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
21167 LDKChannelDetails ret_var = ChannelDetails_clone(arg);
21168 uint64_t ret_ref = 0;
21169 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21170 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21171 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21172 ret_ref = (uint64_t)ret_var.inner;
21173 if (ret_var.is_owned) {
21178 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_clone_ptr(uint32_t arg) {
21179 LDKChannelDetails arg_conv;
21180 arg_conv.inner = (void*)(arg & (~1));
21181 arg_conv.is_owned = false;
21182 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21183 int64_t ret_val = ChannelDetails_clone_ptr(&arg_conv);
21187 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_clone(uint32_t orig) {
21188 LDKChannelDetails orig_conv;
21189 orig_conv.inner = (void*)(orig & (~1));
21190 orig_conv.is_owned = false;
21191 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21192 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
21193 uint64_t ret_ref = 0;
21194 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21195 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21196 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21197 ret_ref = (uint64_t)ret_var.inner;
21198 if (ret_var.is_owned) {
21204 void __attribute__((visibility("default"))) TS_PaymentSendFailure_free(uint32_t this_ptr) {
21205 if ((this_ptr & 1) != 0) return;
21206 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
21207 CHECK_ACCESS(this_ptr_ptr);
21208 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
21209 FREE((void*)this_ptr);
21210 PaymentSendFailure_free(this_ptr_conv);
21213 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
21214 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21215 *ret_copy = PaymentSendFailure_clone(arg);
21216 uint64_t ret_ref = (uint64_t)ret_copy;
21219 int64_t __attribute__((visibility("default"))) TS_PaymentSendFailure_clone_ptr(uint32_t arg) {
21220 LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)arg;
21221 int64_t ret_val = PaymentSendFailure_clone_ptr(arg_conv);
21225 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_clone(uint32_t orig) {
21226 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
21227 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21228 *ret_copy = PaymentSendFailure_clone(orig_conv);
21229 uint64_t ret_ref = (uint64_t)ret_copy;
21233 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_parameter_error(uint32_t a) {
21234 void* a_ptr = (void*)(((uint64_t)a) & ~1);
21235 CHECK_ACCESS(a_ptr);
21236 LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
21237 a_conv = APIError_clone((LDKAPIError*)(((uint64_t)a) & ~1));
21238 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21239 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
21240 uint64_t ret_ref = (uint64_t)ret_copy;
21244 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_path_parameter_error(uint32_tArray a) {
21245 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
21246 a_constr.datalen = a->arr_len;
21247 if (a_constr.datalen > 0)
21248 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
21250 a_constr.data = NULL;
21251 uint32_t* a_vals = a->elems;
21252 for (size_t w = 0; w < a_constr.datalen; w++) {
21253 uint32_t a_conv_22 = a_vals[w];
21254 void* a_conv_22_ptr = (void*)(((uint64_t)a_conv_22) & ~1);
21255 CHECK_ACCESS(a_conv_22_ptr);
21256 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
21257 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
21258 a_constr.data[w] = a_conv_22_conv;
21260 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21261 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
21262 uint64_t ret_ref = (uint64_t)ret_copy;
21266 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_all_failed_retry_safe(uint32_tArray a) {
21267 LDKCVec_APIErrorZ a_constr;
21268 a_constr.datalen = a->arr_len;
21269 if (a_constr.datalen > 0)
21270 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
21272 a_constr.data = NULL;
21273 uint32_t* a_vals = a->elems;
21274 for (size_t k = 0; k < a_constr.datalen; k++) {
21275 uint32_t a_conv_10 = a_vals[k];
21276 void* a_conv_10_ptr = (void*)(((uint64_t)a_conv_10) & ~1);
21277 CHECK_ACCESS(a_conv_10_ptr);
21278 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
21279 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uint64_t)a_conv_10) & ~1));
21280 a_constr.data[k] = a_conv_10_conv;
21282 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21283 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
21284 uint64_t ret_ref = (uint64_t)ret_copy;
21288 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_partial_failure(uint32_tArray results, uint32_t failed_paths_retry, int8_tArray payment_id) {
21289 LDKCVec_CResult_NoneAPIErrorZZ results_constr;
21290 results_constr.datalen = results->arr_len;
21291 if (results_constr.datalen > 0)
21292 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
21294 results_constr.data = NULL;
21295 uint32_t* results_vals = results->elems;
21296 for (size_t w = 0; w < results_constr.datalen; w++) {
21297 uint32_t results_conv_22 = results_vals[w];
21298 void* results_conv_22_ptr = (void*)(((uint64_t)results_conv_22) & ~1);
21299 CHECK_ACCESS(results_conv_22_ptr);
21300 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
21301 results_constr.data[w] = results_conv_22_conv;
21303 LDKRouteParameters failed_paths_retry_conv;
21304 failed_paths_retry_conv.inner = (void*)(failed_paths_retry & (~1));
21305 failed_paths_retry_conv.is_owned = (failed_paths_retry & 1) || (failed_paths_retry == 0);
21306 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
21307 failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
21308 LDKThirtyTwoBytes payment_id_ref;
21309 CHECK(payment_id->arr_len == 32);
21310 memcpy(payment_id_ref.data, payment_id->elems, 32);
21311 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
21312 *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
21313 uint64_t ret_ref = (uint64_t)ret_copy;
21317 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) {
21318 void* fee_est_ptr = (void*)(((uint64_t)fee_est) & ~1);
21319 CHECK_ACCESS(fee_est_ptr);
21320 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
21321 void* chain_monitor_ptr = (void*)(((uint64_t)chain_monitor) & ~1);
21322 CHECK_ACCESS(chain_monitor_ptr);
21323 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
21324 void* tx_broadcaster_ptr = (void*)(((uint64_t)tx_broadcaster) & ~1);
21325 CHECK_ACCESS(tx_broadcaster_ptr);
21326 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
21327 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
21328 CHECK_ACCESS(logger_ptr);
21329 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
21330 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
21331 CHECK_ACCESS(keys_manager_ptr);
21332 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
21333 LDKUserConfig config_conv;
21334 config_conv.inner = (void*)(config & (~1));
21335 config_conv.is_owned = (config & 1) || (config == 0);
21336 CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
21337 config_conv = UserConfig_clone(&config_conv);
21338 LDKChainParameters params_conv;
21339 params_conv.inner = (void*)(params & (~1));
21340 params_conv.is_owned = (params & 1) || (params == 0);
21341 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
21342 params_conv = ChainParameters_clone(¶ms_conv);
21343 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
21344 uint64_t ret_ref = 0;
21345 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21346 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21347 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21348 ret_ref = (uint64_t)ret_var.inner;
21349 if (ret_var.is_owned) {
21355 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_get_current_default_configuration(uint32_t this_arg) {
21356 LDKChannelManager this_arg_conv;
21357 this_arg_conv.inner = (void*)(this_arg & (~1));
21358 this_arg_conv.is_owned = false;
21359 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21360 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
21361 uint64_t ret_ref = 0;
21362 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21363 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21364 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21365 ret_ref = (uint64_t)ret_var.inner;
21366 if (ret_var.is_owned) {
21372 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) {
21373 LDKChannelManager this_arg_conv;
21374 this_arg_conv.inner = (void*)(this_arg & (~1));
21375 this_arg_conv.is_owned = false;
21376 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21377 LDKPublicKey their_network_key_ref;
21378 CHECK(their_network_key->arr_len == 33);
21379 memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33);
21380 LDKUserConfig override_config_conv;
21381 override_config_conv.inner = (void*)(override_config & (~1));
21382 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
21383 CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
21384 override_config_conv = UserConfig_clone(&override_config_conv);
21385 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
21386 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
21387 return (uint64_t)ret_conv;
21390 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_channels(uint32_t this_arg) {
21391 LDKChannelManager this_arg_conv;
21392 this_arg_conv.inner = (void*)(this_arg & (~1));
21393 this_arg_conv.is_owned = false;
21394 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21395 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
21396 uint32_tArray ret_arr = NULL;
21397 ret_arr = init_uint32_tArray(ret_var.datalen);
21398 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
21399 for (size_t q = 0; q < ret_var.datalen; q++) {
21400 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
21401 uint64_t ret_conv_16_ref = 0;
21402 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21403 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21404 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
21405 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
21406 if (ret_conv_16_var.is_owned) {
21407 ret_conv_16_ref |= 1;
21409 ret_arr_ptr[q] = ret_conv_16_ref;
21412 FREE(ret_var.data);
21416 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_usable_channels(uint32_t this_arg) {
21417 LDKChannelManager this_arg_conv;
21418 this_arg_conv.inner = (void*)(this_arg & (~1));
21419 this_arg_conv.is_owned = false;
21420 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21421 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
21422 uint32_tArray ret_arr = NULL;
21423 ret_arr = init_uint32_tArray(ret_var.datalen);
21424 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
21425 for (size_t q = 0; q < ret_var.datalen; q++) {
21426 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
21427 uint64_t ret_conv_16_ref = 0;
21428 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21429 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21430 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
21431 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
21432 if (ret_conv_16_var.is_owned) {
21433 ret_conv_16_ref |= 1;
21435 ret_arr_ptr[q] = ret_conv_16_ref;
21438 FREE(ret_var.data);
21442 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_close_channel(uint32_t this_arg, int8_tArray channel_id) {
21443 LDKChannelManager this_arg_conv;
21444 this_arg_conv.inner = (void*)(this_arg & (~1));
21445 this_arg_conv.is_owned = false;
21446 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21447 unsigned char channel_id_arr[32];
21448 CHECK(channel_id->arr_len == 32);
21449 memcpy(channel_id_arr, channel_id->elems, 32);
21450 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
21451 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
21452 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
21453 return (uint64_t)ret_conv;
21456 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) {
21457 LDKChannelManager this_arg_conv;
21458 this_arg_conv.inner = (void*)(this_arg & (~1));
21459 this_arg_conv.is_owned = false;
21460 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21461 unsigned char channel_id_arr[32];
21462 CHECK(channel_id->arr_len == 32);
21463 memcpy(channel_id_arr, channel_id->elems, 32);
21464 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
21465 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
21466 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
21467 return (uint64_t)ret_conv;
21470 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_force_close_channel(uint32_t this_arg, int8_tArray channel_id) {
21471 LDKChannelManager this_arg_conv;
21472 this_arg_conv.inner = (void*)(this_arg & (~1));
21473 this_arg_conv.is_owned = false;
21474 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21475 unsigned char channel_id_arr[32];
21476 CHECK(channel_id->arr_len == 32);
21477 memcpy(channel_id_arr, channel_id->elems, 32);
21478 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
21479 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
21480 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
21481 return (uint64_t)ret_conv;
21484 void __attribute__((visibility("default"))) TS_ChannelManager_force_close_all_channels(uint32_t this_arg) {
21485 LDKChannelManager this_arg_conv;
21486 this_arg_conv.inner = (void*)(this_arg & (~1));
21487 this_arg_conv.is_owned = false;
21488 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21489 ChannelManager_force_close_all_channels(&this_arg_conv);
21492 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
21493 LDKChannelManager this_arg_conv;
21494 this_arg_conv.inner = (void*)(this_arg & (~1));
21495 this_arg_conv.is_owned = false;
21496 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21497 LDKRoute route_conv;
21498 route_conv.inner = (void*)(route & (~1));
21499 route_conv.is_owned = false;
21500 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
21501 LDKThirtyTwoBytes payment_hash_ref;
21502 CHECK(payment_hash->arr_len == 32);
21503 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
21504 LDKThirtyTwoBytes payment_secret_ref;
21505 CHECK(payment_secret->arr_len == 32);
21506 memcpy(payment_secret_ref.data, payment_secret->elems, 32);
21507 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
21508 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
21509 return (uint64_t)ret_conv;
21512 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_retry_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_id) {
21513 LDKChannelManager this_arg_conv;
21514 this_arg_conv.inner = (void*)(this_arg & (~1));
21515 this_arg_conv.is_owned = false;
21516 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21517 LDKRoute route_conv;
21518 route_conv.inner = (void*)(route & (~1));
21519 route_conv.is_owned = false;
21520 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
21521 LDKThirtyTwoBytes payment_id_ref;
21522 CHECK(payment_id->arr_len == 32);
21523 memcpy(payment_id_ref.data, payment_id->elems, 32);
21524 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
21525 *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
21526 return (uint64_t)ret_conv;
21529 void __attribute__((visibility("default"))) TS_ChannelManager_abandon_payment(uint32_t this_arg, int8_tArray payment_id) {
21530 LDKChannelManager this_arg_conv;
21531 this_arg_conv.inner = (void*)(this_arg & (~1));
21532 this_arg_conv.is_owned = false;
21533 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21534 LDKThirtyTwoBytes payment_id_ref;
21535 CHECK(payment_id->arr_len == 32);
21536 memcpy(payment_id_ref.data, payment_id->elems, 32);
21537 ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
21540 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_spontaneous_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_preimage) {
21541 LDKChannelManager this_arg_conv;
21542 this_arg_conv.inner = (void*)(this_arg & (~1));
21543 this_arg_conv.is_owned = false;
21544 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21545 LDKRoute route_conv;
21546 route_conv.inner = (void*)(route & (~1));
21547 route_conv.is_owned = false;
21548 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
21549 LDKThirtyTwoBytes payment_preimage_ref;
21550 CHECK(payment_preimage->arr_len == 32);
21551 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32);
21552 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
21553 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
21554 return (uint64_t)ret_conv;
21557 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_funding_transaction_generated(uint32_t this_arg, int8_tArray temporary_channel_id, int8_tArray funding_transaction) {
21558 LDKChannelManager this_arg_conv;
21559 this_arg_conv.inner = (void*)(this_arg & (~1));
21560 this_arg_conv.is_owned = false;
21561 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21562 unsigned char temporary_channel_id_arr[32];
21563 CHECK(temporary_channel_id->arr_len == 32);
21564 memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32);
21565 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
21566 LDKTransaction funding_transaction_ref;
21567 funding_transaction_ref.datalen = funding_transaction->arr_len;
21568 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
21569 memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen);
21570 funding_transaction_ref.data_is_owned = true;
21571 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
21572 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
21573 return (uint64_t)ret_conv;
21576 void __attribute__((visibility("default"))) TS_ChannelManager_broadcast_node_announcement(uint32_t this_arg, int8_tArray rgb, int8_tArray alias, uint32_tArray addresses) {
21577 LDKChannelManager this_arg_conv;
21578 this_arg_conv.inner = (void*)(this_arg & (~1));
21579 this_arg_conv.is_owned = false;
21580 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21581 LDKThreeBytes rgb_ref;
21582 CHECK(rgb->arr_len == 3);
21583 memcpy(rgb_ref.data, rgb->elems, 3);
21584 LDKThirtyTwoBytes alias_ref;
21585 CHECK(alias->arr_len == 32);
21586 memcpy(alias_ref.data, alias->elems, 32);
21587 LDKCVec_NetAddressZ addresses_constr;
21588 addresses_constr.datalen = addresses->arr_len;
21589 if (addresses_constr.datalen > 0)
21590 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
21592 addresses_constr.data = NULL;
21593 uint32_t* addresses_vals = addresses->elems;
21594 for (size_t m = 0; m < addresses_constr.datalen; m++) {
21595 uint32_t addresses_conv_12 = addresses_vals[m];
21596 void* addresses_conv_12_ptr = (void*)(((uint64_t)addresses_conv_12) & ~1);
21597 CHECK_ACCESS(addresses_conv_12_ptr);
21598 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
21599 addresses_constr.data[m] = addresses_conv_12_conv;
21601 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
21604 void __attribute__((visibility("default"))) TS_ChannelManager_process_pending_htlc_forwards(uint32_t this_arg) {
21605 LDKChannelManager this_arg_conv;
21606 this_arg_conv.inner = (void*)(this_arg & (~1));
21607 this_arg_conv.is_owned = false;
21608 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21609 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
21612 void __attribute__((visibility("default"))) TS_ChannelManager_timer_tick_occurred(uint32_t this_arg) {
21613 LDKChannelManager this_arg_conv;
21614 this_arg_conv.inner = (void*)(this_arg & (~1));
21615 this_arg_conv.is_owned = false;
21616 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21617 ChannelManager_timer_tick_occurred(&this_arg_conv);
21620 jboolean __attribute__((visibility("default"))) TS_ChannelManager_fail_htlc_backwards(uint32_t this_arg, int8_tArray payment_hash) {
21621 LDKChannelManager this_arg_conv;
21622 this_arg_conv.inner = (void*)(this_arg & (~1));
21623 this_arg_conv.is_owned = false;
21624 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21625 unsigned char payment_hash_arr[32];
21626 CHECK(payment_hash->arr_len == 32);
21627 memcpy(payment_hash_arr, payment_hash->elems, 32);
21628 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
21629 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
21633 jboolean __attribute__((visibility("default"))) TS_ChannelManager_claim_funds(uint32_t this_arg, int8_tArray payment_preimage) {
21634 LDKChannelManager this_arg_conv;
21635 this_arg_conv.inner = (void*)(this_arg & (~1));
21636 this_arg_conv.is_owned = false;
21637 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21638 LDKThirtyTwoBytes payment_preimage_ref;
21639 CHECK(payment_preimage->arr_len == 32);
21640 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32);
21641 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
21645 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_get_our_node_id(uint32_t this_arg) {
21646 LDKChannelManager this_arg_conv;
21647 this_arg_conv.inner = (void*)(this_arg & (~1));
21648 this_arg_conv.is_owned = false;
21649 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21650 int8_tArray ret_arr = init_int8_tArray(33);
21651 memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
21655 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) {
21656 LDKChannelManager this_arg_conv;
21657 this_arg_conv.inner = (void*)(this_arg & (~1));
21658 this_arg_conv.is_owned = false;
21659 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21660 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
21661 CHECK_ACCESS(min_value_msat_ptr);
21662 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
21663 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
21664 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
21665 *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
21666 return (uint64_t)ret_conv;
21669 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) {
21670 LDKChannelManager this_arg_conv;
21671 this_arg_conv.inner = (void*)(this_arg & (~1));
21672 this_arg_conv.is_owned = false;
21673 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21674 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
21675 CHECK_ACCESS(min_value_msat_ptr);
21676 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
21677 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
21678 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
21679 *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
21680 return (uint64_t)ret_conv;
21683 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) {
21684 LDKChannelManager this_arg_conv;
21685 this_arg_conv.inner = (void*)(this_arg & (~1));
21686 this_arg_conv.is_owned = false;
21687 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21688 LDKThirtyTwoBytes payment_hash_ref;
21689 CHECK(payment_hash->arr_len == 32);
21690 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
21691 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
21692 CHECK_ACCESS(min_value_msat_ptr);
21693 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
21694 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
21695 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
21696 *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
21697 return (uint64_t)ret_conv;
21700 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) {
21701 LDKChannelManager this_arg_conv;
21702 this_arg_conv.inner = (void*)(this_arg & (~1));
21703 this_arg_conv.is_owned = false;
21704 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21705 LDKThirtyTwoBytes payment_hash_ref;
21706 CHECK(payment_hash->arr_len == 32);
21707 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
21708 void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
21709 CHECK_ACCESS(min_value_msat_ptr);
21710 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
21711 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
21712 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
21713 *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
21714 return (uint64_t)ret_conv;
21717 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_get_payment_preimage(uint32_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret) {
21718 LDKChannelManager this_arg_conv;
21719 this_arg_conv.inner = (void*)(this_arg & (~1));
21720 this_arg_conv.is_owned = false;
21721 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21722 LDKThirtyTwoBytes payment_hash_ref;
21723 CHECK(payment_hash->arr_len == 32);
21724 memcpy(payment_hash_ref.data, payment_hash->elems, 32);
21725 LDKThirtyTwoBytes payment_secret_ref;
21726 CHECK(payment_secret->arr_len == 32);
21727 memcpy(payment_secret_ref.data, payment_secret->elems, 32);
21728 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
21729 *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
21730 return (uint64_t)ret_conv;
21733 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_MessageSendEventsProvider(uint32_t this_arg) {
21734 LDKChannelManager this_arg_conv;
21735 this_arg_conv.inner = (void*)(this_arg & (~1));
21736 this_arg_conv.is_owned = false;
21737 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21738 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
21739 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
21740 return (uint64_t)ret_ret;
21743 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_EventsProvider(uint32_t this_arg) {
21744 LDKChannelManager this_arg_conv;
21745 this_arg_conv.inner = (void*)(this_arg & (~1));
21746 this_arg_conv.is_owned = false;
21747 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21748 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
21749 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
21750 return (uint64_t)ret_ret;
21753 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Listen(uint32_t this_arg) {
21754 LDKChannelManager this_arg_conv;
21755 this_arg_conv.inner = (void*)(this_arg & (~1));
21756 this_arg_conv.is_owned = false;
21757 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21758 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
21759 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
21760 return (uint64_t)ret_ret;
21763 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Confirm(uint32_t this_arg) {
21764 LDKChannelManager this_arg_conv;
21765 this_arg_conv.inner = (void*)(this_arg & (~1));
21766 this_arg_conv.is_owned = false;
21767 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21768 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
21769 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
21770 return (uint64_t)ret_ret;
21773 void __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update(uint32_t this_arg) {
21774 LDKChannelManager this_arg_conv;
21775 this_arg_conv.inner = (void*)(this_arg & (~1));
21776 this_arg_conv.is_owned = false;
21777 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21778 ChannelManager_await_persistable_update(&this_arg_conv);
21781 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_current_best_block(uint32_t this_arg) {
21782 LDKChannelManager this_arg_conv;
21783 this_arg_conv.inner = (void*)(this_arg & (~1));
21784 this_arg_conv.is_owned = false;
21785 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21786 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
21787 uint64_t ret_ref = 0;
21788 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21789 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21790 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21791 ret_ref = (uint64_t)ret_var.inner;
21792 if (ret_var.is_owned) {
21798 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_ChannelMessageHandler(uint32_t this_arg) {
21799 LDKChannelManager this_arg_conv;
21800 this_arg_conv.inner = (void*)(this_arg & (~1));
21801 this_arg_conv.is_owned = false;
21802 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21803 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
21804 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
21805 return (uint64_t)ret_ret;
21808 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_write(uint32_t obj) {
21809 LDKChannelManager obj_conv;
21810 obj_conv.inner = (void*)(obj & (~1));
21811 obj_conv.is_owned = false;
21812 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
21813 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
21814 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
21815 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21816 CVec_u8Z_free(ret_var);
21820 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_free(uint32_t this_obj) {
21821 LDKChannelManagerReadArgs this_obj_conv;
21822 this_obj_conv.inner = (void*)(this_obj & (~1));
21823 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21824 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21825 ChannelManagerReadArgs_free(this_obj_conv);
21828 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_keys_manager(uint32_t this_ptr) {
21829 LDKChannelManagerReadArgs this_ptr_conv;
21830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21831 this_ptr_conv.is_owned = false;
21832 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21833 // WARNING: This object doesn't live past this scope, needs clone!
21834 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv)) | 1;
21838 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_keys_manager(uint32_t this_ptr, uint32_t val) {
21839 LDKChannelManagerReadArgs this_ptr_conv;
21840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21841 this_ptr_conv.is_owned = false;
21842 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21843 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21844 CHECK_ACCESS(val_ptr);
21845 LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
21846 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
21849 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint32_t this_ptr) {
21850 LDKChannelManagerReadArgs this_ptr_conv;
21851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21852 this_ptr_conv.is_owned = false;
21853 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21854 // WARNING: This object doesn't live past this scope, needs clone!
21855 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv)) | 1;
21859 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint32_t this_ptr, uint32_t val) {
21860 LDKChannelManagerReadArgs this_ptr_conv;
21861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21862 this_ptr_conv.is_owned = false;
21863 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21864 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21865 CHECK_ACCESS(val_ptr);
21866 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
21867 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
21870 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint32_t this_ptr) {
21871 LDKChannelManagerReadArgs this_ptr_conv;
21872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21873 this_ptr_conv.is_owned = false;
21874 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21875 // WARNING: This object doesn't live past this scope, needs clone!
21876 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv)) | 1;
21880 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint32_t this_ptr, uint32_t val) {
21881 LDKChannelManagerReadArgs this_ptr_conv;
21882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21883 this_ptr_conv.is_owned = false;
21884 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21885 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21886 CHECK_ACCESS(val_ptr);
21887 LDKWatch val_conv = *(LDKWatch*)(val_ptr);
21888 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
21891 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint32_t this_ptr) {
21892 LDKChannelManagerReadArgs this_ptr_conv;
21893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21894 this_ptr_conv.is_owned = false;
21895 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21896 // WARNING: This object doesn't live past this scope, needs clone!
21897 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv)) | 1;
21901 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint32_t this_ptr, uint32_t val) {
21902 LDKChannelManagerReadArgs this_ptr_conv;
21903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21904 this_ptr_conv.is_owned = false;
21905 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21906 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21907 CHECK_ACCESS(val_ptr);
21908 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
21909 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
21912 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_logger(uint32_t this_ptr) {
21913 LDKChannelManagerReadArgs this_ptr_conv;
21914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21915 this_ptr_conv.is_owned = false;
21916 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21917 // WARNING: This object doesn't live past this scope, needs clone!
21918 uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv)) | 1;
21922 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_logger(uint32_t this_ptr, uint32_t val) {
21923 LDKChannelManagerReadArgs this_ptr_conv;
21924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21925 this_ptr_conv.is_owned = false;
21926 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21927 void* val_ptr = (void*)(((uint64_t)val) & ~1);
21928 CHECK_ACCESS(val_ptr);
21929 LDKLogger val_conv = *(LDKLogger*)(val_ptr);
21930 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
21933 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_default_config(uint32_t this_ptr) {
21934 LDKChannelManagerReadArgs this_ptr_conv;
21935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21936 this_ptr_conv.is_owned = false;
21937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21938 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
21939 uint64_t ret_ref = 0;
21940 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21941 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21942 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21943 ret_ref = (uint64_t)ret_var.inner;
21944 if (ret_var.is_owned) {
21950 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_default_config(uint32_t this_ptr, uint32_t val) {
21951 LDKChannelManagerReadArgs this_ptr_conv;
21952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21953 this_ptr_conv.is_owned = false;
21954 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21955 LDKUserConfig val_conv;
21956 val_conv.inner = (void*)(val & (~1));
21957 val_conv.is_owned = (val & 1) || (val == 0);
21958 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21959 val_conv = UserConfig_clone(&val_conv);
21960 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
21963 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) {
21964 void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
21965 CHECK_ACCESS(keys_manager_ptr);
21966 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
21967 void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
21968 CHECK_ACCESS(fee_estimator_ptr);
21969 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
21970 void* chain_monitor_ptr = (void*)(((uint64_t)chain_monitor) & ~1);
21971 CHECK_ACCESS(chain_monitor_ptr);
21972 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
21973 void* tx_broadcaster_ptr = (void*)(((uint64_t)tx_broadcaster) & ~1);
21974 CHECK_ACCESS(tx_broadcaster_ptr);
21975 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
21976 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
21977 CHECK_ACCESS(logger_ptr);
21978 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
21979 LDKUserConfig default_config_conv;
21980 default_config_conv.inner = (void*)(default_config & (~1));
21981 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
21982 CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
21983 default_config_conv = UserConfig_clone(&default_config_conv);
21984 LDKCVec_ChannelMonitorZ channel_monitors_constr;
21985 channel_monitors_constr.datalen = channel_monitors->arr_len;
21986 if (channel_monitors_constr.datalen > 0)
21987 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
21989 channel_monitors_constr.data = NULL;
21990 uint32_t* channel_monitors_vals = channel_monitors->elems;
21991 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
21992 uint32_t channel_monitors_conv_16 = channel_monitors_vals[q];
21993 LDKChannelMonitor channel_monitors_conv_16_conv;
21994 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
21995 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
21996 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
21997 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
21999 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);
22000 uint64_t ret_ref = 0;
22001 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22002 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22003 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22004 ret_ref = (uint64_t)ret_var.inner;
22005 if (ret_var.is_owned) {
22011 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint32_t arg) {
22012 LDKu8slice ser_ref;
22013 ser_ref.datalen = ser->arr_len;
22014 ser_ref.data = ser->elems;
22015 LDKChannelManagerReadArgs arg_conv;
22016 arg_conv.inner = (void*)(arg & (~1));
22017 arg_conv.is_owned = (arg & 1) || (arg == 0);
22018 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22019 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
22020 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
22021 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
22022 return (uint64_t)ret_conv;
22025 void __attribute__((visibility("default"))) TS_DecodeError_free(uint32_t this_obj) {
22026 LDKDecodeError this_obj_conv;
22027 this_obj_conv.inner = (void*)(this_obj & (~1));
22028 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22029 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22030 DecodeError_free(this_obj_conv);
22033 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
22034 LDKDecodeError ret_var = DecodeError_clone(arg);
22035 uint64_t ret_ref = 0;
22036 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22037 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22038 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22039 ret_ref = (uint64_t)ret_var.inner;
22040 if (ret_var.is_owned) {
22045 int64_t __attribute__((visibility("default"))) TS_DecodeError_clone_ptr(uint32_t arg) {
22046 LDKDecodeError arg_conv;
22047 arg_conv.inner = (void*)(arg & (~1));
22048 arg_conv.is_owned = false;
22049 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22050 int64_t ret_val = DecodeError_clone_ptr(&arg_conv);
22054 uint32_t __attribute__((visibility("default"))) TS_DecodeError_clone(uint32_t orig) {
22055 LDKDecodeError orig_conv;
22056 orig_conv.inner = (void*)(orig & (~1));
22057 orig_conv.is_owned = false;
22058 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22059 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
22060 uint64_t ret_ref = 0;
22061 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22062 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22063 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22064 ret_ref = (uint64_t)ret_var.inner;
22065 if (ret_var.is_owned) {
22071 void __attribute__((visibility("default"))) TS_Init_free(uint32_t this_obj) {
22072 LDKInit this_obj_conv;
22073 this_obj_conv.inner = (void*)(this_obj & (~1));
22074 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22075 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22076 Init_free(this_obj_conv);
22079 uint32_t __attribute__((visibility("default"))) TS_Init_get_features(uint32_t this_ptr) {
22080 LDKInit this_ptr_conv;
22081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22082 this_ptr_conv.is_owned = false;
22083 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22084 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
22085 uint64_t ret_ref = 0;
22086 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22087 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22088 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22089 ret_ref = (uint64_t)ret_var.inner;
22090 if (ret_var.is_owned) {
22096 void __attribute__((visibility("default"))) TS_Init_set_features(uint32_t this_ptr, uint32_t val) {
22097 LDKInit this_ptr_conv;
22098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22099 this_ptr_conv.is_owned = false;
22100 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22101 LDKInitFeatures val_conv;
22102 val_conv.inner = (void*)(val & (~1));
22103 val_conv.is_owned = (val & 1) || (val == 0);
22104 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
22105 val_conv = InitFeatures_clone(&val_conv);
22106 Init_set_features(&this_ptr_conv, val_conv);
22109 uint32_t __attribute__((visibility("default"))) TS_Init_new(uint32_t features_arg) {
22110 LDKInitFeatures features_arg_conv;
22111 features_arg_conv.inner = (void*)(features_arg & (~1));
22112 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
22113 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
22114 features_arg_conv = InitFeatures_clone(&features_arg_conv);
22115 LDKInit ret_var = Init_new(features_arg_conv);
22116 uint64_t ret_ref = 0;
22117 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22118 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22119 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22120 ret_ref = (uint64_t)ret_var.inner;
22121 if (ret_var.is_owned) {
22127 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
22128 LDKInit ret_var = Init_clone(arg);
22129 uint64_t ret_ref = 0;
22130 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22131 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22132 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22133 ret_ref = (uint64_t)ret_var.inner;
22134 if (ret_var.is_owned) {
22139 int64_t __attribute__((visibility("default"))) TS_Init_clone_ptr(uint32_t arg) {
22141 arg_conv.inner = (void*)(arg & (~1));
22142 arg_conv.is_owned = false;
22143 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22144 int64_t ret_val = Init_clone_ptr(&arg_conv);
22148 uint32_t __attribute__((visibility("default"))) TS_Init_clone(uint32_t orig) {
22150 orig_conv.inner = (void*)(orig & (~1));
22151 orig_conv.is_owned = false;
22152 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22153 LDKInit ret_var = Init_clone(&orig_conv);
22154 uint64_t ret_ref = 0;
22155 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22156 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22157 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22158 ret_ref = (uint64_t)ret_var.inner;
22159 if (ret_var.is_owned) {
22165 void __attribute__((visibility("default"))) TS_ErrorMessage_free(uint32_t this_obj) {
22166 LDKErrorMessage this_obj_conv;
22167 this_obj_conv.inner = (void*)(this_obj & (~1));
22168 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22169 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22170 ErrorMessage_free(this_obj_conv);
22173 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_get_channel_id(uint32_t this_ptr) {
22174 LDKErrorMessage this_ptr_conv;
22175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22176 this_ptr_conv.is_owned = false;
22177 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22178 int8_tArray ret_arr = init_int8_tArray(32);
22179 memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
22183 void __attribute__((visibility("default"))) TS_ErrorMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
22184 LDKErrorMessage this_ptr_conv;
22185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22186 this_ptr_conv.is_owned = false;
22187 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22188 LDKThirtyTwoBytes val_ref;
22189 CHECK(val->arr_len == 32);
22190 memcpy(val_ref.data, val->elems, 32);
22191 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
22194 jstring __attribute__((visibility("default"))) TS_ErrorMessage_get_data(uint32_t this_ptr) {
22195 LDKErrorMessage this_ptr_conv;
22196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22197 this_ptr_conv.is_owned = false;
22198 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22199 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
22200 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
22205 void __attribute__((visibility("default"))) TS_ErrorMessage_set_data(uint32_t this_ptr, jstring val) {
22206 LDKErrorMessage this_ptr_conv;
22207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22208 this_ptr_conv.is_owned = false;
22209 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22210 LDKStr val_conv = str_ref_to_owned_c(val);
22211 ErrorMessage_set_data(&this_ptr_conv, val_conv);
22214 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
22215 LDKThirtyTwoBytes channel_id_arg_ref;
22216 CHECK(channel_id_arg->arr_len == 32);
22217 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
22218 LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
22219 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
22220 uint64_t ret_ref = 0;
22221 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22222 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22223 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22224 ret_ref = (uint64_t)ret_var.inner;
22225 if (ret_var.is_owned) {
22231 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
22232 LDKErrorMessage ret_var = ErrorMessage_clone(arg);
22233 uint64_t ret_ref = 0;
22234 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22235 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22236 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22237 ret_ref = (uint64_t)ret_var.inner;
22238 if (ret_var.is_owned) {
22243 int64_t __attribute__((visibility("default"))) TS_ErrorMessage_clone_ptr(uint32_t arg) {
22244 LDKErrorMessage arg_conv;
22245 arg_conv.inner = (void*)(arg & (~1));
22246 arg_conv.is_owned = false;
22247 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22248 int64_t ret_val = ErrorMessage_clone_ptr(&arg_conv);
22252 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_clone(uint32_t orig) {
22253 LDKErrorMessage orig_conv;
22254 orig_conv.inner = (void*)(orig & (~1));
22255 orig_conv.is_owned = false;
22256 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22257 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
22258 uint64_t ret_ref = 0;
22259 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22260 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22261 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22262 ret_ref = (uint64_t)ret_var.inner;
22263 if (ret_var.is_owned) {
22269 void __attribute__((visibility("default"))) TS_Ping_free(uint32_t this_obj) {
22270 LDKPing this_obj_conv;
22271 this_obj_conv.inner = (void*)(this_obj & (~1));
22272 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22273 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22274 Ping_free(this_obj_conv);
22277 int16_t __attribute__((visibility("default"))) TS_Ping_get_ponglen(uint32_t this_ptr) {
22278 LDKPing this_ptr_conv;
22279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22280 this_ptr_conv.is_owned = false;
22281 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22282 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
22286 void __attribute__((visibility("default"))) TS_Ping_set_ponglen(uint32_t this_ptr, int16_t val) {
22287 LDKPing this_ptr_conv;
22288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22289 this_ptr_conv.is_owned = false;
22290 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22291 Ping_set_ponglen(&this_ptr_conv, val);
22294 int16_t __attribute__((visibility("default"))) TS_Ping_get_byteslen(uint32_t this_ptr) {
22295 LDKPing this_ptr_conv;
22296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22297 this_ptr_conv.is_owned = false;
22298 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22299 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
22303 void __attribute__((visibility("default"))) TS_Ping_set_byteslen(uint32_t this_ptr, int16_t val) {
22304 LDKPing this_ptr_conv;
22305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22306 this_ptr_conv.is_owned = false;
22307 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22308 Ping_set_byteslen(&this_ptr_conv, val);
22311 uint32_t __attribute__((visibility("default"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
22312 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
22313 uint64_t ret_ref = 0;
22314 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22315 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22316 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22317 ret_ref = (uint64_t)ret_var.inner;
22318 if (ret_var.is_owned) {
22324 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
22325 LDKPing ret_var = Ping_clone(arg);
22326 uint64_t ret_ref = 0;
22327 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22328 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22329 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22330 ret_ref = (uint64_t)ret_var.inner;
22331 if (ret_var.is_owned) {
22336 int64_t __attribute__((visibility("default"))) TS_Ping_clone_ptr(uint32_t arg) {
22338 arg_conv.inner = (void*)(arg & (~1));
22339 arg_conv.is_owned = false;
22340 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22341 int64_t ret_val = Ping_clone_ptr(&arg_conv);
22345 uint32_t __attribute__((visibility("default"))) TS_Ping_clone(uint32_t orig) {
22347 orig_conv.inner = (void*)(orig & (~1));
22348 orig_conv.is_owned = false;
22349 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22350 LDKPing ret_var = Ping_clone(&orig_conv);
22351 uint64_t ret_ref = 0;
22352 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22353 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22354 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22355 ret_ref = (uint64_t)ret_var.inner;
22356 if (ret_var.is_owned) {
22362 void __attribute__((visibility("default"))) TS_Pong_free(uint32_t this_obj) {
22363 LDKPong this_obj_conv;
22364 this_obj_conv.inner = (void*)(this_obj & (~1));
22365 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22366 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22367 Pong_free(this_obj_conv);
22370 int16_t __attribute__((visibility("default"))) TS_Pong_get_byteslen(uint32_t this_ptr) {
22371 LDKPong this_ptr_conv;
22372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22373 this_ptr_conv.is_owned = false;
22374 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22375 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
22379 void __attribute__((visibility("default"))) TS_Pong_set_byteslen(uint32_t this_ptr, int16_t val) {
22380 LDKPong this_ptr_conv;
22381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22382 this_ptr_conv.is_owned = false;
22383 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22384 Pong_set_byteslen(&this_ptr_conv, val);
22387 uint32_t __attribute__((visibility("default"))) TS_Pong_new(int16_t byteslen_arg) {
22388 LDKPong ret_var = Pong_new(byteslen_arg);
22389 uint64_t ret_ref = 0;
22390 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22391 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22392 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22393 ret_ref = (uint64_t)ret_var.inner;
22394 if (ret_var.is_owned) {
22400 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
22401 LDKPong ret_var = Pong_clone(arg);
22402 uint64_t ret_ref = 0;
22403 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22404 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22405 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22406 ret_ref = (uint64_t)ret_var.inner;
22407 if (ret_var.is_owned) {
22412 int64_t __attribute__((visibility("default"))) TS_Pong_clone_ptr(uint32_t arg) {
22414 arg_conv.inner = (void*)(arg & (~1));
22415 arg_conv.is_owned = false;
22416 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22417 int64_t ret_val = Pong_clone_ptr(&arg_conv);
22421 uint32_t __attribute__((visibility("default"))) TS_Pong_clone(uint32_t orig) {
22423 orig_conv.inner = (void*)(orig & (~1));
22424 orig_conv.is_owned = false;
22425 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22426 LDKPong ret_var = Pong_clone(&orig_conv);
22427 uint64_t ret_ref = 0;
22428 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22429 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22430 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22431 ret_ref = (uint64_t)ret_var.inner;
22432 if (ret_var.is_owned) {
22438 void __attribute__((visibility("default"))) TS_OpenChannel_free(uint32_t this_obj) {
22439 LDKOpenChannel this_obj_conv;
22440 this_obj_conv.inner = (void*)(this_obj & (~1));
22441 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22442 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22443 OpenChannel_free(this_obj_conv);
22446 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_chain_hash(uint32_t this_ptr) {
22447 LDKOpenChannel this_ptr_conv;
22448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22449 this_ptr_conv.is_owned = false;
22450 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22451 int8_tArray ret_arr = init_int8_tArray(32);
22452 memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
22456 void __attribute__((visibility("default"))) TS_OpenChannel_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
22457 LDKOpenChannel this_ptr_conv;
22458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22459 this_ptr_conv.is_owned = false;
22460 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22461 LDKThirtyTwoBytes val_ref;
22462 CHECK(val->arr_len == 32);
22463 memcpy(val_ref.data, val->elems, 32);
22464 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
22467 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_temporary_channel_id(uint32_t this_ptr) {
22468 LDKOpenChannel this_ptr_conv;
22469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22470 this_ptr_conv.is_owned = false;
22471 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22472 int8_tArray ret_arr = init_int8_tArray(32);
22473 memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
22477 void __attribute__((visibility("default"))) TS_OpenChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
22478 LDKOpenChannel this_ptr_conv;
22479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22480 this_ptr_conv.is_owned = false;
22481 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22482 LDKThirtyTwoBytes val_ref;
22483 CHECK(val->arr_len == 32);
22484 memcpy(val_ref.data, val->elems, 32);
22485 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
22488 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_funding_satoshis(uint32_t this_ptr) {
22489 LDKOpenChannel this_ptr_conv;
22490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22491 this_ptr_conv.is_owned = false;
22492 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22493 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
22497 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_satoshis(uint32_t this_ptr, int64_t val) {
22498 LDKOpenChannel this_ptr_conv;
22499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22500 this_ptr_conv.is_owned = false;
22501 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22502 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
22505 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_push_msat(uint32_t this_ptr) {
22506 LDKOpenChannel this_ptr_conv;
22507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22508 this_ptr_conv.is_owned = false;
22509 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22510 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
22514 void __attribute__((visibility("default"))) TS_OpenChannel_set_push_msat(uint32_t this_ptr, int64_t val) {
22515 LDKOpenChannel this_ptr_conv;
22516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22517 this_ptr_conv.is_owned = false;
22518 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22519 OpenChannel_set_push_msat(&this_ptr_conv, val);
22522 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
22523 LDKOpenChannel this_ptr_conv;
22524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22525 this_ptr_conv.is_owned = false;
22526 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22527 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
22531 void __attribute__((visibility("default"))) TS_OpenChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
22532 LDKOpenChannel this_ptr_conv;
22533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22534 this_ptr_conv.is_owned = false;
22535 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22536 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
22539 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
22540 LDKOpenChannel this_ptr_conv;
22541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22542 this_ptr_conv.is_owned = false;
22543 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22544 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
22548 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
22549 LDKOpenChannel this_ptr_conv;
22550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22551 this_ptr_conv.is_owned = false;
22552 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22553 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
22556 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
22557 LDKOpenChannel this_ptr_conv;
22558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22559 this_ptr_conv.is_owned = false;
22560 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22561 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
22565 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
22566 LDKOpenChannel this_ptr_conv;
22567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22568 this_ptr_conv.is_owned = false;
22569 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22570 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
22573 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
22574 LDKOpenChannel this_ptr_conv;
22575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22576 this_ptr_conv.is_owned = false;
22577 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22578 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
22582 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
22583 LDKOpenChannel this_ptr_conv;
22584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22585 this_ptr_conv.is_owned = false;
22586 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22587 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
22590 int32_t __attribute__((visibility("default"))) TS_OpenChannel_get_feerate_per_kw(uint32_t this_ptr) {
22591 LDKOpenChannel this_ptr_conv;
22592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22593 this_ptr_conv.is_owned = false;
22594 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22595 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
22599 void __attribute__((visibility("default"))) TS_OpenChannel_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
22600 LDKOpenChannel this_ptr_conv;
22601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22602 this_ptr_conv.is_owned = false;
22603 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22604 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
22607 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_to_self_delay(uint32_t this_ptr) {
22608 LDKOpenChannel this_ptr_conv;
22609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22610 this_ptr_conv.is_owned = false;
22611 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22612 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
22616 void __attribute__((visibility("default"))) TS_OpenChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
22617 LDKOpenChannel this_ptr_conv;
22618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22619 this_ptr_conv.is_owned = false;
22620 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22621 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
22624 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
22625 LDKOpenChannel this_ptr_conv;
22626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22627 this_ptr_conv.is_owned = false;
22628 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22629 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
22633 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
22634 LDKOpenChannel this_ptr_conv;
22635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22636 this_ptr_conv.is_owned = false;
22637 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22638 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
22641 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_funding_pubkey(uint32_t this_ptr) {
22642 LDKOpenChannel this_ptr_conv;
22643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22644 this_ptr_conv.is_owned = false;
22645 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22646 int8_tArray ret_arr = init_int8_tArray(33);
22647 memcpy(ret_arr->elems, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
22651 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
22652 LDKOpenChannel this_ptr_conv;
22653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22654 this_ptr_conv.is_owned = false;
22655 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22656 LDKPublicKey val_ref;
22657 CHECK(val->arr_len == 33);
22658 memcpy(val_ref.compressed_form, val->elems, 33);
22659 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
22662 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_revocation_basepoint(uint32_t this_ptr) {
22663 LDKOpenChannel this_ptr_conv;
22664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22665 this_ptr_conv.is_owned = false;
22666 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22667 int8_tArray ret_arr = init_int8_tArray(33);
22668 memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
22672 void __attribute__((visibility("default"))) TS_OpenChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
22673 LDKOpenChannel this_ptr_conv;
22674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22675 this_ptr_conv.is_owned = false;
22676 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22677 LDKPublicKey val_ref;
22678 CHECK(val->arr_len == 33);
22679 memcpy(val_ref.compressed_form, val->elems, 33);
22680 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
22683 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_payment_point(uint32_t this_ptr) {
22684 LDKOpenChannel this_ptr_conv;
22685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22686 this_ptr_conv.is_owned = false;
22687 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22688 int8_tArray ret_arr = init_int8_tArray(33);
22689 memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
22693 void __attribute__((visibility("default"))) TS_OpenChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
22694 LDKOpenChannel this_ptr_conv;
22695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22696 this_ptr_conv.is_owned = false;
22697 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22698 LDKPublicKey val_ref;
22699 CHECK(val->arr_len == 33);
22700 memcpy(val_ref.compressed_form, val->elems, 33);
22701 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
22704 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
22705 LDKOpenChannel this_ptr_conv;
22706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22707 this_ptr_conv.is_owned = false;
22708 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22709 int8_tArray ret_arr = init_int8_tArray(33);
22710 memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
22714 void __attribute__((visibility("default"))) TS_OpenChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
22715 LDKOpenChannel this_ptr_conv;
22716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22717 this_ptr_conv.is_owned = false;
22718 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22719 LDKPublicKey val_ref;
22720 CHECK(val->arr_len == 33);
22721 memcpy(val_ref.compressed_form, val->elems, 33);
22722 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
22725 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_basepoint(uint32_t this_ptr) {
22726 LDKOpenChannel this_ptr_conv;
22727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22728 this_ptr_conv.is_owned = false;
22729 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22730 int8_tArray ret_arr = init_int8_tArray(33);
22731 memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
22735 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
22736 LDKOpenChannel this_ptr_conv;
22737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22738 this_ptr_conv.is_owned = false;
22739 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22740 LDKPublicKey val_ref;
22741 CHECK(val->arr_len == 33);
22742 memcpy(val_ref.compressed_form, val->elems, 33);
22743 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
22746 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_first_per_commitment_point(uint32_t this_ptr) {
22747 LDKOpenChannel this_ptr_conv;
22748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22749 this_ptr_conv.is_owned = false;
22750 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22751 int8_tArray ret_arr = init_int8_tArray(33);
22752 memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
22756 void __attribute__((visibility("default"))) TS_OpenChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
22757 LDKOpenChannel this_ptr_conv;
22758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22759 this_ptr_conv.is_owned = false;
22760 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22761 LDKPublicKey val_ref;
22762 CHECK(val->arr_len == 33);
22763 memcpy(val_ref.compressed_form, val->elems, 33);
22764 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
22767 int8_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_flags(uint32_t this_ptr) {
22768 LDKOpenChannel this_ptr_conv;
22769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22770 this_ptr_conv.is_owned = false;
22771 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22772 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
22776 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_flags(uint32_t this_ptr, int8_t val) {
22777 LDKOpenChannel this_ptr_conv;
22778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22779 this_ptr_conv.is_owned = false;
22780 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22781 OpenChannel_set_channel_flags(&this_ptr_conv, val);
22784 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_type(uint32_t this_ptr) {
22785 LDKOpenChannel this_ptr_conv;
22786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22787 this_ptr_conv.is_owned = false;
22788 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22789 LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
22790 uint64_t ret_ref = 0;
22791 if ((uint64_t)ret_var.inner > 4096) {
22792 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22793 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22794 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22795 ret_ref = (uint64_t)ret_var.inner;
22796 if (ret_var.is_owned) {
22803 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_type(uint32_t this_ptr, uint32_t val) {
22804 LDKOpenChannel this_ptr_conv;
22805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22806 this_ptr_conv.is_owned = false;
22807 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22808 LDKChannelTypeFeatures val_conv;
22809 val_conv.inner = (void*)(val & (~1));
22810 val_conv.is_owned = (val & 1) || (val == 0);
22811 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
22812 val_conv = ChannelTypeFeatures_clone(&val_conv);
22813 OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
22816 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
22817 LDKOpenChannel ret_var = OpenChannel_clone(arg);
22818 uint64_t ret_ref = 0;
22819 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22820 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22821 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22822 ret_ref = (uint64_t)ret_var.inner;
22823 if (ret_var.is_owned) {
22828 int64_t __attribute__((visibility("default"))) TS_OpenChannel_clone_ptr(uint32_t arg) {
22829 LDKOpenChannel arg_conv;
22830 arg_conv.inner = (void*)(arg & (~1));
22831 arg_conv.is_owned = false;
22832 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22833 int64_t ret_val = OpenChannel_clone_ptr(&arg_conv);
22837 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_clone(uint32_t orig) {
22838 LDKOpenChannel orig_conv;
22839 orig_conv.inner = (void*)(orig & (~1));
22840 orig_conv.is_owned = false;
22841 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22842 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
22843 uint64_t ret_ref = 0;
22844 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22845 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22846 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22847 ret_ref = (uint64_t)ret_var.inner;
22848 if (ret_var.is_owned) {
22854 void __attribute__((visibility("default"))) TS_AcceptChannel_free(uint32_t this_obj) {
22855 LDKAcceptChannel this_obj_conv;
22856 this_obj_conv.inner = (void*)(this_obj & (~1));
22857 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22858 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22859 AcceptChannel_free(this_obj_conv);
22862 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_temporary_channel_id(uint32_t this_ptr) {
22863 LDKAcceptChannel this_ptr_conv;
22864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22865 this_ptr_conv.is_owned = false;
22866 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22867 int8_tArray ret_arr = init_int8_tArray(32);
22868 memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
22872 void __attribute__((visibility("default"))) TS_AcceptChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
22873 LDKAcceptChannel this_ptr_conv;
22874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22875 this_ptr_conv.is_owned = false;
22876 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22877 LDKThirtyTwoBytes val_ref;
22878 CHECK(val->arr_len == 32);
22879 memcpy(val_ref.data, val->elems, 32);
22880 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
22883 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
22884 LDKAcceptChannel this_ptr_conv;
22885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22886 this_ptr_conv.is_owned = false;
22887 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22888 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
22892 void __attribute__((visibility("default"))) TS_AcceptChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
22893 LDKAcceptChannel this_ptr_conv;
22894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22895 this_ptr_conv.is_owned = false;
22896 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22897 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
22900 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
22901 LDKAcceptChannel this_ptr_conv;
22902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22903 this_ptr_conv.is_owned = false;
22904 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22905 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
22909 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
22910 LDKAcceptChannel this_ptr_conv;
22911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22912 this_ptr_conv.is_owned = false;
22913 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22914 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
22917 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
22918 LDKAcceptChannel this_ptr_conv;
22919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22920 this_ptr_conv.is_owned = false;
22921 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22922 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
22926 void __attribute__((visibility("default"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
22927 LDKAcceptChannel this_ptr_conv;
22928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22929 this_ptr_conv.is_owned = false;
22930 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22931 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
22934 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
22935 LDKAcceptChannel this_ptr_conv;
22936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22937 this_ptr_conv.is_owned = false;
22938 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22939 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
22943 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
22944 LDKAcceptChannel this_ptr_conv;
22945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22946 this_ptr_conv.is_owned = false;
22947 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22948 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
22951 int32_t __attribute__((visibility("default"))) TS_AcceptChannel_get_minimum_depth(uint32_t this_ptr) {
22952 LDKAcceptChannel this_ptr_conv;
22953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22954 this_ptr_conv.is_owned = false;
22955 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22956 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
22960 void __attribute__((visibility("default"))) TS_AcceptChannel_set_minimum_depth(uint32_t this_ptr, int32_t val) {
22961 LDKAcceptChannel this_ptr_conv;
22962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22963 this_ptr_conv.is_owned = false;
22964 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22965 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
22968 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_to_self_delay(uint32_t this_ptr) {
22969 LDKAcceptChannel this_ptr_conv;
22970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22971 this_ptr_conv.is_owned = false;
22972 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22973 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
22977 void __attribute__((visibility("default"))) TS_AcceptChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
22978 LDKAcceptChannel this_ptr_conv;
22979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22980 this_ptr_conv.is_owned = false;
22981 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22982 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
22985 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
22986 LDKAcceptChannel this_ptr_conv;
22987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22988 this_ptr_conv.is_owned = false;
22989 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22990 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
22994 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
22995 LDKAcceptChannel this_ptr_conv;
22996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22997 this_ptr_conv.is_owned = false;
22998 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22999 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
23002 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_funding_pubkey(uint32_t this_ptr) {
23003 LDKAcceptChannel this_ptr_conv;
23004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23005 this_ptr_conv.is_owned = false;
23006 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23007 int8_tArray ret_arr = init_int8_tArray(33);
23008 memcpy(ret_arr->elems, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
23012 void __attribute__((visibility("default"))) TS_AcceptChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
23013 LDKAcceptChannel this_ptr_conv;
23014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23015 this_ptr_conv.is_owned = false;
23016 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23017 LDKPublicKey val_ref;
23018 CHECK(val->arr_len == 33);
23019 memcpy(val_ref.compressed_form, val->elems, 33);
23020 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
23023 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_revocation_basepoint(uint32_t this_ptr) {
23024 LDKAcceptChannel this_ptr_conv;
23025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23026 this_ptr_conv.is_owned = false;
23027 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23028 int8_tArray ret_arr = init_int8_tArray(33);
23029 memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
23033 void __attribute__((visibility("default"))) TS_AcceptChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
23034 LDKAcceptChannel this_ptr_conv;
23035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23036 this_ptr_conv.is_owned = false;
23037 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23038 LDKPublicKey val_ref;
23039 CHECK(val->arr_len == 33);
23040 memcpy(val_ref.compressed_form, val->elems, 33);
23041 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
23044 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_payment_point(uint32_t this_ptr) {
23045 LDKAcceptChannel this_ptr_conv;
23046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23047 this_ptr_conv.is_owned = false;
23048 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23049 int8_tArray ret_arr = init_int8_tArray(33);
23050 memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
23054 void __attribute__((visibility("default"))) TS_AcceptChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
23055 LDKAcceptChannel this_ptr_conv;
23056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23057 this_ptr_conv.is_owned = false;
23058 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23059 LDKPublicKey val_ref;
23060 CHECK(val->arr_len == 33);
23061 memcpy(val_ref.compressed_form, val->elems, 33);
23062 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
23065 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
23066 LDKAcceptChannel this_ptr_conv;
23067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23068 this_ptr_conv.is_owned = false;
23069 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23070 int8_tArray ret_arr = init_int8_tArray(33);
23071 memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
23075 void __attribute__((visibility("default"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
23076 LDKAcceptChannel this_ptr_conv;
23077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23078 this_ptr_conv.is_owned = false;
23079 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23080 LDKPublicKey val_ref;
23081 CHECK(val->arr_len == 33);
23082 memcpy(val_ref.compressed_form, val->elems, 33);
23083 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
23086 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_basepoint(uint32_t this_ptr) {
23087 LDKAcceptChannel this_ptr_conv;
23088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23089 this_ptr_conv.is_owned = false;
23090 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23091 int8_tArray ret_arr = init_int8_tArray(33);
23092 memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
23096 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
23097 LDKAcceptChannel this_ptr_conv;
23098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23099 this_ptr_conv.is_owned = false;
23100 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23101 LDKPublicKey val_ref;
23102 CHECK(val->arr_len == 33);
23103 memcpy(val_ref.compressed_form, val->elems, 33);
23104 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
23107 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_first_per_commitment_point(uint32_t this_ptr) {
23108 LDKAcceptChannel this_ptr_conv;
23109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23110 this_ptr_conv.is_owned = false;
23111 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23112 int8_tArray ret_arr = init_int8_tArray(33);
23113 memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
23117 void __attribute__((visibility("default"))) TS_AcceptChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
23118 LDKAcceptChannel this_ptr_conv;
23119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23120 this_ptr_conv.is_owned = false;
23121 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23122 LDKPublicKey val_ref;
23123 CHECK(val->arr_len == 33);
23124 memcpy(val_ref.compressed_form, val->elems, 33);
23125 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
23128 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
23129 LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
23130 uint64_t ret_ref = 0;
23131 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23132 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23133 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23134 ret_ref = (uint64_t)ret_var.inner;
23135 if (ret_var.is_owned) {
23140 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_clone_ptr(uint32_t arg) {
23141 LDKAcceptChannel arg_conv;
23142 arg_conv.inner = (void*)(arg & (~1));
23143 arg_conv.is_owned = false;
23144 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23145 int64_t ret_val = AcceptChannel_clone_ptr(&arg_conv);
23149 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_clone(uint32_t orig) {
23150 LDKAcceptChannel orig_conv;
23151 orig_conv.inner = (void*)(orig & (~1));
23152 orig_conv.is_owned = false;
23153 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23154 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
23155 uint64_t ret_ref = 0;
23156 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23157 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23158 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23159 ret_ref = (uint64_t)ret_var.inner;
23160 if (ret_var.is_owned) {
23166 void __attribute__((visibility("default"))) TS_FundingCreated_free(uint32_t this_obj) {
23167 LDKFundingCreated this_obj_conv;
23168 this_obj_conv.inner = (void*)(this_obj & (~1));
23169 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23170 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23171 FundingCreated_free(this_obj_conv);
23174 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_temporary_channel_id(uint32_t this_ptr) {
23175 LDKFundingCreated this_ptr_conv;
23176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23177 this_ptr_conv.is_owned = false;
23178 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23179 int8_tArray ret_arr = init_int8_tArray(32);
23180 memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
23184 void __attribute__((visibility("default"))) TS_FundingCreated_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
23185 LDKFundingCreated this_ptr_conv;
23186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23187 this_ptr_conv.is_owned = false;
23188 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23189 LDKThirtyTwoBytes val_ref;
23190 CHECK(val->arr_len == 32);
23191 memcpy(val_ref.data, val->elems, 32);
23192 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
23195 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_funding_txid(uint32_t this_ptr) {
23196 LDKFundingCreated this_ptr_conv;
23197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23198 this_ptr_conv.is_owned = false;
23199 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23200 int8_tArray ret_arr = init_int8_tArray(32);
23201 memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
23205 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_txid(uint32_t this_ptr, int8_tArray val) {
23206 LDKFundingCreated this_ptr_conv;
23207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23208 this_ptr_conv.is_owned = false;
23209 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23210 LDKThirtyTwoBytes val_ref;
23211 CHECK(val->arr_len == 32);
23212 memcpy(val_ref.data, val->elems, 32);
23213 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
23216 int16_t __attribute__((visibility("default"))) TS_FundingCreated_get_funding_output_index(uint32_t this_ptr) {
23217 LDKFundingCreated this_ptr_conv;
23218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23219 this_ptr_conv.is_owned = false;
23220 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23221 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
23225 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_output_index(uint32_t this_ptr, int16_t val) {
23226 LDKFundingCreated this_ptr_conv;
23227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23228 this_ptr_conv.is_owned = false;
23229 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23230 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
23233 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_signature(uint32_t this_ptr) {
23234 LDKFundingCreated this_ptr_conv;
23235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23236 this_ptr_conv.is_owned = false;
23237 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23238 int8_tArray ret_arr = init_int8_tArray(64);
23239 memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
23243 void __attribute__((visibility("default"))) TS_FundingCreated_set_signature(uint32_t this_ptr, int8_tArray val) {
23244 LDKFundingCreated this_ptr_conv;
23245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23246 this_ptr_conv.is_owned = false;
23247 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23248 LDKSignature val_ref;
23249 CHECK(val->arr_len == 64);
23250 memcpy(val_ref.compact_form, val->elems, 64);
23251 FundingCreated_set_signature(&this_ptr_conv, val_ref);
23254 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) {
23255 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
23256 CHECK(temporary_channel_id_arg->arr_len == 32);
23257 memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32);
23258 LDKThirtyTwoBytes funding_txid_arg_ref;
23259 CHECK(funding_txid_arg->arr_len == 32);
23260 memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32);
23261 LDKSignature signature_arg_ref;
23262 CHECK(signature_arg->arr_len == 64);
23263 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64);
23264 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
23265 uint64_t ret_ref = 0;
23266 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23267 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23268 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23269 ret_ref = (uint64_t)ret_var.inner;
23270 if (ret_var.is_owned) {
23276 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
23277 LDKFundingCreated ret_var = FundingCreated_clone(arg);
23278 uint64_t ret_ref = 0;
23279 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23280 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23281 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23282 ret_ref = (uint64_t)ret_var.inner;
23283 if (ret_var.is_owned) {
23288 int64_t __attribute__((visibility("default"))) TS_FundingCreated_clone_ptr(uint32_t arg) {
23289 LDKFundingCreated arg_conv;
23290 arg_conv.inner = (void*)(arg & (~1));
23291 arg_conv.is_owned = false;
23292 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23293 int64_t ret_val = FundingCreated_clone_ptr(&arg_conv);
23297 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_clone(uint32_t orig) {
23298 LDKFundingCreated orig_conv;
23299 orig_conv.inner = (void*)(orig & (~1));
23300 orig_conv.is_owned = false;
23301 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23302 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
23303 uint64_t ret_ref = 0;
23304 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23305 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23306 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23307 ret_ref = (uint64_t)ret_var.inner;
23308 if (ret_var.is_owned) {
23314 void __attribute__((visibility("default"))) TS_FundingSigned_free(uint32_t this_obj) {
23315 LDKFundingSigned this_obj_conv;
23316 this_obj_conv.inner = (void*)(this_obj & (~1));
23317 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23318 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23319 FundingSigned_free(this_obj_conv);
23322 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_channel_id(uint32_t this_ptr) {
23323 LDKFundingSigned this_ptr_conv;
23324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23325 this_ptr_conv.is_owned = false;
23326 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23327 int8_tArray ret_arr = init_int8_tArray(32);
23328 memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
23332 void __attribute__((visibility("default"))) TS_FundingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
23333 LDKFundingSigned this_ptr_conv;
23334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23335 this_ptr_conv.is_owned = false;
23336 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23337 LDKThirtyTwoBytes val_ref;
23338 CHECK(val->arr_len == 32);
23339 memcpy(val_ref.data, val->elems, 32);
23340 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
23343 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_signature(uint32_t this_ptr) {
23344 LDKFundingSigned this_ptr_conv;
23345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23346 this_ptr_conv.is_owned = false;
23347 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23348 int8_tArray ret_arr = init_int8_tArray(64);
23349 memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
23353 void __attribute__((visibility("default"))) TS_FundingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
23354 LDKFundingSigned this_ptr_conv;
23355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23356 this_ptr_conv.is_owned = false;
23357 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23358 LDKSignature val_ref;
23359 CHECK(val->arr_len == 64);
23360 memcpy(val_ref.compact_form, val->elems, 64);
23361 FundingSigned_set_signature(&this_ptr_conv, val_ref);
23364 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
23365 LDKThirtyTwoBytes channel_id_arg_ref;
23366 CHECK(channel_id_arg->arr_len == 32);
23367 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
23368 LDKSignature signature_arg_ref;
23369 CHECK(signature_arg->arr_len == 64);
23370 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64);
23371 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
23372 uint64_t ret_ref = 0;
23373 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23374 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23375 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23376 ret_ref = (uint64_t)ret_var.inner;
23377 if (ret_var.is_owned) {
23383 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
23384 LDKFundingSigned ret_var = FundingSigned_clone(arg);
23385 uint64_t ret_ref = 0;
23386 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23387 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23388 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23389 ret_ref = (uint64_t)ret_var.inner;
23390 if (ret_var.is_owned) {
23395 int64_t __attribute__((visibility("default"))) TS_FundingSigned_clone_ptr(uint32_t arg) {
23396 LDKFundingSigned arg_conv;
23397 arg_conv.inner = (void*)(arg & (~1));
23398 arg_conv.is_owned = false;
23399 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23400 int64_t ret_val = FundingSigned_clone_ptr(&arg_conv);
23404 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_clone(uint32_t orig) {
23405 LDKFundingSigned orig_conv;
23406 orig_conv.inner = (void*)(orig & (~1));
23407 orig_conv.is_owned = false;
23408 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23409 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
23410 uint64_t ret_ref = 0;
23411 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23412 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23413 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23414 ret_ref = (uint64_t)ret_var.inner;
23415 if (ret_var.is_owned) {
23421 void __attribute__((visibility("default"))) TS_FundingLocked_free(uint32_t this_obj) {
23422 LDKFundingLocked this_obj_conv;
23423 this_obj_conv.inner = (void*)(this_obj & (~1));
23424 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23425 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23426 FundingLocked_free(this_obj_conv);
23429 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_channel_id(uint32_t this_ptr) {
23430 LDKFundingLocked this_ptr_conv;
23431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23432 this_ptr_conv.is_owned = false;
23433 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23434 int8_tArray ret_arr = init_int8_tArray(32);
23435 memcpy(ret_arr->elems, *FundingLocked_get_channel_id(&this_ptr_conv), 32);
23439 void __attribute__((visibility("default"))) TS_FundingLocked_set_channel_id(uint32_t this_ptr, int8_tArray val) {
23440 LDKFundingLocked this_ptr_conv;
23441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23442 this_ptr_conv.is_owned = false;
23443 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23444 LDKThirtyTwoBytes val_ref;
23445 CHECK(val->arr_len == 32);
23446 memcpy(val_ref.data, val->elems, 32);
23447 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
23450 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_next_per_commitment_point(uint32_t this_ptr) {
23451 LDKFundingLocked this_ptr_conv;
23452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23453 this_ptr_conv.is_owned = false;
23454 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23455 int8_tArray ret_arr = init_int8_tArray(33);
23456 memcpy(ret_arr->elems, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
23460 void __attribute__((visibility("default"))) TS_FundingLocked_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
23461 LDKFundingLocked this_ptr_conv;
23462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23463 this_ptr_conv.is_owned = false;
23464 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23465 LDKPublicKey val_ref;
23466 CHECK(val->arr_len == 33);
23467 memcpy(val_ref.compressed_form, val->elems, 33);
23468 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
23471 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_new(int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
23472 LDKThirtyTwoBytes channel_id_arg_ref;
23473 CHECK(channel_id_arg->arr_len == 32);
23474 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
23475 LDKPublicKey next_per_commitment_point_arg_ref;
23476 CHECK(next_per_commitment_point_arg->arr_len == 33);
23477 memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33);
23478 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
23479 uint64_t ret_ref = 0;
23480 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23481 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23482 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23483 ret_ref = (uint64_t)ret_var.inner;
23484 if (ret_var.is_owned) {
23490 static inline uint64_t FundingLocked_clone_ptr(LDKFundingLocked *NONNULL_PTR arg) {
23491 LDKFundingLocked ret_var = FundingLocked_clone(arg);
23492 uint64_t ret_ref = 0;
23493 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23494 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23495 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23496 ret_ref = (uint64_t)ret_var.inner;
23497 if (ret_var.is_owned) {
23502 int64_t __attribute__((visibility("default"))) TS_FundingLocked_clone_ptr(uint32_t arg) {
23503 LDKFundingLocked arg_conv;
23504 arg_conv.inner = (void*)(arg & (~1));
23505 arg_conv.is_owned = false;
23506 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23507 int64_t ret_val = FundingLocked_clone_ptr(&arg_conv);
23511 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_clone(uint32_t orig) {
23512 LDKFundingLocked orig_conv;
23513 orig_conv.inner = (void*)(orig & (~1));
23514 orig_conv.is_owned = false;
23515 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23516 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
23517 uint64_t ret_ref = 0;
23518 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23519 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23520 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23521 ret_ref = (uint64_t)ret_var.inner;
23522 if (ret_var.is_owned) {
23528 void __attribute__((visibility("default"))) TS_Shutdown_free(uint32_t this_obj) {
23529 LDKShutdown this_obj_conv;
23530 this_obj_conv.inner = (void*)(this_obj & (~1));
23531 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23532 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23533 Shutdown_free(this_obj_conv);
23536 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_channel_id(uint32_t this_ptr) {
23537 LDKShutdown this_ptr_conv;
23538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23539 this_ptr_conv.is_owned = false;
23540 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23541 int8_tArray ret_arr = init_int8_tArray(32);
23542 memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
23546 void __attribute__((visibility("default"))) TS_Shutdown_set_channel_id(uint32_t this_ptr, int8_tArray val) {
23547 LDKShutdown this_ptr_conv;
23548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23549 this_ptr_conv.is_owned = false;
23550 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23551 LDKThirtyTwoBytes val_ref;
23552 CHECK(val->arr_len == 32);
23553 memcpy(val_ref.data, val->elems, 32);
23554 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
23557 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_scriptpubkey(uint32_t this_ptr) {
23558 LDKShutdown this_ptr_conv;
23559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23560 this_ptr_conv.is_owned = false;
23561 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23562 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
23563 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
23564 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23568 void __attribute__((visibility("default"))) TS_Shutdown_set_scriptpubkey(uint32_t this_ptr, int8_tArray val) {
23569 LDKShutdown this_ptr_conv;
23570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23571 this_ptr_conv.is_owned = false;
23572 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23573 LDKCVec_u8Z val_ref;
23574 val_ref.datalen = val->arr_len;
23575 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
23576 memcpy(val_ref.data, val->elems, val_ref.datalen);
23577 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
23580 uint32_t __attribute__((visibility("default"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
23581 LDKThirtyTwoBytes channel_id_arg_ref;
23582 CHECK(channel_id_arg->arr_len == 32);
23583 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
23584 LDKCVec_u8Z scriptpubkey_arg_ref;
23585 scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
23586 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
23587 memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen);
23588 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
23589 uint64_t ret_ref = 0;
23590 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23591 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23592 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23593 ret_ref = (uint64_t)ret_var.inner;
23594 if (ret_var.is_owned) {
23600 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
23601 LDKShutdown ret_var = Shutdown_clone(arg);
23602 uint64_t ret_ref = 0;
23603 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23604 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23605 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23606 ret_ref = (uint64_t)ret_var.inner;
23607 if (ret_var.is_owned) {
23612 int64_t __attribute__((visibility("default"))) TS_Shutdown_clone_ptr(uint32_t arg) {
23613 LDKShutdown arg_conv;
23614 arg_conv.inner = (void*)(arg & (~1));
23615 arg_conv.is_owned = false;
23616 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23617 int64_t ret_val = Shutdown_clone_ptr(&arg_conv);
23621 uint32_t __attribute__((visibility("default"))) TS_Shutdown_clone(uint32_t orig) {
23622 LDKShutdown orig_conv;
23623 orig_conv.inner = (void*)(orig & (~1));
23624 orig_conv.is_owned = false;
23625 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23626 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
23627 uint64_t ret_ref = 0;
23628 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23629 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23630 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23631 ret_ref = (uint64_t)ret_var.inner;
23632 if (ret_var.is_owned) {
23638 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_free(uint32_t this_obj) {
23639 LDKClosingSignedFeeRange this_obj_conv;
23640 this_obj_conv.inner = (void*)(this_obj & (~1));
23641 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23642 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23643 ClosingSignedFeeRange_free(this_obj_conv);
23646 int64_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint32_t this_ptr) {
23647 LDKClosingSignedFeeRange this_ptr_conv;
23648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23649 this_ptr_conv.is_owned = false;
23650 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23651 int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
23655 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint32_t this_ptr, int64_t val) {
23656 LDKClosingSignedFeeRange this_ptr_conv;
23657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23658 this_ptr_conv.is_owned = false;
23659 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23660 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
23663 int64_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint32_t this_ptr) {
23664 LDKClosingSignedFeeRange this_ptr_conv;
23665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23666 this_ptr_conv.is_owned = false;
23667 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23668 int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
23672 void __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
23673 LDKClosingSignedFeeRange this_ptr_conv;
23674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23675 this_ptr_conv.is_owned = false;
23676 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23677 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
23680 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
23681 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
23682 uint64_t ret_ref = 0;
23683 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23684 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23685 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23686 ret_ref = (uint64_t)ret_var.inner;
23687 if (ret_var.is_owned) {
23693 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
23694 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
23695 uint64_t ret_ref = 0;
23696 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23697 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23698 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23699 ret_ref = (uint64_t)ret_var.inner;
23700 if (ret_var.is_owned) {
23705 int64_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_clone_ptr(uint32_t arg) {
23706 LDKClosingSignedFeeRange arg_conv;
23707 arg_conv.inner = (void*)(arg & (~1));
23708 arg_conv.is_owned = false;
23709 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23710 int64_t ret_val = ClosingSignedFeeRange_clone_ptr(&arg_conv);
23714 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_clone(uint32_t orig) {
23715 LDKClosingSignedFeeRange orig_conv;
23716 orig_conv.inner = (void*)(orig & (~1));
23717 orig_conv.is_owned = false;
23718 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23719 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
23720 uint64_t ret_ref = 0;
23721 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23722 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23723 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23724 ret_ref = (uint64_t)ret_var.inner;
23725 if (ret_var.is_owned) {
23731 void __attribute__((visibility("default"))) TS_ClosingSigned_free(uint32_t this_obj) {
23732 LDKClosingSigned this_obj_conv;
23733 this_obj_conv.inner = (void*)(this_obj & (~1));
23734 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23735 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23736 ClosingSigned_free(this_obj_conv);
23739 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_channel_id(uint32_t this_ptr) {
23740 LDKClosingSigned this_ptr_conv;
23741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23742 this_ptr_conv.is_owned = false;
23743 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23744 int8_tArray ret_arr = init_int8_tArray(32);
23745 memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
23749 void __attribute__((visibility("default"))) TS_ClosingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
23750 LDKClosingSigned this_ptr_conv;
23751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23752 this_ptr_conv.is_owned = false;
23753 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23754 LDKThirtyTwoBytes val_ref;
23755 CHECK(val->arr_len == 32);
23756 memcpy(val_ref.data, val->elems, 32);
23757 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
23760 int64_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_satoshis(uint32_t this_ptr) {
23761 LDKClosingSigned this_ptr_conv;
23762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23763 this_ptr_conv.is_owned = false;
23764 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23765 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
23769 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_satoshis(uint32_t this_ptr, int64_t val) {
23770 LDKClosingSigned this_ptr_conv;
23771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23772 this_ptr_conv.is_owned = false;
23773 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23774 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
23777 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_signature(uint32_t this_ptr) {
23778 LDKClosingSigned this_ptr_conv;
23779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23780 this_ptr_conv.is_owned = false;
23781 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23782 int8_tArray ret_arr = init_int8_tArray(64);
23783 memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
23787 void __attribute__((visibility("default"))) TS_ClosingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
23788 LDKClosingSigned this_ptr_conv;
23789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23790 this_ptr_conv.is_owned = false;
23791 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23792 LDKSignature val_ref;
23793 CHECK(val->arr_len == 64);
23794 memcpy(val_ref.compact_form, val->elems, 64);
23795 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
23798 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_range(uint32_t this_ptr) {
23799 LDKClosingSigned this_ptr_conv;
23800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23801 this_ptr_conv.is_owned = false;
23802 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23803 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
23804 uint64_t ret_ref = 0;
23805 if ((uint64_t)ret_var.inner > 4096) {
23806 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23807 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23808 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23809 ret_ref = (uint64_t)ret_var.inner;
23810 if (ret_var.is_owned) {
23817 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_range(uint32_t this_ptr, uint32_t val) {
23818 LDKClosingSigned this_ptr_conv;
23819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23820 this_ptr_conv.is_owned = false;
23821 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23822 LDKClosingSignedFeeRange val_conv;
23823 val_conv.inner = (void*)(val & (~1));
23824 val_conv.is_owned = (val & 1) || (val == 0);
23825 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23826 val_conv = ClosingSignedFeeRange_clone(&val_conv);
23827 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
23830 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) {
23831 LDKThirtyTwoBytes channel_id_arg_ref;
23832 CHECK(channel_id_arg->arr_len == 32);
23833 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
23834 LDKSignature signature_arg_ref;
23835 CHECK(signature_arg->arr_len == 64);
23836 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64);
23837 LDKClosingSignedFeeRange fee_range_arg_conv;
23838 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
23839 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
23840 CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
23841 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
23842 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
23843 uint64_t ret_ref = 0;
23844 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23845 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23846 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23847 ret_ref = (uint64_t)ret_var.inner;
23848 if (ret_var.is_owned) {
23854 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
23855 LDKClosingSigned ret_var = ClosingSigned_clone(arg);
23856 uint64_t ret_ref = 0;
23857 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23858 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23859 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23860 ret_ref = (uint64_t)ret_var.inner;
23861 if (ret_var.is_owned) {
23866 int64_t __attribute__((visibility("default"))) TS_ClosingSigned_clone_ptr(uint32_t arg) {
23867 LDKClosingSigned arg_conv;
23868 arg_conv.inner = (void*)(arg & (~1));
23869 arg_conv.is_owned = false;
23870 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23871 int64_t ret_val = ClosingSigned_clone_ptr(&arg_conv);
23875 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_clone(uint32_t orig) {
23876 LDKClosingSigned orig_conv;
23877 orig_conv.inner = (void*)(orig & (~1));
23878 orig_conv.is_owned = false;
23879 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23880 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
23881 uint64_t ret_ref = 0;
23882 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23883 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23884 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23885 ret_ref = (uint64_t)ret_var.inner;
23886 if (ret_var.is_owned) {
23892 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_free(uint32_t this_obj) {
23893 LDKUpdateAddHTLC this_obj_conv;
23894 this_obj_conv.inner = (void*)(this_obj & (~1));
23895 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23896 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23897 UpdateAddHTLC_free(this_obj_conv);
23900 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_channel_id(uint32_t this_ptr) {
23901 LDKUpdateAddHTLC this_ptr_conv;
23902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23903 this_ptr_conv.is_owned = false;
23904 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23905 int8_tArray ret_arr = init_int8_tArray(32);
23906 memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
23910 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
23911 LDKUpdateAddHTLC this_ptr_conv;
23912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23913 this_ptr_conv.is_owned = false;
23914 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23915 LDKThirtyTwoBytes val_ref;
23916 CHECK(val->arr_len == 32);
23917 memcpy(val_ref.data, val->elems, 32);
23918 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
23921 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_htlc_id(uint32_t this_ptr) {
23922 LDKUpdateAddHTLC this_ptr_conv;
23923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23924 this_ptr_conv.is_owned = false;
23925 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23926 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
23930 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
23931 LDKUpdateAddHTLC this_ptr_conv;
23932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23933 this_ptr_conv.is_owned = false;
23934 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23935 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
23938 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_amount_msat(uint32_t this_ptr) {
23939 LDKUpdateAddHTLC this_ptr_conv;
23940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23941 this_ptr_conv.is_owned = false;
23942 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23943 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
23947 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_amount_msat(uint32_t this_ptr, int64_t val) {
23948 LDKUpdateAddHTLC this_ptr_conv;
23949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23950 this_ptr_conv.is_owned = false;
23951 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23952 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
23955 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_payment_hash(uint32_t this_ptr) {
23956 LDKUpdateAddHTLC this_ptr_conv;
23957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23958 this_ptr_conv.is_owned = false;
23959 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23960 int8_tArray ret_arr = init_int8_tArray(32);
23961 memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
23965 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
23966 LDKUpdateAddHTLC this_ptr_conv;
23967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23968 this_ptr_conv.is_owned = false;
23969 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23970 LDKThirtyTwoBytes val_ref;
23971 CHECK(val->arr_len == 32);
23972 memcpy(val_ref.data, val->elems, 32);
23973 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
23976 int32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_cltv_expiry(uint32_t this_ptr) {
23977 LDKUpdateAddHTLC this_ptr_conv;
23978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23979 this_ptr_conv.is_owned = false;
23980 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23981 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
23985 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
23986 LDKUpdateAddHTLC this_ptr_conv;
23987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23988 this_ptr_conv.is_owned = false;
23989 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23990 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
23993 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
23994 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
23995 uint64_t ret_ref = 0;
23996 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23997 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23998 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23999 ret_ref = (uint64_t)ret_var.inner;
24000 if (ret_var.is_owned) {
24005 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_clone_ptr(uint32_t arg) {
24006 LDKUpdateAddHTLC arg_conv;
24007 arg_conv.inner = (void*)(arg & (~1));
24008 arg_conv.is_owned = false;
24009 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24010 int64_t ret_val = UpdateAddHTLC_clone_ptr(&arg_conv);
24014 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_clone(uint32_t orig) {
24015 LDKUpdateAddHTLC orig_conv;
24016 orig_conv.inner = (void*)(orig & (~1));
24017 orig_conv.is_owned = false;
24018 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24019 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
24020 uint64_t ret_ref = 0;
24021 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24022 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24023 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24024 ret_ref = (uint64_t)ret_var.inner;
24025 if (ret_var.is_owned) {
24031 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_free(uint32_t this_obj) {
24032 LDKUpdateFulfillHTLC this_obj_conv;
24033 this_obj_conv.inner = (void*)(this_obj & (~1));
24034 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24035 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24036 UpdateFulfillHTLC_free(this_obj_conv);
24039 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_channel_id(uint32_t this_ptr) {
24040 LDKUpdateFulfillHTLC this_ptr_conv;
24041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24042 this_ptr_conv.is_owned = false;
24043 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24044 int8_tArray ret_arr = init_int8_tArray(32);
24045 memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
24049 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24050 LDKUpdateFulfillHTLC this_ptr_conv;
24051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24052 this_ptr_conv.is_owned = false;
24053 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24054 LDKThirtyTwoBytes val_ref;
24055 CHECK(val->arr_len == 32);
24056 memcpy(val_ref.data, val->elems, 32);
24057 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
24060 int64_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_htlc_id(uint32_t this_ptr) {
24061 LDKUpdateFulfillHTLC this_ptr_conv;
24062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24063 this_ptr_conv.is_owned = false;
24064 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24065 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
24069 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
24070 LDKUpdateFulfillHTLC this_ptr_conv;
24071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24072 this_ptr_conv.is_owned = false;
24073 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24074 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
24077 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint32_t this_ptr) {
24078 LDKUpdateFulfillHTLC this_ptr_conv;
24079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24080 this_ptr_conv.is_owned = false;
24081 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24082 int8_tArray ret_arr = init_int8_tArray(32);
24083 memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
24087 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint32_t this_ptr, int8_tArray val) {
24088 LDKUpdateFulfillHTLC this_ptr_conv;
24089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24090 this_ptr_conv.is_owned = false;
24091 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24092 LDKThirtyTwoBytes val_ref;
24093 CHECK(val->arr_len == 32);
24094 memcpy(val_ref.data, val->elems, 32);
24095 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
24098 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_new(int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
24099 LDKThirtyTwoBytes channel_id_arg_ref;
24100 CHECK(channel_id_arg->arr_len == 32);
24101 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
24102 LDKThirtyTwoBytes payment_preimage_arg_ref;
24103 CHECK(payment_preimage_arg->arr_len == 32);
24104 memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32);
24105 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
24106 uint64_t ret_ref = 0;
24107 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24108 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24109 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24110 ret_ref = (uint64_t)ret_var.inner;
24111 if (ret_var.is_owned) {
24117 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
24118 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
24119 uint64_t ret_ref = 0;
24120 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24121 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24122 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24123 ret_ref = (uint64_t)ret_var.inner;
24124 if (ret_var.is_owned) {
24129 int64_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_clone_ptr(uint32_t arg) {
24130 LDKUpdateFulfillHTLC arg_conv;
24131 arg_conv.inner = (void*)(arg & (~1));
24132 arg_conv.is_owned = false;
24133 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24134 int64_t ret_val = UpdateFulfillHTLC_clone_ptr(&arg_conv);
24138 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_clone(uint32_t orig) {
24139 LDKUpdateFulfillHTLC orig_conv;
24140 orig_conv.inner = (void*)(orig & (~1));
24141 orig_conv.is_owned = false;
24142 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24143 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
24144 uint64_t ret_ref = 0;
24145 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24146 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24147 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24148 ret_ref = (uint64_t)ret_var.inner;
24149 if (ret_var.is_owned) {
24155 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_free(uint32_t this_obj) {
24156 LDKUpdateFailHTLC this_obj_conv;
24157 this_obj_conv.inner = (void*)(this_obj & (~1));
24158 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24159 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24160 UpdateFailHTLC_free(this_obj_conv);
24163 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_channel_id(uint32_t this_ptr) {
24164 LDKUpdateFailHTLC this_ptr_conv;
24165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24166 this_ptr_conv.is_owned = false;
24167 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24168 int8_tArray ret_arr = init_int8_tArray(32);
24169 memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
24173 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24174 LDKUpdateFailHTLC this_ptr_conv;
24175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24176 this_ptr_conv.is_owned = false;
24177 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24178 LDKThirtyTwoBytes val_ref;
24179 CHECK(val->arr_len == 32);
24180 memcpy(val_ref.data, val->elems, 32);
24181 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
24184 int64_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_htlc_id(uint32_t this_ptr) {
24185 LDKUpdateFailHTLC this_ptr_conv;
24186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24187 this_ptr_conv.is_owned = false;
24188 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24189 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
24193 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
24194 LDKUpdateFailHTLC this_ptr_conv;
24195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24196 this_ptr_conv.is_owned = false;
24197 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24198 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
24201 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
24202 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
24203 uint64_t ret_ref = 0;
24204 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24205 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24206 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24207 ret_ref = (uint64_t)ret_var.inner;
24208 if (ret_var.is_owned) {
24213 int64_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_clone_ptr(uint32_t arg) {
24214 LDKUpdateFailHTLC arg_conv;
24215 arg_conv.inner = (void*)(arg & (~1));
24216 arg_conv.is_owned = false;
24217 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24218 int64_t ret_val = UpdateFailHTLC_clone_ptr(&arg_conv);
24222 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_clone(uint32_t orig) {
24223 LDKUpdateFailHTLC orig_conv;
24224 orig_conv.inner = (void*)(orig & (~1));
24225 orig_conv.is_owned = false;
24226 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24227 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
24228 uint64_t ret_ref = 0;
24229 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24230 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24231 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24232 ret_ref = (uint64_t)ret_var.inner;
24233 if (ret_var.is_owned) {
24239 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_free(uint32_t this_obj) {
24240 LDKUpdateFailMalformedHTLC this_obj_conv;
24241 this_obj_conv.inner = (void*)(this_obj & (~1));
24242 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24243 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24244 UpdateFailMalformedHTLC_free(this_obj_conv);
24247 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint32_t this_ptr) {
24248 LDKUpdateFailMalformedHTLC this_ptr_conv;
24249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24250 this_ptr_conv.is_owned = false;
24251 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24252 int8_tArray ret_arr = init_int8_tArray(32);
24253 memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
24257 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24258 LDKUpdateFailMalformedHTLC this_ptr_conv;
24259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24260 this_ptr_conv.is_owned = false;
24261 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24262 LDKThirtyTwoBytes val_ref;
24263 CHECK(val->arr_len == 32);
24264 memcpy(val_ref.data, val->elems, 32);
24265 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
24268 int64_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint32_t this_ptr) {
24269 LDKUpdateFailMalformedHTLC this_ptr_conv;
24270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24271 this_ptr_conv.is_owned = false;
24272 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24273 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
24277 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
24278 LDKUpdateFailMalformedHTLC this_ptr_conv;
24279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24280 this_ptr_conv.is_owned = false;
24281 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24282 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
24285 int16_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint32_t this_ptr) {
24286 LDKUpdateFailMalformedHTLC this_ptr_conv;
24287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24288 this_ptr_conv.is_owned = false;
24289 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24290 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
24294 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint32_t this_ptr, int16_t val) {
24295 LDKUpdateFailMalformedHTLC this_ptr_conv;
24296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24297 this_ptr_conv.is_owned = false;
24298 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24299 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
24302 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
24303 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
24304 uint64_t ret_ref = 0;
24305 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24306 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24307 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24308 ret_ref = (uint64_t)ret_var.inner;
24309 if (ret_var.is_owned) {
24314 int64_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint32_t arg) {
24315 LDKUpdateFailMalformedHTLC arg_conv;
24316 arg_conv.inner = (void*)(arg & (~1));
24317 arg_conv.is_owned = false;
24318 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24319 int64_t ret_val = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
24323 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_clone(uint32_t orig) {
24324 LDKUpdateFailMalformedHTLC orig_conv;
24325 orig_conv.inner = (void*)(orig & (~1));
24326 orig_conv.is_owned = false;
24327 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24328 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
24329 uint64_t ret_ref = 0;
24330 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24331 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24332 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24333 ret_ref = (uint64_t)ret_var.inner;
24334 if (ret_var.is_owned) {
24340 void __attribute__((visibility("default"))) TS_CommitmentSigned_free(uint32_t this_obj) {
24341 LDKCommitmentSigned this_obj_conv;
24342 this_obj_conv.inner = (void*)(this_obj & (~1));
24343 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24344 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24345 CommitmentSigned_free(this_obj_conv);
24348 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_channel_id(uint32_t this_ptr) {
24349 LDKCommitmentSigned this_ptr_conv;
24350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24351 this_ptr_conv.is_owned = false;
24352 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24353 int8_tArray ret_arr = init_int8_tArray(32);
24354 memcpy(ret_arr->elems, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
24358 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24359 LDKCommitmentSigned this_ptr_conv;
24360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24361 this_ptr_conv.is_owned = false;
24362 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24363 LDKThirtyTwoBytes val_ref;
24364 CHECK(val->arr_len == 32);
24365 memcpy(val_ref.data, val->elems, 32);
24366 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
24369 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_signature(uint32_t this_ptr) {
24370 LDKCommitmentSigned this_ptr_conv;
24371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24372 this_ptr_conv.is_owned = false;
24373 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24374 int8_tArray ret_arr = init_int8_tArray(64);
24375 memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
24379 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
24380 LDKCommitmentSigned this_ptr_conv;
24381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24382 this_ptr_conv.is_owned = false;
24383 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24384 LDKSignature val_ref;
24385 CHECK(val->arr_len == 64);
24386 memcpy(val_ref.compact_form, val->elems, 64);
24387 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
24390 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_htlc_signatures(uint32_t this_ptr, ptrArray val) {
24391 LDKCommitmentSigned this_ptr_conv;
24392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24393 this_ptr_conv.is_owned = false;
24394 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24395 LDKCVec_SignatureZ val_constr;
24396 val_constr.datalen = val->arr_len;
24397 if (val_constr.datalen > 0)
24398 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
24400 val_constr.data = NULL;
24401 int8_tArray* val_vals = (void*) val->elems;
24402 for (size_t m = 0; m < val_constr.datalen; m++) {
24403 int8_tArray val_conv_12 = val_vals[m];
24404 LDKSignature val_conv_12_ref;
24405 CHECK(val_conv_12->arr_len == 64);
24406 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64);
24407 val_constr.data[m] = val_conv_12_ref;
24409 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
24412 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
24413 LDKThirtyTwoBytes channel_id_arg_ref;
24414 CHECK(channel_id_arg->arr_len == 32);
24415 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
24416 LDKSignature signature_arg_ref;
24417 CHECK(signature_arg->arr_len == 64);
24418 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64);
24419 LDKCVec_SignatureZ htlc_signatures_arg_constr;
24420 htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
24421 if (htlc_signatures_arg_constr.datalen > 0)
24422 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
24424 htlc_signatures_arg_constr.data = NULL;
24425 int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
24426 for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
24427 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
24428 LDKSignature htlc_signatures_arg_conv_12_ref;
24429 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
24430 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64);
24431 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
24433 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
24434 uint64_t ret_ref = 0;
24435 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24436 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24437 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24438 ret_ref = (uint64_t)ret_var.inner;
24439 if (ret_var.is_owned) {
24445 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
24446 LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
24447 uint64_t ret_ref = 0;
24448 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24449 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24450 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24451 ret_ref = (uint64_t)ret_var.inner;
24452 if (ret_var.is_owned) {
24457 int64_t __attribute__((visibility("default"))) TS_CommitmentSigned_clone_ptr(uint32_t arg) {
24458 LDKCommitmentSigned arg_conv;
24459 arg_conv.inner = (void*)(arg & (~1));
24460 arg_conv.is_owned = false;
24461 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24462 int64_t ret_val = CommitmentSigned_clone_ptr(&arg_conv);
24466 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_clone(uint32_t orig) {
24467 LDKCommitmentSigned orig_conv;
24468 orig_conv.inner = (void*)(orig & (~1));
24469 orig_conv.is_owned = false;
24470 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24471 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
24472 uint64_t ret_ref = 0;
24473 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24474 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24475 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24476 ret_ref = (uint64_t)ret_var.inner;
24477 if (ret_var.is_owned) {
24483 void __attribute__((visibility("default"))) TS_RevokeAndACK_free(uint32_t this_obj) {
24484 LDKRevokeAndACK this_obj_conv;
24485 this_obj_conv.inner = (void*)(this_obj & (~1));
24486 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24487 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24488 RevokeAndACK_free(this_obj_conv);
24491 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_channel_id(uint32_t this_ptr) {
24492 LDKRevokeAndACK this_ptr_conv;
24493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24494 this_ptr_conv.is_owned = false;
24495 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24496 int8_tArray ret_arr = init_int8_tArray(32);
24497 memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
24501 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24502 LDKRevokeAndACK this_ptr_conv;
24503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24504 this_ptr_conv.is_owned = false;
24505 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24506 LDKThirtyTwoBytes val_ref;
24507 CHECK(val->arr_len == 32);
24508 memcpy(val_ref.data, val->elems, 32);
24509 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
24512 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_per_commitment_secret(uint32_t this_ptr) {
24513 LDKRevokeAndACK this_ptr_conv;
24514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24515 this_ptr_conv.is_owned = false;
24516 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24517 int8_tArray ret_arr = init_int8_tArray(32);
24518 memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
24522 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
24523 LDKRevokeAndACK this_ptr_conv;
24524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24525 this_ptr_conv.is_owned = false;
24526 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24527 LDKThirtyTwoBytes val_ref;
24528 CHECK(val->arr_len == 32);
24529 memcpy(val_ref.data, val->elems, 32);
24530 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
24533 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_next_per_commitment_point(uint32_t this_ptr) {
24534 LDKRevokeAndACK this_ptr_conv;
24535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24536 this_ptr_conv.is_owned = false;
24537 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24538 int8_tArray ret_arr = init_int8_tArray(33);
24539 memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
24543 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
24544 LDKRevokeAndACK this_ptr_conv;
24545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24546 this_ptr_conv.is_owned = false;
24547 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24548 LDKPublicKey val_ref;
24549 CHECK(val->arr_len == 33);
24550 memcpy(val_ref.compressed_form, val->elems, 33);
24551 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
24554 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) {
24555 LDKThirtyTwoBytes channel_id_arg_ref;
24556 CHECK(channel_id_arg->arr_len == 32);
24557 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
24558 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
24559 CHECK(per_commitment_secret_arg->arr_len == 32);
24560 memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32);
24561 LDKPublicKey next_per_commitment_point_arg_ref;
24562 CHECK(next_per_commitment_point_arg->arr_len == 33);
24563 memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33);
24564 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
24565 uint64_t ret_ref = 0;
24566 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24567 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24568 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24569 ret_ref = (uint64_t)ret_var.inner;
24570 if (ret_var.is_owned) {
24576 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
24577 LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
24578 uint64_t ret_ref = 0;
24579 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24580 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24581 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24582 ret_ref = (uint64_t)ret_var.inner;
24583 if (ret_var.is_owned) {
24588 int64_t __attribute__((visibility("default"))) TS_RevokeAndACK_clone_ptr(uint32_t arg) {
24589 LDKRevokeAndACK arg_conv;
24590 arg_conv.inner = (void*)(arg & (~1));
24591 arg_conv.is_owned = false;
24592 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24593 int64_t ret_val = RevokeAndACK_clone_ptr(&arg_conv);
24597 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_clone(uint32_t orig) {
24598 LDKRevokeAndACK orig_conv;
24599 orig_conv.inner = (void*)(orig & (~1));
24600 orig_conv.is_owned = false;
24601 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24602 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
24603 uint64_t ret_ref = 0;
24604 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24605 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24606 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24607 ret_ref = (uint64_t)ret_var.inner;
24608 if (ret_var.is_owned) {
24614 void __attribute__((visibility("default"))) TS_UpdateFee_free(uint32_t this_obj) {
24615 LDKUpdateFee this_obj_conv;
24616 this_obj_conv.inner = (void*)(this_obj & (~1));
24617 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24618 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24619 UpdateFee_free(this_obj_conv);
24622 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_get_channel_id(uint32_t this_ptr) {
24623 LDKUpdateFee this_ptr_conv;
24624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24625 this_ptr_conv.is_owned = false;
24626 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24627 int8_tArray ret_arr = init_int8_tArray(32);
24628 memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
24632 void __attribute__((visibility("default"))) TS_UpdateFee_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24633 LDKUpdateFee this_ptr_conv;
24634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24635 this_ptr_conv.is_owned = false;
24636 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24637 LDKThirtyTwoBytes val_ref;
24638 CHECK(val->arr_len == 32);
24639 memcpy(val_ref.data, val->elems, 32);
24640 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
24643 int32_t __attribute__((visibility("default"))) TS_UpdateFee_get_feerate_per_kw(uint32_t this_ptr) {
24644 LDKUpdateFee this_ptr_conv;
24645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24646 this_ptr_conv.is_owned = false;
24647 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24648 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
24652 void __attribute__((visibility("default"))) TS_UpdateFee_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
24653 LDKUpdateFee this_ptr_conv;
24654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24655 this_ptr_conv.is_owned = false;
24656 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24657 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
24660 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
24661 LDKThirtyTwoBytes channel_id_arg_ref;
24662 CHECK(channel_id_arg->arr_len == 32);
24663 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
24664 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
24665 uint64_t ret_ref = 0;
24666 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24667 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24668 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24669 ret_ref = (uint64_t)ret_var.inner;
24670 if (ret_var.is_owned) {
24676 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
24677 LDKUpdateFee ret_var = UpdateFee_clone(arg);
24678 uint64_t ret_ref = 0;
24679 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24680 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24681 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24682 ret_ref = (uint64_t)ret_var.inner;
24683 if (ret_var.is_owned) {
24688 int64_t __attribute__((visibility("default"))) TS_UpdateFee_clone_ptr(uint32_t arg) {
24689 LDKUpdateFee arg_conv;
24690 arg_conv.inner = (void*)(arg & (~1));
24691 arg_conv.is_owned = false;
24692 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24693 int64_t ret_val = UpdateFee_clone_ptr(&arg_conv);
24697 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_clone(uint32_t orig) {
24698 LDKUpdateFee orig_conv;
24699 orig_conv.inner = (void*)(orig & (~1));
24700 orig_conv.is_owned = false;
24701 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24702 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
24703 uint64_t ret_ref = 0;
24704 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24705 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24706 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24707 ret_ref = (uint64_t)ret_var.inner;
24708 if (ret_var.is_owned) {
24714 void __attribute__((visibility("default"))) TS_DataLossProtect_free(uint32_t this_obj) {
24715 LDKDataLossProtect this_obj_conv;
24716 this_obj_conv.inner = (void*)(this_obj & (~1));
24717 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24718 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24719 DataLossProtect_free(this_obj_conv);
24722 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_your_last_per_commitment_secret(uint32_t this_ptr) {
24723 LDKDataLossProtect this_ptr_conv;
24724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24725 this_ptr_conv.is_owned = false;
24726 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24727 int8_tArray ret_arr = init_int8_tArray(32);
24728 memcpy(ret_arr->elems, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
24732 void __attribute__((visibility("default"))) TS_DataLossProtect_set_your_last_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
24733 LDKDataLossProtect this_ptr_conv;
24734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24735 this_ptr_conv.is_owned = false;
24736 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24737 LDKThirtyTwoBytes val_ref;
24738 CHECK(val->arr_len == 32);
24739 memcpy(val_ref.data, val->elems, 32);
24740 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
24743 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_my_current_per_commitment_point(uint32_t this_ptr) {
24744 LDKDataLossProtect this_ptr_conv;
24745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24746 this_ptr_conv.is_owned = false;
24747 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24748 int8_tArray ret_arr = init_int8_tArray(33);
24749 memcpy(ret_arr->elems, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
24753 void __attribute__((visibility("default"))) TS_DataLossProtect_set_my_current_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
24754 LDKDataLossProtect this_ptr_conv;
24755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24756 this_ptr_conv.is_owned = false;
24757 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24758 LDKPublicKey val_ref;
24759 CHECK(val->arr_len == 33);
24760 memcpy(val_ref.compressed_form, val->elems, 33);
24761 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
24764 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_new(int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
24765 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
24766 CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
24767 memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32);
24768 LDKPublicKey my_current_per_commitment_point_arg_ref;
24769 CHECK(my_current_per_commitment_point_arg->arr_len == 33);
24770 memcpy(my_current_per_commitment_point_arg_ref.compressed_form, my_current_per_commitment_point_arg->elems, 33);
24771 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
24772 uint64_t ret_ref = 0;
24773 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24774 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24775 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24776 ret_ref = (uint64_t)ret_var.inner;
24777 if (ret_var.is_owned) {
24783 static inline uint64_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
24784 LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
24785 uint64_t ret_ref = 0;
24786 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24787 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24788 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24789 ret_ref = (uint64_t)ret_var.inner;
24790 if (ret_var.is_owned) {
24795 int64_t __attribute__((visibility("default"))) TS_DataLossProtect_clone_ptr(uint32_t arg) {
24796 LDKDataLossProtect arg_conv;
24797 arg_conv.inner = (void*)(arg & (~1));
24798 arg_conv.is_owned = false;
24799 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24800 int64_t ret_val = DataLossProtect_clone_ptr(&arg_conv);
24804 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_clone(uint32_t orig) {
24805 LDKDataLossProtect orig_conv;
24806 orig_conv.inner = (void*)(orig & (~1));
24807 orig_conv.is_owned = false;
24808 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24809 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
24810 uint64_t ret_ref = 0;
24811 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24812 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24813 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24814 ret_ref = (uint64_t)ret_var.inner;
24815 if (ret_var.is_owned) {
24821 void __attribute__((visibility("default"))) TS_ChannelReestablish_free(uint32_t this_obj) {
24822 LDKChannelReestablish this_obj_conv;
24823 this_obj_conv.inner = (void*)(this_obj & (~1));
24824 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24825 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24826 ChannelReestablish_free(this_obj_conv);
24829 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_get_channel_id(uint32_t this_ptr) {
24830 LDKChannelReestablish this_ptr_conv;
24831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24832 this_ptr_conv.is_owned = false;
24833 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24834 int8_tArray ret_arr = init_int8_tArray(32);
24835 memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
24839 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24840 LDKChannelReestablish this_ptr_conv;
24841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24842 this_ptr_conv.is_owned = false;
24843 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24844 LDKThirtyTwoBytes val_ref;
24845 CHECK(val->arr_len == 32);
24846 memcpy(val_ref.data, val->elems, 32);
24847 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
24850 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_local_commitment_number(uint32_t this_ptr) {
24851 LDKChannelReestablish this_ptr_conv;
24852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24853 this_ptr_conv.is_owned = false;
24854 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24855 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
24859 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_local_commitment_number(uint32_t this_ptr, int64_t val) {
24860 LDKChannelReestablish this_ptr_conv;
24861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24862 this_ptr_conv.is_owned = false;
24863 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24864 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
24867 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint32_t this_ptr) {
24868 LDKChannelReestablish this_ptr_conv;
24869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24870 this_ptr_conv.is_owned = false;
24871 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24872 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
24876 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_remote_commitment_number(uint32_t this_ptr, int64_t val) {
24877 LDKChannelReestablish this_ptr_conv;
24878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24879 this_ptr_conv.is_owned = false;
24880 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24881 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
24884 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
24885 LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
24886 uint64_t ret_ref = 0;
24887 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24888 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24889 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24890 ret_ref = (uint64_t)ret_var.inner;
24891 if (ret_var.is_owned) {
24896 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_clone_ptr(uint32_t arg) {
24897 LDKChannelReestablish arg_conv;
24898 arg_conv.inner = (void*)(arg & (~1));
24899 arg_conv.is_owned = false;
24900 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24901 int64_t ret_val = ChannelReestablish_clone_ptr(&arg_conv);
24905 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_clone(uint32_t orig) {
24906 LDKChannelReestablish orig_conv;
24907 orig_conv.inner = (void*)(orig & (~1));
24908 orig_conv.is_owned = false;
24909 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24910 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
24911 uint64_t ret_ref = 0;
24912 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24913 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24914 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24915 ret_ref = (uint64_t)ret_var.inner;
24916 if (ret_var.is_owned) {
24922 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_free(uint32_t this_obj) {
24923 LDKAnnouncementSignatures this_obj_conv;
24924 this_obj_conv.inner = (void*)(this_obj & (~1));
24925 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24926 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24927 AnnouncementSignatures_free(this_obj_conv);
24930 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_channel_id(uint32_t this_ptr) {
24931 LDKAnnouncementSignatures this_ptr_conv;
24932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24933 this_ptr_conv.is_owned = false;
24934 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24935 int8_tArray ret_arr = init_int8_tArray(32);
24936 memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
24940 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24941 LDKAnnouncementSignatures this_ptr_conv;
24942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24943 this_ptr_conv.is_owned = false;
24944 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24945 LDKThirtyTwoBytes val_ref;
24946 CHECK(val->arr_len == 32);
24947 memcpy(val_ref.data, val->elems, 32);
24948 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
24951 int64_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_short_channel_id(uint32_t this_ptr) {
24952 LDKAnnouncementSignatures this_ptr_conv;
24953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24954 this_ptr_conv.is_owned = false;
24955 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24956 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
24960 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_short_channel_id(uint32_t this_ptr, int64_t val) {
24961 LDKAnnouncementSignatures this_ptr_conv;
24962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24963 this_ptr_conv.is_owned = false;
24964 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24965 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
24968 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_node_signature(uint32_t this_ptr) {
24969 LDKAnnouncementSignatures this_ptr_conv;
24970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24971 this_ptr_conv.is_owned = false;
24972 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24973 int8_tArray ret_arr = init_int8_tArray(64);
24974 memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
24978 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_node_signature(uint32_t this_ptr, int8_tArray val) {
24979 LDKAnnouncementSignatures this_ptr_conv;
24980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24981 this_ptr_conv.is_owned = false;
24982 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24983 LDKSignature val_ref;
24984 CHECK(val->arr_len == 64);
24985 memcpy(val_ref.compact_form, val->elems, 64);
24986 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
24989 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint32_t this_ptr) {
24990 LDKAnnouncementSignatures this_ptr_conv;
24991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24992 this_ptr_conv.is_owned = false;
24993 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24994 int8_tArray ret_arr = init_int8_tArray(64);
24995 memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
24999 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint32_t this_ptr, int8_tArray val) {
25000 LDKAnnouncementSignatures this_ptr_conv;
25001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25002 this_ptr_conv.is_owned = false;
25003 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25004 LDKSignature val_ref;
25005 CHECK(val->arr_len == 64);
25006 memcpy(val_ref.compact_form, val->elems, 64);
25007 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
25010 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) {
25011 LDKThirtyTwoBytes channel_id_arg_ref;
25012 CHECK(channel_id_arg->arr_len == 32);
25013 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32);
25014 LDKSignature node_signature_arg_ref;
25015 CHECK(node_signature_arg->arr_len == 64);
25016 memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64);
25017 LDKSignature bitcoin_signature_arg_ref;
25018 CHECK(bitcoin_signature_arg->arr_len == 64);
25019 memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64);
25020 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
25021 uint64_t ret_ref = 0;
25022 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25023 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25024 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25025 ret_ref = (uint64_t)ret_var.inner;
25026 if (ret_var.is_owned) {
25032 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
25033 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
25034 uint64_t ret_ref = 0;
25035 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25036 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25037 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25038 ret_ref = (uint64_t)ret_var.inner;
25039 if (ret_var.is_owned) {
25044 int64_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_clone_ptr(uint32_t arg) {
25045 LDKAnnouncementSignatures arg_conv;
25046 arg_conv.inner = (void*)(arg & (~1));
25047 arg_conv.is_owned = false;
25048 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25049 int64_t ret_val = AnnouncementSignatures_clone_ptr(&arg_conv);
25053 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_clone(uint32_t orig) {
25054 LDKAnnouncementSignatures orig_conv;
25055 orig_conv.inner = (void*)(orig & (~1));
25056 orig_conv.is_owned = false;
25057 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25058 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
25059 uint64_t ret_ref = 0;
25060 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25061 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25062 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25063 ret_ref = (uint64_t)ret_var.inner;
25064 if (ret_var.is_owned) {
25070 void __attribute__((visibility("default"))) TS_NetAddress_free(uint32_t this_ptr) {
25071 if ((this_ptr & 1) != 0) return;
25072 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
25073 CHECK_ACCESS(this_ptr_ptr);
25074 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
25075 FREE((void*)this_ptr);
25076 NetAddress_free(this_ptr_conv);
25079 static inline uint64_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
25080 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
25081 *ret_copy = NetAddress_clone(arg);
25082 uint64_t ret_ref = (uint64_t)ret_copy;
25085 int64_t __attribute__((visibility("default"))) TS_NetAddress_clone_ptr(uint32_t arg) {
25086 LDKNetAddress* arg_conv = (LDKNetAddress*)arg;
25087 int64_t ret_val = NetAddress_clone_ptr(arg_conv);
25091 uint32_t __attribute__((visibility("default"))) TS_NetAddress_clone(uint32_t orig) {
25092 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
25093 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
25094 *ret_copy = NetAddress_clone(orig_conv);
25095 uint64_t ret_ref = (uint64_t)ret_copy;
25099 uint32_t __attribute__((visibility("default"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
25100 LDKFourBytes addr_ref;
25101 CHECK(addr->arr_len == 4);
25102 memcpy(addr_ref.data, addr->elems, 4);
25103 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
25104 *ret_copy = NetAddress_ipv4(addr_ref, port);
25105 uint64_t ret_ref = (uint64_t)ret_copy;
25109 uint32_t __attribute__((visibility("default"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
25110 LDKSixteenBytes addr_ref;
25111 CHECK(addr->arr_len == 16);
25112 memcpy(addr_ref.data, addr->elems, 16);
25113 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
25114 *ret_copy = NetAddress_ipv6(addr_ref, port);
25115 uint64_t ret_ref = (uint64_t)ret_copy;
25119 uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v2(int8_tArray a) {
25120 LDKTwelveBytes a_ref;
25121 CHECK(a->arr_len == 12);
25122 memcpy(a_ref.data, a->elems, 12);
25123 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
25124 *ret_copy = NetAddress_onion_v2(a_ref);
25125 uint64_t ret_ref = (uint64_t)ret_copy;
25129 uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v3(int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
25130 LDKThirtyTwoBytes ed25519_pubkey_ref;
25131 CHECK(ed25519_pubkey->arr_len == 32);
25132 memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32);
25133 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
25134 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
25135 uint64_t ret_ref = (uint64_t)ret_copy;
25139 int8_tArray __attribute__((visibility("default"))) TS_NetAddress_write(uint32_t obj) {
25140 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
25141 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
25142 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
25143 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25144 CVec_u8Z_free(ret_var);
25148 uint32_t __attribute__((visibility("default"))) TS_NetAddress_read(int8_tArray ser) {
25149 LDKu8slice ser_ref;
25150 ser_ref.datalen = ser->arr_len;
25151 ser_ref.data = ser->elems;
25152 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
25153 *ret_conv = NetAddress_read(ser_ref);
25154 return (uint64_t)ret_conv;
25157 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_free(uint32_t this_obj) {
25158 LDKUnsignedNodeAnnouncement this_obj_conv;
25159 this_obj_conv.inner = (void*)(this_obj & (~1));
25160 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25161 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25162 UnsignedNodeAnnouncement_free(this_obj_conv);
25165 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_features(uint32_t this_ptr) {
25166 LDKUnsignedNodeAnnouncement this_ptr_conv;
25167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25168 this_ptr_conv.is_owned = false;
25169 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25170 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
25171 uint64_t ret_ref = 0;
25172 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25173 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25174 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25175 ret_ref = (uint64_t)ret_var.inner;
25176 if (ret_var.is_owned) {
25182 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
25183 LDKUnsignedNodeAnnouncement this_ptr_conv;
25184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25185 this_ptr_conv.is_owned = false;
25186 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25187 LDKNodeFeatures val_conv;
25188 val_conv.inner = (void*)(val & (~1));
25189 val_conv.is_owned = (val & 1) || (val == 0);
25190 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25191 val_conv = NodeFeatures_clone(&val_conv);
25192 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
25195 int32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint32_t this_ptr) {
25196 LDKUnsignedNodeAnnouncement this_ptr_conv;
25197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25198 this_ptr_conv.is_owned = false;
25199 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25200 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
25204 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint32_t this_ptr, int32_t val) {
25205 LDKUnsignedNodeAnnouncement this_ptr_conv;
25206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25207 this_ptr_conv.is_owned = false;
25208 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25209 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
25212 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_node_id(uint32_t this_ptr) {
25213 LDKUnsignedNodeAnnouncement this_ptr_conv;
25214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25215 this_ptr_conv.is_owned = false;
25216 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25217 int8_tArray ret_arr = init_int8_tArray(33);
25218 memcpy(ret_arr->elems, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
25222 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_node_id(uint32_t this_ptr, int8_tArray val) {
25223 LDKUnsignedNodeAnnouncement this_ptr_conv;
25224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25225 this_ptr_conv.is_owned = false;
25226 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25227 LDKPublicKey val_ref;
25228 CHECK(val->arr_len == 33);
25229 memcpy(val_ref.compressed_form, val->elems, 33);
25230 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
25233 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_rgb(uint32_t this_ptr) {
25234 LDKUnsignedNodeAnnouncement this_ptr_conv;
25235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25236 this_ptr_conv.is_owned = false;
25237 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25238 int8_tArray ret_arr = init_int8_tArray(3);
25239 memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
25243 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_rgb(uint32_t this_ptr, int8_tArray val) {
25244 LDKUnsignedNodeAnnouncement this_ptr_conv;
25245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25246 this_ptr_conv.is_owned = false;
25247 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25248 LDKThreeBytes val_ref;
25249 CHECK(val->arr_len == 3);
25250 memcpy(val_ref.data, val->elems, 3);
25251 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
25254 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_alias(uint32_t this_ptr) {
25255 LDKUnsignedNodeAnnouncement this_ptr_conv;
25256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25257 this_ptr_conv.is_owned = false;
25258 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25259 int8_tArray ret_arr = init_int8_tArray(32);
25260 memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
25264 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_alias(uint32_t this_ptr, int8_tArray val) {
25265 LDKUnsignedNodeAnnouncement this_ptr_conv;
25266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25267 this_ptr_conv.is_owned = false;
25268 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25269 LDKThirtyTwoBytes val_ref;
25270 CHECK(val->arr_len == 32);
25271 memcpy(val_ref.data, val->elems, 32);
25272 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
25275 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_addresses(uint32_t this_ptr, uint32_tArray val) {
25276 LDKUnsignedNodeAnnouncement this_ptr_conv;
25277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25278 this_ptr_conv.is_owned = false;
25279 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25280 LDKCVec_NetAddressZ val_constr;
25281 val_constr.datalen = val->arr_len;
25282 if (val_constr.datalen > 0)
25283 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
25285 val_constr.data = NULL;
25286 uint32_t* val_vals = val->elems;
25287 for (size_t m = 0; m < val_constr.datalen; m++) {
25288 uint32_t val_conv_12 = val_vals[m];
25289 void* val_conv_12_ptr = (void*)(((uint64_t)val_conv_12) & ~1);
25290 CHECK_ACCESS(val_conv_12_ptr);
25291 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
25292 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
25293 val_constr.data[m] = val_conv_12_conv;
25295 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
25298 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
25299 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
25300 uint64_t ret_ref = 0;
25301 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25302 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25303 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25304 ret_ref = (uint64_t)ret_var.inner;
25305 if (ret_var.is_owned) {
25310 int64_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint32_t arg) {
25311 LDKUnsignedNodeAnnouncement arg_conv;
25312 arg_conv.inner = (void*)(arg & (~1));
25313 arg_conv.is_owned = false;
25314 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25315 int64_t ret_val = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
25319 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_clone(uint32_t orig) {
25320 LDKUnsignedNodeAnnouncement orig_conv;
25321 orig_conv.inner = (void*)(orig & (~1));
25322 orig_conv.is_owned = false;
25323 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25324 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
25325 uint64_t ret_ref = 0;
25326 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25327 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25328 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25329 ret_ref = (uint64_t)ret_var.inner;
25330 if (ret_var.is_owned) {
25336 void __attribute__((visibility("default"))) TS_NodeAnnouncement_free(uint32_t this_obj) {
25337 LDKNodeAnnouncement this_obj_conv;
25338 this_obj_conv.inner = (void*)(this_obj & (~1));
25339 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25340 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25341 NodeAnnouncement_free(this_obj_conv);
25344 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_get_signature(uint32_t this_ptr) {
25345 LDKNodeAnnouncement this_ptr_conv;
25346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25347 this_ptr_conv.is_owned = false;
25348 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25349 int8_tArray ret_arr = init_int8_tArray(64);
25350 memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
25354 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_signature(uint32_t this_ptr, int8_tArray val) {
25355 LDKNodeAnnouncement this_ptr_conv;
25356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25357 this_ptr_conv.is_owned = false;
25358 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25359 LDKSignature val_ref;
25360 CHECK(val->arr_len == 64);
25361 memcpy(val_ref.compact_form, val->elems, 64);
25362 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
25365 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_get_contents(uint32_t this_ptr) {
25366 LDKNodeAnnouncement this_ptr_conv;
25367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25368 this_ptr_conv.is_owned = false;
25369 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25370 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
25371 uint64_t ret_ref = 0;
25372 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25373 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25374 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25375 ret_ref = (uint64_t)ret_var.inner;
25376 if (ret_var.is_owned) {
25382 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
25383 LDKNodeAnnouncement this_ptr_conv;
25384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25385 this_ptr_conv.is_owned = false;
25386 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25387 LDKUnsignedNodeAnnouncement val_conv;
25388 val_conv.inner = (void*)(val & (~1));
25389 val_conv.is_owned = (val & 1) || (val == 0);
25390 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25391 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
25392 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
25395 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint32_t contents_arg) {
25396 LDKSignature signature_arg_ref;
25397 CHECK(signature_arg->arr_len == 64);
25398 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64);
25399 LDKUnsignedNodeAnnouncement contents_arg_conv;
25400 contents_arg_conv.inner = (void*)(contents_arg & (~1));
25401 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
25402 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
25403 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
25404 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
25405 uint64_t ret_ref = 0;
25406 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25407 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25408 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25409 ret_ref = (uint64_t)ret_var.inner;
25410 if (ret_var.is_owned) {
25416 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
25417 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
25418 uint64_t ret_ref = 0;
25419 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25420 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25421 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25422 ret_ref = (uint64_t)ret_var.inner;
25423 if (ret_var.is_owned) {
25428 int64_t __attribute__((visibility("default"))) TS_NodeAnnouncement_clone_ptr(uint32_t arg) {
25429 LDKNodeAnnouncement arg_conv;
25430 arg_conv.inner = (void*)(arg & (~1));
25431 arg_conv.is_owned = false;
25432 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25433 int64_t ret_val = NodeAnnouncement_clone_ptr(&arg_conv);
25437 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_clone(uint32_t orig) {
25438 LDKNodeAnnouncement orig_conv;
25439 orig_conv.inner = (void*)(orig & (~1));
25440 orig_conv.is_owned = false;
25441 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25442 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
25443 uint64_t ret_ref = 0;
25444 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25445 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25446 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25447 ret_ref = (uint64_t)ret_var.inner;
25448 if (ret_var.is_owned) {
25454 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_free(uint32_t this_obj) {
25455 LDKUnsignedChannelAnnouncement this_obj_conv;
25456 this_obj_conv.inner = (void*)(this_obj & (~1));
25457 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25458 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25459 UnsignedChannelAnnouncement_free(this_obj_conv);
25462 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_features(uint32_t this_ptr) {
25463 LDKUnsignedChannelAnnouncement this_ptr_conv;
25464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25465 this_ptr_conv.is_owned = false;
25466 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25467 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
25468 uint64_t ret_ref = 0;
25469 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25470 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25471 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25472 ret_ref = (uint64_t)ret_var.inner;
25473 if (ret_var.is_owned) {
25479 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
25480 LDKUnsignedChannelAnnouncement this_ptr_conv;
25481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25482 this_ptr_conv.is_owned = false;
25483 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25484 LDKChannelFeatures val_conv;
25485 val_conv.inner = (void*)(val & (~1));
25486 val_conv.is_owned = (val & 1) || (val == 0);
25487 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25488 val_conv = ChannelFeatures_clone(&val_conv);
25489 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
25492 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint32_t this_ptr) {
25493 LDKUnsignedChannelAnnouncement this_ptr_conv;
25494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25495 this_ptr_conv.is_owned = false;
25496 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25497 int8_tArray ret_arr = init_int8_tArray(32);
25498 memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
25502 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
25503 LDKUnsignedChannelAnnouncement this_ptr_conv;
25504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25505 this_ptr_conv.is_owned = false;
25506 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25507 LDKThirtyTwoBytes val_ref;
25508 CHECK(val->arr_len == 32);
25509 memcpy(val_ref.data, val->elems, 32);
25510 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
25513 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint32_t this_ptr) {
25514 LDKUnsignedChannelAnnouncement this_ptr_conv;
25515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25516 this_ptr_conv.is_owned = false;
25517 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25518 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
25522 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint32_t this_ptr, int64_t val) {
25523 LDKUnsignedChannelAnnouncement this_ptr_conv;
25524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25525 this_ptr_conv.is_owned = false;
25526 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25527 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
25530 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint32_t this_ptr) {
25531 LDKUnsignedChannelAnnouncement this_ptr_conv;
25532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25533 this_ptr_conv.is_owned = false;
25534 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25535 int8_tArray ret_arr = init_int8_tArray(33);
25536 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
25540 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint32_t this_ptr, int8_tArray val) {
25541 LDKUnsignedChannelAnnouncement this_ptr_conv;
25542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25543 this_ptr_conv.is_owned = false;
25544 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25545 LDKPublicKey val_ref;
25546 CHECK(val->arr_len == 33);
25547 memcpy(val_ref.compressed_form, val->elems, 33);
25548 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
25551 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint32_t this_ptr) {
25552 LDKUnsignedChannelAnnouncement this_ptr_conv;
25553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25554 this_ptr_conv.is_owned = false;
25555 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25556 int8_tArray ret_arr = init_int8_tArray(33);
25557 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
25561 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint32_t this_ptr, int8_tArray val) {
25562 LDKUnsignedChannelAnnouncement this_ptr_conv;
25563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25564 this_ptr_conv.is_owned = false;
25565 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25566 LDKPublicKey val_ref;
25567 CHECK(val->arr_len == 33);
25568 memcpy(val_ref.compressed_form, val->elems, 33);
25569 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
25572 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint32_t this_ptr) {
25573 LDKUnsignedChannelAnnouncement this_ptr_conv;
25574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25575 this_ptr_conv.is_owned = false;
25576 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25577 int8_tArray ret_arr = init_int8_tArray(33);
25578 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
25582 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint32_t this_ptr, int8_tArray val) {
25583 LDKUnsignedChannelAnnouncement this_ptr_conv;
25584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25585 this_ptr_conv.is_owned = false;
25586 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25587 LDKPublicKey val_ref;
25588 CHECK(val->arr_len == 33);
25589 memcpy(val_ref.compressed_form, val->elems, 33);
25590 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
25593 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint32_t this_ptr) {
25594 LDKUnsignedChannelAnnouncement this_ptr_conv;
25595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25596 this_ptr_conv.is_owned = false;
25597 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25598 int8_tArray ret_arr = init_int8_tArray(33);
25599 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
25603 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint32_t this_ptr, int8_tArray val) {
25604 LDKUnsignedChannelAnnouncement this_ptr_conv;
25605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25606 this_ptr_conv.is_owned = false;
25607 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25608 LDKPublicKey val_ref;
25609 CHECK(val->arr_len == 33);
25610 memcpy(val_ref.compressed_form, val->elems, 33);
25611 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
25614 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
25615 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
25616 uint64_t ret_ref = 0;
25617 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25618 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25619 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25620 ret_ref = (uint64_t)ret_var.inner;
25621 if (ret_var.is_owned) {
25626 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint32_t arg) {
25627 LDKUnsignedChannelAnnouncement arg_conv;
25628 arg_conv.inner = (void*)(arg & (~1));
25629 arg_conv.is_owned = false;
25630 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25631 int64_t ret_val = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
25635 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_clone(uint32_t orig) {
25636 LDKUnsignedChannelAnnouncement orig_conv;
25637 orig_conv.inner = (void*)(orig & (~1));
25638 orig_conv.is_owned = false;
25639 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25640 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
25641 uint64_t ret_ref = 0;
25642 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25643 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25644 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25645 ret_ref = (uint64_t)ret_var.inner;
25646 if (ret_var.is_owned) {
25652 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_free(uint32_t this_obj) {
25653 LDKChannelAnnouncement this_obj_conv;
25654 this_obj_conv.inner = (void*)(this_obj & (~1));
25655 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25656 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25657 ChannelAnnouncement_free(this_obj_conv);
25660 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_1(uint32_t this_ptr) {
25661 LDKChannelAnnouncement this_ptr_conv;
25662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25663 this_ptr_conv.is_owned = false;
25664 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25665 int8_tArray ret_arr = init_int8_tArray(64);
25666 memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
25670 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_1(uint32_t this_ptr, int8_tArray val) {
25671 LDKChannelAnnouncement this_ptr_conv;
25672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25673 this_ptr_conv.is_owned = false;
25674 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25675 LDKSignature val_ref;
25676 CHECK(val->arr_len == 64);
25677 memcpy(val_ref.compact_form, val->elems, 64);
25678 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
25681 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_2(uint32_t this_ptr) {
25682 LDKChannelAnnouncement this_ptr_conv;
25683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25684 this_ptr_conv.is_owned = false;
25685 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25686 int8_tArray ret_arr = init_int8_tArray(64);
25687 memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
25691 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_2(uint32_t this_ptr, int8_tArray val) {
25692 LDKChannelAnnouncement this_ptr_conv;
25693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25694 this_ptr_conv.is_owned = false;
25695 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25696 LDKSignature val_ref;
25697 CHECK(val->arr_len == 64);
25698 memcpy(val_ref.compact_form, val->elems, 64);
25699 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
25702 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint32_t this_ptr) {
25703 LDKChannelAnnouncement this_ptr_conv;
25704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25705 this_ptr_conv.is_owned = false;
25706 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25707 int8_tArray ret_arr = init_int8_tArray(64);
25708 memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
25712 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint32_t this_ptr, int8_tArray val) {
25713 LDKChannelAnnouncement this_ptr_conv;
25714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25715 this_ptr_conv.is_owned = false;
25716 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25717 LDKSignature val_ref;
25718 CHECK(val->arr_len == 64);
25719 memcpy(val_ref.compact_form, val->elems, 64);
25720 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
25723 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint32_t this_ptr) {
25724 LDKChannelAnnouncement this_ptr_conv;
25725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25726 this_ptr_conv.is_owned = false;
25727 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25728 int8_tArray ret_arr = init_int8_tArray(64);
25729 memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
25733 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint32_t this_ptr, int8_tArray val) {
25734 LDKChannelAnnouncement this_ptr_conv;
25735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25736 this_ptr_conv.is_owned = false;
25737 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25738 LDKSignature val_ref;
25739 CHECK(val->arr_len == 64);
25740 memcpy(val_ref.compact_form, val->elems, 64);
25741 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
25744 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_contents(uint32_t this_ptr) {
25745 LDKChannelAnnouncement this_ptr_conv;
25746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25747 this_ptr_conv.is_owned = false;
25748 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25749 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
25750 uint64_t ret_ref = 0;
25751 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25752 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25753 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25754 ret_ref = (uint64_t)ret_var.inner;
25755 if (ret_var.is_owned) {
25761 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
25762 LDKChannelAnnouncement this_ptr_conv;
25763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25764 this_ptr_conv.is_owned = false;
25765 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25766 LDKUnsignedChannelAnnouncement val_conv;
25767 val_conv.inner = (void*)(val & (~1));
25768 val_conv.is_owned = (val & 1) || (val == 0);
25769 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25770 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
25771 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
25774 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) {
25775 LDKSignature node_signature_1_arg_ref;
25776 CHECK(node_signature_1_arg->arr_len == 64);
25777 memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64);
25778 LDKSignature node_signature_2_arg_ref;
25779 CHECK(node_signature_2_arg->arr_len == 64);
25780 memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64);
25781 LDKSignature bitcoin_signature_1_arg_ref;
25782 CHECK(bitcoin_signature_1_arg->arr_len == 64);
25783 memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64);
25784 LDKSignature bitcoin_signature_2_arg_ref;
25785 CHECK(bitcoin_signature_2_arg->arr_len == 64);
25786 memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64);
25787 LDKUnsignedChannelAnnouncement contents_arg_conv;
25788 contents_arg_conv.inner = (void*)(contents_arg & (~1));
25789 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
25790 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
25791 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
25792 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);
25793 uint64_t ret_ref = 0;
25794 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25795 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25796 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25797 ret_ref = (uint64_t)ret_var.inner;
25798 if (ret_var.is_owned) {
25804 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
25805 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
25806 uint64_t ret_ref = 0;
25807 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25808 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25809 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25810 ret_ref = (uint64_t)ret_var.inner;
25811 if (ret_var.is_owned) {
25816 int64_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_clone_ptr(uint32_t arg) {
25817 LDKChannelAnnouncement arg_conv;
25818 arg_conv.inner = (void*)(arg & (~1));
25819 arg_conv.is_owned = false;
25820 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25821 int64_t ret_val = ChannelAnnouncement_clone_ptr(&arg_conv);
25825 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_clone(uint32_t orig) {
25826 LDKChannelAnnouncement orig_conv;
25827 orig_conv.inner = (void*)(orig & (~1));
25828 orig_conv.is_owned = false;
25829 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25830 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
25831 uint64_t ret_ref = 0;
25832 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25833 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25834 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25835 ret_ref = (uint64_t)ret_var.inner;
25836 if (ret_var.is_owned) {
25842 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_free(uint32_t this_obj) {
25843 LDKUnsignedChannelUpdate this_obj_conv;
25844 this_obj_conv.inner = (void*)(this_obj & (~1));
25845 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25846 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25847 UnsignedChannelUpdate_free(this_obj_conv);
25850 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_chain_hash(uint32_t this_ptr) {
25851 LDKUnsignedChannelUpdate this_ptr_conv;
25852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25853 this_ptr_conv.is_owned = false;
25854 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25855 int8_tArray ret_arr = init_int8_tArray(32);
25856 memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
25860 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
25861 LDKUnsignedChannelUpdate this_ptr_conv;
25862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25863 this_ptr_conv.is_owned = false;
25864 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25865 LDKThirtyTwoBytes val_ref;
25866 CHECK(val->arr_len == 32);
25867 memcpy(val_ref.data, val->elems, 32);
25868 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
25871 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint32_t this_ptr) {
25872 LDKUnsignedChannelUpdate this_ptr_conv;
25873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25874 this_ptr_conv.is_owned = false;
25875 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25876 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
25880 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint32_t this_ptr, int64_t val) {
25881 LDKUnsignedChannelUpdate this_ptr_conv;
25882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25883 this_ptr_conv.is_owned = false;
25884 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25885 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
25888 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_timestamp(uint32_t this_ptr) {
25889 LDKUnsignedChannelUpdate this_ptr_conv;
25890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25891 this_ptr_conv.is_owned = false;
25892 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25893 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
25897 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_timestamp(uint32_t this_ptr, int32_t val) {
25898 LDKUnsignedChannelUpdate this_ptr_conv;
25899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25900 this_ptr_conv.is_owned = false;
25901 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25902 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
25905 int8_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_flags(uint32_t this_ptr) {
25906 LDKUnsignedChannelUpdate this_ptr_conv;
25907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25908 this_ptr_conv.is_owned = false;
25909 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25910 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
25914 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_flags(uint32_t this_ptr, int8_t val) {
25915 LDKUnsignedChannelUpdate this_ptr_conv;
25916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25917 this_ptr_conv.is_owned = false;
25918 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25919 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
25922 int16_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint32_t this_ptr) {
25923 LDKUnsignedChannelUpdate this_ptr_conv;
25924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25925 this_ptr_conv.is_owned = false;
25926 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25927 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
25931 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
25932 LDKUnsignedChannelUpdate this_ptr_conv;
25933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25934 this_ptr_conv.is_owned = false;
25935 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25936 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
25939 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint32_t this_ptr) {
25940 LDKUnsignedChannelUpdate this_ptr_conv;
25941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25942 this_ptr_conv.is_owned = false;
25943 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25944 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
25948 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
25949 LDKUnsignedChannelUpdate this_ptr_conv;
25950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25951 this_ptr_conv.is_owned = false;
25952 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25953 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
25956 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint32_t this_ptr) {
25957 LDKUnsignedChannelUpdate this_ptr_conv;
25958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25959 this_ptr_conv.is_owned = false;
25960 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25961 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
25965 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
25966 LDKUnsignedChannelUpdate this_ptr_conv;
25967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25968 this_ptr_conv.is_owned = false;
25969 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25970 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
25973 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint32_t this_ptr) {
25974 LDKUnsignedChannelUpdate this_ptr_conv;
25975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25976 this_ptr_conv.is_owned = false;
25977 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25978 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
25982 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
25983 LDKUnsignedChannelUpdate this_ptr_conv;
25984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25985 this_ptr_conv.is_owned = false;
25986 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25987 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
25990 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
25991 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
25992 uint64_t ret_ref = 0;
25993 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25994 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25995 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25996 ret_ref = (uint64_t)ret_var.inner;
25997 if (ret_var.is_owned) {
26002 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_clone_ptr(uint32_t arg) {
26003 LDKUnsignedChannelUpdate arg_conv;
26004 arg_conv.inner = (void*)(arg & (~1));
26005 arg_conv.is_owned = false;
26006 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26007 int64_t ret_val = UnsignedChannelUpdate_clone_ptr(&arg_conv);
26011 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_clone(uint32_t orig) {
26012 LDKUnsignedChannelUpdate orig_conv;
26013 orig_conv.inner = (void*)(orig & (~1));
26014 orig_conv.is_owned = false;
26015 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26016 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
26017 uint64_t ret_ref = 0;
26018 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26019 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26020 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26021 ret_ref = (uint64_t)ret_var.inner;
26022 if (ret_var.is_owned) {
26028 void __attribute__((visibility("default"))) TS_ChannelUpdate_free(uint32_t this_obj) {
26029 LDKChannelUpdate this_obj_conv;
26030 this_obj_conv.inner = (void*)(this_obj & (~1));
26031 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26032 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26033 ChannelUpdate_free(this_obj_conv);
26036 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_get_signature(uint32_t this_ptr) {
26037 LDKChannelUpdate this_ptr_conv;
26038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26039 this_ptr_conv.is_owned = false;
26040 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26041 int8_tArray ret_arr = init_int8_tArray(64);
26042 memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
26046 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_signature(uint32_t this_ptr, int8_tArray val) {
26047 LDKChannelUpdate this_ptr_conv;
26048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26049 this_ptr_conv.is_owned = false;
26050 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26051 LDKSignature val_ref;
26052 CHECK(val->arr_len == 64);
26053 memcpy(val_ref.compact_form, val->elems, 64);
26054 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
26057 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_get_contents(uint32_t this_ptr) {
26058 LDKChannelUpdate this_ptr_conv;
26059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26060 this_ptr_conv.is_owned = false;
26061 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26062 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
26063 uint64_t ret_ref = 0;
26064 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26065 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26066 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26067 ret_ref = (uint64_t)ret_var.inner;
26068 if (ret_var.is_owned) {
26074 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_contents(uint32_t this_ptr, uint32_t val) {
26075 LDKChannelUpdate this_ptr_conv;
26076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26077 this_ptr_conv.is_owned = false;
26078 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26079 LDKUnsignedChannelUpdate val_conv;
26080 val_conv.inner = (void*)(val & (~1));
26081 val_conv.is_owned = (val & 1) || (val == 0);
26082 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26083 val_conv = UnsignedChannelUpdate_clone(&val_conv);
26084 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
26087 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint32_t contents_arg) {
26088 LDKSignature signature_arg_ref;
26089 CHECK(signature_arg->arr_len == 64);
26090 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64);
26091 LDKUnsignedChannelUpdate contents_arg_conv;
26092 contents_arg_conv.inner = (void*)(contents_arg & (~1));
26093 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
26094 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
26095 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
26096 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
26097 uint64_t ret_ref = 0;
26098 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26099 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26100 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26101 ret_ref = (uint64_t)ret_var.inner;
26102 if (ret_var.is_owned) {
26108 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
26109 LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
26110 uint64_t ret_ref = 0;
26111 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26112 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26113 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26114 ret_ref = (uint64_t)ret_var.inner;
26115 if (ret_var.is_owned) {
26120 int64_t __attribute__((visibility("default"))) TS_ChannelUpdate_clone_ptr(uint32_t arg) {
26121 LDKChannelUpdate arg_conv;
26122 arg_conv.inner = (void*)(arg & (~1));
26123 arg_conv.is_owned = false;
26124 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26125 int64_t ret_val = ChannelUpdate_clone_ptr(&arg_conv);
26129 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_clone(uint32_t orig) {
26130 LDKChannelUpdate orig_conv;
26131 orig_conv.inner = (void*)(orig & (~1));
26132 orig_conv.is_owned = false;
26133 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26134 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
26135 uint64_t ret_ref = 0;
26136 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26137 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26138 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26139 ret_ref = (uint64_t)ret_var.inner;
26140 if (ret_var.is_owned) {
26146 void __attribute__((visibility("default"))) TS_QueryChannelRange_free(uint32_t this_obj) {
26147 LDKQueryChannelRange this_obj_conv;
26148 this_obj_conv.inner = (void*)(this_obj & (~1));
26149 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26150 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26151 QueryChannelRange_free(this_obj_conv);
26154 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_get_chain_hash(uint32_t this_ptr) {
26155 LDKQueryChannelRange this_ptr_conv;
26156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26157 this_ptr_conv.is_owned = false;
26158 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26159 int8_tArray ret_arr = init_int8_tArray(32);
26160 memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
26164 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26165 LDKQueryChannelRange this_ptr_conv;
26166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26167 this_ptr_conv.is_owned = false;
26168 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26169 LDKThirtyTwoBytes val_ref;
26170 CHECK(val->arr_len == 32);
26171 memcpy(val_ref.data, val->elems, 32);
26172 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
26175 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_first_blocknum(uint32_t this_ptr) {
26176 LDKQueryChannelRange this_ptr_conv;
26177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26178 this_ptr_conv.is_owned = false;
26179 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26180 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
26184 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
26185 LDKQueryChannelRange this_ptr_conv;
26186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26187 this_ptr_conv.is_owned = false;
26188 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26189 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
26192 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_number_of_blocks(uint32_t this_ptr) {
26193 LDKQueryChannelRange this_ptr_conv;
26194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26195 this_ptr_conv.is_owned = false;
26196 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26197 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
26201 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
26202 LDKQueryChannelRange this_ptr_conv;
26203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26204 this_ptr_conv.is_owned = false;
26205 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26206 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
26209 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_new(int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
26210 LDKThirtyTwoBytes chain_hash_arg_ref;
26211 CHECK(chain_hash_arg->arr_len == 32);
26212 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32);
26213 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
26214 uint64_t ret_ref = 0;
26215 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26216 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26217 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26218 ret_ref = (uint64_t)ret_var.inner;
26219 if (ret_var.is_owned) {
26225 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
26226 LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
26227 uint64_t ret_ref = 0;
26228 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26229 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26230 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26231 ret_ref = (uint64_t)ret_var.inner;
26232 if (ret_var.is_owned) {
26237 int64_t __attribute__((visibility("default"))) TS_QueryChannelRange_clone_ptr(uint32_t arg) {
26238 LDKQueryChannelRange arg_conv;
26239 arg_conv.inner = (void*)(arg & (~1));
26240 arg_conv.is_owned = false;
26241 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26242 int64_t ret_val = QueryChannelRange_clone_ptr(&arg_conv);
26246 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_clone(uint32_t orig) {
26247 LDKQueryChannelRange orig_conv;
26248 orig_conv.inner = (void*)(orig & (~1));
26249 orig_conv.is_owned = false;
26250 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26251 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
26252 uint64_t ret_ref = 0;
26253 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26254 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26255 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26256 ret_ref = (uint64_t)ret_var.inner;
26257 if (ret_var.is_owned) {
26263 void __attribute__((visibility("default"))) TS_ReplyChannelRange_free(uint32_t this_obj) {
26264 LDKReplyChannelRange this_obj_conv;
26265 this_obj_conv.inner = (void*)(this_obj & (~1));
26266 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26267 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26268 ReplyChannelRange_free(this_obj_conv);
26271 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_get_chain_hash(uint32_t this_ptr) {
26272 LDKReplyChannelRange this_ptr_conv;
26273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26274 this_ptr_conv.is_owned = false;
26275 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26276 int8_tArray ret_arr = init_int8_tArray(32);
26277 memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
26281 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26282 LDKReplyChannelRange this_ptr_conv;
26283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26284 this_ptr_conv.is_owned = false;
26285 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26286 LDKThirtyTwoBytes val_ref;
26287 CHECK(val->arr_len == 32);
26288 memcpy(val_ref.data, val->elems, 32);
26289 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
26292 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_first_blocknum(uint32_t this_ptr) {
26293 LDKReplyChannelRange this_ptr_conv;
26294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26295 this_ptr_conv.is_owned = false;
26296 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26297 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
26301 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
26302 LDKReplyChannelRange this_ptr_conv;
26303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26304 this_ptr_conv.is_owned = false;
26305 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26306 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
26309 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_number_of_blocks(uint32_t this_ptr) {
26310 LDKReplyChannelRange this_ptr_conv;
26311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26312 this_ptr_conv.is_owned = false;
26313 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26314 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
26318 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
26319 LDKReplyChannelRange this_ptr_conv;
26320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26321 this_ptr_conv.is_owned = false;
26322 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26323 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
26326 jboolean __attribute__((visibility("default"))) TS_ReplyChannelRange_get_sync_complete(uint32_t this_ptr) {
26327 LDKReplyChannelRange this_ptr_conv;
26328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26329 this_ptr_conv.is_owned = false;
26330 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26331 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
26335 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_sync_complete(uint32_t this_ptr, jboolean val) {
26336 LDKReplyChannelRange this_ptr_conv;
26337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26338 this_ptr_conv.is_owned = false;
26339 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26340 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
26343 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
26344 LDKReplyChannelRange this_ptr_conv;
26345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26346 this_ptr_conv.is_owned = false;
26347 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26348 LDKCVec_u64Z val_constr;
26349 val_constr.datalen = val->arr_len;
26350 if (val_constr.datalen > 0)
26351 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26353 val_constr.data = NULL;
26354 int64_t* val_vals = val->elems;
26355 for (size_t i = 0; i < val_constr.datalen; i++) {
26356 int64_t val_conv_8 = val_vals[i];
26357 val_constr.data[i] = val_conv_8;
26359 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
26362 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) {
26363 LDKThirtyTwoBytes chain_hash_arg_ref;
26364 CHECK(chain_hash_arg->arr_len == 32);
26365 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32);
26366 LDKCVec_u64Z short_channel_ids_arg_constr;
26367 short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
26368 if (short_channel_ids_arg_constr.datalen > 0)
26369 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26371 short_channel_ids_arg_constr.data = NULL;
26372 int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
26373 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
26374 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
26375 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
26377 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
26378 uint64_t ret_ref = 0;
26379 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26380 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26381 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26382 ret_ref = (uint64_t)ret_var.inner;
26383 if (ret_var.is_owned) {
26389 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
26390 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
26391 uint64_t ret_ref = 0;
26392 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26393 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26394 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26395 ret_ref = (uint64_t)ret_var.inner;
26396 if (ret_var.is_owned) {
26401 int64_t __attribute__((visibility("default"))) TS_ReplyChannelRange_clone_ptr(uint32_t arg) {
26402 LDKReplyChannelRange arg_conv;
26403 arg_conv.inner = (void*)(arg & (~1));
26404 arg_conv.is_owned = false;
26405 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26406 int64_t ret_val = ReplyChannelRange_clone_ptr(&arg_conv);
26410 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_clone(uint32_t orig) {
26411 LDKReplyChannelRange orig_conv;
26412 orig_conv.inner = (void*)(orig & (~1));
26413 orig_conv.is_owned = false;
26414 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26415 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
26416 uint64_t ret_ref = 0;
26417 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26418 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26419 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26420 ret_ref = (uint64_t)ret_var.inner;
26421 if (ret_var.is_owned) {
26427 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_free(uint32_t this_obj) {
26428 LDKQueryShortChannelIds this_obj_conv;
26429 this_obj_conv.inner = (void*)(this_obj & (~1));
26430 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26431 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26432 QueryShortChannelIds_free(this_obj_conv);
26435 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_get_chain_hash(uint32_t this_ptr) {
26436 LDKQueryShortChannelIds this_ptr_conv;
26437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26438 this_ptr_conv.is_owned = false;
26439 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26440 int8_tArray ret_arr = init_int8_tArray(32);
26441 memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
26445 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26446 LDKQueryShortChannelIds this_ptr_conv;
26447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26448 this_ptr_conv.is_owned = false;
26449 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26450 LDKThirtyTwoBytes val_ref;
26451 CHECK(val->arr_len == 32);
26452 memcpy(val_ref.data, val->elems, 32);
26453 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
26456 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
26457 LDKQueryShortChannelIds this_ptr_conv;
26458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26459 this_ptr_conv.is_owned = false;
26460 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26461 LDKCVec_u64Z val_constr;
26462 val_constr.datalen = val->arr_len;
26463 if (val_constr.datalen > 0)
26464 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26466 val_constr.data = NULL;
26467 int64_t* val_vals = val->elems;
26468 for (size_t i = 0; i < val_constr.datalen; i++) {
26469 int64_t val_conv_8 = val_vals[i];
26470 val_constr.data[i] = val_conv_8;
26472 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
26475 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
26476 LDKThirtyTwoBytes chain_hash_arg_ref;
26477 CHECK(chain_hash_arg->arr_len == 32);
26478 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32);
26479 LDKCVec_u64Z short_channel_ids_arg_constr;
26480 short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
26481 if (short_channel_ids_arg_constr.datalen > 0)
26482 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26484 short_channel_ids_arg_constr.data = NULL;
26485 int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
26486 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
26487 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
26488 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
26490 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
26491 uint64_t ret_ref = 0;
26492 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26493 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26494 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26495 ret_ref = (uint64_t)ret_var.inner;
26496 if (ret_var.is_owned) {
26502 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
26503 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
26504 uint64_t ret_ref = 0;
26505 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26506 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26507 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26508 ret_ref = (uint64_t)ret_var.inner;
26509 if (ret_var.is_owned) {
26514 int64_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_clone_ptr(uint32_t arg) {
26515 LDKQueryShortChannelIds arg_conv;
26516 arg_conv.inner = (void*)(arg & (~1));
26517 arg_conv.is_owned = false;
26518 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26519 int64_t ret_val = QueryShortChannelIds_clone_ptr(&arg_conv);
26523 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_clone(uint32_t orig) {
26524 LDKQueryShortChannelIds orig_conv;
26525 orig_conv.inner = (void*)(orig & (~1));
26526 orig_conv.is_owned = false;
26527 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26528 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
26529 uint64_t ret_ref = 0;
26530 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26531 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26532 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26533 ret_ref = (uint64_t)ret_var.inner;
26534 if (ret_var.is_owned) {
26540 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_free(uint32_t this_obj) {
26541 LDKReplyShortChannelIdsEnd this_obj_conv;
26542 this_obj_conv.inner = (void*)(this_obj & (~1));
26543 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26544 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26545 ReplyShortChannelIdsEnd_free(this_obj_conv);
26548 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint32_t this_ptr) {
26549 LDKReplyShortChannelIdsEnd this_ptr_conv;
26550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26551 this_ptr_conv.is_owned = false;
26552 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26553 int8_tArray ret_arr = init_int8_tArray(32);
26554 memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
26558 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26559 LDKReplyShortChannelIdsEnd this_ptr_conv;
26560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26561 this_ptr_conv.is_owned = false;
26562 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26563 LDKThirtyTwoBytes val_ref;
26564 CHECK(val->arr_len == 32);
26565 memcpy(val_ref.data, val->elems, 32);
26566 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
26569 jboolean __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint32_t this_ptr) {
26570 LDKReplyShortChannelIdsEnd this_ptr_conv;
26571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26572 this_ptr_conv.is_owned = false;
26573 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26574 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
26578 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint32_t this_ptr, jboolean val) {
26579 LDKReplyShortChannelIdsEnd this_ptr_conv;
26580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26581 this_ptr_conv.is_owned = false;
26582 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26583 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
26586 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
26587 LDKThirtyTwoBytes chain_hash_arg_ref;
26588 CHECK(chain_hash_arg->arr_len == 32);
26589 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32);
26590 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
26591 uint64_t ret_ref = 0;
26592 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26593 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26594 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26595 ret_ref = (uint64_t)ret_var.inner;
26596 if (ret_var.is_owned) {
26602 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
26603 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
26604 uint64_t ret_ref = 0;
26605 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26606 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26607 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26608 ret_ref = (uint64_t)ret_var.inner;
26609 if (ret_var.is_owned) {
26614 int64_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint32_t arg) {
26615 LDKReplyShortChannelIdsEnd arg_conv;
26616 arg_conv.inner = (void*)(arg & (~1));
26617 arg_conv.is_owned = false;
26618 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26619 int64_t ret_val = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
26623 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_clone(uint32_t orig) {
26624 LDKReplyShortChannelIdsEnd orig_conv;
26625 orig_conv.inner = (void*)(orig & (~1));
26626 orig_conv.is_owned = false;
26627 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26628 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
26629 uint64_t ret_ref = 0;
26630 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26631 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26632 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26633 ret_ref = (uint64_t)ret_var.inner;
26634 if (ret_var.is_owned) {
26640 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_free(uint32_t this_obj) {
26641 LDKGossipTimestampFilter this_obj_conv;
26642 this_obj_conv.inner = (void*)(this_obj & (~1));
26643 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26644 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26645 GossipTimestampFilter_free(this_obj_conv);
26648 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_chain_hash(uint32_t this_ptr) {
26649 LDKGossipTimestampFilter this_ptr_conv;
26650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26651 this_ptr_conv.is_owned = false;
26652 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26653 int8_tArray ret_arr = init_int8_tArray(32);
26654 memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
26658 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26659 LDKGossipTimestampFilter this_ptr_conv;
26660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26661 this_ptr_conv.is_owned = false;
26662 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26663 LDKThirtyTwoBytes val_ref;
26664 CHECK(val->arr_len == 32);
26665 memcpy(val_ref.data, val->elems, 32);
26666 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
26669 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_first_timestamp(uint32_t this_ptr) {
26670 LDKGossipTimestampFilter this_ptr_conv;
26671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26672 this_ptr_conv.is_owned = false;
26673 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26674 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
26678 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_first_timestamp(uint32_t this_ptr, int32_t val) {
26679 LDKGossipTimestampFilter this_ptr_conv;
26680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26681 this_ptr_conv.is_owned = false;
26682 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26683 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
26686 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_timestamp_range(uint32_t this_ptr) {
26687 LDKGossipTimestampFilter this_ptr_conv;
26688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26689 this_ptr_conv.is_owned = false;
26690 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26691 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
26695 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_timestamp_range(uint32_t this_ptr, int32_t val) {
26696 LDKGossipTimestampFilter this_ptr_conv;
26697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26698 this_ptr_conv.is_owned = false;
26699 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26700 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
26703 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_new(int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
26704 LDKThirtyTwoBytes chain_hash_arg_ref;
26705 CHECK(chain_hash_arg->arr_len == 32);
26706 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32);
26707 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
26708 uint64_t ret_ref = 0;
26709 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26710 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26711 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26712 ret_ref = (uint64_t)ret_var.inner;
26713 if (ret_var.is_owned) {
26719 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
26720 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
26721 uint64_t ret_ref = 0;
26722 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26723 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26724 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26725 ret_ref = (uint64_t)ret_var.inner;
26726 if (ret_var.is_owned) {
26731 int64_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_clone_ptr(uint32_t arg) {
26732 LDKGossipTimestampFilter arg_conv;
26733 arg_conv.inner = (void*)(arg & (~1));
26734 arg_conv.is_owned = false;
26735 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26736 int64_t ret_val = GossipTimestampFilter_clone_ptr(&arg_conv);
26740 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_clone(uint32_t orig) {
26741 LDKGossipTimestampFilter orig_conv;
26742 orig_conv.inner = (void*)(orig & (~1));
26743 orig_conv.is_owned = false;
26744 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26745 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
26746 uint64_t ret_ref = 0;
26747 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26748 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26749 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26750 ret_ref = (uint64_t)ret_var.inner;
26751 if (ret_var.is_owned) {
26757 void __attribute__((visibility("default"))) TS_ErrorAction_free(uint32_t this_ptr) {
26758 if ((this_ptr & 1) != 0) return;
26759 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
26760 CHECK_ACCESS(this_ptr_ptr);
26761 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
26762 FREE((void*)this_ptr);
26763 ErrorAction_free(this_ptr_conv);
26766 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
26767 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
26768 *ret_copy = ErrorAction_clone(arg);
26769 uint64_t ret_ref = (uint64_t)ret_copy;
26772 int64_t __attribute__((visibility("default"))) TS_ErrorAction_clone_ptr(uint32_t arg) {
26773 LDKErrorAction* arg_conv = (LDKErrorAction*)arg;
26774 int64_t ret_val = ErrorAction_clone_ptr(arg_conv);
26778 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_clone(uint32_t orig) {
26779 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
26780 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
26781 *ret_copy = ErrorAction_clone(orig_conv);
26782 uint64_t ret_ref = (uint64_t)ret_copy;
26786 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_disconnect_peer(uint32_t msg) {
26787 LDKErrorMessage msg_conv;
26788 msg_conv.inner = (void*)(msg & (~1));
26789 msg_conv.is_owned = (msg & 1) || (msg == 0);
26790 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
26791 msg_conv = ErrorMessage_clone(&msg_conv);
26792 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
26793 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
26794 uint64_t ret_ref = (uint64_t)ret_copy;
26798 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_error() {
26799 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
26800 *ret_copy = ErrorAction_ignore_error();
26801 uint64_t ret_ref = (uint64_t)ret_copy;
26805 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
26806 LDKLevel a_conv = LDKLevel_from_js(a);
26807 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
26808 *ret_copy = ErrorAction_ignore_and_log(a_conv);
26809 uint64_t ret_ref = (uint64_t)ret_copy;
26813 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_duplicate_gossip() {
26814 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
26815 *ret_copy = ErrorAction_ignore_duplicate_gossip();
26816 uint64_t ret_ref = (uint64_t)ret_copy;
26820 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_send_error_message(uint32_t msg) {
26821 LDKErrorMessage msg_conv;
26822 msg_conv.inner = (void*)(msg & (~1));
26823 msg_conv.is_owned = (msg & 1) || (msg == 0);
26824 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
26825 msg_conv = ErrorMessage_clone(&msg_conv);
26826 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
26827 *ret_copy = ErrorAction_send_error_message(msg_conv);
26828 uint64_t ret_ref = (uint64_t)ret_copy;
26832 void __attribute__((visibility("default"))) TS_LightningError_free(uint32_t this_obj) {
26833 LDKLightningError this_obj_conv;
26834 this_obj_conv.inner = (void*)(this_obj & (~1));
26835 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26836 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26837 LightningError_free(this_obj_conv);
26840 jstring __attribute__((visibility("default"))) TS_LightningError_get_err(uint32_t this_ptr) {
26841 LDKLightningError this_ptr_conv;
26842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26843 this_ptr_conv.is_owned = false;
26844 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26845 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
26846 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
26851 void __attribute__((visibility("default"))) TS_LightningError_set_err(uint32_t this_ptr, jstring val) {
26852 LDKLightningError this_ptr_conv;
26853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26854 this_ptr_conv.is_owned = false;
26855 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26856 LDKStr val_conv = str_ref_to_owned_c(val);
26857 LightningError_set_err(&this_ptr_conv, val_conv);
26860 uint32_t __attribute__((visibility("default"))) TS_LightningError_get_action(uint32_t this_ptr) {
26861 LDKLightningError this_ptr_conv;
26862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26863 this_ptr_conv.is_owned = false;
26864 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26865 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
26866 *ret_copy = LightningError_get_action(&this_ptr_conv);
26867 uint64_t ret_ref = (uint64_t)ret_copy;
26871 void __attribute__((visibility("default"))) TS_LightningError_set_action(uint32_t this_ptr, uint32_t val) {
26872 LDKLightningError this_ptr_conv;
26873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26874 this_ptr_conv.is_owned = false;
26875 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26876 void* val_ptr = (void*)(((uint64_t)val) & ~1);
26877 CHECK_ACCESS(val_ptr);
26878 LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
26879 val_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)val) & ~1));
26880 LightningError_set_action(&this_ptr_conv, val_conv);
26883 uint32_t __attribute__((visibility("default"))) TS_LightningError_new(jstring err_arg, uint32_t action_arg) {
26884 LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
26885 void* action_arg_ptr = (void*)(((uint64_t)action_arg) & ~1);
26886 CHECK_ACCESS(action_arg_ptr);
26887 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
26888 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action_arg) & ~1));
26889 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
26890 uint64_t ret_ref = 0;
26891 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26892 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26893 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26894 ret_ref = (uint64_t)ret_var.inner;
26895 if (ret_var.is_owned) {
26901 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
26902 LDKLightningError ret_var = LightningError_clone(arg);
26903 uint64_t ret_ref = 0;
26904 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26905 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26906 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26907 ret_ref = (uint64_t)ret_var.inner;
26908 if (ret_var.is_owned) {
26913 int64_t __attribute__((visibility("default"))) TS_LightningError_clone_ptr(uint32_t arg) {
26914 LDKLightningError arg_conv;
26915 arg_conv.inner = (void*)(arg & (~1));
26916 arg_conv.is_owned = false;
26917 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26918 int64_t ret_val = LightningError_clone_ptr(&arg_conv);
26922 uint32_t __attribute__((visibility("default"))) TS_LightningError_clone(uint32_t orig) {
26923 LDKLightningError orig_conv;
26924 orig_conv.inner = (void*)(orig & (~1));
26925 orig_conv.is_owned = false;
26926 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26927 LDKLightningError ret_var = LightningError_clone(&orig_conv);
26928 uint64_t ret_ref = 0;
26929 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26930 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26931 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26932 ret_ref = (uint64_t)ret_var.inner;
26933 if (ret_var.is_owned) {
26939 void __attribute__((visibility("default"))) TS_CommitmentUpdate_free(uint32_t this_obj) {
26940 LDKCommitmentUpdate this_obj_conv;
26941 this_obj_conv.inner = (void*)(this_obj & (~1));
26942 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26943 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26944 CommitmentUpdate_free(this_obj_conv);
26947 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_add_htlcs(uint32_t this_ptr) {
26948 LDKCommitmentUpdate this_ptr_conv;
26949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26950 this_ptr_conv.is_owned = false;
26951 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26952 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
26953 uint32_tArray ret_arr = NULL;
26954 ret_arr = init_uint32_tArray(ret_var.datalen);
26955 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
26956 for (size_t p = 0; p < ret_var.datalen; p++) {
26957 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
26958 uint64_t ret_conv_15_ref = 0;
26959 CHECK((((uint64_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26960 CHECK((((uint64_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26961 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
26962 ret_conv_15_ref = (uint64_t)ret_conv_15_var.inner;
26963 if (ret_conv_15_var.is_owned) {
26964 ret_conv_15_ref |= 1;
26966 ret_arr_ptr[p] = ret_conv_15_ref;
26969 FREE(ret_var.data);
26973 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_add_htlcs(uint32_t this_ptr, uint32_tArray val) {
26974 LDKCommitmentUpdate this_ptr_conv;
26975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26976 this_ptr_conv.is_owned = false;
26977 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26978 LDKCVec_UpdateAddHTLCZ val_constr;
26979 val_constr.datalen = val->arr_len;
26980 if (val_constr.datalen > 0)
26981 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
26983 val_constr.data = NULL;
26984 uint32_t* val_vals = val->elems;
26985 for (size_t p = 0; p < val_constr.datalen; p++) {
26986 uint32_t val_conv_15 = val_vals[p];
26987 LDKUpdateAddHTLC val_conv_15_conv;
26988 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
26989 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
26990 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
26991 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
26992 val_constr.data[p] = val_conv_15_conv;
26994 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
26997 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint32_t this_ptr) {
26998 LDKCommitmentUpdate this_ptr_conv;
26999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27000 this_ptr_conv.is_owned = false;
27001 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27002 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
27003 uint32_tArray ret_arr = NULL;
27004 ret_arr = init_uint32_tArray(ret_var.datalen);
27005 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
27006 for (size_t t = 0; t < ret_var.datalen; t++) {
27007 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
27008 uint64_t ret_conv_19_ref = 0;
27009 CHECK((((uint64_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27010 CHECK((((uint64_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27011 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
27012 ret_conv_19_ref = (uint64_t)ret_conv_19_var.inner;
27013 if (ret_conv_19_var.is_owned) {
27014 ret_conv_19_ref |= 1;
27016 ret_arr_ptr[t] = ret_conv_19_ref;
27019 FREE(ret_var.data);
27023 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint32_t this_ptr, uint32_tArray val) {
27024 LDKCommitmentUpdate this_ptr_conv;
27025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27026 this_ptr_conv.is_owned = false;
27027 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27028 LDKCVec_UpdateFulfillHTLCZ val_constr;
27029 val_constr.datalen = val->arr_len;
27030 if (val_constr.datalen > 0)
27031 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
27033 val_constr.data = NULL;
27034 uint32_t* val_vals = val->elems;
27035 for (size_t t = 0; t < val_constr.datalen; t++) {
27036 uint32_t val_conv_19 = val_vals[t];
27037 LDKUpdateFulfillHTLC val_conv_19_conv;
27038 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
27039 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
27040 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
27041 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
27042 val_constr.data[t] = val_conv_19_conv;
27044 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
27047 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint32_t this_ptr) {
27048 LDKCommitmentUpdate this_ptr_conv;
27049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27050 this_ptr_conv.is_owned = false;
27051 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27052 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
27053 uint32_tArray ret_arr = NULL;
27054 ret_arr = init_uint32_tArray(ret_var.datalen);
27055 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
27056 for (size_t q = 0; q < ret_var.datalen; q++) {
27057 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
27058 uint64_t ret_conv_16_ref = 0;
27059 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27060 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27061 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
27062 ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
27063 if (ret_conv_16_var.is_owned) {
27064 ret_conv_16_ref |= 1;
27066 ret_arr_ptr[q] = ret_conv_16_ref;
27069 FREE(ret_var.data);
27073 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint32_t this_ptr, uint32_tArray val) {
27074 LDKCommitmentUpdate this_ptr_conv;
27075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27076 this_ptr_conv.is_owned = false;
27077 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27078 LDKCVec_UpdateFailHTLCZ val_constr;
27079 val_constr.datalen = val->arr_len;
27080 if (val_constr.datalen > 0)
27081 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
27083 val_constr.data = NULL;
27084 uint32_t* val_vals = val->elems;
27085 for (size_t q = 0; q < val_constr.datalen; q++) {
27086 uint32_t val_conv_16 = val_vals[q];
27087 LDKUpdateFailHTLC val_conv_16_conv;
27088 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
27089 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
27090 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
27091 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
27092 val_constr.data[q] = val_conv_16_conv;
27094 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
27097 uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint32_t this_ptr) {
27098 LDKCommitmentUpdate this_ptr_conv;
27099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27100 this_ptr_conv.is_owned = false;
27101 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27102 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
27103 uint32_tArray ret_arr = NULL;
27104 ret_arr = init_uint32_tArray(ret_var.datalen);
27105 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
27106 for (size_t z = 0; z < ret_var.datalen; z++) {
27107 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
27108 uint64_t ret_conv_25_ref = 0;
27109 CHECK((((uint64_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27110 CHECK((((uint64_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27111 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
27112 ret_conv_25_ref = (uint64_t)ret_conv_25_var.inner;
27113 if (ret_conv_25_var.is_owned) {
27114 ret_conv_25_ref |= 1;
27116 ret_arr_ptr[z] = ret_conv_25_ref;
27119 FREE(ret_var.data);
27123 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_malformed_htlcs(uint32_t this_ptr, uint32_tArray val) {
27124 LDKCommitmentUpdate this_ptr_conv;
27125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27126 this_ptr_conv.is_owned = false;
27127 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27128 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
27129 val_constr.datalen = val->arr_len;
27130 if (val_constr.datalen > 0)
27131 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
27133 val_constr.data = NULL;
27134 uint32_t* val_vals = val->elems;
27135 for (size_t z = 0; z < val_constr.datalen; z++) {
27136 uint32_t val_conv_25 = val_vals[z];
27137 LDKUpdateFailMalformedHTLC val_conv_25_conv;
27138 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
27139 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
27140 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
27141 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
27142 val_constr.data[z] = val_conv_25_conv;
27144 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
27147 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fee(uint32_t this_ptr) {
27148 LDKCommitmentUpdate this_ptr_conv;
27149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27150 this_ptr_conv.is_owned = false;
27151 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27152 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
27153 uint64_t ret_ref = 0;
27154 if ((uint64_t)ret_var.inner > 4096) {
27155 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27156 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27157 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27158 ret_ref = (uint64_t)ret_var.inner;
27159 if (ret_var.is_owned) {
27166 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fee(uint32_t this_ptr, uint32_t val) {
27167 LDKCommitmentUpdate this_ptr_conv;
27168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27169 this_ptr_conv.is_owned = false;
27170 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27171 LDKUpdateFee val_conv;
27172 val_conv.inner = (void*)(val & (~1));
27173 val_conv.is_owned = (val & 1) || (val == 0);
27174 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27175 val_conv = UpdateFee_clone(&val_conv);
27176 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
27179 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_commitment_signed(uint32_t this_ptr) {
27180 LDKCommitmentUpdate this_ptr_conv;
27181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27182 this_ptr_conv.is_owned = false;
27183 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27184 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
27185 uint64_t ret_ref = 0;
27186 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27187 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27188 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27189 ret_ref = (uint64_t)ret_var.inner;
27190 if (ret_var.is_owned) {
27196 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_commitment_signed(uint32_t this_ptr, uint32_t val) {
27197 LDKCommitmentUpdate this_ptr_conv;
27198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27199 this_ptr_conv.is_owned = false;
27200 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27201 LDKCommitmentSigned val_conv;
27202 val_conv.inner = (void*)(val & (~1));
27203 val_conv.is_owned = (val & 1) || (val == 0);
27204 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27205 val_conv = CommitmentSigned_clone(&val_conv);
27206 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
27209 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) {
27210 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
27211 update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
27212 if (update_add_htlcs_arg_constr.datalen > 0)
27213 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
27215 update_add_htlcs_arg_constr.data = NULL;
27216 uint32_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
27217 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
27218 uint32_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
27219 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
27220 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
27221 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
27222 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
27223 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
27224 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
27226 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
27227 update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
27228 if (update_fulfill_htlcs_arg_constr.datalen > 0)
27229 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
27231 update_fulfill_htlcs_arg_constr.data = NULL;
27232 uint32_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
27233 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
27234 uint32_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
27235 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
27236 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
27237 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
27238 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
27239 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
27240 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
27242 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
27243 update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
27244 if (update_fail_htlcs_arg_constr.datalen > 0)
27245 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
27247 update_fail_htlcs_arg_constr.data = NULL;
27248 uint32_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
27249 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
27250 uint32_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
27251 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
27252 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
27253 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
27254 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
27255 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
27256 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
27258 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
27259 update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
27260 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
27261 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
27263 update_fail_malformed_htlcs_arg_constr.data = NULL;
27264 uint32_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
27265 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
27266 uint32_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
27267 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
27268 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
27269 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);
27270 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
27271 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
27272 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
27274 LDKUpdateFee update_fee_arg_conv;
27275 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
27276 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
27277 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
27278 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
27279 LDKCommitmentSigned commitment_signed_arg_conv;
27280 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
27281 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
27282 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
27283 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
27284 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);
27285 uint64_t ret_ref = 0;
27286 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27287 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27288 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27289 ret_ref = (uint64_t)ret_var.inner;
27290 if (ret_var.is_owned) {
27296 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
27297 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
27298 uint64_t ret_ref = 0;
27299 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27300 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27301 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27302 ret_ref = (uint64_t)ret_var.inner;
27303 if (ret_var.is_owned) {
27308 int64_t __attribute__((visibility("default"))) TS_CommitmentUpdate_clone_ptr(uint32_t arg) {
27309 LDKCommitmentUpdate arg_conv;
27310 arg_conv.inner = (void*)(arg & (~1));
27311 arg_conv.is_owned = false;
27312 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27313 int64_t ret_val = CommitmentUpdate_clone_ptr(&arg_conv);
27317 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_clone(uint32_t orig) {
27318 LDKCommitmentUpdate orig_conv;
27319 orig_conv.inner = (void*)(orig & (~1));
27320 orig_conv.is_owned = false;
27321 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27322 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
27323 uint64_t ret_ref = 0;
27324 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27325 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27326 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27327 ret_ref = (uint64_t)ret_var.inner;
27328 if (ret_var.is_owned) {
27334 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_free(uint32_t this_ptr) {
27335 if ((this_ptr & 1) != 0) return;
27336 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
27337 CHECK_ACCESS(this_ptr_ptr);
27338 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
27339 FREE((void*)this_ptr);
27340 ChannelMessageHandler_free(this_ptr_conv);
27343 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_free(uint32_t this_ptr) {
27344 if ((this_ptr & 1) != 0) return;
27345 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
27346 CHECK_ACCESS(this_ptr_ptr);
27347 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
27348 FREE((void*)this_ptr);
27349 RoutingMessageHandler_free(this_ptr_conv);
27352 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_write(uint32_t obj) {
27353 LDKAcceptChannel obj_conv;
27354 obj_conv.inner = (void*)(obj & (~1));
27355 obj_conv.is_owned = false;
27356 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27357 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
27358 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27359 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27360 CVec_u8Z_free(ret_var);
27364 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_read(int8_tArray ser) {
27365 LDKu8slice ser_ref;
27366 ser_ref.datalen = ser->arr_len;
27367 ser_ref.data = ser->elems;
27368 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
27369 *ret_conv = AcceptChannel_read(ser_ref);
27370 return (uint64_t)ret_conv;
27373 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_write(uint32_t obj) {
27374 LDKAnnouncementSignatures obj_conv;
27375 obj_conv.inner = (void*)(obj & (~1));
27376 obj_conv.is_owned = false;
27377 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27378 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
27379 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27380 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27381 CVec_u8Z_free(ret_var);
27385 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
27386 LDKu8slice ser_ref;
27387 ser_ref.datalen = ser->arr_len;
27388 ser_ref.data = ser->elems;
27389 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
27390 *ret_conv = AnnouncementSignatures_read(ser_ref);
27391 return (uint64_t)ret_conv;
27394 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_write(uint32_t obj) {
27395 LDKChannelReestablish obj_conv;
27396 obj_conv.inner = (void*)(obj & (~1));
27397 obj_conv.is_owned = false;
27398 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27399 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
27400 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27401 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27402 CVec_u8Z_free(ret_var);
27406 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_read(int8_tArray ser) {
27407 LDKu8slice ser_ref;
27408 ser_ref.datalen = ser->arr_len;
27409 ser_ref.data = ser->elems;
27410 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
27411 *ret_conv = ChannelReestablish_read(ser_ref);
27412 return (uint64_t)ret_conv;
27415 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_write(uint32_t obj) {
27416 LDKClosingSigned obj_conv;
27417 obj_conv.inner = (void*)(obj & (~1));
27418 obj_conv.is_owned = false;
27419 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27420 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
27421 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27422 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27423 CVec_u8Z_free(ret_var);
27427 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_read(int8_tArray ser) {
27428 LDKu8slice ser_ref;
27429 ser_ref.datalen = ser->arr_len;
27430 ser_ref.data = ser->elems;
27431 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
27432 *ret_conv = ClosingSigned_read(ser_ref);
27433 return (uint64_t)ret_conv;
27436 int8_tArray __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_write(uint32_t obj) {
27437 LDKClosingSignedFeeRange obj_conv;
27438 obj_conv.inner = (void*)(obj & (~1));
27439 obj_conv.is_owned = false;
27440 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27441 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
27442 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27443 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27444 CVec_u8Z_free(ret_var);
27448 uint32_t __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
27449 LDKu8slice ser_ref;
27450 ser_ref.datalen = ser->arr_len;
27451 ser_ref.data = ser->elems;
27452 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
27453 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
27454 return (uint64_t)ret_conv;
27457 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_write(uint32_t obj) {
27458 LDKCommitmentSigned obj_conv;
27459 obj_conv.inner = (void*)(obj & (~1));
27460 obj_conv.is_owned = false;
27461 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27462 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
27463 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27464 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27465 CVec_u8Z_free(ret_var);
27469 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_read(int8_tArray ser) {
27470 LDKu8slice ser_ref;
27471 ser_ref.datalen = ser->arr_len;
27472 ser_ref.data = ser->elems;
27473 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
27474 *ret_conv = CommitmentSigned_read(ser_ref);
27475 return (uint64_t)ret_conv;
27478 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_write(uint32_t obj) {
27479 LDKFundingCreated obj_conv;
27480 obj_conv.inner = (void*)(obj & (~1));
27481 obj_conv.is_owned = false;
27482 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27483 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
27484 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27485 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27486 CVec_u8Z_free(ret_var);
27490 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_read(int8_tArray ser) {
27491 LDKu8slice ser_ref;
27492 ser_ref.datalen = ser->arr_len;
27493 ser_ref.data = ser->elems;
27494 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
27495 *ret_conv = FundingCreated_read(ser_ref);
27496 return (uint64_t)ret_conv;
27499 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_write(uint32_t obj) {
27500 LDKFundingSigned obj_conv;
27501 obj_conv.inner = (void*)(obj & (~1));
27502 obj_conv.is_owned = false;
27503 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27504 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
27505 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27506 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27507 CVec_u8Z_free(ret_var);
27511 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_read(int8_tArray ser) {
27512 LDKu8slice ser_ref;
27513 ser_ref.datalen = ser->arr_len;
27514 ser_ref.data = ser->elems;
27515 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
27516 *ret_conv = FundingSigned_read(ser_ref);
27517 return (uint64_t)ret_conv;
27520 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_write(uint32_t obj) {
27521 LDKFundingLocked obj_conv;
27522 obj_conv.inner = (void*)(obj & (~1));
27523 obj_conv.is_owned = false;
27524 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27525 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
27526 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27527 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27528 CVec_u8Z_free(ret_var);
27532 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_read(int8_tArray ser) {
27533 LDKu8slice ser_ref;
27534 ser_ref.datalen = ser->arr_len;
27535 ser_ref.data = ser->elems;
27536 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
27537 *ret_conv = FundingLocked_read(ser_ref);
27538 return (uint64_t)ret_conv;
27541 int8_tArray __attribute__((visibility("default"))) TS_Init_write(uint32_t obj) {
27543 obj_conv.inner = (void*)(obj & (~1));
27544 obj_conv.is_owned = false;
27545 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27546 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
27547 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27548 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27549 CVec_u8Z_free(ret_var);
27553 uint32_t __attribute__((visibility("default"))) TS_Init_read(int8_tArray ser) {
27554 LDKu8slice ser_ref;
27555 ser_ref.datalen = ser->arr_len;
27556 ser_ref.data = ser->elems;
27557 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
27558 *ret_conv = Init_read(ser_ref);
27559 return (uint64_t)ret_conv;
27562 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_write(uint32_t obj) {
27563 LDKOpenChannel obj_conv;
27564 obj_conv.inner = (void*)(obj & (~1));
27565 obj_conv.is_owned = false;
27566 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27567 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
27568 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27569 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27570 CVec_u8Z_free(ret_var);
27574 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_read(int8_tArray ser) {
27575 LDKu8slice ser_ref;
27576 ser_ref.datalen = ser->arr_len;
27577 ser_ref.data = ser->elems;
27578 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
27579 *ret_conv = OpenChannel_read(ser_ref);
27580 return (uint64_t)ret_conv;
27583 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_write(uint32_t obj) {
27584 LDKRevokeAndACK obj_conv;
27585 obj_conv.inner = (void*)(obj & (~1));
27586 obj_conv.is_owned = false;
27587 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27588 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
27589 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27590 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27591 CVec_u8Z_free(ret_var);
27595 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_read(int8_tArray ser) {
27596 LDKu8slice ser_ref;
27597 ser_ref.datalen = ser->arr_len;
27598 ser_ref.data = ser->elems;
27599 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
27600 *ret_conv = RevokeAndACK_read(ser_ref);
27601 return (uint64_t)ret_conv;
27604 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_write(uint32_t obj) {
27605 LDKShutdown obj_conv;
27606 obj_conv.inner = (void*)(obj & (~1));
27607 obj_conv.is_owned = false;
27608 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27609 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
27610 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27611 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27612 CVec_u8Z_free(ret_var);
27616 uint32_t __attribute__((visibility("default"))) TS_Shutdown_read(int8_tArray ser) {
27617 LDKu8slice ser_ref;
27618 ser_ref.datalen = ser->arr_len;
27619 ser_ref.data = ser->elems;
27620 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
27621 *ret_conv = Shutdown_read(ser_ref);
27622 return (uint64_t)ret_conv;
27625 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_write(uint32_t obj) {
27626 LDKUpdateFailHTLC obj_conv;
27627 obj_conv.inner = (void*)(obj & (~1));
27628 obj_conv.is_owned = false;
27629 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27630 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
27631 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27632 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27633 CVec_u8Z_free(ret_var);
27637 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
27638 LDKu8slice ser_ref;
27639 ser_ref.datalen = ser->arr_len;
27640 ser_ref.data = ser->elems;
27641 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
27642 *ret_conv = UpdateFailHTLC_read(ser_ref);
27643 return (uint64_t)ret_conv;
27646 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_write(uint32_t obj) {
27647 LDKUpdateFailMalformedHTLC obj_conv;
27648 obj_conv.inner = (void*)(obj & (~1));
27649 obj_conv.is_owned = false;
27650 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27651 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
27652 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27653 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27654 CVec_u8Z_free(ret_var);
27658 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
27659 LDKu8slice ser_ref;
27660 ser_ref.datalen = ser->arr_len;
27661 ser_ref.data = ser->elems;
27662 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
27663 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
27664 return (uint64_t)ret_conv;
27667 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_write(uint32_t obj) {
27668 LDKUpdateFee obj_conv;
27669 obj_conv.inner = (void*)(obj & (~1));
27670 obj_conv.is_owned = false;
27671 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27672 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
27673 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27674 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27675 CVec_u8Z_free(ret_var);
27679 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_read(int8_tArray ser) {
27680 LDKu8slice ser_ref;
27681 ser_ref.datalen = ser->arr_len;
27682 ser_ref.data = ser->elems;
27683 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
27684 *ret_conv = UpdateFee_read(ser_ref);
27685 return (uint64_t)ret_conv;
27688 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_write(uint32_t obj) {
27689 LDKUpdateFulfillHTLC obj_conv;
27690 obj_conv.inner = (void*)(obj & (~1));
27691 obj_conv.is_owned = false;
27692 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27693 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
27694 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27695 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27696 CVec_u8Z_free(ret_var);
27700 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
27701 LDKu8slice ser_ref;
27702 ser_ref.datalen = ser->arr_len;
27703 ser_ref.data = ser->elems;
27704 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
27705 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
27706 return (uint64_t)ret_conv;
27709 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_write(uint32_t obj) {
27710 LDKUpdateAddHTLC obj_conv;
27711 obj_conv.inner = (void*)(obj & (~1));
27712 obj_conv.is_owned = false;
27713 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27714 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
27715 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27716 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27717 CVec_u8Z_free(ret_var);
27721 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
27722 LDKu8slice ser_ref;
27723 ser_ref.datalen = ser->arr_len;
27724 ser_ref.data = ser->elems;
27725 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
27726 *ret_conv = UpdateAddHTLC_read(ser_ref);
27727 return (uint64_t)ret_conv;
27730 int8_tArray __attribute__((visibility("default"))) TS_Ping_write(uint32_t obj) {
27732 obj_conv.inner = (void*)(obj & (~1));
27733 obj_conv.is_owned = false;
27734 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27735 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
27736 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27737 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27738 CVec_u8Z_free(ret_var);
27742 uint32_t __attribute__((visibility("default"))) TS_Ping_read(int8_tArray ser) {
27743 LDKu8slice ser_ref;
27744 ser_ref.datalen = ser->arr_len;
27745 ser_ref.data = ser->elems;
27746 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
27747 *ret_conv = Ping_read(ser_ref);
27748 return (uint64_t)ret_conv;
27751 int8_tArray __attribute__((visibility("default"))) TS_Pong_write(uint32_t obj) {
27753 obj_conv.inner = (void*)(obj & (~1));
27754 obj_conv.is_owned = false;
27755 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27756 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
27757 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27758 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27759 CVec_u8Z_free(ret_var);
27763 uint32_t __attribute__((visibility("default"))) TS_Pong_read(int8_tArray ser) {
27764 LDKu8slice ser_ref;
27765 ser_ref.datalen = ser->arr_len;
27766 ser_ref.data = ser->elems;
27767 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
27768 *ret_conv = Pong_read(ser_ref);
27769 return (uint64_t)ret_conv;
27772 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_write(uint32_t obj) {
27773 LDKUnsignedChannelAnnouncement obj_conv;
27774 obj_conv.inner = (void*)(obj & (~1));
27775 obj_conv.is_owned = false;
27776 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27777 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
27778 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27779 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27780 CVec_u8Z_free(ret_var);
27784 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
27785 LDKu8slice ser_ref;
27786 ser_ref.datalen = ser->arr_len;
27787 ser_ref.data = ser->elems;
27788 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
27789 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
27790 return (uint64_t)ret_conv;
27793 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_write(uint32_t obj) {
27794 LDKChannelAnnouncement obj_conv;
27795 obj_conv.inner = (void*)(obj & (~1));
27796 obj_conv.is_owned = false;
27797 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27798 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
27799 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27800 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27801 CVec_u8Z_free(ret_var);
27805 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
27806 LDKu8slice ser_ref;
27807 ser_ref.datalen = ser->arr_len;
27808 ser_ref.data = ser->elems;
27809 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
27810 *ret_conv = ChannelAnnouncement_read(ser_ref);
27811 return (uint64_t)ret_conv;
27814 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_write(uint32_t obj) {
27815 LDKUnsignedChannelUpdate obj_conv;
27816 obj_conv.inner = (void*)(obj & (~1));
27817 obj_conv.is_owned = false;
27818 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27819 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
27820 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27821 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27822 CVec_u8Z_free(ret_var);
27826 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
27827 LDKu8slice ser_ref;
27828 ser_ref.datalen = ser->arr_len;
27829 ser_ref.data = ser->elems;
27830 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
27831 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
27832 return (uint64_t)ret_conv;
27835 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_write(uint32_t obj) {
27836 LDKChannelUpdate obj_conv;
27837 obj_conv.inner = (void*)(obj & (~1));
27838 obj_conv.is_owned = false;
27839 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27840 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
27841 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27842 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27843 CVec_u8Z_free(ret_var);
27847 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_read(int8_tArray ser) {
27848 LDKu8slice ser_ref;
27849 ser_ref.datalen = ser->arr_len;
27850 ser_ref.data = ser->elems;
27851 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
27852 *ret_conv = ChannelUpdate_read(ser_ref);
27853 return (uint64_t)ret_conv;
27856 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_write(uint32_t obj) {
27857 LDKErrorMessage obj_conv;
27858 obj_conv.inner = (void*)(obj & (~1));
27859 obj_conv.is_owned = false;
27860 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27861 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
27862 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27863 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27864 CVec_u8Z_free(ret_var);
27868 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_read(int8_tArray ser) {
27869 LDKu8slice ser_ref;
27870 ser_ref.datalen = ser->arr_len;
27871 ser_ref.data = ser->elems;
27872 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
27873 *ret_conv = ErrorMessage_read(ser_ref);
27874 return (uint64_t)ret_conv;
27877 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_write(uint32_t obj) {
27878 LDKUnsignedNodeAnnouncement obj_conv;
27879 obj_conv.inner = (void*)(obj & (~1));
27880 obj_conv.is_owned = false;
27881 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27882 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
27883 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27884 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27885 CVec_u8Z_free(ret_var);
27889 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
27890 LDKu8slice ser_ref;
27891 ser_ref.datalen = ser->arr_len;
27892 ser_ref.data = ser->elems;
27893 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
27894 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
27895 return (uint64_t)ret_conv;
27898 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_write(uint32_t obj) {
27899 LDKNodeAnnouncement obj_conv;
27900 obj_conv.inner = (void*)(obj & (~1));
27901 obj_conv.is_owned = false;
27902 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27903 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
27904 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27905 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27906 CVec_u8Z_free(ret_var);
27910 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_read(int8_tArray ser) {
27911 LDKu8slice ser_ref;
27912 ser_ref.datalen = ser->arr_len;
27913 ser_ref.data = ser->elems;
27914 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
27915 *ret_conv = NodeAnnouncement_read(ser_ref);
27916 return (uint64_t)ret_conv;
27919 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
27920 LDKu8slice ser_ref;
27921 ser_ref.datalen = ser->arr_len;
27922 ser_ref.data = ser->elems;
27923 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
27924 *ret_conv = QueryShortChannelIds_read(ser_ref);
27925 return (uint64_t)ret_conv;
27928 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_write(uint32_t obj) {
27929 LDKQueryShortChannelIds obj_conv;
27930 obj_conv.inner = (void*)(obj & (~1));
27931 obj_conv.is_owned = false;
27932 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27933 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
27934 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27935 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27936 CVec_u8Z_free(ret_var);
27940 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_write(uint32_t obj) {
27941 LDKReplyShortChannelIdsEnd obj_conv;
27942 obj_conv.inner = (void*)(obj & (~1));
27943 obj_conv.is_owned = false;
27944 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27945 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
27946 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27947 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27948 CVec_u8Z_free(ret_var);
27952 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
27953 LDKu8slice ser_ref;
27954 ser_ref.datalen = ser->arr_len;
27955 ser_ref.data = ser->elems;
27956 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
27957 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
27958 return (uint64_t)ret_conv;
27961 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_end_blocknum(uint32_t this_arg) {
27962 LDKQueryChannelRange this_arg_conv;
27963 this_arg_conv.inner = (void*)(this_arg & (~1));
27964 this_arg_conv.is_owned = false;
27965 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27966 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
27970 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_write(uint32_t obj) {
27971 LDKQueryChannelRange obj_conv;
27972 obj_conv.inner = (void*)(obj & (~1));
27973 obj_conv.is_owned = false;
27974 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27975 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
27976 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
27977 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27978 CVec_u8Z_free(ret_var);
27982 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_read(int8_tArray ser) {
27983 LDKu8slice ser_ref;
27984 ser_ref.datalen = ser->arr_len;
27985 ser_ref.data = ser->elems;
27986 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
27987 *ret_conv = QueryChannelRange_read(ser_ref);
27988 return (uint64_t)ret_conv;
27991 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_read(int8_tArray ser) {
27992 LDKu8slice ser_ref;
27993 ser_ref.datalen = ser->arr_len;
27994 ser_ref.data = ser->elems;
27995 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
27996 *ret_conv = ReplyChannelRange_read(ser_ref);
27997 return (uint64_t)ret_conv;
28000 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_write(uint32_t obj) {
28001 LDKReplyChannelRange obj_conv;
28002 obj_conv.inner = (void*)(obj & (~1));
28003 obj_conv.is_owned = false;
28004 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28005 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
28006 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28007 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28008 CVec_u8Z_free(ret_var);
28012 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_write(uint32_t obj) {
28013 LDKGossipTimestampFilter obj_conv;
28014 obj_conv.inner = (void*)(obj & (~1));
28015 obj_conv.is_owned = false;
28016 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28017 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
28018 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28019 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28020 CVec_u8Z_free(ret_var);
28024 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
28025 LDKu8slice ser_ref;
28026 ser_ref.datalen = ser->arr_len;
28027 ser_ref.data = ser->elems;
28028 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
28029 *ret_conv = GossipTimestampFilter_read(ser_ref);
28030 return (uint64_t)ret_conv;
28033 void __attribute__((visibility("default"))) TS_CustomMessageHandler_free(uint32_t this_ptr) {
28034 if ((this_ptr & 1) != 0) return;
28035 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
28036 CHECK_ACCESS(this_ptr_ptr);
28037 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
28038 FREE((void*)this_ptr);
28039 CustomMessageHandler_free(this_ptr_conv);
28042 void __attribute__((visibility("default"))) TS_IgnoringMessageHandler_free(uint32_t this_obj) {
28043 LDKIgnoringMessageHandler this_obj_conv;
28044 this_obj_conv.inner = (void*)(this_obj & (~1));
28045 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28046 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28047 IgnoringMessageHandler_free(this_obj_conv);
28050 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_new() {
28051 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
28052 uint64_t ret_ref = 0;
28053 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28054 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28055 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28056 ret_ref = (uint64_t)ret_var.inner;
28057 if (ret_var.is_owned) {
28063 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
28064 LDKIgnoringMessageHandler this_arg_conv;
28065 this_arg_conv.inner = (void*)(this_arg & (~1));
28066 this_arg_conv.is_owned = false;
28067 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28068 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
28069 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
28070 return (uint64_t)ret_ret;
28073 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint32_t this_arg) {
28074 LDKIgnoringMessageHandler this_arg_conv;
28075 this_arg_conv.inner = (void*)(this_arg & (~1));
28076 this_arg_conv.is_owned = false;
28077 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28078 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
28079 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
28080 return (uint64_t)ret_ret;
28083 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint32_t this_arg) {
28084 LDKIgnoringMessageHandler this_arg_conv;
28085 this_arg_conv.inner = (void*)(this_arg & (~1));
28086 this_arg_conv.is_owned = false;
28087 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28088 LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
28089 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
28090 return (uint64_t)ret_ret;
28093 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint32_t this_arg) {
28094 LDKIgnoringMessageHandler this_arg_conv;
28095 this_arg_conv.inner = (void*)(this_arg & (~1));
28096 this_arg_conv.is_owned = false;
28097 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28098 LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
28099 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
28100 return (uint64_t)ret_ret;
28103 void __attribute__((visibility("default"))) TS_ErroringMessageHandler_free(uint32_t this_obj) {
28104 LDKErroringMessageHandler this_obj_conv;
28105 this_obj_conv.inner = (void*)(this_obj & (~1));
28106 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28107 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28108 ErroringMessageHandler_free(this_obj_conv);
28111 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_new() {
28112 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
28113 uint64_t ret_ref = 0;
28114 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28115 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28116 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28117 ret_ref = (uint64_t)ret_var.inner;
28118 if (ret_var.is_owned) {
28124 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
28125 LDKErroringMessageHandler this_arg_conv;
28126 this_arg_conv.inner = (void*)(this_arg & (~1));
28127 this_arg_conv.is_owned = false;
28128 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28129 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
28130 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
28131 return (uint64_t)ret_ret;
28134 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint32_t this_arg) {
28135 LDKErroringMessageHandler this_arg_conv;
28136 this_arg_conv.inner = (void*)(this_arg & (~1));
28137 this_arg_conv.is_owned = false;
28138 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28139 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
28140 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
28141 return (uint64_t)ret_ret;
28144 void __attribute__((visibility("default"))) TS_MessageHandler_free(uint32_t this_obj) {
28145 LDKMessageHandler this_obj_conv;
28146 this_obj_conv.inner = (void*)(this_obj & (~1));
28147 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28148 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28149 MessageHandler_free(this_obj_conv);
28152 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_chan_handler(uint32_t this_ptr) {
28153 LDKMessageHandler this_ptr_conv;
28154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28155 this_ptr_conv.is_owned = false;
28156 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28157 // WARNING: This object doesn't live past this scope, needs clone!
28158 uint64_t ret_ret = ((uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv)) | 1;
28162 void __attribute__((visibility("default"))) TS_MessageHandler_set_chan_handler(uint32_t this_ptr, uint32_t val) {
28163 LDKMessageHandler this_ptr_conv;
28164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28165 this_ptr_conv.is_owned = false;
28166 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28167 void* val_ptr = (void*)(((uint64_t)val) & ~1);
28168 CHECK_ACCESS(val_ptr);
28169 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
28170 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
28173 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_route_handler(uint32_t this_ptr) {
28174 LDKMessageHandler this_ptr_conv;
28175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28176 this_ptr_conv.is_owned = false;
28177 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28178 // WARNING: This object doesn't live past this scope, needs clone!
28179 uint64_t ret_ret = ((uint64_t)MessageHandler_get_route_handler(&this_ptr_conv)) | 1;
28183 void __attribute__((visibility("default"))) TS_MessageHandler_set_route_handler(uint32_t this_ptr, uint32_t val) {
28184 LDKMessageHandler this_ptr_conv;
28185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28186 this_ptr_conv.is_owned = false;
28187 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28188 void* val_ptr = (void*)(((uint64_t)val) & ~1);
28189 CHECK_ACCESS(val_ptr);
28190 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
28191 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
28194 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_new(uint32_t chan_handler_arg, uint32_t route_handler_arg) {
28195 void* chan_handler_arg_ptr = (void*)(((uint64_t)chan_handler_arg) & ~1);
28196 CHECK_ACCESS(chan_handler_arg_ptr);
28197 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
28198 void* route_handler_arg_ptr = (void*)(((uint64_t)route_handler_arg) & ~1);
28199 CHECK_ACCESS(route_handler_arg_ptr);
28200 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
28201 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
28202 uint64_t ret_ref = 0;
28203 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28204 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28205 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28206 ret_ref = (uint64_t)ret_var.inner;
28207 if (ret_var.is_owned) {
28213 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
28214 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
28215 *ret_ret = SocketDescriptor_clone(arg);
28216 return (uint64_t)ret_ret;
28218 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_clone_ptr(uint32_t arg) {
28219 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
28220 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
28221 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
28222 int64_t ret_val = SocketDescriptor_clone_ptr(arg_conv);
28226 uint32_t __attribute__((visibility("default"))) TS_SocketDescriptor_clone(uint32_t orig) {
28227 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
28228 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
28229 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
28230 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
28231 *ret_ret = SocketDescriptor_clone(orig_conv);
28232 return (uint64_t)ret_ret;
28235 void __attribute__((visibility("default"))) TS_SocketDescriptor_free(uint32_t this_ptr) {
28236 if ((this_ptr & 1) != 0) return;
28237 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
28238 CHECK_ACCESS(this_ptr_ptr);
28239 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
28240 FREE((void*)this_ptr);
28241 SocketDescriptor_free(this_ptr_conv);
28244 void __attribute__((visibility("default"))) TS_PeerHandleError_free(uint32_t this_obj) {
28245 LDKPeerHandleError this_obj_conv;
28246 this_obj_conv.inner = (void*)(this_obj & (~1));
28247 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28248 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28249 PeerHandleError_free(this_obj_conv);
28252 jboolean __attribute__((visibility("default"))) TS_PeerHandleError_get_no_connection_possible(uint32_t this_ptr) {
28253 LDKPeerHandleError this_ptr_conv;
28254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28255 this_ptr_conv.is_owned = false;
28256 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28257 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
28261 void __attribute__((visibility("default"))) TS_PeerHandleError_set_no_connection_possible(uint32_t this_ptr, jboolean val) {
28262 LDKPeerHandleError this_ptr_conv;
28263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28264 this_ptr_conv.is_owned = false;
28265 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28266 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
28269 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
28270 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
28271 uint64_t ret_ref = 0;
28272 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28273 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28274 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28275 ret_ref = (uint64_t)ret_var.inner;
28276 if (ret_var.is_owned) {
28282 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
28283 LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
28284 uint64_t ret_ref = 0;
28285 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28286 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28287 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28288 ret_ref = (uint64_t)ret_var.inner;
28289 if (ret_var.is_owned) {
28294 int64_t __attribute__((visibility("default"))) TS_PeerHandleError_clone_ptr(uint32_t arg) {
28295 LDKPeerHandleError arg_conv;
28296 arg_conv.inner = (void*)(arg & (~1));
28297 arg_conv.is_owned = false;
28298 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28299 int64_t ret_val = PeerHandleError_clone_ptr(&arg_conv);
28303 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_clone(uint32_t orig) {
28304 LDKPeerHandleError orig_conv;
28305 orig_conv.inner = (void*)(orig & (~1));
28306 orig_conv.is_owned = false;
28307 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28308 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
28309 uint64_t ret_ref = 0;
28310 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28311 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28312 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28313 ret_ref = (uint64_t)ret_var.inner;
28314 if (ret_var.is_owned) {
28320 void __attribute__((visibility("default"))) TS_PeerManager_free(uint32_t this_obj) {
28321 LDKPeerManager this_obj_conv;
28322 this_obj_conv.inner = (void*)(this_obj & (~1));
28323 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28324 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28325 PeerManager_free(this_obj_conv);
28328 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) {
28329 LDKMessageHandler message_handler_conv;
28330 message_handler_conv.inner = (void*)(message_handler & (~1));
28331 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
28332 CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
28333 // Warning: we need a move here but no clone is available for LDKMessageHandler
28334 LDKSecretKey our_node_secret_ref;
28335 CHECK(our_node_secret->arr_len == 32);
28336 memcpy(our_node_secret_ref.bytes, our_node_secret->elems, 32);
28337 unsigned char ephemeral_random_data_arr[32];
28338 CHECK(ephemeral_random_data->arr_len == 32);
28339 memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32);
28340 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
28341 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
28342 CHECK_ACCESS(logger_ptr);
28343 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
28344 void* custom_message_handler_ptr = (void*)(((uint64_t)custom_message_handler) & ~1);
28345 CHECK_ACCESS(custom_message_handler_ptr);
28346 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
28347 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
28348 uint64_t ret_ref = 0;
28349 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28350 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28351 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28352 ret_ref = (uint64_t)ret_var.inner;
28353 if (ret_var.is_owned) {
28359 ptrArray __attribute__((visibility("default"))) TS_PeerManager_get_peer_node_ids(uint32_t this_arg) {
28360 LDKPeerManager this_arg_conv;
28361 this_arg_conv.inner = (void*)(this_arg & (~1));
28362 this_arg_conv.is_owned = false;
28363 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28364 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
28365 ptrArray ret_arr = NULL;
28366 ret_arr = init_ptrArray(ret_var.datalen);
28367 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
28368 for (size_t m = 0; m < ret_var.datalen; m++) {
28369 int8_tArray ret_conv_12_arr = init_int8_tArray(33);
28370 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compressed_form, 33);
28371 ret_arr_ptr[m] = ret_conv_12_arr;
28374 FREE(ret_var.data);
28378 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_outbound_connection(uint32_t this_arg, int8_tArray their_node_id, uint32_t descriptor) {
28379 LDKPeerManager this_arg_conv;
28380 this_arg_conv.inner = (void*)(this_arg & (~1));
28381 this_arg_conv.is_owned = false;
28382 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28383 LDKPublicKey their_node_id_ref;
28384 CHECK(their_node_id->arr_len == 33);
28385 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33);
28386 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
28387 CHECK_ACCESS(descriptor_ptr);
28388 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
28389 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
28390 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
28391 return (uint64_t)ret_conv;
28394 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_inbound_connection(uint32_t this_arg, uint32_t descriptor) {
28395 LDKPeerManager this_arg_conv;
28396 this_arg_conv.inner = (void*)(this_arg & (~1));
28397 this_arg_conv.is_owned = false;
28398 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28399 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
28400 CHECK_ACCESS(descriptor_ptr);
28401 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
28402 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
28403 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
28404 return (uint64_t)ret_conv;
28407 uint32_t __attribute__((visibility("default"))) TS_PeerManager_write_buffer_space_avail(uint32_t this_arg, uint32_t descriptor) {
28408 LDKPeerManager this_arg_conv;
28409 this_arg_conv.inner = (void*)(this_arg & (~1));
28410 this_arg_conv.is_owned = false;
28411 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28412 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
28413 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
28414 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
28415 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
28416 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
28417 return (uint64_t)ret_conv;
28420 uint32_t __attribute__((visibility("default"))) TS_PeerManager_read_event(uint32_t this_arg, uint32_t peer_descriptor, int8_tArray data) {
28421 LDKPeerManager this_arg_conv;
28422 this_arg_conv.inner = (void*)(this_arg & (~1));
28423 this_arg_conv.is_owned = false;
28424 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28425 void* peer_descriptor_ptr = (void*)(((uint64_t)peer_descriptor) & ~1);
28426 if (!(peer_descriptor & 1)) { CHECK_ACCESS(peer_descriptor_ptr); }
28427 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
28428 LDKu8slice data_ref;
28429 data_ref.datalen = data->arr_len;
28430 data_ref.data = data->elems;
28431 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
28432 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
28433 return (uint64_t)ret_conv;
28436 void __attribute__((visibility("default"))) TS_PeerManager_process_events(uint32_t this_arg) {
28437 LDKPeerManager this_arg_conv;
28438 this_arg_conv.inner = (void*)(this_arg & (~1));
28439 this_arg_conv.is_owned = false;
28440 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28441 PeerManager_process_events(&this_arg_conv);
28444 void __attribute__((visibility("default"))) TS_PeerManager_socket_disconnected(uint32_t this_arg, uint32_t descriptor) {
28445 LDKPeerManager this_arg_conv;
28446 this_arg_conv.inner = (void*)(this_arg & (~1));
28447 this_arg_conv.is_owned = false;
28448 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28449 void* descriptor_ptr = (void*)(((uint64_t)descriptor) & ~1);
28450 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
28451 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
28452 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
28455 void __attribute__((visibility("default"))) TS_PeerManager_disconnect_by_node_id(uint32_t this_arg, int8_tArray node_id, jboolean no_connection_possible) {
28456 LDKPeerManager this_arg_conv;
28457 this_arg_conv.inner = (void*)(this_arg & (~1));
28458 this_arg_conv.is_owned = false;
28459 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28460 LDKPublicKey node_id_ref;
28461 CHECK(node_id->arr_len == 33);
28462 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
28463 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
28466 void __attribute__((visibility("default"))) TS_PeerManager_disconnect_all_peers(uint32_t this_arg) {
28467 LDKPeerManager this_arg_conv;
28468 this_arg_conv.inner = (void*)(this_arg & (~1));
28469 this_arg_conv.is_owned = false;
28470 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28471 PeerManager_disconnect_all_peers(&this_arg_conv);
28474 void __attribute__((visibility("default"))) TS_PeerManager_timer_tick_occurred(uint32_t this_arg) {
28475 LDKPeerManager this_arg_conv;
28476 this_arg_conv.inner = (void*)(this_arg & (~1));
28477 this_arg_conv.is_owned = false;
28478 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28479 PeerManager_timer_tick_occurred(&this_arg_conv);
28482 int64_t __attribute__((visibility("default"))) TS_htlc_success_tx_weight(jboolean opt_anchors) {
28483 int64_t ret_val = htlc_success_tx_weight(opt_anchors);
28487 int64_t __attribute__((visibility("default"))) TS_htlc_timeout_tx_weight(jboolean opt_anchors) {
28488 int64_t ret_val = htlc_timeout_tx_weight(opt_anchors);
28492 int8_tArray __attribute__((visibility("default"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
28493 unsigned char commitment_seed_arr[32];
28494 CHECK(commitment_seed->arr_len == 32);
28495 memcpy(commitment_seed_arr, commitment_seed->elems, 32);
28496 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
28497 int8_tArray ret_arr = init_int8_tArray(32);
28498 memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
28502 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) {
28503 LDKCVec_u8Z to_holder_script_ref;
28504 to_holder_script_ref.datalen = to_holder_script->arr_len;
28505 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
28506 memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen);
28507 LDKCVec_u8Z to_counterparty_script_ref;
28508 to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
28509 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
28510 memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen);
28511 LDKOutPoint funding_outpoint_conv;
28512 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
28513 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
28514 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
28515 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
28516 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);
28517 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28518 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28519 Transaction_free(ret_var);
28523 uint32_t __attribute__((visibility("default"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
28524 LDKPublicKey per_commitment_point_ref;
28525 CHECK(per_commitment_point->arr_len == 33);
28526 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33);
28527 unsigned char base_secret_arr[32];
28528 CHECK(base_secret->arr_len == 32);
28529 memcpy(base_secret_arr, base_secret->elems, 32);
28530 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
28531 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
28532 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
28533 return (uint64_t)ret_conv;
28536 uint32_t __attribute__((visibility("default"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
28537 LDKPublicKey per_commitment_point_ref;
28538 CHECK(per_commitment_point->arr_len == 33);
28539 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33);
28540 LDKPublicKey base_point_ref;
28541 CHECK(base_point->arr_len == 33);
28542 memcpy(base_point_ref.compressed_form, base_point->elems, 33);
28543 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
28544 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
28545 return (uint64_t)ret_conv;
28548 uint32_t __attribute__((visibility("default"))) TS_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
28549 unsigned char per_commitment_secret_arr[32];
28550 CHECK(per_commitment_secret->arr_len == 32);
28551 memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32);
28552 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
28553 unsigned char countersignatory_revocation_base_secret_arr[32];
28554 CHECK(countersignatory_revocation_base_secret->arr_len == 32);
28555 memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32);
28556 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
28557 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
28558 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
28559 return (uint64_t)ret_conv;
28562 uint32_t __attribute__((visibility("default"))) TS_derive_public_revocation_key(int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
28563 LDKPublicKey per_commitment_point_ref;
28564 CHECK(per_commitment_point->arr_len == 33);
28565 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33);
28566 LDKPublicKey countersignatory_revocation_base_point_ref;
28567 CHECK(countersignatory_revocation_base_point->arr_len == 33);
28568 memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point->elems, 33);
28569 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
28570 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
28571 return (uint64_t)ret_conv;
28574 void __attribute__((visibility("default"))) TS_TxCreationKeys_free(uint32_t this_obj) {
28575 LDKTxCreationKeys this_obj_conv;
28576 this_obj_conv.inner = (void*)(this_obj & (~1));
28577 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28578 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28579 TxCreationKeys_free(this_obj_conv);
28582 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_per_commitment_point(uint32_t this_ptr) {
28583 LDKTxCreationKeys this_ptr_conv;
28584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28585 this_ptr_conv.is_owned = false;
28586 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28587 int8_tArray ret_arr = init_int8_tArray(33);
28588 memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
28592 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
28593 LDKTxCreationKeys this_ptr_conv;
28594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28595 this_ptr_conv.is_owned = false;
28596 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28597 LDKPublicKey val_ref;
28598 CHECK(val->arr_len == 33);
28599 memcpy(val_ref.compressed_form, val->elems, 33);
28600 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
28603 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_revocation_key(uint32_t this_ptr) {
28604 LDKTxCreationKeys this_ptr_conv;
28605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28606 this_ptr_conv.is_owned = false;
28607 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28608 int8_tArray ret_arr = init_int8_tArray(33);
28609 memcpy(ret_arr->elems, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
28613 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_revocation_key(uint32_t this_ptr, int8_tArray val) {
28614 LDKTxCreationKeys this_ptr_conv;
28615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28616 this_ptr_conv.is_owned = false;
28617 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28618 LDKPublicKey val_ref;
28619 CHECK(val->arr_len == 33);
28620 memcpy(val_ref.compressed_form, val->elems, 33);
28621 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
28624 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint32_t this_ptr) {
28625 LDKTxCreationKeys this_ptr_conv;
28626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28627 this_ptr_conv.is_owned = false;
28628 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28629 int8_tArray ret_arr = init_int8_tArray(33);
28630 memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
28634 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint32_t this_ptr, int8_tArray val) {
28635 LDKTxCreationKeys this_ptr_conv;
28636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28637 this_ptr_conv.is_owned = false;
28638 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28639 LDKPublicKey val_ref;
28640 CHECK(val->arr_len == 33);
28641 memcpy(val_ref.compressed_form, val->elems, 33);
28642 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
28645 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint32_t this_ptr) {
28646 LDKTxCreationKeys this_ptr_conv;
28647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28648 this_ptr_conv.is_owned = false;
28649 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28650 int8_tArray ret_arr = init_int8_tArray(33);
28651 memcpy(ret_arr->elems, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
28655 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint32_t this_ptr, int8_tArray val) {
28656 LDKTxCreationKeys this_ptr_conv;
28657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28658 this_ptr_conv.is_owned = false;
28659 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28660 LDKPublicKey val_ref;
28661 CHECK(val->arr_len == 33);
28662 memcpy(val_ref.compressed_form, val->elems, 33);
28663 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
28666 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint32_t this_ptr) {
28667 LDKTxCreationKeys this_ptr_conv;
28668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28669 this_ptr_conv.is_owned = false;
28670 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28671 int8_tArray ret_arr = init_int8_tArray(33);
28672 memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
28676 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_delayed_payment_key(uint32_t this_ptr, int8_tArray val) {
28677 LDKTxCreationKeys this_ptr_conv;
28678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28679 this_ptr_conv.is_owned = false;
28680 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28681 LDKPublicKey val_ref;
28682 CHECK(val->arr_len == 33);
28683 memcpy(val_ref.compressed_form, val->elems, 33);
28684 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
28687 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) {
28688 LDKPublicKey per_commitment_point_arg_ref;
28689 CHECK(per_commitment_point_arg->arr_len == 33);
28690 memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33);
28691 LDKPublicKey revocation_key_arg_ref;
28692 CHECK(revocation_key_arg->arr_len == 33);
28693 memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg->elems, 33);
28694 LDKPublicKey broadcaster_htlc_key_arg_ref;
28695 CHECK(broadcaster_htlc_key_arg->arr_len == 33);
28696 memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg->elems, 33);
28697 LDKPublicKey countersignatory_htlc_key_arg_ref;
28698 CHECK(countersignatory_htlc_key_arg->arr_len == 33);
28699 memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg->elems, 33);
28700 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
28701 CHECK(broadcaster_delayed_payment_key_arg->arr_len == 33);
28702 memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg->elems, 33);
28703 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);
28704 uint64_t ret_ref = 0;
28705 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28706 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28707 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28708 ret_ref = (uint64_t)ret_var.inner;
28709 if (ret_var.is_owned) {
28715 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
28716 LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
28717 uint64_t ret_ref = 0;
28718 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28719 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28720 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28721 ret_ref = (uint64_t)ret_var.inner;
28722 if (ret_var.is_owned) {
28727 int64_t __attribute__((visibility("default"))) TS_TxCreationKeys_clone_ptr(uint32_t arg) {
28728 LDKTxCreationKeys arg_conv;
28729 arg_conv.inner = (void*)(arg & (~1));
28730 arg_conv.is_owned = false;
28731 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28732 int64_t ret_val = TxCreationKeys_clone_ptr(&arg_conv);
28736 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_clone(uint32_t orig) {
28737 LDKTxCreationKeys orig_conv;
28738 orig_conv.inner = (void*)(orig & (~1));
28739 orig_conv.is_owned = false;
28740 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28741 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
28742 uint64_t ret_ref = 0;
28743 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28744 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28745 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28746 ret_ref = (uint64_t)ret_var.inner;
28747 if (ret_var.is_owned) {
28753 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_write(uint32_t obj) {
28754 LDKTxCreationKeys obj_conv;
28755 obj_conv.inner = (void*)(obj & (~1));
28756 obj_conv.is_owned = false;
28757 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28758 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
28759 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28760 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28761 CVec_u8Z_free(ret_var);
28765 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_read(int8_tArray ser) {
28766 LDKu8slice ser_ref;
28767 ser_ref.datalen = ser->arr_len;
28768 ser_ref.data = ser->elems;
28769 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
28770 *ret_conv = TxCreationKeys_read(ser_ref);
28771 return (uint64_t)ret_conv;
28774 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_free(uint32_t this_obj) {
28775 LDKChannelPublicKeys this_obj_conv;
28776 this_obj_conv.inner = (void*)(this_obj & (~1));
28777 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28778 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28779 ChannelPublicKeys_free(this_obj_conv);
28782 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_funding_pubkey(uint32_t this_ptr) {
28783 LDKChannelPublicKeys this_ptr_conv;
28784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28785 this_ptr_conv.is_owned = false;
28786 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28787 int8_tArray ret_arr = init_int8_tArray(33);
28788 memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
28792 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
28793 LDKChannelPublicKeys this_ptr_conv;
28794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28795 this_ptr_conv.is_owned = false;
28796 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28797 LDKPublicKey val_ref;
28798 CHECK(val->arr_len == 33);
28799 memcpy(val_ref.compressed_form, val->elems, 33);
28800 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
28803 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint32_t this_ptr) {
28804 LDKChannelPublicKeys this_ptr_conv;
28805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28806 this_ptr_conv.is_owned = false;
28807 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28808 int8_tArray ret_arr = init_int8_tArray(33);
28809 memcpy(ret_arr->elems, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
28813 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
28814 LDKChannelPublicKeys this_ptr_conv;
28815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28816 this_ptr_conv.is_owned = false;
28817 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28818 LDKPublicKey val_ref;
28819 CHECK(val->arr_len == 33);
28820 memcpy(val_ref.compressed_form, val->elems, 33);
28821 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
28824 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_payment_point(uint32_t this_ptr) {
28825 LDKChannelPublicKeys this_ptr_conv;
28826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28827 this_ptr_conv.is_owned = false;
28828 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28829 int8_tArray ret_arr = init_int8_tArray(33);
28830 memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
28834 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_payment_point(uint32_t this_ptr, int8_tArray val) {
28835 LDKChannelPublicKeys this_ptr_conv;
28836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28837 this_ptr_conv.is_owned = false;
28838 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28839 LDKPublicKey val_ref;
28840 CHECK(val->arr_len == 33);
28841 memcpy(val_ref.compressed_form, val->elems, 33);
28842 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
28845 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint32_t this_ptr) {
28846 LDKChannelPublicKeys this_ptr_conv;
28847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28848 this_ptr_conv.is_owned = false;
28849 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28850 int8_tArray ret_arr = init_int8_tArray(33);
28851 memcpy(ret_arr->elems, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
28855 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
28856 LDKChannelPublicKeys this_ptr_conv;
28857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28858 this_ptr_conv.is_owned = false;
28859 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28860 LDKPublicKey val_ref;
28861 CHECK(val->arr_len == 33);
28862 memcpy(val_ref.compressed_form, val->elems, 33);
28863 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
28866 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint32_t this_ptr) {
28867 LDKChannelPublicKeys this_ptr_conv;
28868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28869 this_ptr_conv.is_owned = false;
28870 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28871 int8_tArray ret_arr = init_int8_tArray(33);
28872 memcpy(ret_arr->elems, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
28876 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
28877 LDKChannelPublicKeys this_ptr_conv;
28878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28879 this_ptr_conv.is_owned = false;
28880 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28881 LDKPublicKey val_ref;
28882 CHECK(val->arr_len == 33);
28883 memcpy(val_ref.compressed_form, val->elems, 33);
28884 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
28887 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) {
28888 LDKPublicKey funding_pubkey_arg_ref;
28889 CHECK(funding_pubkey_arg->arr_len == 33);
28890 memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33);
28891 LDKPublicKey revocation_basepoint_arg_ref;
28892 CHECK(revocation_basepoint_arg->arr_len == 33);
28893 memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33);
28894 LDKPublicKey payment_point_arg_ref;
28895 CHECK(payment_point_arg->arr_len == 33);
28896 memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33);
28897 LDKPublicKey delayed_payment_basepoint_arg_ref;
28898 CHECK(delayed_payment_basepoint_arg->arr_len == 33);
28899 memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33);
28900 LDKPublicKey htlc_basepoint_arg_ref;
28901 CHECK(htlc_basepoint_arg->arr_len == 33);
28902 memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33);
28903 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);
28904 uint64_t ret_ref = 0;
28905 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28906 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28907 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28908 ret_ref = (uint64_t)ret_var.inner;
28909 if (ret_var.is_owned) {
28915 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
28916 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
28917 uint64_t ret_ref = 0;
28918 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28919 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28920 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28921 ret_ref = (uint64_t)ret_var.inner;
28922 if (ret_var.is_owned) {
28927 int64_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_clone_ptr(uint32_t arg) {
28928 LDKChannelPublicKeys arg_conv;
28929 arg_conv.inner = (void*)(arg & (~1));
28930 arg_conv.is_owned = false;
28931 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28932 int64_t ret_val = ChannelPublicKeys_clone_ptr(&arg_conv);
28936 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_clone(uint32_t orig) {
28937 LDKChannelPublicKeys orig_conv;
28938 orig_conv.inner = (void*)(orig & (~1));
28939 orig_conv.is_owned = false;
28940 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28941 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
28942 uint64_t ret_ref = 0;
28943 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28944 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28945 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28946 ret_ref = (uint64_t)ret_var.inner;
28947 if (ret_var.is_owned) {
28953 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_write(uint32_t obj) {
28954 LDKChannelPublicKeys obj_conv;
28955 obj_conv.inner = (void*)(obj & (~1));
28956 obj_conv.is_owned = false;
28957 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28958 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
28959 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
28960 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28961 CVec_u8Z_free(ret_var);
28965 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
28966 LDKu8slice ser_ref;
28967 ser_ref.datalen = ser->arr_len;
28968 ser_ref.data = ser->elems;
28969 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
28970 *ret_conv = ChannelPublicKeys_read(ser_ref);
28971 return (uint64_t)ret_conv;
28974 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) {
28975 LDKPublicKey per_commitment_point_ref;
28976 CHECK(per_commitment_point->arr_len == 33);
28977 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33);
28978 LDKPublicKey broadcaster_delayed_payment_base_ref;
28979 CHECK(broadcaster_delayed_payment_base->arr_len == 33);
28980 memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base->elems, 33);
28981 LDKPublicKey broadcaster_htlc_base_ref;
28982 CHECK(broadcaster_htlc_base->arr_len == 33);
28983 memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base->elems, 33);
28984 LDKPublicKey countersignatory_revocation_base_ref;
28985 CHECK(countersignatory_revocation_base->arr_len == 33);
28986 memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base->elems, 33);
28987 LDKPublicKey countersignatory_htlc_base_ref;
28988 CHECK(countersignatory_htlc_base->arr_len == 33);
28989 memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base->elems, 33);
28990 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
28991 *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);
28992 return (uint64_t)ret_conv;
28995 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_from_channel_static_keys(int8_tArray per_commitment_point, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
28996 LDKPublicKey per_commitment_point_ref;
28997 CHECK(per_commitment_point->arr_len == 33);
28998 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33);
28999 LDKChannelPublicKeys broadcaster_keys_conv;
29000 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
29001 broadcaster_keys_conv.is_owned = false;
29002 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
29003 LDKChannelPublicKeys countersignatory_keys_conv;
29004 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
29005 countersignatory_keys_conv.is_owned = false;
29006 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
29007 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
29008 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
29009 return (uint64_t)ret_conv;
29012 int8_tArray __attribute__((visibility("default"))) TS_get_revokeable_redeemscript(int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
29013 LDKPublicKey revocation_key_ref;
29014 CHECK(revocation_key->arr_len == 33);
29015 memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33);
29016 LDKPublicKey broadcaster_delayed_payment_key_ref;
29017 CHECK(broadcaster_delayed_payment_key->arr_len == 33);
29018 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33);
29019 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
29020 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29021 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29022 CVec_u8Z_free(ret_var);
29026 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_free(uint32_t this_obj) {
29027 LDKHTLCOutputInCommitment this_obj_conv;
29028 this_obj_conv.inner = (void*)(this_obj & (~1));
29029 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29030 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29031 HTLCOutputInCommitment_free(this_obj_conv);
29034 jboolean __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_offered(uint32_t this_ptr) {
29035 LDKHTLCOutputInCommitment this_ptr_conv;
29036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29037 this_ptr_conv.is_owned = false;
29038 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29039 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
29043 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_offered(uint32_t this_ptr, jboolean val) {
29044 LDKHTLCOutputInCommitment this_ptr_conv;
29045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29046 this_ptr_conv.is_owned = false;
29047 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29048 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
29051 int64_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_amount_msat(uint32_t this_ptr) {
29052 LDKHTLCOutputInCommitment this_ptr_conv;
29053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29054 this_ptr_conv.is_owned = false;
29055 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29056 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
29060 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_amount_msat(uint32_t this_ptr, int64_t val) {
29061 LDKHTLCOutputInCommitment this_ptr_conv;
29062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29063 this_ptr_conv.is_owned = false;
29064 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29065 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
29068 int32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint32_t this_ptr) {
29069 LDKHTLCOutputInCommitment this_ptr_conv;
29070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29071 this_ptr_conv.is_owned = false;
29072 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29073 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
29077 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
29078 LDKHTLCOutputInCommitment this_ptr_conv;
29079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29080 this_ptr_conv.is_owned = false;
29081 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29082 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
29085 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_payment_hash(uint32_t this_ptr) {
29086 LDKHTLCOutputInCommitment this_ptr_conv;
29087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29088 this_ptr_conv.is_owned = false;
29089 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29090 int8_tArray ret_arr = init_int8_tArray(32);
29091 memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
29095 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
29096 LDKHTLCOutputInCommitment this_ptr_conv;
29097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29098 this_ptr_conv.is_owned = false;
29099 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29100 LDKThirtyTwoBytes val_ref;
29101 CHECK(val->arr_len == 32);
29102 memcpy(val_ref.data, val->elems, 32);
29103 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
29106 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint32_t this_ptr) {
29107 LDKHTLCOutputInCommitment this_ptr_conv;
29108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29109 this_ptr_conv.is_owned = false;
29110 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29111 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
29112 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
29113 uint64_t ret_ref = (uint64_t)ret_copy;
29117 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint32_t this_ptr, uint32_t val) {
29118 LDKHTLCOutputInCommitment this_ptr_conv;
29119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29120 this_ptr_conv.is_owned = false;
29121 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29122 void* val_ptr = (void*)(((uint64_t)val) & ~1);
29123 CHECK_ACCESS(val_ptr);
29124 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
29125 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
29126 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
29129 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) {
29130 LDKThirtyTwoBytes payment_hash_arg_ref;
29131 CHECK(payment_hash_arg->arr_len == 32);
29132 memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32);
29133 void* transaction_output_index_arg_ptr = (void*)(((uint64_t)transaction_output_index_arg) & ~1);
29134 CHECK_ACCESS(transaction_output_index_arg_ptr);
29135 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
29136 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1));
29137 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
29138 uint64_t ret_ref = 0;
29139 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29140 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29141 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29142 ret_ref = (uint64_t)ret_var.inner;
29143 if (ret_var.is_owned) {
29149 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
29150 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
29151 uint64_t ret_ref = 0;
29152 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29153 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29154 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29155 ret_ref = (uint64_t)ret_var.inner;
29156 if (ret_var.is_owned) {
29161 int64_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_clone_ptr(uint32_t arg) {
29162 LDKHTLCOutputInCommitment arg_conv;
29163 arg_conv.inner = (void*)(arg & (~1));
29164 arg_conv.is_owned = false;
29165 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29166 int64_t ret_val = HTLCOutputInCommitment_clone_ptr(&arg_conv);
29170 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_clone(uint32_t orig) {
29171 LDKHTLCOutputInCommitment orig_conv;
29172 orig_conv.inner = (void*)(orig & (~1));
29173 orig_conv.is_owned = false;
29174 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29175 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
29176 uint64_t ret_ref = 0;
29177 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29178 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29179 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29180 ret_ref = (uint64_t)ret_var.inner;
29181 if (ret_var.is_owned) {
29187 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_write(uint32_t obj) {
29188 LDKHTLCOutputInCommitment obj_conv;
29189 obj_conv.inner = (void*)(obj & (~1));
29190 obj_conv.is_owned = false;
29191 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29192 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
29193 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29194 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29195 CVec_u8Z_free(ret_var);
29199 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
29200 LDKu8slice ser_ref;
29201 ser_ref.datalen = ser->arr_len;
29202 ser_ref.data = ser->elems;
29203 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
29204 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
29205 return (uint64_t)ret_conv;
29208 int8_tArray __attribute__((visibility("default"))) TS_get_htlc_redeemscript(uint32_t htlc, jboolean opt_anchors, uint32_t keys) {
29209 LDKHTLCOutputInCommitment htlc_conv;
29210 htlc_conv.inner = (void*)(htlc & (~1));
29211 htlc_conv.is_owned = false;
29212 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
29213 LDKTxCreationKeys keys_conv;
29214 keys_conv.inner = (void*)(keys & (~1));
29215 keys_conv.is_owned = false;
29216 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
29217 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
29218 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29219 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29220 CVec_u8Z_free(ret_var);
29224 int8_tArray __attribute__((visibility("default"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
29225 LDKPublicKey broadcaster_ref;
29226 CHECK(broadcaster->arr_len == 33);
29227 memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33);
29228 LDKPublicKey countersignatory_ref;
29229 CHECK(countersignatory->arr_len == 33);
29230 memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33);
29231 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
29232 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29233 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29234 CVec_u8Z_free(ret_var);
29238 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) {
29239 unsigned char commitment_txid_arr[32];
29240 CHECK(commitment_txid->arr_len == 32);
29241 memcpy(commitment_txid_arr, commitment_txid->elems, 32);
29242 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
29243 LDKHTLCOutputInCommitment htlc_conv;
29244 htlc_conv.inner = (void*)(htlc & (~1));
29245 htlc_conv.is_owned = false;
29246 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
29247 LDKPublicKey broadcaster_delayed_payment_key_ref;
29248 CHECK(broadcaster_delayed_payment_key->arr_len == 33);
29249 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33);
29250 LDKPublicKey revocation_key_ref;
29251 CHECK(revocation_key->arr_len == 33);
29252 memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33);
29253 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);
29254 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29255 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29256 Transaction_free(ret_var);
29260 int8_tArray __attribute__((visibility("default"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
29261 LDKPublicKey funding_pubkey_ref;
29262 CHECK(funding_pubkey->arr_len == 33);
29263 memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33);
29264 LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
29265 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29266 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29267 CVec_u8Z_free(ret_var);
29271 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_free(uint32_t this_obj) {
29272 LDKChannelTransactionParameters this_obj_conv;
29273 this_obj_conv.inner = (void*)(this_obj & (~1));
29274 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29275 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29276 ChannelTransactionParameters_free(this_obj_conv);
29279 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint32_t this_ptr) {
29280 LDKChannelTransactionParameters this_ptr_conv;
29281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29282 this_ptr_conv.is_owned = false;
29283 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29284 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
29285 uint64_t ret_ref = 0;
29286 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29287 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29288 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29289 ret_ref = (uint64_t)ret_var.inner;
29290 if (ret_var.is_owned) {
29296 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint32_t this_ptr, uint32_t val) {
29297 LDKChannelTransactionParameters this_ptr_conv;
29298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29299 this_ptr_conv.is_owned = false;
29300 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29301 LDKChannelPublicKeys val_conv;
29302 val_conv.inner = (void*)(val & (~1));
29303 val_conv.is_owned = (val & 1) || (val == 0);
29304 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29305 val_conv = ChannelPublicKeys_clone(&val_conv);
29306 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
29309 int16_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint32_t this_ptr) {
29310 LDKChannelTransactionParameters this_ptr_conv;
29311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29312 this_ptr_conv.is_owned = false;
29313 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29314 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
29318 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_selected_contest_delay(uint32_t this_ptr, int16_t val) {
29319 LDKChannelTransactionParameters this_ptr_conv;
29320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29321 this_ptr_conv.is_owned = false;
29322 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29323 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
29326 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint32_t this_ptr) {
29327 LDKChannelTransactionParameters this_ptr_conv;
29328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29329 this_ptr_conv.is_owned = false;
29330 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29331 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
29335 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint32_t this_ptr, jboolean val) {
29336 LDKChannelTransactionParameters this_ptr_conv;
29337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29338 this_ptr_conv.is_owned = false;
29339 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29340 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
29343 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint32_t this_ptr) {
29344 LDKChannelTransactionParameters this_ptr_conv;
29345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29346 this_ptr_conv.is_owned = false;
29347 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29348 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
29349 uint64_t ret_ref = 0;
29350 if ((uint64_t)ret_var.inner > 4096) {
29351 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29352 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29353 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29354 ret_ref = (uint64_t)ret_var.inner;
29355 if (ret_var.is_owned) {
29362 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint32_t this_ptr, uint32_t val) {
29363 LDKChannelTransactionParameters this_ptr_conv;
29364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29365 this_ptr_conv.is_owned = false;
29366 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29367 LDKCounterpartyChannelTransactionParameters val_conv;
29368 val_conv.inner = (void*)(val & (~1));
29369 val_conv.is_owned = (val & 1) || (val == 0);
29370 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29371 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
29372 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
29375 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint32_t this_ptr) {
29376 LDKChannelTransactionParameters this_ptr_conv;
29377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29378 this_ptr_conv.is_owned = false;
29379 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29380 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
29381 uint64_t ret_ref = 0;
29382 if ((uint64_t)ret_var.inner > 4096) {
29383 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29384 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29385 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29386 ret_ref = (uint64_t)ret_var.inner;
29387 if (ret_var.is_owned) {
29394 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint32_t this_ptr, uint32_t val) {
29395 LDKChannelTransactionParameters this_ptr_conv;
29396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29397 this_ptr_conv.is_owned = false;
29398 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29399 LDKOutPoint val_conv;
29400 val_conv.inner = (void*)(val & (~1));
29401 val_conv.is_owned = (val & 1) || (val == 0);
29402 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29403 val_conv = OutPoint_clone(&val_conv);
29404 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
29407 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_opt_anchors(uint32_t this_ptr) {
29408 LDKChannelTransactionParameters this_ptr_conv;
29409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29410 this_ptr_conv.is_owned = false;
29411 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29412 uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
29416 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_opt_anchors(uint32_t this_ptr, uint32_t val) {
29417 LDKChannelTransactionParameters this_ptr_conv;
29418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29419 this_ptr_conv.is_owned = false;
29420 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29421 LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
29422 ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
29425 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) {
29426 LDKChannelPublicKeys holder_pubkeys_arg_conv;
29427 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
29428 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
29429 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
29430 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
29431 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
29432 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
29433 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
29434 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
29435 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
29436 LDKOutPoint funding_outpoint_arg_conv;
29437 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
29438 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
29439 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
29440 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
29441 LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_anchors_arg);
29442 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);
29443 uint64_t ret_ref = 0;
29444 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29445 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29446 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29447 ret_ref = (uint64_t)ret_var.inner;
29448 if (ret_var.is_owned) {
29454 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
29455 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
29456 uint64_t ret_ref = 0;
29457 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29458 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29459 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29460 ret_ref = (uint64_t)ret_var.inner;
29461 if (ret_var.is_owned) {
29466 int64_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_clone_ptr(uint32_t arg) {
29467 LDKChannelTransactionParameters arg_conv;
29468 arg_conv.inner = (void*)(arg & (~1));
29469 arg_conv.is_owned = false;
29470 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29471 int64_t ret_val = ChannelTransactionParameters_clone_ptr(&arg_conv);
29475 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_clone(uint32_t orig) {
29476 LDKChannelTransactionParameters orig_conv;
29477 orig_conv.inner = (void*)(orig & (~1));
29478 orig_conv.is_owned = false;
29479 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29480 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
29481 uint64_t ret_ref = 0;
29482 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29483 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29484 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29485 ret_ref = (uint64_t)ret_var.inner;
29486 if (ret_var.is_owned) {
29492 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_free(uint32_t this_obj) {
29493 LDKCounterpartyChannelTransactionParameters this_obj_conv;
29494 this_obj_conv.inner = (void*)(this_obj & (~1));
29495 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29496 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29497 CounterpartyChannelTransactionParameters_free(this_obj_conv);
29500 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint32_t this_ptr) {
29501 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
29502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29503 this_ptr_conv.is_owned = false;
29504 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29505 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
29506 uint64_t ret_ref = 0;
29507 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29508 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29509 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29510 ret_ref = (uint64_t)ret_var.inner;
29511 if (ret_var.is_owned) {
29517 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint32_t this_ptr, uint32_t val) {
29518 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
29519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29520 this_ptr_conv.is_owned = false;
29521 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29522 LDKChannelPublicKeys val_conv;
29523 val_conv.inner = (void*)(val & (~1));
29524 val_conv.is_owned = (val & 1) || (val == 0);
29525 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29526 val_conv = ChannelPublicKeys_clone(&val_conv);
29527 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
29530 int16_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint32_t this_ptr) {
29531 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
29532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29533 this_ptr_conv.is_owned = false;
29534 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29535 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
29539 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint32_t this_ptr, int16_t val) {
29540 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
29541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29542 this_ptr_conv.is_owned = false;
29543 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29544 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
29547 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_new(uint32_t pubkeys_arg, int16_t selected_contest_delay_arg) {
29548 LDKChannelPublicKeys pubkeys_arg_conv;
29549 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
29550 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
29551 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
29552 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
29553 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
29554 uint64_t ret_ref = 0;
29555 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29556 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29557 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29558 ret_ref = (uint64_t)ret_var.inner;
29559 if (ret_var.is_owned) {
29565 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
29566 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
29567 uint64_t ret_ref = 0;
29568 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29569 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29570 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29571 ret_ref = (uint64_t)ret_var.inner;
29572 if (ret_var.is_owned) {
29577 int64_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint32_t arg) {
29578 LDKCounterpartyChannelTransactionParameters arg_conv;
29579 arg_conv.inner = (void*)(arg & (~1));
29580 arg_conv.is_owned = false;
29581 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29582 int64_t ret_val = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
29586 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_clone(uint32_t orig) {
29587 LDKCounterpartyChannelTransactionParameters orig_conv;
29588 orig_conv.inner = (void*)(orig & (~1));
29589 orig_conv.is_owned = false;
29590 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29591 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
29592 uint64_t ret_ref = 0;
29593 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29594 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29595 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29596 ret_ref = (uint64_t)ret_var.inner;
29597 if (ret_var.is_owned) {
29603 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_is_populated(uint32_t this_arg) {
29604 LDKChannelTransactionParameters this_arg_conv;
29605 this_arg_conv.inner = (void*)(this_arg & (~1));
29606 this_arg_conv.is_owned = false;
29607 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29608 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
29612 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint32_t this_arg) {
29613 LDKChannelTransactionParameters this_arg_conv;
29614 this_arg_conv.inner = (void*)(this_arg & (~1));
29615 this_arg_conv.is_owned = false;
29616 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29617 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
29618 uint64_t ret_ref = 0;
29619 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29620 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29621 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29622 ret_ref = (uint64_t)ret_var.inner;
29623 if (ret_var.is_owned) {
29629 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint32_t this_arg) {
29630 LDKChannelTransactionParameters this_arg_conv;
29631 this_arg_conv.inner = (void*)(this_arg & (~1));
29632 this_arg_conv.is_owned = false;
29633 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29634 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
29635 uint64_t ret_ref = 0;
29636 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29637 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29638 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29639 ret_ref = (uint64_t)ret_var.inner;
29640 if (ret_var.is_owned) {
29646 int8_tArray __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_write(uint32_t obj) {
29647 LDKCounterpartyChannelTransactionParameters obj_conv;
29648 obj_conv.inner = (void*)(obj & (~1));
29649 obj_conv.is_owned = false;
29650 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29651 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
29652 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29653 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29654 CVec_u8Z_free(ret_var);
29658 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
29659 LDKu8slice ser_ref;
29660 ser_ref.datalen = ser->arr_len;
29661 ser_ref.data = ser->elems;
29662 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
29663 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
29664 return (uint64_t)ret_conv;
29667 int8_tArray __attribute__((visibility("default"))) TS_ChannelTransactionParameters_write(uint32_t obj) {
29668 LDKChannelTransactionParameters obj_conv;
29669 obj_conv.inner = (void*)(obj & (~1));
29670 obj_conv.is_owned = false;
29671 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29672 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
29673 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29674 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29675 CVec_u8Z_free(ret_var);
29679 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
29680 LDKu8slice ser_ref;
29681 ser_ref.datalen = ser->arr_len;
29682 ser_ref.data = ser->elems;
29683 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
29684 *ret_conv = ChannelTransactionParameters_read(ser_ref);
29685 return (uint64_t)ret_conv;
29688 void __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_free(uint32_t this_obj) {
29689 LDKDirectedChannelTransactionParameters this_obj_conv;
29690 this_obj_conv.inner = (void*)(this_obj & (~1));
29691 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29692 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29693 DirectedChannelTransactionParameters_free(this_obj_conv);
29696 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint32_t this_arg) {
29697 LDKDirectedChannelTransactionParameters this_arg_conv;
29698 this_arg_conv.inner = (void*)(this_arg & (~1));
29699 this_arg_conv.is_owned = false;
29700 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29701 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
29702 uint64_t ret_ref = 0;
29703 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29704 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29705 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29706 ret_ref = (uint64_t)ret_var.inner;
29707 if (ret_var.is_owned) {
29713 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint32_t this_arg) {
29714 LDKDirectedChannelTransactionParameters this_arg_conv;
29715 this_arg_conv.inner = (void*)(this_arg & (~1));
29716 this_arg_conv.is_owned = false;
29717 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29718 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
29719 uint64_t ret_ref = 0;
29720 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29721 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29722 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29723 ret_ref = (uint64_t)ret_var.inner;
29724 if (ret_var.is_owned) {
29730 int16_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_contest_delay(uint32_t this_arg) {
29731 LDKDirectedChannelTransactionParameters this_arg_conv;
29732 this_arg_conv.inner = (void*)(this_arg & (~1));
29733 this_arg_conv.is_owned = false;
29734 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29735 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
29739 jboolean __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_is_outbound(uint32_t this_arg) {
29740 LDKDirectedChannelTransactionParameters this_arg_conv;
29741 this_arg_conv.inner = (void*)(this_arg & (~1));
29742 this_arg_conv.is_owned = false;
29743 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29744 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
29748 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint32_t this_arg) {
29749 LDKDirectedChannelTransactionParameters this_arg_conv;
29750 this_arg_conv.inner = (void*)(this_arg & (~1));
29751 this_arg_conv.is_owned = false;
29752 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29753 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
29754 uint64_t ret_ref = 0;
29755 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29756 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29757 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29758 ret_ref = (uint64_t)ret_var.inner;
29759 if (ret_var.is_owned) {
29765 jboolean __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_opt_anchors(uint32_t this_arg) {
29766 LDKDirectedChannelTransactionParameters this_arg_conv;
29767 this_arg_conv.inner = (void*)(this_arg & (~1));
29768 this_arg_conv.is_owned = false;
29769 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29770 jboolean ret_val = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
29774 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_free(uint32_t this_obj) {
29775 LDKHolderCommitmentTransaction this_obj_conv;
29776 this_obj_conv.inner = (void*)(this_obj & (~1));
29777 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29778 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29779 HolderCommitmentTransaction_free(this_obj_conv);
29782 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint32_t this_ptr) {
29783 LDKHolderCommitmentTransaction this_ptr_conv;
29784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29785 this_ptr_conv.is_owned = false;
29786 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29787 int8_tArray ret_arr = init_int8_tArray(64);
29788 memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
29792 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint32_t this_ptr, int8_tArray val) {
29793 LDKHolderCommitmentTransaction this_ptr_conv;
29794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29795 this_ptr_conv.is_owned = false;
29796 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29797 LDKSignature val_ref;
29798 CHECK(val->arr_len == 64);
29799 memcpy(val_ref.compact_form, val->elems, 64);
29800 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
29803 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint32_t this_ptr, ptrArray val) {
29804 LDKHolderCommitmentTransaction this_ptr_conv;
29805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29806 this_ptr_conv.is_owned = false;
29807 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29808 LDKCVec_SignatureZ val_constr;
29809 val_constr.datalen = val->arr_len;
29810 if (val_constr.datalen > 0)
29811 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
29813 val_constr.data = NULL;
29814 int8_tArray* val_vals = (void*) val->elems;
29815 for (size_t m = 0; m < val_constr.datalen; m++) {
29816 int8_tArray val_conv_12 = val_vals[m];
29817 LDKSignature val_conv_12_ref;
29818 CHECK(val_conv_12->arr_len == 64);
29819 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64);
29820 val_constr.data[m] = val_conv_12_ref;
29822 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
29825 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
29826 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
29827 uint64_t ret_ref = 0;
29828 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29829 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29830 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29831 ret_ref = (uint64_t)ret_var.inner;
29832 if (ret_var.is_owned) {
29837 int64_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_clone_ptr(uint32_t arg) {
29838 LDKHolderCommitmentTransaction arg_conv;
29839 arg_conv.inner = (void*)(arg & (~1));
29840 arg_conv.is_owned = false;
29841 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29842 int64_t ret_val = HolderCommitmentTransaction_clone_ptr(&arg_conv);
29846 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_clone(uint32_t orig) {
29847 LDKHolderCommitmentTransaction orig_conv;
29848 orig_conv.inner = (void*)(orig & (~1));
29849 orig_conv.is_owned = false;
29850 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29851 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
29852 uint64_t ret_ref = 0;
29853 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29854 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29855 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29856 ret_ref = (uint64_t)ret_var.inner;
29857 if (ret_var.is_owned) {
29863 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_write(uint32_t obj) {
29864 LDKHolderCommitmentTransaction obj_conv;
29865 obj_conv.inner = (void*)(obj & (~1));
29866 obj_conv.is_owned = false;
29867 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29868 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
29869 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29870 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29871 CVec_u8Z_free(ret_var);
29875 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
29876 LDKu8slice ser_ref;
29877 ser_ref.datalen = ser->arr_len;
29878 ser_ref.data = ser->elems;
29879 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
29880 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
29881 return (uint64_t)ret_conv;
29884 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) {
29885 LDKCommitmentTransaction commitment_tx_conv;
29886 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
29887 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
29888 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
29889 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
29890 LDKSignature counterparty_sig_ref;
29891 CHECK(counterparty_sig->arr_len == 64);
29892 memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64);
29893 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
29894 counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
29895 if (counterparty_htlc_sigs_constr.datalen > 0)
29896 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
29898 counterparty_htlc_sigs_constr.data = NULL;
29899 int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
29900 for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
29901 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
29902 LDKSignature counterparty_htlc_sigs_conv_12_ref;
29903 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
29904 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64);
29905 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
29907 LDKPublicKey holder_funding_key_ref;
29908 CHECK(holder_funding_key->arr_len == 33);
29909 memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33);
29910 LDKPublicKey counterparty_funding_key_ref;
29911 CHECK(counterparty_funding_key->arr_len == 33);
29912 memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33);
29913 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
29914 uint64_t ret_ref = 0;
29915 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29916 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29917 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29918 ret_ref = (uint64_t)ret_var.inner;
29919 if (ret_var.is_owned) {
29925 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_free(uint32_t this_obj) {
29926 LDKBuiltCommitmentTransaction this_obj_conv;
29927 this_obj_conv.inner = (void*)(this_obj & (~1));
29928 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29929 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29930 BuiltCommitmentTransaction_free(this_obj_conv);
29933 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_transaction(uint32_t this_ptr) {
29934 LDKBuiltCommitmentTransaction this_ptr_conv;
29935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29936 this_ptr_conv.is_owned = false;
29937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29938 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
29939 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
29940 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29941 Transaction_free(ret_var);
29945 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_transaction(uint32_t this_ptr, int8_tArray val) {
29946 LDKBuiltCommitmentTransaction this_ptr_conv;
29947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29948 this_ptr_conv.is_owned = false;
29949 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29950 LDKTransaction val_ref;
29951 val_ref.datalen = val->arr_len;
29952 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
29953 memcpy(val_ref.data, val->elems, val_ref.datalen);
29954 val_ref.data_is_owned = true;
29955 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
29958 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_txid(uint32_t this_ptr) {
29959 LDKBuiltCommitmentTransaction this_ptr_conv;
29960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29961 this_ptr_conv.is_owned = false;
29962 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29963 int8_tArray ret_arr = init_int8_tArray(32);
29964 memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
29968 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_txid(uint32_t this_ptr, int8_tArray val) {
29969 LDKBuiltCommitmentTransaction this_ptr_conv;
29970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29971 this_ptr_conv.is_owned = false;
29972 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29973 LDKThirtyTwoBytes val_ref;
29974 CHECK(val->arr_len == 32);
29975 memcpy(val_ref.data, val->elems, 32);
29976 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
29979 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
29980 LDKTransaction transaction_arg_ref;
29981 transaction_arg_ref.datalen = transaction_arg->arr_len;
29982 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
29983 memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen);
29984 transaction_arg_ref.data_is_owned = true;
29985 LDKThirtyTwoBytes txid_arg_ref;
29986 CHECK(txid_arg->arr_len == 32);
29987 memcpy(txid_arg_ref.data, txid_arg->elems, 32);
29988 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
29989 uint64_t ret_ref = 0;
29990 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29991 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29992 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29993 ret_ref = (uint64_t)ret_var.inner;
29994 if (ret_var.is_owned) {
30000 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
30001 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
30002 uint64_t ret_ref = 0;
30003 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30004 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30005 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30006 ret_ref = (uint64_t)ret_var.inner;
30007 if (ret_var.is_owned) {
30012 int64_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_clone_ptr(uint32_t arg) {
30013 LDKBuiltCommitmentTransaction arg_conv;
30014 arg_conv.inner = (void*)(arg & (~1));
30015 arg_conv.is_owned = false;
30016 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30017 int64_t ret_val = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
30021 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_clone(uint32_t orig) {
30022 LDKBuiltCommitmentTransaction orig_conv;
30023 orig_conv.inner = (void*)(orig & (~1));
30024 orig_conv.is_owned = false;
30025 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30026 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
30027 uint64_t ret_ref = 0;
30028 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30029 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30030 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30031 ret_ref = (uint64_t)ret_var.inner;
30032 if (ret_var.is_owned) {
30038 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_write(uint32_t obj) {
30039 LDKBuiltCommitmentTransaction obj_conv;
30040 obj_conv.inner = (void*)(obj & (~1));
30041 obj_conv.is_owned = false;
30042 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30043 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
30044 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
30045 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30046 CVec_u8Z_free(ret_var);
30050 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
30051 LDKu8slice ser_ref;
30052 ser_ref.datalen = ser->arr_len;
30053 ser_ref.data = ser->elems;
30054 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
30055 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
30056 return (uint64_t)ret_conv;
30059 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
30060 LDKBuiltCommitmentTransaction this_arg_conv;
30061 this_arg_conv.inner = (void*)(this_arg & (~1));
30062 this_arg_conv.is_owned = false;
30063 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30064 LDKu8slice funding_redeemscript_ref;
30065 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
30066 funding_redeemscript_ref.data = funding_redeemscript->elems;
30067 int8_tArray ret_arr = init_int8_tArray(32);
30068 memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
30072 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) {
30073 LDKBuiltCommitmentTransaction this_arg_conv;
30074 this_arg_conv.inner = (void*)(this_arg & (~1));
30075 this_arg_conv.is_owned = false;
30076 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30077 unsigned char funding_key_arr[32];
30078 CHECK(funding_key->arr_len == 32);
30079 memcpy(funding_key_arr, funding_key->elems, 32);
30080 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
30081 LDKu8slice funding_redeemscript_ref;
30082 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
30083 funding_redeemscript_ref.data = funding_redeemscript->elems;
30084 int8_tArray ret_arr = init_int8_tArray(64);
30085 memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
30089 void __attribute__((visibility("default"))) TS_ClosingTransaction_free(uint32_t this_obj) {
30090 LDKClosingTransaction this_obj_conv;
30091 this_obj_conv.inner = (void*)(this_obj & (~1));
30092 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30093 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30094 ClosingTransaction_free(this_obj_conv);
30097 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
30098 LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
30099 uint64_t ret_ref = 0;
30100 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30101 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30102 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30103 ret_ref = (uint64_t)ret_var.inner;
30104 if (ret_var.is_owned) {
30109 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_clone_ptr(uint32_t arg) {
30110 LDKClosingTransaction arg_conv;
30111 arg_conv.inner = (void*)(arg & (~1));
30112 arg_conv.is_owned = false;
30113 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30114 int64_t ret_val = ClosingTransaction_clone_ptr(&arg_conv);
30118 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_clone(uint32_t orig) {
30119 LDKClosingTransaction orig_conv;
30120 orig_conv.inner = (void*)(orig & (~1));
30121 orig_conv.is_owned = false;
30122 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30123 LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
30124 uint64_t ret_ref = 0;
30125 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30126 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30127 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30128 ret_ref = (uint64_t)ret_var.inner;
30129 if (ret_var.is_owned) {
30135 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_hash(uint32_t o) {
30136 LDKClosingTransaction o_conv;
30137 o_conv.inner = (void*)(o & (~1));
30138 o_conv.is_owned = false;
30139 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30140 int64_t ret_val = ClosingTransaction_hash(&o_conv);
30144 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) {
30145 LDKCVec_u8Z to_holder_script_ref;
30146 to_holder_script_ref.datalen = to_holder_script->arr_len;
30147 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
30148 memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen);
30149 LDKCVec_u8Z to_counterparty_script_ref;
30150 to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
30151 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
30152 memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen);
30153 LDKOutPoint funding_outpoint_conv;
30154 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
30155 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
30156 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
30157 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
30158 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
30159 uint64_t ret_ref = 0;
30160 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30161 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30162 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30163 ret_ref = (uint64_t)ret_var.inner;
30164 if (ret_var.is_owned) {
30170 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_trust(uint32_t this_arg) {
30171 LDKClosingTransaction this_arg_conv;
30172 this_arg_conv.inner = (void*)(this_arg & (~1));
30173 this_arg_conv.is_owned = false;
30174 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30175 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
30176 uint64_t ret_ref = 0;
30177 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30178 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30179 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30180 ret_ref = (uint64_t)ret_var.inner;
30181 if (ret_var.is_owned) {
30187 uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_verify(uint32_t this_arg, uint32_t funding_outpoint) {
30188 LDKClosingTransaction this_arg_conv;
30189 this_arg_conv.inner = (void*)(this_arg & (~1));
30190 this_arg_conv.is_owned = false;
30191 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30192 LDKOutPoint funding_outpoint_conv;
30193 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
30194 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
30195 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
30196 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
30197 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
30198 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
30199 return (uint64_t)ret_conv;
30202 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_to_holder_value_sat(uint32_t this_arg) {
30203 LDKClosingTransaction this_arg_conv;
30204 this_arg_conv.inner = (void*)(this_arg & (~1));
30205 this_arg_conv.is_owned = false;
30206 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30207 int64_t ret_val = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
30211 int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_to_counterparty_value_sat(uint32_t this_arg) {
30212 LDKClosingTransaction this_arg_conv;
30213 this_arg_conv.inner = (void*)(this_arg & (~1));
30214 this_arg_conv.is_owned = false;
30215 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30216 int64_t ret_val = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
30220 int8_tArray __attribute__((visibility("default"))) TS_ClosingTransaction_to_holder_script(uint32_t this_arg) {
30221 LDKClosingTransaction this_arg_conv;
30222 this_arg_conv.inner = (void*)(this_arg & (~1));
30223 this_arg_conv.is_owned = false;
30224 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30225 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
30226 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
30227 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30231 int8_tArray __attribute__((visibility("default"))) TS_ClosingTransaction_to_counterparty_script(uint32_t this_arg) {
30232 LDKClosingTransaction this_arg_conv;
30233 this_arg_conv.inner = (void*)(this_arg & (~1));
30234 this_arg_conv.is_owned = false;
30235 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30236 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
30237 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
30238 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30242 void __attribute__((visibility("default"))) TS_TrustedClosingTransaction_free(uint32_t this_obj) {
30243 LDKTrustedClosingTransaction this_obj_conv;
30244 this_obj_conv.inner = (void*)(this_obj & (~1));
30245 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30246 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30247 TrustedClosingTransaction_free(this_obj_conv);
30250 int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_built_transaction(uint32_t this_arg) {
30251 LDKTrustedClosingTransaction this_arg_conv;
30252 this_arg_conv.inner = (void*)(this_arg & (~1));
30253 this_arg_conv.is_owned = false;
30254 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30255 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
30256 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
30257 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30258 Transaction_free(ret_var);
30262 int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
30263 LDKTrustedClosingTransaction this_arg_conv;
30264 this_arg_conv.inner = (void*)(this_arg & (~1));
30265 this_arg_conv.is_owned = false;
30266 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30267 LDKu8slice funding_redeemscript_ref;
30268 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
30269 funding_redeemscript_ref.data = funding_redeemscript->elems;
30270 int8_tArray ret_arr = init_int8_tArray(32);
30271 memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
30275 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) {
30276 LDKTrustedClosingTransaction this_arg_conv;
30277 this_arg_conv.inner = (void*)(this_arg & (~1));
30278 this_arg_conv.is_owned = false;
30279 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30280 unsigned char funding_key_arr[32];
30281 CHECK(funding_key->arr_len == 32);
30282 memcpy(funding_key_arr, funding_key->elems, 32);
30283 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
30284 LDKu8slice funding_redeemscript_ref;
30285 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
30286 funding_redeemscript_ref.data = funding_redeemscript->elems;
30287 int8_tArray ret_arr = init_int8_tArray(64);
30288 memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
30292 void __attribute__((visibility("default"))) TS_CommitmentTransaction_free(uint32_t this_obj) {
30293 LDKCommitmentTransaction this_obj_conv;
30294 this_obj_conv.inner = (void*)(this_obj & (~1));
30295 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30296 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30297 CommitmentTransaction_free(this_obj_conv);
30300 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
30301 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
30302 uint64_t ret_ref = 0;
30303 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30304 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30305 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30306 ret_ref = (uint64_t)ret_var.inner;
30307 if (ret_var.is_owned) {
30312 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_clone_ptr(uint32_t arg) {
30313 LDKCommitmentTransaction arg_conv;
30314 arg_conv.inner = (void*)(arg & (~1));
30315 arg_conv.is_owned = false;
30316 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30317 int64_t ret_val = CommitmentTransaction_clone_ptr(&arg_conv);
30321 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_clone(uint32_t orig) {
30322 LDKCommitmentTransaction orig_conv;
30323 orig_conv.inner = (void*)(orig & (~1));
30324 orig_conv.is_owned = false;
30325 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30326 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
30327 uint64_t ret_ref = 0;
30328 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30329 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30330 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30331 ret_ref = (uint64_t)ret_var.inner;
30332 if (ret_var.is_owned) {
30338 int8_tArray __attribute__((visibility("default"))) TS_CommitmentTransaction_write(uint32_t obj) {
30339 LDKCommitmentTransaction obj_conv;
30340 obj_conv.inner = (void*)(obj & (~1));
30341 obj_conv.is_owned = false;
30342 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30343 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
30344 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
30345 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30346 CVec_u8Z_free(ret_var);
30350 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_read(int8_tArray ser) {
30351 LDKu8slice ser_ref;
30352 ser_ref.datalen = ser->arr_len;
30353 ser_ref.data = ser->elems;
30354 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
30355 *ret_conv = CommitmentTransaction_read(ser_ref);
30356 return (uint64_t)ret_conv;
30359 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_commitment_number(uint32_t this_arg) {
30360 LDKCommitmentTransaction this_arg_conv;
30361 this_arg_conv.inner = (void*)(this_arg & (~1));
30362 this_arg_conv.is_owned = false;
30363 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30364 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
30368 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint32_t this_arg) {
30369 LDKCommitmentTransaction this_arg_conv;
30370 this_arg_conv.inner = (void*)(this_arg & (~1));
30371 this_arg_conv.is_owned = false;
30372 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30373 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
30377 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint32_t this_arg) {
30378 LDKCommitmentTransaction this_arg_conv;
30379 this_arg_conv.inner = (void*)(this_arg & (~1));
30380 this_arg_conv.is_owned = false;
30381 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30382 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
30386 int32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_feerate_per_kw(uint32_t this_arg) {
30387 LDKCommitmentTransaction this_arg_conv;
30388 this_arg_conv.inner = (void*)(this_arg & (~1));
30389 this_arg_conv.is_owned = false;
30390 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30391 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
30395 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_trust(uint32_t this_arg) {
30396 LDKCommitmentTransaction this_arg_conv;
30397 this_arg_conv.inner = (void*)(this_arg & (~1));
30398 this_arg_conv.is_owned = false;
30399 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30400 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
30401 uint64_t ret_ref = 0;
30402 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30403 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30404 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30405 ret_ref = (uint64_t)ret_var.inner;
30406 if (ret_var.is_owned) {
30412 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_verify(uint32_t this_arg, uint32_t channel_parameters, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
30413 LDKCommitmentTransaction this_arg_conv;
30414 this_arg_conv.inner = (void*)(this_arg & (~1));
30415 this_arg_conv.is_owned = false;
30416 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30417 LDKDirectedChannelTransactionParameters channel_parameters_conv;
30418 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
30419 channel_parameters_conv.is_owned = false;
30420 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
30421 LDKChannelPublicKeys broadcaster_keys_conv;
30422 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
30423 broadcaster_keys_conv.is_owned = false;
30424 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
30425 LDKChannelPublicKeys countersignatory_keys_conv;
30426 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
30427 countersignatory_keys_conv.is_owned = false;
30428 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
30429 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
30430 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
30431 return (uint64_t)ret_conv;
30434 void __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_free(uint32_t this_obj) {
30435 LDKTrustedCommitmentTransaction this_obj_conv;
30436 this_obj_conv.inner = (void*)(this_obj & (~1));
30437 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30438 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30439 TrustedCommitmentTransaction_free(this_obj_conv);
30442 int8_tArray __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_txid(uint32_t this_arg) {
30443 LDKTrustedCommitmentTransaction this_arg_conv;
30444 this_arg_conv.inner = (void*)(this_arg & (~1));
30445 this_arg_conv.is_owned = false;
30446 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30447 int8_tArray ret_arr = init_int8_tArray(32);
30448 memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
30452 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_built_transaction(uint32_t this_arg) {
30453 LDKTrustedCommitmentTransaction this_arg_conv;
30454 this_arg_conv.inner = (void*)(this_arg & (~1));
30455 this_arg_conv.is_owned = false;
30456 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30457 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
30458 uint64_t ret_ref = 0;
30459 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30460 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30461 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30462 ret_ref = (uint64_t)ret_var.inner;
30463 if (ret_var.is_owned) {
30469 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_keys(uint32_t this_arg) {
30470 LDKTrustedCommitmentTransaction this_arg_conv;
30471 this_arg_conv.inner = (void*)(this_arg & (~1));
30472 this_arg_conv.is_owned = false;
30473 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30474 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
30475 uint64_t ret_ref = 0;
30476 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30477 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30478 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30479 ret_ref = (uint64_t)ret_var.inner;
30480 if (ret_var.is_owned) {
30486 jboolean __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_opt_anchors(uint32_t this_arg) {
30487 LDKTrustedCommitmentTransaction this_arg_conv;
30488 this_arg_conv.inner = (void*)(this_arg & (~1));
30489 this_arg_conv.is_owned = false;
30490 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30491 jboolean ret_val = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
30495 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_get_htlc_sigs(uint32_t this_arg, int8_tArray htlc_base_key, uint32_t channel_parameters) {
30496 LDKTrustedCommitmentTransaction this_arg_conv;
30497 this_arg_conv.inner = (void*)(this_arg & (~1));
30498 this_arg_conv.is_owned = false;
30499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30500 unsigned char htlc_base_key_arr[32];
30501 CHECK(htlc_base_key->arr_len == 32);
30502 memcpy(htlc_base_key_arr, htlc_base_key->elems, 32);
30503 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
30504 LDKDirectedChannelTransactionParameters channel_parameters_conv;
30505 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
30506 channel_parameters_conv.is_owned = false;
30507 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
30508 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
30509 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
30510 return (uint64_t)ret_conv;
30513 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) {
30514 LDKPublicKey broadcaster_payment_basepoint_ref;
30515 CHECK(broadcaster_payment_basepoint->arr_len == 33);
30516 memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33);
30517 LDKPublicKey countersignatory_payment_basepoint_ref;
30518 CHECK(countersignatory_payment_basepoint->arr_len == 33);
30519 memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33);
30520 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
30524 jboolean __attribute__((visibility("default"))) TS_InitFeatures_eq(uint32_t a, uint32_t b) {
30525 LDKInitFeatures a_conv;
30526 a_conv.inner = (void*)(a & (~1));
30527 a_conv.is_owned = false;
30528 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30529 LDKInitFeatures b_conv;
30530 b_conv.inner = (void*)(b & (~1));
30531 b_conv.is_owned = false;
30532 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30533 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
30537 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_eq(uint32_t a, uint32_t b) {
30538 LDKNodeFeatures a_conv;
30539 a_conv.inner = (void*)(a & (~1));
30540 a_conv.is_owned = false;
30541 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30542 LDKNodeFeatures b_conv;
30543 b_conv.inner = (void*)(b & (~1));
30544 b_conv.is_owned = false;
30545 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30546 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
30550 jboolean __attribute__((visibility("default"))) TS_ChannelFeatures_eq(uint32_t a, uint32_t b) {
30551 LDKChannelFeatures a_conv;
30552 a_conv.inner = (void*)(a & (~1));
30553 a_conv.is_owned = false;
30554 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30555 LDKChannelFeatures b_conv;
30556 b_conv.inner = (void*)(b & (~1));
30557 b_conv.is_owned = false;
30558 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30559 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
30563 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_eq(uint32_t a, uint32_t b) {
30564 LDKInvoiceFeatures a_conv;
30565 a_conv.inner = (void*)(a & (~1));
30566 a_conv.is_owned = false;
30567 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30568 LDKInvoiceFeatures b_conv;
30569 b_conv.inner = (void*)(b & (~1));
30570 b_conv.is_owned = false;
30571 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30572 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
30576 jboolean __attribute__((visibility("default"))) TS_ChannelTypeFeatures_eq(uint32_t a, uint32_t b) {
30577 LDKChannelTypeFeatures a_conv;
30578 a_conv.inner = (void*)(a & (~1));
30579 a_conv.is_owned = false;
30580 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30581 LDKChannelTypeFeatures b_conv;
30582 b_conv.inner = (void*)(b & (~1));
30583 b_conv.is_owned = false;
30584 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30585 jboolean ret_val = ChannelTypeFeatures_eq(&a_conv, &b_conv);
30589 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
30590 LDKInitFeatures ret_var = InitFeatures_clone(arg);
30591 uint64_t ret_ref = 0;
30592 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30593 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30594 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30595 ret_ref = (uint64_t)ret_var.inner;
30596 if (ret_var.is_owned) {
30601 int64_t __attribute__((visibility("default"))) TS_InitFeatures_clone_ptr(uint32_t arg) {
30602 LDKInitFeatures arg_conv;
30603 arg_conv.inner = (void*)(arg & (~1));
30604 arg_conv.is_owned = false;
30605 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30606 int64_t ret_val = InitFeatures_clone_ptr(&arg_conv);
30610 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_clone(uint32_t orig) {
30611 LDKInitFeatures orig_conv;
30612 orig_conv.inner = (void*)(orig & (~1));
30613 orig_conv.is_owned = false;
30614 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30615 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
30616 uint64_t ret_ref = 0;
30617 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30618 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30619 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30620 ret_ref = (uint64_t)ret_var.inner;
30621 if (ret_var.is_owned) {
30627 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
30628 LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
30629 uint64_t ret_ref = 0;
30630 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30631 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30632 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30633 ret_ref = (uint64_t)ret_var.inner;
30634 if (ret_var.is_owned) {
30639 int64_t __attribute__((visibility("default"))) TS_NodeFeatures_clone_ptr(uint32_t arg) {
30640 LDKNodeFeatures arg_conv;
30641 arg_conv.inner = (void*)(arg & (~1));
30642 arg_conv.is_owned = false;
30643 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30644 int64_t ret_val = NodeFeatures_clone_ptr(&arg_conv);
30648 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_clone(uint32_t orig) {
30649 LDKNodeFeatures orig_conv;
30650 orig_conv.inner = (void*)(orig & (~1));
30651 orig_conv.is_owned = false;
30652 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30653 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
30654 uint64_t ret_ref = 0;
30655 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30656 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30657 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30658 ret_ref = (uint64_t)ret_var.inner;
30659 if (ret_var.is_owned) {
30665 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
30666 LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
30667 uint64_t ret_ref = 0;
30668 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30669 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30670 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30671 ret_ref = (uint64_t)ret_var.inner;
30672 if (ret_var.is_owned) {
30677 int64_t __attribute__((visibility("default"))) TS_ChannelFeatures_clone_ptr(uint32_t arg) {
30678 LDKChannelFeatures arg_conv;
30679 arg_conv.inner = (void*)(arg & (~1));
30680 arg_conv.is_owned = false;
30681 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30682 int64_t ret_val = ChannelFeatures_clone_ptr(&arg_conv);
30686 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_clone(uint32_t orig) {
30687 LDKChannelFeatures orig_conv;
30688 orig_conv.inner = (void*)(orig & (~1));
30689 orig_conv.is_owned = false;
30690 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30691 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
30692 uint64_t ret_ref = 0;
30693 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30694 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30695 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30696 ret_ref = (uint64_t)ret_var.inner;
30697 if (ret_var.is_owned) {
30703 static inline uint64_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
30704 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
30705 uint64_t ret_ref = 0;
30706 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30707 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30708 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30709 ret_ref = (uint64_t)ret_var.inner;
30710 if (ret_var.is_owned) {
30715 int64_t __attribute__((visibility("default"))) TS_InvoiceFeatures_clone_ptr(uint32_t arg) {
30716 LDKInvoiceFeatures arg_conv;
30717 arg_conv.inner = (void*)(arg & (~1));
30718 arg_conv.is_owned = false;
30719 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30720 int64_t ret_val = InvoiceFeatures_clone_ptr(&arg_conv);
30724 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_clone(uint32_t orig) {
30725 LDKInvoiceFeatures orig_conv;
30726 orig_conv.inner = (void*)(orig & (~1));
30727 orig_conv.is_owned = false;
30728 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30729 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
30730 uint64_t ret_ref = 0;
30731 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30732 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30733 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30734 ret_ref = (uint64_t)ret_var.inner;
30735 if (ret_var.is_owned) {
30741 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
30742 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
30743 uint64_t ret_ref = 0;
30744 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30745 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30746 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30747 ret_ref = (uint64_t)ret_var.inner;
30748 if (ret_var.is_owned) {
30753 int64_t __attribute__((visibility("default"))) TS_ChannelTypeFeatures_clone_ptr(uint32_t arg) {
30754 LDKChannelTypeFeatures arg_conv;
30755 arg_conv.inner = (void*)(arg & (~1));
30756 arg_conv.is_owned = false;
30757 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30758 int64_t ret_val = ChannelTypeFeatures_clone_ptr(&arg_conv);
30762 uint32_t __attribute__((visibility("default"))) TS_ChannelTypeFeatures_clone(uint32_t orig) {
30763 LDKChannelTypeFeatures orig_conv;
30764 orig_conv.inner = (void*)(orig & (~1));
30765 orig_conv.is_owned = false;
30766 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30767 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
30768 uint64_t ret_ref = 0;
30769 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30770 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30771 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30772 ret_ref = (uint64_t)ret_var.inner;
30773 if (ret_var.is_owned) {
30779 void __attribute__((visibility("default"))) TS_InitFeatures_free(uint32_t this_obj) {
30780 LDKInitFeatures this_obj_conv;
30781 this_obj_conv.inner = (void*)(this_obj & (~1));
30782 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30783 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30784 InitFeatures_free(this_obj_conv);
30787 void __attribute__((visibility("default"))) TS_NodeFeatures_free(uint32_t this_obj) {
30788 LDKNodeFeatures this_obj_conv;
30789 this_obj_conv.inner = (void*)(this_obj & (~1));
30790 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30791 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30792 NodeFeatures_free(this_obj_conv);
30795 void __attribute__((visibility("default"))) TS_ChannelFeatures_free(uint32_t this_obj) {
30796 LDKChannelFeatures this_obj_conv;
30797 this_obj_conv.inner = (void*)(this_obj & (~1));
30798 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30799 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30800 ChannelFeatures_free(this_obj_conv);
30803 void __attribute__((visibility("default"))) TS_InvoiceFeatures_free(uint32_t this_obj) {
30804 LDKInvoiceFeatures this_obj_conv;
30805 this_obj_conv.inner = (void*)(this_obj & (~1));
30806 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30807 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30808 InvoiceFeatures_free(this_obj_conv);
30811 void __attribute__((visibility("default"))) TS_ChannelTypeFeatures_free(uint32_t this_obj) {
30812 LDKChannelTypeFeatures this_obj_conv;
30813 this_obj_conv.inner = (void*)(this_obj & (~1));
30814 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30815 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30816 ChannelTypeFeatures_free(this_obj_conv);
30819 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_empty() {
30820 LDKInitFeatures ret_var = InitFeatures_empty();
30821 uint64_t ret_ref = 0;
30822 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30823 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30824 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30825 ret_ref = (uint64_t)ret_var.inner;
30826 if (ret_var.is_owned) {
30832 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_known() {
30833 LDKInitFeatures ret_var = InitFeatures_known();
30834 uint64_t ret_ref = 0;
30835 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30836 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30837 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30838 ret_ref = (uint64_t)ret_var.inner;
30839 if (ret_var.is_owned) {
30845 jboolean __attribute__((visibility("default"))) TS_InitFeatures_requires_unknown_bits(uint32_t this_arg) {
30846 LDKInitFeatures this_arg_conv;
30847 this_arg_conv.inner = (void*)(this_arg & (~1));
30848 this_arg_conv.is_owned = false;
30849 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30850 jboolean ret_val = InitFeatures_requires_unknown_bits(&this_arg_conv);
30854 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_empty() {
30855 LDKNodeFeatures ret_var = NodeFeatures_empty();
30856 uint64_t ret_ref = 0;
30857 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30858 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30859 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30860 ret_ref = (uint64_t)ret_var.inner;
30861 if (ret_var.is_owned) {
30867 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_known() {
30868 LDKNodeFeatures ret_var = NodeFeatures_known();
30869 uint64_t ret_ref = 0;
30870 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30871 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30872 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30873 ret_ref = (uint64_t)ret_var.inner;
30874 if (ret_var.is_owned) {
30880 jboolean __attribute__((visibility("default"))) TS_NodeFeatures_requires_unknown_bits(uint32_t this_arg) {
30881 LDKNodeFeatures this_arg_conv;
30882 this_arg_conv.inner = (void*)(this_arg & (~1));
30883 this_arg_conv.is_owned = false;
30884 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30885 jboolean ret_val = NodeFeatures_requires_unknown_bits(&this_arg_conv);
30889 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_empty() {
30890 LDKChannelFeatures ret_var = ChannelFeatures_empty();
30891 uint64_t ret_ref = 0;
30892 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30893 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30894 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30895 ret_ref = (uint64_t)ret_var.inner;
30896 if (ret_var.is_owned) {
30902 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_known() {
30903 LDKChannelFeatures ret_var = ChannelFeatures_known();
30904 uint64_t ret_ref = 0;
30905 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30906 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30907 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30908 ret_ref = (uint64_t)ret_var.inner;
30909 if (ret_var.is_owned) {
30915 jboolean __attribute__((visibility("default"))) TS_ChannelFeatures_requires_unknown_bits(uint32_t this_arg) {
30916 LDKChannelFeatures this_arg_conv;
30917 this_arg_conv.inner = (void*)(this_arg & (~1));
30918 this_arg_conv.is_owned = false;
30919 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30920 jboolean ret_val = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
30924 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_empty() {
30925 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
30926 uint64_t ret_ref = 0;
30927 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30928 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30929 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30930 ret_ref = (uint64_t)ret_var.inner;
30931 if (ret_var.is_owned) {
30937 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_known() {
30938 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
30939 uint64_t ret_ref = 0;
30940 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30941 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30942 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30943 ret_ref = (uint64_t)ret_var.inner;
30944 if (ret_var.is_owned) {
30950 jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_requires_unknown_bits(uint32_t this_arg) {
30951 LDKInvoiceFeatures this_arg_conv;
30952 this_arg_conv.inner = (void*)(this_arg & (~1));
30953 this_arg_conv.is_owned = false;
30954 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30955 jboolean ret_val = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
30959 uint32_t __attribute__((visibility("default"))) TS_ChannelTypeFeatures_empty() {
30960 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
30961 uint64_t ret_ref = 0;
30962 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30963 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30964 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30965 ret_ref = (uint64_t)ret_var.inner;
30966 if (ret_var.is_owned) {
30972 uint32_t __attribute__((visibility("default"))) TS_ChannelTypeFeatures_known() {
30973 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_known();
30974 uint64_t ret_ref = 0;
30975 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30976 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30977 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30978 ret_ref = (uint64_t)ret_var.inner;
30979 if (ret_var.is_owned) {
30985 jboolean __attribute__((visibility("default"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint32_t this_arg) {
30986 LDKChannelTypeFeatures this_arg_conv;
30987 this_arg_conv.inner = (void*)(this_arg & (~1));
30988 this_arg_conv.is_owned = false;
30989 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30990 jboolean ret_val = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
30994 int8_tArray __attribute__((visibility("default"))) TS_InitFeatures_write(uint32_t obj) {
30995 LDKInitFeatures obj_conv;
30996 obj_conv.inner = (void*)(obj & (~1));
30997 obj_conv.is_owned = false;
30998 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30999 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
31000 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31001 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31002 CVec_u8Z_free(ret_var);
31006 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_read(int8_tArray ser) {
31007 LDKu8slice ser_ref;
31008 ser_ref.datalen = ser->arr_len;
31009 ser_ref.data = ser->elems;
31010 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
31011 *ret_conv = InitFeatures_read(ser_ref);
31012 return (uint64_t)ret_conv;
31015 int8_tArray __attribute__((visibility("default"))) TS_ChannelFeatures_write(uint32_t obj) {
31016 LDKChannelFeatures obj_conv;
31017 obj_conv.inner = (void*)(obj & (~1));
31018 obj_conv.is_owned = false;
31019 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31020 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
31021 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31022 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31023 CVec_u8Z_free(ret_var);
31027 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_read(int8_tArray ser) {
31028 LDKu8slice ser_ref;
31029 ser_ref.datalen = ser->arr_len;
31030 ser_ref.data = ser->elems;
31031 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
31032 *ret_conv = ChannelFeatures_read(ser_ref);
31033 return (uint64_t)ret_conv;
31036 int8_tArray __attribute__((visibility("default"))) TS_NodeFeatures_write(uint32_t obj) {
31037 LDKNodeFeatures obj_conv;
31038 obj_conv.inner = (void*)(obj & (~1));
31039 obj_conv.is_owned = false;
31040 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31041 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
31042 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31043 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31044 CVec_u8Z_free(ret_var);
31048 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_read(int8_tArray ser) {
31049 LDKu8slice ser_ref;
31050 ser_ref.datalen = ser->arr_len;
31051 ser_ref.data = ser->elems;
31052 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
31053 *ret_conv = NodeFeatures_read(ser_ref);
31054 return (uint64_t)ret_conv;
31057 int8_tArray __attribute__((visibility("default"))) TS_InvoiceFeatures_write(uint32_t obj) {
31058 LDKInvoiceFeatures obj_conv;
31059 obj_conv.inner = (void*)(obj & (~1));
31060 obj_conv.is_owned = false;
31061 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31062 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
31063 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31064 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31065 CVec_u8Z_free(ret_var);
31069 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_read(int8_tArray ser) {
31070 LDKu8slice ser_ref;
31071 ser_ref.datalen = ser->arr_len;
31072 ser_ref.data = ser->elems;
31073 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
31074 *ret_conv = InvoiceFeatures_read(ser_ref);
31075 return (uint64_t)ret_conv;
31078 int8_tArray __attribute__((visibility("default"))) TS_ChannelTypeFeatures_write(uint32_t obj) {
31079 LDKChannelTypeFeatures obj_conv;
31080 obj_conv.inner = (void*)(obj & (~1));
31081 obj_conv.is_owned = false;
31082 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31083 LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
31084 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31085 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31086 CVec_u8Z_free(ret_var);
31090 uint32_t __attribute__((visibility("default"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
31091 LDKu8slice ser_ref;
31092 ser_ref.datalen = ser->arr_len;
31093 ser_ref.data = ser->elems;
31094 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
31095 *ret_conv = ChannelTypeFeatures_read(ser_ref);
31096 return (uint64_t)ret_conv;
31099 void __attribute__((visibility("default"))) TS_ShutdownScript_free(uint32_t this_obj) {
31100 LDKShutdownScript this_obj_conv;
31101 this_obj_conv.inner = (void*)(this_obj & (~1));
31102 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31103 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31104 ShutdownScript_free(this_obj_conv);
31107 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
31108 LDKShutdownScript ret_var = ShutdownScript_clone(arg);
31109 uint64_t ret_ref = 0;
31110 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31111 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31112 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31113 ret_ref = (uint64_t)ret_var.inner;
31114 if (ret_var.is_owned) {
31119 int64_t __attribute__((visibility("default"))) TS_ShutdownScript_clone_ptr(uint32_t arg) {
31120 LDKShutdownScript arg_conv;
31121 arg_conv.inner = (void*)(arg & (~1));
31122 arg_conv.is_owned = false;
31123 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31124 int64_t ret_val = ShutdownScript_clone_ptr(&arg_conv);
31128 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_clone(uint32_t orig) {
31129 LDKShutdownScript orig_conv;
31130 orig_conv.inner = (void*)(orig & (~1));
31131 orig_conv.is_owned = false;
31132 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31133 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
31134 uint64_t ret_ref = 0;
31135 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31136 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31137 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31138 ret_ref = (uint64_t)ret_var.inner;
31139 if (ret_var.is_owned) {
31145 void __attribute__((visibility("default"))) TS_InvalidShutdownScript_free(uint32_t this_obj) {
31146 LDKInvalidShutdownScript this_obj_conv;
31147 this_obj_conv.inner = (void*)(this_obj & (~1));
31148 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31149 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31150 InvalidShutdownScript_free(this_obj_conv);
31153 int8_tArray __attribute__((visibility("default"))) TS_InvalidShutdownScript_get_script(uint32_t this_ptr) {
31154 LDKInvalidShutdownScript this_ptr_conv;
31155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31156 this_ptr_conv.is_owned = false;
31157 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31158 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
31159 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31160 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31164 void __attribute__((visibility("default"))) TS_InvalidShutdownScript_set_script(uint32_t this_ptr, int8_tArray val) {
31165 LDKInvalidShutdownScript this_ptr_conv;
31166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31167 this_ptr_conv.is_owned = false;
31168 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31169 LDKCVec_u8Z val_ref;
31170 val_ref.datalen = val->arr_len;
31171 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
31172 memcpy(val_ref.data, val->elems, val_ref.datalen);
31173 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
31176 uint32_t __attribute__((visibility("default"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
31177 LDKCVec_u8Z script_arg_ref;
31178 script_arg_ref.datalen = script_arg->arr_len;
31179 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
31180 memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen);
31181 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
31182 uint64_t ret_ref = 0;
31183 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31184 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31185 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31186 ret_ref = (uint64_t)ret_var.inner;
31187 if (ret_var.is_owned) {
31193 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
31194 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
31195 uint64_t ret_ref = 0;
31196 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31197 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31198 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31199 ret_ref = (uint64_t)ret_var.inner;
31200 if (ret_var.is_owned) {
31205 int64_t __attribute__((visibility("default"))) TS_InvalidShutdownScript_clone_ptr(uint32_t arg) {
31206 LDKInvalidShutdownScript arg_conv;
31207 arg_conv.inner = (void*)(arg & (~1));
31208 arg_conv.is_owned = false;
31209 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31210 int64_t ret_val = InvalidShutdownScript_clone_ptr(&arg_conv);
31214 uint32_t __attribute__((visibility("default"))) TS_InvalidShutdownScript_clone(uint32_t orig) {
31215 LDKInvalidShutdownScript orig_conv;
31216 orig_conv.inner = (void*)(orig & (~1));
31217 orig_conv.is_owned = false;
31218 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31219 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
31220 uint64_t ret_ref = 0;
31221 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31222 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31223 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31224 ret_ref = (uint64_t)ret_var.inner;
31225 if (ret_var.is_owned) {
31231 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_write(uint32_t obj) {
31232 LDKShutdownScript obj_conv;
31233 obj_conv.inner = (void*)(obj & (~1));
31234 obj_conv.is_owned = false;
31235 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31236 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
31237 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31238 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31239 CVec_u8Z_free(ret_var);
31243 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_read(int8_tArray ser) {
31244 LDKu8slice ser_ref;
31245 ser_ref.datalen = ser->arr_len;
31246 ser_ref.data = ser->elems;
31247 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
31248 *ret_conv = ShutdownScript_read(ser_ref);
31249 return (uint64_t)ret_conv;
31252 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
31253 unsigned char pubkey_hash_arr[20];
31254 CHECK(pubkey_hash->arr_len == 20);
31255 memcpy(pubkey_hash_arr, pubkey_hash->elems, 20);
31256 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
31257 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
31258 uint64_t ret_ref = 0;
31259 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31260 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31261 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31262 ret_ref = (uint64_t)ret_var.inner;
31263 if (ret_var.is_owned) {
31269 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
31270 unsigned char script_hash_arr[32];
31271 CHECK(script_hash->arr_len == 32);
31272 memcpy(script_hash_arr, script_hash->elems, 32);
31273 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
31274 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
31275 uint64_t ret_ref = 0;
31276 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31277 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31278 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31279 ret_ref = (uint64_t)ret_var.inner;
31280 if (ret_var.is_owned) {
31286 uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
31287 LDKu8slice program_ref;
31288 program_ref.datalen = program->arr_len;
31289 program_ref.data = program->elems;
31290 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
31291 *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
31292 return (uint64_t)ret_conv;
31295 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_into_inner(uint32_t this_arg) {
31296 LDKShutdownScript this_arg_conv;
31297 this_arg_conv.inner = (void*)(this_arg & (~1));
31298 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
31299 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31300 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
31301 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
31302 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31303 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31304 CVec_u8Z_free(ret_var);
31308 int8_tArray __attribute__((visibility("default"))) TS_ShutdownScript_as_legacy_pubkey(uint32_t this_arg) {
31309 LDKShutdownScript this_arg_conv;
31310 this_arg_conv.inner = (void*)(this_arg & (~1));
31311 this_arg_conv.is_owned = false;
31312 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31313 int8_tArray ret_arr = init_int8_tArray(33);
31314 memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
31318 jboolean __attribute__((visibility("default"))) TS_ShutdownScript_is_compatible(uint32_t this_arg, uint32_t features) {
31319 LDKShutdownScript this_arg_conv;
31320 this_arg_conv.inner = (void*)(this_arg & (~1));
31321 this_arg_conv.is_owned = false;
31322 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31323 LDKInitFeatures features_conv;
31324 features_conv.inner = (void*)(features & (~1));
31325 features_conv.is_owned = false;
31326 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
31327 jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
31331 void __attribute__((visibility("default"))) TS_CustomMessageReader_free(uint32_t this_ptr) {
31332 if ((this_ptr & 1) != 0) return;
31333 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
31334 CHECK_ACCESS(this_ptr_ptr);
31335 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
31336 FREE((void*)this_ptr);
31337 CustomMessageReader_free(this_ptr_conv);
31340 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
31341 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
31342 *ret_ret = Type_clone(arg);
31343 return (uint64_t)ret_ret;
31345 int64_t __attribute__((visibility("default"))) TS_Type_clone_ptr(uint32_t arg) {
31346 void* arg_ptr = (void*)(((uint64_t)arg) & ~1);
31347 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
31348 LDKType* arg_conv = (LDKType*)arg_ptr;
31349 int64_t ret_val = Type_clone_ptr(arg_conv);
31353 uint32_t __attribute__((visibility("default"))) TS_Type_clone(uint32_t orig) {
31354 void* orig_ptr = (void*)(((uint64_t)orig) & ~1);
31355 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
31356 LDKType* orig_conv = (LDKType*)orig_ptr;
31357 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
31358 *ret_ret = Type_clone(orig_conv);
31359 return (uint64_t)ret_ret;
31362 void __attribute__((visibility("default"))) TS_Type_free(uint32_t this_ptr) {
31363 if ((this_ptr & 1) != 0) return;
31364 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
31365 CHECK_ACCESS(this_ptr_ptr);
31366 LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
31367 FREE((void*)this_ptr);
31368 Type_free(this_ptr_conv);
31371 void __attribute__((visibility("default"))) TS_NodeId_free(uint32_t this_obj) {
31372 LDKNodeId this_obj_conv;
31373 this_obj_conv.inner = (void*)(this_obj & (~1));
31374 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31375 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31376 NodeId_free(this_obj_conv);
31379 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
31380 LDKNodeId ret_var = NodeId_clone(arg);
31381 uint64_t ret_ref = 0;
31382 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31383 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31384 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31385 ret_ref = (uint64_t)ret_var.inner;
31386 if (ret_var.is_owned) {
31391 int64_t __attribute__((visibility("default"))) TS_NodeId_clone_ptr(uint32_t arg) {
31392 LDKNodeId arg_conv;
31393 arg_conv.inner = (void*)(arg & (~1));
31394 arg_conv.is_owned = false;
31395 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31396 int64_t ret_val = NodeId_clone_ptr(&arg_conv);
31400 uint32_t __attribute__((visibility("default"))) TS_NodeId_clone(uint32_t orig) {
31401 LDKNodeId orig_conv;
31402 orig_conv.inner = (void*)(orig & (~1));
31403 orig_conv.is_owned = false;
31404 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31405 LDKNodeId ret_var = NodeId_clone(&orig_conv);
31406 uint64_t ret_ref = 0;
31407 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31408 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31409 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31410 ret_ref = (uint64_t)ret_var.inner;
31411 if (ret_var.is_owned) {
31417 uint32_t __attribute__((visibility("default"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
31418 LDKPublicKey pubkey_ref;
31419 CHECK(pubkey->arr_len == 33);
31420 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33);
31421 LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
31422 uint64_t ret_ref = 0;
31423 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31424 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31425 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31426 ret_ref = (uint64_t)ret_var.inner;
31427 if (ret_var.is_owned) {
31433 int8_tArray __attribute__((visibility("default"))) TS_NodeId_as_slice(uint32_t this_arg) {
31434 LDKNodeId this_arg_conv;
31435 this_arg_conv.inner = (void*)(this_arg & (~1));
31436 this_arg_conv.is_owned = false;
31437 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31438 LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
31439 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31440 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31444 int64_t __attribute__((visibility("default"))) TS_NodeId_hash(uint32_t o) {
31446 o_conv.inner = (void*)(o & (~1));
31447 o_conv.is_owned = false;
31448 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31449 int64_t ret_val = NodeId_hash(&o_conv);
31453 int8_tArray __attribute__((visibility("default"))) TS_NodeId_write(uint32_t obj) {
31454 LDKNodeId obj_conv;
31455 obj_conv.inner = (void*)(obj & (~1));
31456 obj_conv.is_owned = false;
31457 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31458 LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
31459 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31460 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31461 CVec_u8Z_free(ret_var);
31465 uint32_t __attribute__((visibility("default"))) TS_NodeId_read(int8_tArray ser) {
31466 LDKu8slice ser_ref;
31467 ser_ref.datalen = ser->arr_len;
31468 ser_ref.data = ser->elems;
31469 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
31470 *ret_conv = NodeId_read(ser_ref);
31471 return (uint64_t)ret_conv;
31474 void __attribute__((visibility("default"))) TS_NetworkGraph_free(uint32_t this_obj) {
31475 LDKNetworkGraph this_obj_conv;
31476 this_obj_conv.inner = (void*)(this_obj & (~1));
31477 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31478 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31479 NetworkGraph_free(this_obj_conv);
31482 static inline uint64_t NetworkGraph_clone_ptr(LDKNetworkGraph *NONNULL_PTR arg) {
31483 LDKNetworkGraph ret_var = NetworkGraph_clone(arg);
31484 uint64_t ret_ref = 0;
31485 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31486 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31487 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31488 ret_ref = (uint64_t)ret_var.inner;
31489 if (ret_var.is_owned) {
31494 int64_t __attribute__((visibility("default"))) TS_NetworkGraph_clone_ptr(uint32_t arg) {
31495 LDKNetworkGraph arg_conv;
31496 arg_conv.inner = (void*)(arg & (~1));
31497 arg_conv.is_owned = false;
31498 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31499 int64_t ret_val = NetworkGraph_clone_ptr(&arg_conv);
31503 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_clone(uint32_t orig) {
31504 LDKNetworkGraph orig_conv;
31505 orig_conv.inner = (void*)(orig & (~1));
31506 orig_conv.is_owned = false;
31507 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31508 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
31509 uint64_t ret_ref = 0;
31510 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31511 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31512 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31513 ret_ref = (uint64_t)ret_var.inner;
31514 if (ret_var.is_owned) {
31520 void __attribute__((visibility("default"))) TS_ReadOnlyNetworkGraph_free(uint32_t this_obj) {
31521 LDKReadOnlyNetworkGraph this_obj_conv;
31522 this_obj_conv.inner = (void*)(this_obj & (~1));
31523 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31524 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31525 ReadOnlyNetworkGraph_free(this_obj_conv);
31528 void __attribute__((visibility("default"))) TS_NetworkUpdate_free(uint32_t this_ptr) {
31529 if ((this_ptr & 1) != 0) return;
31530 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
31531 CHECK_ACCESS(this_ptr_ptr);
31532 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
31533 FREE((void*)this_ptr);
31534 NetworkUpdate_free(this_ptr_conv);
31537 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
31538 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
31539 *ret_copy = NetworkUpdate_clone(arg);
31540 uint64_t ret_ref = (uint64_t)ret_copy;
31543 int64_t __attribute__((visibility("default"))) TS_NetworkUpdate_clone_ptr(uint32_t arg) {
31544 LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)arg;
31545 int64_t ret_val = NetworkUpdate_clone_ptr(arg_conv);
31549 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_clone(uint32_t orig) {
31550 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
31551 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
31552 *ret_copy = NetworkUpdate_clone(orig_conv);
31553 uint64_t ret_ref = (uint64_t)ret_copy;
31557 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_update_message(uint32_t msg) {
31558 LDKChannelUpdate msg_conv;
31559 msg_conv.inner = (void*)(msg & (~1));
31560 msg_conv.is_owned = (msg & 1) || (msg == 0);
31561 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
31562 msg_conv = ChannelUpdate_clone(&msg_conv);
31563 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
31564 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
31565 uint64_t ret_ref = (uint64_t)ret_copy;
31569 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_closed(int64_t short_channel_id, jboolean is_permanent) {
31570 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
31571 *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent);
31572 uint64_t ret_ref = (uint64_t)ret_copy;
31576 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
31577 LDKPublicKey node_id_ref;
31578 CHECK(node_id->arr_len == 33);
31579 memcpy(node_id_ref.compressed_form, node_id->elems, 33);
31580 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
31581 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
31582 uint64_t ret_ref = (uint64_t)ret_copy;
31586 int8_tArray __attribute__((visibility("default"))) TS_NetworkUpdate_write(uint32_t obj) {
31587 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
31588 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
31589 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31590 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31591 CVec_u8Z_free(ret_var);
31595 uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_read(int8_tArray ser) {
31596 LDKu8slice ser_ref;
31597 ser_ref.datalen = ser->arr_len;
31598 ser_ref.data = ser->elems;
31599 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
31600 *ret_conv = NetworkUpdate_read(ser_ref);
31601 return (uint64_t)ret_conv;
31604 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_EventHandler(uint32_t this_arg) {
31605 LDKNetGraphMsgHandler this_arg_conv;
31606 this_arg_conv.inner = (void*)(this_arg & (~1));
31607 this_arg_conv.is_owned = false;
31608 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31609 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
31610 *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv);
31611 return (uint64_t)ret_ret;
31614 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_free(uint32_t this_obj) {
31615 LDKNetGraphMsgHandler this_obj_conv;
31616 this_obj_conv.inner = (void*)(this_obj & (~1));
31617 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31618 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31619 NetGraphMsgHandler_free(this_obj_conv);
31622 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_new(uint32_t network_graph, uint32_t chain_access, uint32_t logger) {
31623 LDKNetworkGraph network_graph_conv;
31624 network_graph_conv.inner = (void*)(network_graph & (~1));
31625 network_graph_conv.is_owned = false;
31626 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
31627 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
31628 CHECK_ACCESS(chain_access_ptr);
31629 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
31630 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
31631 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
31632 // Manually implement clone for Java trait instances
31634 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
31635 CHECK_ACCESS(logger_ptr);
31636 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
31637 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(&network_graph_conv, chain_access_conv, logger_conv);
31638 uint64_t ret_ref = 0;
31639 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31640 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31641 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31642 ret_ref = (uint64_t)ret_var.inner;
31643 if (ret_var.is_owned) {
31649 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_add_chain_access(uint32_t this_arg, uint32_t chain_access) {
31650 LDKNetGraphMsgHandler this_arg_conv;
31651 this_arg_conv.inner = (void*)(this_arg & (~1));
31652 this_arg_conv.is_owned = false;
31653 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31654 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
31655 CHECK_ACCESS(chain_access_ptr);
31656 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
31657 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
31658 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
31659 // Manually implement clone for Java trait instances
31661 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
31664 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_RoutingMessageHandler(uint32_t this_arg) {
31665 LDKNetGraphMsgHandler this_arg_conv;
31666 this_arg_conv.inner = (void*)(this_arg & (~1));
31667 this_arg_conv.is_owned = false;
31668 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31669 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
31670 *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
31671 return (uint64_t)ret_ret;
31674 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
31675 LDKNetGraphMsgHandler this_arg_conv;
31676 this_arg_conv.inner = (void*)(this_arg & (~1));
31677 this_arg_conv.is_owned = false;
31678 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31679 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
31680 *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
31681 return (uint64_t)ret_ret;
31684 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_free(uint32_t this_obj) {
31685 LDKDirectionalChannelInfo this_obj_conv;
31686 this_obj_conv.inner = (void*)(this_obj & (~1));
31687 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31688 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31689 DirectionalChannelInfo_free(this_obj_conv);
31692 int32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update(uint32_t this_ptr) {
31693 LDKDirectionalChannelInfo this_ptr_conv;
31694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31695 this_ptr_conv.is_owned = false;
31696 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31697 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
31701 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update(uint32_t this_ptr, int32_t val) {
31702 LDKDirectionalChannelInfo this_ptr_conv;
31703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31704 this_ptr_conv.is_owned = false;
31705 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31706 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
31709 jboolean __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_enabled(uint32_t this_ptr) {
31710 LDKDirectionalChannelInfo this_ptr_conv;
31711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31712 this_ptr_conv.is_owned = false;
31713 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31714 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
31718 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_enabled(uint32_t this_ptr, jboolean val) {
31719 LDKDirectionalChannelInfo this_ptr_conv;
31720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31721 this_ptr_conv.is_owned = false;
31722 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31723 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
31726 int16_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
31727 LDKDirectionalChannelInfo this_ptr_conv;
31728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31729 this_ptr_conv.is_owned = false;
31730 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31731 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
31735 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
31736 LDKDirectionalChannelInfo this_ptr_conv;
31737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31738 this_ptr_conv.is_owned = false;
31739 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31740 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
31743 int64_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_minimum_msat(uint32_t this_ptr) {
31744 LDKDirectionalChannelInfo this_ptr_conv;
31745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31746 this_ptr_conv.is_owned = false;
31747 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31748 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
31752 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
31753 LDKDirectionalChannelInfo this_ptr_conv;
31754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31755 this_ptr_conv.is_owned = false;
31756 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31757 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
31760 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_maximum_msat(uint32_t this_ptr) {
31761 LDKDirectionalChannelInfo this_ptr_conv;
31762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31763 this_ptr_conv.is_owned = false;
31764 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31765 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31766 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
31767 uint64_t ret_ref = (uint64_t)ret_copy;
31771 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
31772 LDKDirectionalChannelInfo this_ptr_conv;
31773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31774 this_ptr_conv.is_owned = false;
31775 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31776 void* val_ptr = (void*)(((uint64_t)val) & ~1);
31777 CHECK_ACCESS(val_ptr);
31778 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31779 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
31780 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
31783 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_fees(uint32_t this_ptr) {
31784 LDKDirectionalChannelInfo this_ptr_conv;
31785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31786 this_ptr_conv.is_owned = false;
31787 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31788 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
31789 uint64_t ret_ref = 0;
31790 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31791 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31792 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31793 ret_ref = (uint64_t)ret_var.inner;
31794 if (ret_var.is_owned) {
31800 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_fees(uint32_t this_ptr, uint32_t val) {
31801 LDKDirectionalChannelInfo this_ptr_conv;
31802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31803 this_ptr_conv.is_owned = false;
31804 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31805 LDKRoutingFees val_conv;
31806 val_conv.inner = (void*)(val & (~1));
31807 val_conv.is_owned = (val & 1) || (val == 0);
31808 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31809 val_conv = RoutingFees_clone(&val_conv);
31810 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
31813 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update_message(uint32_t this_ptr) {
31814 LDKDirectionalChannelInfo this_ptr_conv;
31815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31816 this_ptr_conv.is_owned = false;
31817 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31818 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
31819 uint64_t ret_ref = 0;
31820 if ((uint64_t)ret_var.inner > 4096) {
31821 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31822 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31823 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31824 ret_ref = (uint64_t)ret_var.inner;
31825 if (ret_var.is_owned) {
31832 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) {
31833 LDKDirectionalChannelInfo this_ptr_conv;
31834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31835 this_ptr_conv.is_owned = false;
31836 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31837 LDKChannelUpdate val_conv;
31838 val_conv.inner = (void*)(val & (~1));
31839 val_conv.is_owned = (val & 1) || (val == 0);
31840 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31841 val_conv = ChannelUpdate_clone(&val_conv);
31842 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
31845 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) {
31846 void* htlc_maximum_msat_arg_ptr = (void*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
31847 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
31848 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
31849 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
31850 LDKRoutingFees fees_arg_conv;
31851 fees_arg_conv.inner = (void*)(fees_arg & (~1));
31852 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
31853 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
31854 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
31855 LDKChannelUpdate last_update_message_arg_conv;
31856 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
31857 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
31858 CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
31859 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
31860 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);
31861 uint64_t ret_ref = 0;
31862 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31863 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31864 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31865 ret_ref = (uint64_t)ret_var.inner;
31866 if (ret_var.is_owned) {
31872 static inline uint64_t DirectionalChannelInfo_clone_ptr(LDKDirectionalChannelInfo *NONNULL_PTR arg) {
31873 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(arg);
31874 uint64_t ret_ref = 0;
31875 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31876 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31877 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31878 ret_ref = (uint64_t)ret_var.inner;
31879 if (ret_var.is_owned) {
31884 int64_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_clone_ptr(uint32_t arg) {
31885 LDKDirectionalChannelInfo arg_conv;
31886 arg_conv.inner = (void*)(arg & (~1));
31887 arg_conv.is_owned = false;
31888 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31889 int64_t ret_val = DirectionalChannelInfo_clone_ptr(&arg_conv);
31893 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_clone(uint32_t orig) {
31894 LDKDirectionalChannelInfo orig_conv;
31895 orig_conv.inner = (void*)(orig & (~1));
31896 orig_conv.is_owned = false;
31897 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31898 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
31899 uint64_t ret_ref = 0;
31900 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31901 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31902 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31903 ret_ref = (uint64_t)ret_var.inner;
31904 if (ret_var.is_owned) {
31910 int8_tArray __attribute__((visibility("default"))) TS_DirectionalChannelInfo_write(uint32_t obj) {
31911 LDKDirectionalChannelInfo obj_conv;
31912 obj_conv.inner = (void*)(obj & (~1));
31913 obj_conv.is_owned = false;
31914 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31915 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
31916 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
31917 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31918 CVec_u8Z_free(ret_var);
31922 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_read(int8_tArray ser) {
31923 LDKu8slice ser_ref;
31924 ser_ref.datalen = ser->arr_len;
31925 ser_ref.data = ser->elems;
31926 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
31927 *ret_conv = DirectionalChannelInfo_read(ser_ref);
31928 return (uint64_t)ret_conv;
31931 void __attribute__((visibility("default"))) TS_ChannelInfo_free(uint32_t this_obj) {
31932 LDKChannelInfo this_obj_conv;
31933 this_obj_conv.inner = (void*)(this_obj & (~1));
31934 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31935 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31936 ChannelInfo_free(this_obj_conv);
31939 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_features(uint32_t this_ptr) {
31940 LDKChannelInfo this_ptr_conv;
31941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31942 this_ptr_conv.is_owned = false;
31943 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31944 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
31945 uint64_t ret_ref = 0;
31946 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31947 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31948 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31949 ret_ref = (uint64_t)ret_var.inner;
31950 if (ret_var.is_owned) {
31956 void __attribute__((visibility("default"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) {
31957 LDKChannelInfo this_ptr_conv;
31958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31959 this_ptr_conv.is_owned = false;
31960 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31961 LDKChannelFeatures val_conv;
31962 val_conv.inner = (void*)(val & (~1));
31963 val_conv.is_owned = (val & 1) || (val == 0);
31964 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31965 val_conv = ChannelFeatures_clone(&val_conv);
31966 ChannelInfo_set_features(&this_ptr_conv, val_conv);
31969 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) {
31970 LDKChannelInfo this_ptr_conv;
31971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31972 this_ptr_conv.is_owned = false;
31973 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31974 LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
31975 uint64_t ret_ref = 0;
31976 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31977 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31978 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31979 ret_ref = (uint64_t)ret_var.inner;
31980 if (ret_var.is_owned) {
31986 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, uint32_t val) {
31987 LDKChannelInfo this_ptr_conv;
31988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31989 this_ptr_conv.is_owned = false;
31990 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31991 LDKNodeId val_conv;
31992 val_conv.inner = (void*)(val & (~1));
31993 val_conv.is_owned = (val & 1) || (val == 0);
31994 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31995 val_conv = NodeId_clone(&val_conv);
31996 ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
31999 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_one_to_two(uint32_t this_ptr) {
32000 LDKChannelInfo this_ptr_conv;
32001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32002 this_ptr_conv.is_owned = false;
32003 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32004 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
32005 uint64_t ret_ref = 0;
32006 if ((uint64_t)ret_var.inner > 4096) {
32007 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32008 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32009 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32010 ret_ref = (uint64_t)ret_var.inner;
32011 if (ret_var.is_owned) {
32018 void __attribute__((visibility("default"))) TS_ChannelInfo_set_one_to_two(uint32_t this_ptr, uint32_t val) {
32019 LDKChannelInfo this_ptr_conv;
32020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32021 this_ptr_conv.is_owned = false;
32022 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32023 LDKDirectionalChannelInfo val_conv;
32024 val_conv.inner = (void*)(val & (~1));
32025 val_conv.is_owned = (val & 1) || (val == 0);
32026 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32027 val_conv = DirectionalChannelInfo_clone(&val_conv);
32028 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
32031 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_node_two(uint32_t this_ptr) {
32032 LDKChannelInfo this_ptr_conv;
32033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32034 this_ptr_conv.is_owned = false;
32035 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32036 LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
32037 uint64_t ret_ref = 0;
32038 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32039 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32040 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32041 ret_ref = (uint64_t)ret_var.inner;
32042 if (ret_var.is_owned) {
32048 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, uint32_t val) {
32049 LDKChannelInfo this_ptr_conv;
32050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32051 this_ptr_conv.is_owned = false;
32052 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32053 LDKNodeId val_conv;
32054 val_conv.inner = (void*)(val & (~1));
32055 val_conv.is_owned = (val & 1) || (val == 0);
32056 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32057 val_conv = NodeId_clone(&val_conv);
32058 ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
32061 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) {
32062 LDKChannelInfo this_ptr_conv;
32063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32064 this_ptr_conv.is_owned = false;
32065 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32066 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
32067 uint64_t ret_ref = 0;
32068 if ((uint64_t)ret_var.inner > 4096) {
32069 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32070 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32071 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32072 ret_ref = (uint64_t)ret_var.inner;
32073 if (ret_var.is_owned) {
32080 void __attribute__((visibility("default"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) {
32081 LDKChannelInfo this_ptr_conv;
32082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32083 this_ptr_conv.is_owned = false;
32084 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32085 LDKDirectionalChannelInfo val_conv;
32086 val_conv.inner = (void*)(val & (~1));
32087 val_conv.is_owned = (val & 1) || (val == 0);
32088 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32089 val_conv = DirectionalChannelInfo_clone(&val_conv);
32090 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
32093 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_capacity_sats(uint32_t this_ptr) {
32094 LDKChannelInfo this_ptr_conv;
32095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32096 this_ptr_conv.is_owned = false;
32097 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32098 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
32099 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
32100 uint64_t ret_ref = (uint64_t)ret_copy;
32104 void __attribute__((visibility("default"))) TS_ChannelInfo_set_capacity_sats(uint32_t this_ptr, uint32_t val) {
32105 LDKChannelInfo this_ptr_conv;
32106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32107 this_ptr_conv.is_owned = false;
32108 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32109 void* val_ptr = (void*)(((uint64_t)val) & ~1);
32110 CHECK_ACCESS(val_ptr);
32111 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
32112 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
32113 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
32116 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) {
32117 LDKChannelInfo this_ptr_conv;
32118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32119 this_ptr_conv.is_owned = false;
32120 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32121 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
32122 uint64_t ret_ref = 0;
32123 if ((uint64_t)ret_var.inner > 4096) {
32124 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32125 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32126 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32127 ret_ref = (uint64_t)ret_var.inner;
32128 if (ret_var.is_owned) {
32135 void __attribute__((visibility("default"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
32136 LDKChannelInfo this_ptr_conv;
32137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32138 this_ptr_conv.is_owned = false;
32139 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32140 LDKChannelAnnouncement val_conv;
32141 val_conv.inner = (void*)(val & (~1));
32142 val_conv.is_owned = (val & 1) || (val == 0);
32143 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32144 val_conv = ChannelAnnouncement_clone(&val_conv);
32145 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
32148 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
32149 LDKChannelInfo ret_var = ChannelInfo_clone(arg);
32150 uint64_t ret_ref = 0;
32151 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32152 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32153 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32154 ret_ref = (uint64_t)ret_var.inner;
32155 if (ret_var.is_owned) {
32160 int64_t __attribute__((visibility("default"))) TS_ChannelInfo_clone_ptr(uint32_t arg) {
32161 LDKChannelInfo arg_conv;
32162 arg_conv.inner = (void*)(arg & (~1));
32163 arg_conv.is_owned = false;
32164 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32165 int64_t ret_val = ChannelInfo_clone_ptr(&arg_conv);
32169 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_clone(uint32_t orig) {
32170 LDKChannelInfo orig_conv;
32171 orig_conv.inner = (void*)(orig & (~1));
32172 orig_conv.is_owned = false;
32173 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32174 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
32175 uint64_t ret_ref = 0;
32176 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32177 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32178 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32179 ret_ref = (uint64_t)ret_var.inner;
32180 if (ret_var.is_owned) {
32186 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_write(uint32_t obj) {
32187 LDKChannelInfo obj_conv;
32188 obj_conv.inner = (void*)(obj & (~1));
32189 obj_conv.is_owned = false;
32190 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32191 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
32192 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
32193 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32194 CVec_u8Z_free(ret_var);
32198 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_read(int8_tArray ser) {
32199 LDKu8slice ser_ref;
32200 ser_ref.datalen = ser->arr_len;
32201 ser_ref.data = ser->elems;
32202 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
32203 *ret_conv = ChannelInfo_read(ser_ref);
32204 return (uint64_t)ret_conv;
32207 void __attribute__((visibility("default"))) TS_RoutingFees_free(uint32_t this_obj) {
32208 LDKRoutingFees this_obj_conv;
32209 this_obj_conv.inner = (void*)(this_obj & (~1));
32210 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32211 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32212 RoutingFees_free(this_obj_conv);
32215 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) {
32216 LDKRoutingFees this_ptr_conv;
32217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32218 this_ptr_conv.is_owned = false;
32219 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32220 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
32224 void __attribute__((visibility("default"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) {
32225 LDKRoutingFees this_ptr_conv;
32226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32227 this_ptr_conv.is_owned = false;
32228 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32229 RoutingFees_set_base_msat(&this_ptr_conv, val);
32232 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) {
32233 LDKRoutingFees this_ptr_conv;
32234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32235 this_ptr_conv.is_owned = false;
32236 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32237 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
32241 void __attribute__((visibility("default"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) {
32242 LDKRoutingFees this_ptr_conv;
32243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32244 this_ptr_conv.is_owned = false;
32245 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32246 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
32249 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
32250 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
32251 uint64_t ret_ref = 0;
32252 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32253 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32254 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32255 ret_ref = (uint64_t)ret_var.inner;
32256 if (ret_var.is_owned) {
32262 jboolean __attribute__((visibility("default"))) TS_RoutingFees_eq(uint32_t a, uint32_t b) {
32263 LDKRoutingFees a_conv;
32264 a_conv.inner = (void*)(a & (~1));
32265 a_conv.is_owned = false;
32266 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32267 LDKRoutingFees b_conv;
32268 b_conv.inner = (void*)(b & (~1));
32269 b_conv.is_owned = false;
32270 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32271 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
32275 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
32276 LDKRoutingFees ret_var = RoutingFees_clone(arg);
32277 uint64_t ret_ref = 0;
32278 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32279 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32280 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32281 ret_ref = (uint64_t)ret_var.inner;
32282 if (ret_var.is_owned) {
32287 int64_t __attribute__((visibility("default"))) TS_RoutingFees_clone_ptr(uint32_t arg) {
32288 LDKRoutingFees arg_conv;
32289 arg_conv.inner = (void*)(arg & (~1));
32290 arg_conv.is_owned = false;
32291 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32292 int64_t ret_val = RoutingFees_clone_ptr(&arg_conv);
32296 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_clone(uint32_t orig) {
32297 LDKRoutingFees orig_conv;
32298 orig_conv.inner = (void*)(orig & (~1));
32299 orig_conv.is_owned = false;
32300 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32301 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
32302 uint64_t ret_ref = 0;
32303 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32304 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32305 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32306 ret_ref = (uint64_t)ret_var.inner;
32307 if (ret_var.is_owned) {
32313 int64_t __attribute__((visibility("default"))) TS_RoutingFees_hash(uint32_t o) {
32314 LDKRoutingFees o_conv;
32315 o_conv.inner = (void*)(o & (~1));
32316 o_conv.is_owned = false;
32317 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32318 int64_t ret_val = RoutingFees_hash(&o_conv);
32322 int8_tArray __attribute__((visibility("default"))) TS_RoutingFees_write(uint32_t obj) {
32323 LDKRoutingFees obj_conv;
32324 obj_conv.inner = (void*)(obj & (~1));
32325 obj_conv.is_owned = false;
32326 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32327 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
32328 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
32329 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32330 CVec_u8Z_free(ret_var);
32334 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_read(int8_tArray ser) {
32335 LDKu8slice ser_ref;
32336 ser_ref.datalen = ser->arr_len;
32337 ser_ref.data = ser->elems;
32338 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
32339 *ret_conv = RoutingFees_read(ser_ref);
32340 return (uint64_t)ret_conv;
32343 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_free(uint32_t this_obj) {
32344 LDKNodeAnnouncementInfo this_obj_conv;
32345 this_obj_conv.inner = (void*)(this_obj & (~1));
32346 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32347 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32348 NodeAnnouncementInfo_free(this_obj_conv);
32351 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) {
32352 LDKNodeAnnouncementInfo this_ptr_conv;
32353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32354 this_ptr_conv.is_owned = false;
32355 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32356 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
32357 uint64_t ret_ref = 0;
32358 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32359 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32360 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32361 ret_ref = (uint64_t)ret_var.inner;
32362 if (ret_var.is_owned) {
32368 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) {
32369 LDKNodeAnnouncementInfo this_ptr_conv;
32370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32371 this_ptr_conv.is_owned = false;
32372 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32373 LDKNodeFeatures val_conv;
32374 val_conv.inner = (void*)(val & (~1));
32375 val_conv.is_owned = (val & 1) || (val == 0);
32376 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32377 val_conv = NodeFeatures_clone(&val_conv);
32378 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
32381 int32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) {
32382 LDKNodeAnnouncementInfo this_ptr_conv;
32383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32384 this_ptr_conv.is_owned = false;
32385 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32386 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
32390 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) {
32391 LDKNodeAnnouncementInfo this_ptr_conv;
32392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32393 this_ptr_conv.is_owned = false;
32394 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32395 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
32398 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) {
32399 LDKNodeAnnouncementInfo this_ptr_conv;
32400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32401 this_ptr_conv.is_owned = false;
32402 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32403 int8_tArray ret_arr = init_int8_tArray(3);
32404 memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
32408 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) {
32409 LDKNodeAnnouncementInfo this_ptr_conv;
32410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32411 this_ptr_conv.is_owned = false;
32412 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32413 LDKThreeBytes val_ref;
32414 CHECK(val->arr_len == 3);
32415 memcpy(val_ref.data, val->elems, 3);
32416 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
32419 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) {
32420 LDKNodeAnnouncementInfo this_ptr_conv;
32421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32422 this_ptr_conv.is_owned = false;
32423 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32424 int8_tArray ret_arr = init_int8_tArray(32);
32425 memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
32429 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, int8_tArray val) {
32430 LDKNodeAnnouncementInfo this_ptr_conv;
32431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32432 this_ptr_conv.is_owned = false;
32433 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32434 LDKThirtyTwoBytes val_ref;
32435 CHECK(val->arr_len == 32);
32436 memcpy(val_ref.data, val->elems, 32);
32437 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
32440 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) {
32441 LDKNodeAnnouncementInfo this_ptr_conv;
32442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32443 this_ptr_conv.is_owned = false;
32444 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32445 LDKCVec_NetAddressZ val_constr;
32446 val_constr.datalen = val->arr_len;
32447 if (val_constr.datalen > 0)
32448 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
32450 val_constr.data = NULL;
32451 uint32_t* val_vals = val->elems;
32452 for (size_t m = 0; m < val_constr.datalen; m++) {
32453 uint32_t val_conv_12 = val_vals[m];
32454 void* val_conv_12_ptr = (void*)(((uint64_t)val_conv_12) & ~1);
32455 CHECK_ACCESS(val_conv_12_ptr);
32456 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
32457 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
32458 val_constr.data[m] = val_conv_12_conv;
32460 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
32463 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) {
32464 LDKNodeAnnouncementInfo this_ptr_conv;
32465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32466 this_ptr_conv.is_owned = false;
32467 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32468 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
32469 uint64_t ret_ref = 0;
32470 if ((uint64_t)ret_var.inner > 4096) {
32471 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32472 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32473 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32474 ret_ref = (uint64_t)ret_var.inner;
32475 if (ret_var.is_owned) {
32482 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
32483 LDKNodeAnnouncementInfo this_ptr_conv;
32484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32485 this_ptr_conv.is_owned = false;
32486 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32487 LDKNodeAnnouncement val_conv;
32488 val_conv.inner = (void*)(val & (~1));
32489 val_conv.is_owned = (val & 1) || (val == 0);
32490 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32491 val_conv = NodeAnnouncement_clone(&val_conv);
32492 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
32495 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) {
32496 LDKNodeFeatures features_arg_conv;
32497 features_arg_conv.inner = (void*)(features_arg & (~1));
32498 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
32499 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
32500 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
32501 LDKThreeBytes rgb_arg_ref;
32502 CHECK(rgb_arg->arr_len == 3);
32503 memcpy(rgb_arg_ref.data, rgb_arg->elems, 3);
32504 LDKThirtyTwoBytes alias_arg_ref;
32505 CHECK(alias_arg->arr_len == 32);
32506 memcpy(alias_arg_ref.data, alias_arg->elems, 32);
32507 LDKCVec_NetAddressZ addresses_arg_constr;
32508 addresses_arg_constr.datalen = addresses_arg->arr_len;
32509 if (addresses_arg_constr.datalen > 0)
32510 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
32512 addresses_arg_constr.data = NULL;
32513 uint32_t* addresses_arg_vals = addresses_arg->elems;
32514 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
32515 uint32_t addresses_arg_conv_12 = addresses_arg_vals[m];
32516 void* addresses_arg_conv_12_ptr = (void*)(((uint64_t)addresses_arg_conv_12) & ~1);
32517 CHECK_ACCESS(addresses_arg_conv_12_ptr);
32518 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
32519 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
32521 LDKNodeAnnouncement announcement_message_arg_conv;
32522 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
32523 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
32524 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
32525 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
32526 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
32527 uint64_t ret_ref = 0;
32528 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32529 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32530 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32531 ret_ref = (uint64_t)ret_var.inner;
32532 if (ret_var.is_owned) {
32538 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
32539 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
32540 uint64_t ret_ref = 0;
32541 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32542 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32543 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32544 ret_ref = (uint64_t)ret_var.inner;
32545 if (ret_var.is_owned) {
32550 int64_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_clone_ptr(uint32_t arg) {
32551 LDKNodeAnnouncementInfo arg_conv;
32552 arg_conv.inner = (void*)(arg & (~1));
32553 arg_conv.is_owned = false;
32554 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32555 int64_t ret_val = NodeAnnouncementInfo_clone_ptr(&arg_conv);
32559 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) {
32560 LDKNodeAnnouncementInfo orig_conv;
32561 orig_conv.inner = (void*)(orig & (~1));
32562 orig_conv.is_owned = false;
32563 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32564 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
32565 uint64_t ret_ref = 0;
32566 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32567 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32568 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32569 ret_ref = (uint64_t)ret_var.inner;
32570 if (ret_var.is_owned) {
32576 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_write(uint32_t obj) {
32577 LDKNodeAnnouncementInfo obj_conv;
32578 obj_conv.inner = (void*)(obj & (~1));
32579 obj_conv.is_owned = false;
32580 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32581 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
32582 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
32583 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32584 CVec_u8Z_free(ret_var);
32588 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
32589 LDKu8slice ser_ref;
32590 ser_ref.datalen = ser->arr_len;
32591 ser_ref.data = ser->elems;
32592 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
32593 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
32594 return (uint64_t)ret_conv;
32597 void __attribute__((visibility("default"))) TS_NodeInfo_free(uint32_t this_obj) {
32598 LDKNodeInfo this_obj_conv;
32599 this_obj_conv.inner = (void*)(this_obj & (~1));
32600 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32601 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32602 NodeInfo_free(this_obj_conv);
32605 void __attribute__((visibility("default"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) {
32606 LDKNodeInfo this_ptr_conv;
32607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32608 this_ptr_conv.is_owned = false;
32609 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32610 LDKCVec_u64Z val_constr;
32611 val_constr.datalen = val->arr_len;
32612 if (val_constr.datalen > 0)
32613 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
32615 val_constr.data = NULL;
32616 int64_t* val_vals = val->elems;
32617 for (size_t i = 0; i < val_constr.datalen; i++) {
32618 int64_t val_conv_8 = val_vals[i];
32619 val_constr.data[i] = val_conv_8;
32621 NodeInfo_set_channels(&this_ptr_conv, val_constr);
32624 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) {
32625 LDKNodeInfo this_ptr_conv;
32626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32627 this_ptr_conv.is_owned = false;
32628 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32629 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
32630 uint64_t ret_ref = 0;
32631 if ((uint64_t)ret_var.inner > 4096) {
32632 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32633 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32634 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32635 ret_ref = (uint64_t)ret_var.inner;
32636 if (ret_var.is_owned) {
32643 void __attribute__((visibility("default"))) TS_NodeInfo_set_lowest_inbound_channel_fees(uint32_t this_ptr, uint32_t val) {
32644 LDKNodeInfo this_ptr_conv;
32645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32646 this_ptr_conv.is_owned = false;
32647 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32648 LDKRoutingFees val_conv;
32649 val_conv.inner = (void*)(val & (~1));
32650 val_conv.is_owned = (val & 1) || (val == 0);
32651 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32652 val_conv = RoutingFees_clone(&val_conv);
32653 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
32656 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) {
32657 LDKNodeInfo this_ptr_conv;
32658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32659 this_ptr_conv.is_owned = false;
32660 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32661 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
32662 uint64_t ret_ref = 0;
32663 if ((uint64_t)ret_var.inner > 4096) {
32664 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32665 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32666 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32667 ret_ref = (uint64_t)ret_var.inner;
32668 if (ret_var.is_owned) {
32675 void __attribute__((visibility("default"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) {
32676 LDKNodeInfo this_ptr_conv;
32677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32678 this_ptr_conv.is_owned = false;
32679 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32680 LDKNodeAnnouncementInfo val_conv;
32681 val_conv.inner = (void*)(val & (~1));
32682 val_conv.is_owned = (val & 1) || (val == 0);
32683 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32684 val_conv = NodeAnnouncementInfo_clone(&val_conv);
32685 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
32688 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_new(int64_tArray channels_arg, uint32_t lowest_inbound_channel_fees_arg, uint32_t announcement_info_arg) {
32689 LDKCVec_u64Z channels_arg_constr;
32690 channels_arg_constr.datalen = channels_arg->arr_len;
32691 if (channels_arg_constr.datalen > 0)
32692 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
32694 channels_arg_constr.data = NULL;
32695 int64_t* channels_arg_vals = channels_arg->elems;
32696 for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
32697 int64_t channels_arg_conv_8 = channels_arg_vals[i];
32698 channels_arg_constr.data[i] = channels_arg_conv_8;
32700 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
32701 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
32702 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
32703 CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
32704 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
32705 LDKNodeAnnouncementInfo announcement_info_arg_conv;
32706 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
32707 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
32708 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
32709 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
32710 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
32711 uint64_t ret_ref = 0;
32712 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32713 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32714 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32715 ret_ref = (uint64_t)ret_var.inner;
32716 if (ret_var.is_owned) {
32722 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
32723 LDKNodeInfo ret_var = NodeInfo_clone(arg);
32724 uint64_t ret_ref = 0;
32725 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32726 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32727 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32728 ret_ref = (uint64_t)ret_var.inner;
32729 if (ret_var.is_owned) {
32734 int64_t __attribute__((visibility("default"))) TS_NodeInfo_clone_ptr(uint32_t arg) {
32735 LDKNodeInfo arg_conv;
32736 arg_conv.inner = (void*)(arg & (~1));
32737 arg_conv.is_owned = false;
32738 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32739 int64_t ret_val = NodeInfo_clone_ptr(&arg_conv);
32743 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_clone(uint32_t orig) {
32744 LDKNodeInfo orig_conv;
32745 orig_conv.inner = (void*)(orig & (~1));
32746 orig_conv.is_owned = false;
32747 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32748 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
32749 uint64_t ret_ref = 0;
32750 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32751 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32752 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32753 ret_ref = (uint64_t)ret_var.inner;
32754 if (ret_var.is_owned) {
32760 int8_tArray __attribute__((visibility("default"))) TS_NodeInfo_write(uint32_t obj) {
32761 LDKNodeInfo obj_conv;
32762 obj_conv.inner = (void*)(obj & (~1));
32763 obj_conv.is_owned = false;
32764 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32765 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
32766 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
32767 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32768 CVec_u8Z_free(ret_var);
32772 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_read(int8_tArray ser) {
32773 LDKu8slice ser_ref;
32774 ser_ref.datalen = ser->arr_len;
32775 ser_ref.data = ser->elems;
32776 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
32777 *ret_conv = NodeInfo_read(ser_ref);
32778 return (uint64_t)ret_conv;
32781 int8_tArray __attribute__((visibility("default"))) TS_NetworkGraph_write(uint32_t obj) {
32782 LDKNetworkGraph obj_conv;
32783 obj_conv.inner = (void*)(obj & (~1));
32784 obj_conv.is_owned = false;
32785 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32786 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
32787 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
32788 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32789 CVec_u8Z_free(ret_var);
32793 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read(int8_tArray ser) {
32794 LDKu8slice ser_ref;
32795 ser_ref.datalen = ser->arr_len;
32796 ser_ref.data = ser->elems;
32797 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
32798 *ret_conv = NetworkGraph_read(ser_ref);
32799 return (uint64_t)ret_conv;
32802 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_new(int8_tArray genesis_hash) {
32803 LDKThirtyTwoBytes genesis_hash_ref;
32804 CHECK(genesis_hash->arr_len == 32);
32805 memcpy(genesis_hash_ref.data, genesis_hash->elems, 32);
32806 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
32807 uint64_t ret_ref = 0;
32808 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32809 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32810 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32811 ret_ref = (uint64_t)ret_var.inner;
32812 if (ret_var.is_owned) {
32818 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read_only(uint32_t this_arg) {
32819 LDKNetworkGraph this_arg_conv;
32820 this_arg_conv.inner = (void*)(this_arg & (~1));
32821 this_arg_conv.is_owned = false;
32822 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32823 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
32824 uint64_t ret_ref = 0;
32825 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32826 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32827 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32828 ret_ref = (uint64_t)ret_var.inner;
32829 if (ret_var.is_owned) {
32835 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) {
32836 LDKNetworkGraph this_arg_conv;
32837 this_arg_conv.inner = (void*)(this_arg & (~1));
32838 this_arg_conv.is_owned = false;
32839 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32840 LDKNodeAnnouncement msg_conv;
32841 msg_conv.inner = (void*)(msg & (~1));
32842 msg_conv.is_owned = false;
32843 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32844 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
32845 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
32846 return (uint64_t)ret_conv;
32849 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_unsigned_announcement(uint32_t this_arg, uint32_t msg) {
32850 LDKNetworkGraph this_arg_conv;
32851 this_arg_conv.inner = (void*)(this_arg & (~1));
32852 this_arg_conv.is_owned = false;
32853 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32854 LDKUnsignedNodeAnnouncement msg_conv;
32855 msg_conv.inner = (void*)(msg & (~1));
32856 msg_conv.is_owned = false;
32857 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32858 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
32859 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
32860 return (uint64_t)ret_conv;
32863 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
32864 LDKNetworkGraph this_arg_conv;
32865 this_arg_conv.inner = (void*)(this_arg & (~1));
32866 this_arg_conv.is_owned = false;
32867 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32868 LDKChannelAnnouncement msg_conv;
32869 msg_conv.inner = (void*)(msg & (~1));
32870 msg_conv.is_owned = false;
32871 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32872 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
32873 CHECK_ACCESS(chain_access_ptr);
32874 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
32875 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
32876 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
32877 // Manually implement clone for Java trait instances
32879 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
32880 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
32881 return (uint64_t)ret_conv;
32884 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_unsigned_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
32885 LDKNetworkGraph this_arg_conv;
32886 this_arg_conv.inner = (void*)(this_arg & (~1));
32887 this_arg_conv.is_owned = false;
32888 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32889 LDKUnsignedChannelAnnouncement msg_conv;
32890 msg_conv.inner = (void*)(msg & (~1));
32891 msg_conv.is_owned = false;
32892 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32893 void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
32894 CHECK_ACCESS(chain_access_ptr);
32895 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
32896 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
32897 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
32898 // Manually implement clone for Java trait instances
32900 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
32901 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
32902 return (uint64_t)ret_conv;
32905 void __attribute__((visibility("default"))) TS_NetworkGraph_close_channel_from_update(uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
32906 LDKNetworkGraph this_arg_conv;
32907 this_arg_conv.inner = (void*)(this_arg & (~1));
32908 this_arg_conv.is_owned = false;
32909 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32910 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
32913 void __attribute__((visibility("default"))) TS_NetworkGraph_fail_node(uint32_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
32914 LDKNetworkGraph this_arg_conv;
32915 this_arg_conv.inner = (void*)(this_arg & (~1));
32916 this_arg_conv.is_owned = false;
32917 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32918 LDKPublicKey _node_id_ref;
32919 CHECK(_node_id->arr_len == 33);
32920 memcpy(_node_id_ref.compressed_form, _node_id->elems, 33);
32921 NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent);
32924 void __attribute__((visibility("default"))) TS_NetworkGraph_remove_stale_channels_with_time(uint32_t this_arg, int64_t current_time_unix) {
32925 LDKNetworkGraph this_arg_conv;
32926 this_arg_conv.inner = (void*)(this_arg & (~1));
32927 this_arg_conv.is_owned = false;
32928 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32929 NetworkGraph_remove_stale_channels_with_time(&this_arg_conv, current_time_unix);
32932 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) {
32933 LDKNetworkGraph this_arg_conv;
32934 this_arg_conv.inner = (void*)(this_arg & (~1));
32935 this_arg_conv.is_owned = false;
32936 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32937 LDKChannelUpdate msg_conv;
32938 msg_conv.inner = (void*)(msg & (~1));
32939 msg_conv.is_owned = false;
32940 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32941 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
32942 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
32943 return (uint64_t)ret_conv;
32946 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) {
32947 LDKNetworkGraph this_arg_conv;
32948 this_arg_conv.inner = (void*)(this_arg & (~1));
32949 this_arg_conv.is_owned = false;
32950 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32951 LDKUnsignedChannelUpdate msg_conv;
32952 msg_conv.inner = (void*)(msg & (~1));
32953 msg_conv.is_owned = false;
32954 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32955 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
32956 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
32957 return (uint64_t)ret_conv;
32960 uint32_t __attribute__((visibility("default"))) TS_ReadOnlyNetworkGraph_get_addresses(uint32_t this_arg, int8_tArray pubkey) {
32961 LDKReadOnlyNetworkGraph this_arg_conv;
32962 this_arg_conv.inner = (void*)(this_arg & (~1));
32963 this_arg_conv.is_owned = false;
32964 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32965 LDKPublicKey pubkey_ref;
32966 CHECK(pubkey->arr_len == 33);
32967 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33);
32968 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
32969 *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
32970 uint64_t ret_ref = (uint64_t)ret_copy;
32974 void __attribute__((visibility("default"))) TS_RouteHop_free(uint32_t this_obj) {
32975 LDKRouteHop this_obj_conv;
32976 this_obj_conv.inner = (void*)(this_obj & (~1));
32977 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32978 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32979 RouteHop_free(this_obj_conv);
32982 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) {
32983 LDKRouteHop this_ptr_conv;
32984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32985 this_ptr_conv.is_owned = false;
32986 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32987 int8_tArray ret_arr = init_int8_tArray(33);
32988 memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
32992 void __attribute__((visibility("default"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) {
32993 LDKRouteHop this_ptr_conv;
32994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32995 this_ptr_conv.is_owned = false;
32996 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32997 LDKPublicKey val_ref;
32998 CHECK(val->arr_len == 33);
32999 memcpy(val_ref.compressed_form, val->elems, 33);
33000 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
33003 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_node_features(uint32_t this_ptr) {
33004 LDKRouteHop this_ptr_conv;
33005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33006 this_ptr_conv.is_owned = false;
33007 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33008 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
33009 uint64_t ret_ref = 0;
33010 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33011 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33012 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33013 ret_ref = (uint64_t)ret_var.inner;
33014 if (ret_var.is_owned) {
33020 void __attribute__((visibility("default"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) {
33021 LDKRouteHop this_ptr_conv;
33022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33023 this_ptr_conv.is_owned = false;
33024 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33025 LDKNodeFeatures val_conv;
33026 val_conv.inner = (void*)(val & (~1));
33027 val_conv.is_owned = (val & 1) || (val == 0);
33028 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33029 val_conv = NodeFeatures_clone(&val_conv);
33030 RouteHop_set_node_features(&this_ptr_conv, val_conv);
33033 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) {
33034 LDKRouteHop this_ptr_conv;
33035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33036 this_ptr_conv.is_owned = false;
33037 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33038 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
33042 void __attribute__((visibility("default"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
33043 LDKRouteHop this_ptr_conv;
33044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33045 this_ptr_conv.is_owned = false;
33046 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33047 RouteHop_set_short_channel_id(&this_ptr_conv, val);
33050 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) {
33051 LDKRouteHop this_ptr_conv;
33052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33053 this_ptr_conv.is_owned = false;
33054 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33055 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
33056 uint64_t ret_ref = 0;
33057 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33058 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33059 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33060 ret_ref = (uint64_t)ret_var.inner;
33061 if (ret_var.is_owned) {
33067 void __attribute__((visibility("default"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) {
33068 LDKRouteHop this_ptr_conv;
33069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33070 this_ptr_conv.is_owned = false;
33071 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33072 LDKChannelFeatures val_conv;
33073 val_conv.inner = (void*)(val & (~1));
33074 val_conv.is_owned = (val & 1) || (val == 0);
33075 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33076 val_conv = ChannelFeatures_clone(&val_conv);
33077 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
33080 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) {
33081 LDKRouteHop this_ptr_conv;
33082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33083 this_ptr_conv.is_owned = false;
33084 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33085 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
33089 void __attribute__((visibility("default"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) {
33090 LDKRouteHop this_ptr_conv;
33091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33092 this_ptr_conv.is_owned = false;
33093 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33094 RouteHop_set_fee_msat(&this_ptr_conv, val);
33097 int32_t __attribute__((visibility("default"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) {
33098 LDKRouteHop this_ptr_conv;
33099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33100 this_ptr_conv.is_owned = false;
33101 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33102 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
33106 void __attribute__((visibility("default"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
33107 LDKRouteHop this_ptr_conv;
33108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33109 this_ptr_conv.is_owned = false;
33110 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33111 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
33114 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) {
33115 LDKPublicKey pubkey_arg_ref;
33116 CHECK(pubkey_arg->arr_len == 33);
33117 memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33);
33118 LDKNodeFeatures node_features_arg_conv;
33119 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
33120 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
33121 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
33122 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
33123 LDKChannelFeatures channel_features_arg_conv;
33124 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
33125 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
33126 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
33127 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
33128 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);
33129 uint64_t ret_ref = 0;
33130 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33131 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33132 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33133 ret_ref = (uint64_t)ret_var.inner;
33134 if (ret_var.is_owned) {
33140 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
33141 LDKRouteHop ret_var = RouteHop_clone(arg);
33142 uint64_t ret_ref = 0;
33143 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33144 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33145 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33146 ret_ref = (uint64_t)ret_var.inner;
33147 if (ret_var.is_owned) {
33152 int64_t __attribute__((visibility("default"))) TS_RouteHop_clone_ptr(uint32_t arg) {
33153 LDKRouteHop arg_conv;
33154 arg_conv.inner = (void*)(arg & (~1));
33155 arg_conv.is_owned = false;
33156 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33157 int64_t ret_val = RouteHop_clone_ptr(&arg_conv);
33161 uint32_t __attribute__((visibility("default"))) TS_RouteHop_clone(uint32_t orig) {
33162 LDKRouteHop orig_conv;
33163 orig_conv.inner = (void*)(orig & (~1));
33164 orig_conv.is_owned = false;
33165 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33166 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
33167 uint64_t ret_ref = 0;
33168 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33169 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33170 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33171 ret_ref = (uint64_t)ret_var.inner;
33172 if (ret_var.is_owned) {
33178 int64_t __attribute__((visibility("default"))) TS_RouteHop_hash(uint32_t o) {
33179 LDKRouteHop o_conv;
33180 o_conv.inner = (void*)(o & (~1));
33181 o_conv.is_owned = false;
33182 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33183 int64_t ret_val = RouteHop_hash(&o_conv);
33187 jboolean __attribute__((visibility("default"))) TS_RouteHop_eq(uint32_t a, uint32_t b) {
33188 LDKRouteHop a_conv;
33189 a_conv.inner = (void*)(a & (~1));
33190 a_conv.is_owned = false;
33191 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33192 LDKRouteHop b_conv;
33193 b_conv.inner = (void*)(b & (~1));
33194 b_conv.is_owned = false;
33195 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33196 jboolean ret_val = RouteHop_eq(&a_conv, &b_conv);
33200 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_write(uint32_t obj) {
33201 LDKRouteHop obj_conv;
33202 obj_conv.inner = (void*)(obj & (~1));
33203 obj_conv.is_owned = false;
33204 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33205 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
33206 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
33207 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33208 CVec_u8Z_free(ret_var);
33212 uint32_t __attribute__((visibility("default"))) TS_RouteHop_read(int8_tArray ser) {
33213 LDKu8slice ser_ref;
33214 ser_ref.datalen = ser->arr_len;
33215 ser_ref.data = ser->elems;
33216 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
33217 *ret_conv = RouteHop_read(ser_ref);
33218 return (uint64_t)ret_conv;
33221 void __attribute__((visibility("default"))) TS_Route_free(uint32_t this_obj) {
33222 LDKRoute this_obj_conv;
33223 this_obj_conv.inner = (void*)(this_obj & (~1));
33224 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33225 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33226 Route_free(this_obj_conv);
33229 ptrArray __attribute__((visibility("default"))) TS_Route_get_paths(uint32_t this_ptr) {
33230 LDKRoute this_ptr_conv;
33231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33232 this_ptr_conv.is_owned = false;
33233 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33234 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
33235 ptrArray ret_arr = NULL;
33236 ret_arr = init_ptrArray(ret_var.datalen);
33237 uint32_tArray *ret_arr_ptr = (uint32_tArray*)(ret_arr + 4);
33238 for (size_t m = 0; m < ret_var.datalen; m++) {
33239 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
33240 uint32_tArray ret_conv_12_arr = NULL;
33241 ret_conv_12_arr = init_uint32_tArray(ret_conv_12_var.datalen);
33242 uint32_t *ret_conv_12_arr_ptr = (uint32_t*)(ret_conv_12_arr + 4);
33243 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
33244 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
33245 uint64_t ret_conv_12_conv_10_ref = 0;
33246 CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33247 CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33248 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
33249 ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner;
33250 if (ret_conv_12_conv_10_var.is_owned) {
33251 ret_conv_12_conv_10_ref |= 1;
33253 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
33256 FREE(ret_conv_12_var.data);
33257 ret_arr_ptr[m] = ret_conv_12_arr;
33260 FREE(ret_var.data);
33264 void __attribute__((visibility("default"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) {
33265 LDKRoute this_ptr_conv;
33266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33267 this_ptr_conv.is_owned = false;
33268 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33269 LDKCVec_CVec_RouteHopZZ val_constr;
33270 val_constr.datalen = val->arr_len;
33271 if (val_constr.datalen > 0)
33272 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
33274 val_constr.data = NULL;
33275 uint32_tArray* val_vals = (void*) val->elems;
33276 for (size_t m = 0; m < val_constr.datalen; m++) {
33277 uint32_tArray val_conv_12 = val_vals[m];
33278 LDKCVec_RouteHopZ val_conv_12_constr;
33279 val_conv_12_constr.datalen = val_conv_12->arr_len;
33280 if (val_conv_12_constr.datalen > 0)
33281 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
33283 val_conv_12_constr.data = NULL;
33284 uint32_t* val_conv_12_vals = val_conv_12->elems;
33285 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
33286 uint32_t val_conv_12_conv_10 = val_conv_12_vals[k];
33287 LDKRouteHop val_conv_12_conv_10_conv;
33288 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
33289 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
33290 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
33291 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
33292 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
33294 val_constr.data[m] = val_conv_12_constr;
33296 Route_set_paths(&this_ptr_conv, val_constr);
33299 uint32_t __attribute__((visibility("default"))) TS_Route_get_payee(uint32_t this_ptr) {
33300 LDKRoute this_ptr_conv;
33301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33302 this_ptr_conv.is_owned = false;
33303 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33304 LDKPayee ret_var = Route_get_payee(&this_ptr_conv);
33305 uint64_t ret_ref = 0;
33306 if ((uint64_t)ret_var.inner > 4096) {
33307 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33308 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33309 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33310 ret_ref = (uint64_t)ret_var.inner;
33311 if (ret_var.is_owned) {
33318 void __attribute__((visibility("default"))) TS_Route_set_payee(uint32_t this_ptr, uint32_t val) {
33319 LDKRoute this_ptr_conv;
33320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33321 this_ptr_conv.is_owned = false;
33322 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33324 val_conv.inner = (void*)(val & (~1));
33325 val_conv.is_owned = (val & 1) || (val == 0);
33326 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33327 val_conv = Payee_clone(&val_conv);
33328 Route_set_payee(&this_ptr_conv, val_conv);
33331 uint32_t __attribute__((visibility("default"))) TS_Route_new(ptrArray paths_arg, uint32_t payee_arg) {
33332 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
33333 paths_arg_constr.datalen = paths_arg->arr_len;
33334 if (paths_arg_constr.datalen > 0)
33335 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
33337 paths_arg_constr.data = NULL;
33338 uint32_tArray* paths_arg_vals = (void*) paths_arg->elems;
33339 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
33340 uint32_tArray paths_arg_conv_12 = paths_arg_vals[m];
33341 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
33342 paths_arg_conv_12_constr.datalen = paths_arg_conv_12->arr_len;
33343 if (paths_arg_conv_12_constr.datalen > 0)
33344 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
33346 paths_arg_conv_12_constr.data = NULL;
33347 uint32_t* paths_arg_conv_12_vals = paths_arg_conv_12->elems;
33348 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
33349 uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
33350 LDKRouteHop paths_arg_conv_12_conv_10_conv;
33351 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
33352 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
33353 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
33354 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
33355 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
33357 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
33359 LDKPayee payee_arg_conv;
33360 payee_arg_conv.inner = (void*)(payee_arg & (~1));
33361 payee_arg_conv.is_owned = (payee_arg & 1) || (payee_arg == 0);
33362 CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_arg_conv);
33363 payee_arg_conv = Payee_clone(&payee_arg_conv);
33364 LDKRoute ret_var = Route_new(paths_arg_constr, payee_arg_conv);
33365 uint64_t ret_ref = 0;
33366 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33367 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33368 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33369 ret_ref = (uint64_t)ret_var.inner;
33370 if (ret_var.is_owned) {
33376 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
33377 LDKRoute ret_var = Route_clone(arg);
33378 uint64_t ret_ref = 0;
33379 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33380 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33381 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33382 ret_ref = (uint64_t)ret_var.inner;
33383 if (ret_var.is_owned) {
33388 int64_t __attribute__((visibility("default"))) TS_Route_clone_ptr(uint32_t arg) {
33390 arg_conv.inner = (void*)(arg & (~1));
33391 arg_conv.is_owned = false;
33392 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33393 int64_t ret_val = Route_clone_ptr(&arg_conv);
33397 uint32_t __attribute__((visibility("default"))) TS_Route_clone(uint32_t orig) {
33398 LDKRoute orig_conv;
33399 orig_conv.inner = (void*)(orig & (~1));
33400 orig_conv.is_owned = false;
33401 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33402 LDKRoute ret_var = Route_clone(&orig_conv);
33403 uint64_t ret_ref = 0;
33404 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33405 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33406 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33407 ret_ref = (uint64_t)ret_var.inner;
33408 if (ret_var.is_owned) {
33414 int64_t __attribute__((visibility("default"))) TS_Route_hash(uint32_t o) {
33416 o_conv.inner = (void*)(o & (~1));
33417 o_conv.is_owned = false;
33418 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33419 int64_t ret_val = Route_hash(&o_conv);
33423 jboolean __attribute__((visibility("default"))) TS_Route_eq(uint32_t a, uint32_t b) {
33425 a_conv.inner = (void*)(a & (~1));
33426 a_conv.is_owned = false;
33427 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33429 b_conv.inner = (void*)(b & (~1));
33430 b_conv.is_owned = false;
33431 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33432 jboolean ret_val = Route_eq(&a_conv, &b_conv);
33436 int64_t __attribute__((visibility("default"))) TS_Route_get_total_fees(uint32_t this_arg) {
33437 LDKRoute this_arg_conv;
33438 this_arg_conv.inner = (void*)(this_arg & (~1));
33439 this_arg_conv.is_owned = false;
33440 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33441 int64_t ret_val = Route_get_total_fees(&this_arg_conv);
33445 int64_t __attribute__((visibility("default"))) TS_Route_get_total_amount(uint32_t this_arg) {
33446 LDKRoute this_arg_conv;
33447 this_arg_conv.inner = (void*)(this_arg & (~1));
33448 this_arg_conv.is_owned = false;
33449 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33450 int64_t ret_val = Route_get_total_amount(&this_arg_conv);
33454 int8_tArray __attribute__((visibility("default"))) TS_Route_write(uint32_t obj) {
33456 obj_conv.inner = (void*)(obj & (~1));
33457 obj_conv.is_owned = false;
33458 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33459 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
33460 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
33461 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33462 CVec_u8Z_free(ret_var);
33466 uint32_t __attribute__((visibility("default"))) TS_Route_read(int8_tArray ser) {
33467 LDKu8slice ser_ref;
33468 ser_ref.datalen = ser->arr_len;
33469 ser_ref.data = ser->elems;
33470 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
33471 *ret_conv = Route_read(ser_ref);
33472 return (uint64_t)ret_conv;
33475 void __attribute__((visibility("default"))) TS_RouteParameters_free(uint32_t this_obj) {
33476 LDKRouteParameters this_obj_conv;
33477 this_obj_conv.inner = (void*)(this_obj & (~1));
33478 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33479 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33480 RouteParameters_free(this_obj_conv);
33483 uint32_t __attribute__((visibility("default"))) TS_RouteParameters_get_payee(uint32_t this_ptr) {
33484 LDKRouteParameters this_ptr_conv;
33485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33486 this_ptr_conv.is_owned = false;
33487 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33488 LDKPayee ret_var = RouteParameters_get_payee(&this_ptr_conv);
33489 uint64_t ret_ref = 0;
33490 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33491 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33492 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33493 ret_ref = (uint64_t)ret_var.inner;
33494 if (ret_var.is_owned) {
33500 void __attribute__((visibility("default"))) TS_RouteParameters_set_payee(uint32_t this_ptr, uint32_t val) {
33501 LDKRouteParameters this_ptr_conv;
33502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33503 this_ptr_conv.is_owned = false;
33504 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33506 val_conv.inner = (void*)(val & (~1));
33507 val_conv.is_owned = (val & 1) || (val == 0);
33508 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33509 val_conv = Payee_clone(&val_conv);
33510 RouteParameters_set_payee(&this_ptr_conv, val_conv);
33513 int64_t __attribute__((visibility("default"))) TS_RouteParameters_get_final_value_msat(uint32_t this_ptr) {
33514 LDKRouteParameters this_ptr_conv;
33515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33516 this_ptr_conv.is_owned = false;
33517 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33518 int64_t ret_val = RouteParameters_get_final_value_msat(&this_ptr_conv);
33522 void __attribute__((visibility("default"))) TS_RouteParameters_set_final_value_msat(uint32_t this_ptr, int64_t val) {
33523 LDKRouteParameters this_ptr_conv;
33524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33525 this_ptr_conv.is_owned = false;
33526 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33527 RouteParameters_set_final_value_msat(&this_ptr_conv, val);
33530 int32_t __attribute__((visibility("default"))) TS_RouteParameters_get_final_cltv_expiry_delta(uint32_t this_ptr) {
33531 LDKRouteParameters this_ptr_conv;
33532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33533 this_ptr_conv.is_owned = false;
33534 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33535 int32_t ret_val = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
33539 void __attribute__((visibility("default"))) TS_RouteParameters_set_final_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
33540 LDKRouteParameters this_ptr_conv;
33541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33542 this_ptr_conv.is_owned = false;
33543 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33544 RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
33547 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) {
33548 LDKPayee payee_arg_conv;
33549 payee_arg_conv.inner = (void*)(payee_arg & (~1));
33550 payee_arg_conv.is_owned = (payee_arg & 1) || (payee_arg == 0);
33551 CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_arg_conv);
33552 payee_arg_conv = Payee_clone(&payee_arg_conv);
33553 LDKRouteParameters ret_var = RouteParameters_new(payee_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
33554 uint64_t ret_ref = 0;
33555 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33556 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33557 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33558 ret_ref = (uint64_t)ret_var.inner;
33559 if (ret_var.is_owned) {
33565 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
33566 LDKRouteParameters ret_var = RouteParameters_clone(arg);
33567 uint64_t ret_ref = 0;
33568 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33569 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33570 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33571 ret_ref = (uint64_t)ret_var.inner;
33572 if (ret_var.is_owned) {
33577 int64_t __attribute__((visibility("default"))) TS_RouteParameters_clone_ptr(uint32_t arg) {
33578 LDKRouteParameters arg_conv;
33579 arg_conv.inner = (void*)(arg & (~1));
33580 arg_conv.is_owned = false;
33581 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33582 int64_t ret_val = RouteParameters_clone_ptr(&arg_conv);
33586 uint32_t __attribute__((visibility("default"))) TS_RouteParameters_clone(uint32_t orig) {
33587 LDKRouteParameters orig_conv;
33588 orig_conv.inner = (void*)(orig & (~1));
33589 orig_conv.is_owned = false;
33590 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33591 LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
33592 uint64_t ret_ref = 0;
33593 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33594 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33595 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33596 ret_ref = (uint64_t)ret_var.inner;
33597 if (ret_var.is_owned) {
33603 int8_tArray __attribute__((visibility("default"))) TS_RouteParameters_write(uint32_t obj) {
33604 LDKRouteParameters obj_conv;
33605 obj_conv.inner = (void*)(obj & (~1));
33606 obj_conv.is_owned = false;
33607 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33608 LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
33609 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
33610 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33611 CVec_u8Z_free(ret_var);
33615 uint32_t __attribute__((visibility("default"))) TS_RouteParameters_read(int8_tArray ser) {
33616 LDKu8slice ser_ref;
33617 ser_ref.datalen = ser->arr_len;
33618 ser_ref.data = ser->elems;
33619 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
33620 *ret_conv = RouteParameters_read(ser_ref);
33621 return (uint64_t)ret_conv;
33624 void __attribute__((visibility("default"))) TS_Payee_free(uint32_t this_obj) {
33625 LDKPayee this_obj_conv;
33626 this_obj_conv.inner = (void*)(this_obj & (~1));
33627 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33628 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33629 Payee_free(this_obj_conv);
33632 int8_tArray __attribute__((visibility("default"))) TS_Payee_get_pubkey(uint32_t this_ptr) {
33633 LDKPayee this_ptr_conv;
33634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33635 this_ptr_conv.is_owned = false;
33636 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33637 int8_tArray ret_arr = init_int8_tArray(33);
33638 memcpy(ret_arr->elems, Payee_get_pubkey(&this_ptr_conv).compressed_form, 33);
33642 void __attribute__((visibility("default"))) TS_Payee_set_pubkey(uint32_t this_ptr, int8_tArray val) {
33643 LDKPayee this_ptr_conv;
33644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33645 this_ptr_conv.is_owned = false;
33646 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33647 LDKPublicKey val_ref;
33648 CHECK(val->arr_len == 33);
33649 memcpy(val_ref.compressed_form, val->elems, 33);
33650 Payee_set_pubkey(&this_ptr_conv, val_ref);
33653 uint32_t __attribute__((visibility("default"))) TS_Payee_get_features(uint32_t this_ptr) {
33654 LDKPayee this_ptr_conv;
33655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33656 this_ptr_conv.is_owned = false;
33657 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33658 LDKInvoiceFeatures ret_var = Payee_get_features(&this_ptr_conv);
33659 uint64_t ret_ref = 0;
33660 if ((uint64_t)ret_var.inner > 4096) {
33661 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33662 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33663 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33664 ret_ref = (uint64_t)ret_var.inner;
33665 if (ret_var.is_owned) {
33672 void __attribute__((visibility("default"))) TS_Payee_set_features(uint32_t this_ptr, uint32_t val) {
33673 LDKPayee this_ptr_conv;
33674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33675 this_ptr_conv.is_owned = false;
33676 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33677 LDKInvoiceFeatures val_conv;
33678 val_conv.inner = (void*)(val & (~1));
33679 val_conv.is_owned = (val & 1) || (val == 0);
33680 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33681 val_conv = InvoiceFeatures_clone(&val_conv);
33682 Payee_set_features(&this_ptr_conv, val_conv);
33685 uint32_tArray __attribute__((visibility("default"))) TS_Payee_get_route_hints(uint32_t this_ptr) {
33686 LDKPayee this_ptr_conv;
33687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33688 this_ptr_conv.is_owned = false;
33689 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33690 LDKCVec_RouteHintZ ret_var = Payee_get_route_hints(&this_ptr_conv);
33691 uint32_tArray ret_arr = NULL;
33692 ret_arr = init_uint32_tArray(ret_var.datalen);
33693 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
33694 for (size_t l = 0; l < ret_var.datalen; l++) {
33695 LDKRouteHint ret_conv_11_var = ret_var.data[l];
33696 uint64_t ret_conv_11_ref = 0;
33697 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33698 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33699 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
33700 ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
33701 if (ret_conv_11_var.is_owned) {
33702 ret_conv_11_ref |= 1;
33704 ret_arr_ptr[l] = ret_conv_11_ref;
33707 FREE(ret_var.data);
33711 void __attribute__((visibility("default"))) TS_Payee_set_route_hints(uint32_t this_ptr, uint32_tArray val) {
33712 LDKPayee this_ptr_conv;
33713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33714 this_ptr_conv.is_owned = false;
33715 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33716 LDKCVec_RouteHintZ val_constr;
33717 val_constr.datalen = val->arr_len;
33718 if (val_constr.datalen > 0)
33719 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
33721 val_constr.data = NULL;
33722 uint32_t* val_vals = val->elems;
33723 for (size_t l = 0; l < val_constr.datalen; l++) {
33724 uint32_t val_conv_11 = val_vals[l];
33725 LDKRouteHint val_conv_11_conv;
33726 val_conv_11_conv.inner = (void*)(val_conv_11 & (~1));
33727 val_conv_11_conv.is_owned = (val_conv_11 & 1) || (val_conv_11 == 0);
33728 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
33729 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
33730 val_constr.data[l] = val_conv_11_conv;
33732 Payee_set_route_hints(&this_ptr_conv, val_constr);
33735 uint32_t __attribute__((visibility("default"))) TS_Payee_get_expiry_time(uint32_t this_ptr) {
33736 LDKPayee this_ptr_conv;
33737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33738 this_ptr_conv.is_owned = false;
33739 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33740 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
33741 *ret_copy = Payee_get_expiry_time(&this_ptr_conv);
33742 uint64_t ret_ref = (uint64_t)ret_copy;
33746 void __attribute__((visibility("default"))) TS_Payee_set_expiry_time(uint32_t this_ptr, uint32_t val) {
33747 LDKPayee this_ptr_conv;
33748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33749 this_ptr_conv.is_owned = false;
33750 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33751 void* val_ptr = (void*)(((uint64_t)val) & ~1);
33752 CHECK_ACCESS(val_ptr);
33753 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
33754 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
33755 Payee_set_expiry_time(&this_ptr_conv, val_conv);
33758 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) {
33759 LDKPublicKey pubkey_arg_ref;
33760 CHECK(pubkey_arg->arr_len == 33);
33761 memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33);
33762 LDKInvoiceFeatures features_arg_conv;
33763 features_arg_conv.inner = (void*)(features_arg & (~1));
33764 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
33765 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
33766 features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
33767 LDKCVec_RouteHintZ route_hints_arg_constr;
33768 route_hints_arg_constr.datalen = route_hints_arg->arr_len;
33769 if (route_hints_arg_constr.datalen > 0)
33770 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
33772 route_hints_arg_constr.data = NULL;
33773 uint32_t* route_hints_arg_vals = route_hints_arg->elems;
33774 for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
33775 uint32_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
33776 LDKRouteHint route_hints_arg_conv_11_conv;
33777 route_hints_arg_conv_11_conv.inner = (void*)(route_hints_arg_conv_11 & (~1));
33778 route_hints_arg_conv_11_conv.is_owned = (route_hints_arg_conv_11 & 1) || (route_hints_arg_conv_11 == 0);
33779 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
33780 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
33781 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
33783 void* expiry_time_arg_ptr = (void*)(((uint64_t)expiry_time_arg) & ~1);
33784 CHECK_ACCESS(expiry_time_arg_ptr);
33785 LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
33786 expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)expiry_time_arg) & ~1));
33787 LDKPayee ret_var = Payee_new(pubkey_arg_ref, features_arg_conv, route_hints_arg_constr, expiry_time_arg_conv);
33788 uint64_t ret_ref = 0;
33789 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33790 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33791 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33792 ret_ref = (uint64_t)ret_var.inner;
33793 if (ret_var.is_owned) {
33799 static inline uint64_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
33800 LDKPayee ret_var = Payee_clone(arg);
33801 uint64_t ret_ref = 0;
33802 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33803 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33804 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33805 ret_ref = (uint64_t)ret_var.inner;
33806 if (ret_var.is_owned) {
33811 int64_t __attribute__((visibility("default"))) TS_Payee_clone_ptr(uint32_t arg) {
33813 arg_conv.inner = (void*)(arg & (~1));
33814 arg_conv.is_owned = false;
33815 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33816 int64_t ret_val = Payee_clone_ptr(&arg_conv);
33820 uint32_t __attribute__((visibility("default"))) TS_Payee_clone(uint32_t orig) {
33821 LDKPayee orig_conv;
33822 orig_conv.inner = (void*)(orig & (~1));
33823 orig_conv.is_owned = false;
33824 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33825 LDKPayee ret_var = Payee_clone(&orig_conv);
33826 uint64_t ret_ref = 0;
33827 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33828 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33829 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33830 ret_ref = (uint64_t)ret_var.inner;
33831 if (ret_var.is_owned) {
33837 int64_t __attribute__((visibility("default"))) TS_Payee_hash(uint32_t o) {
33839 o_conv.inner = (void*)(o & (~1));
33840 o_conv.is_owned = false;
33841 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33842 int64_t ret_val = Payee_hash(&o_conv);
33846 jboolean __attribute__((visibility("default"))) TS_Payee_eq(uint32_t a, uint32_t b) {
33848 a_conv.inner = (void*)(a & (~1));
33849 a_conv.is_owned = false;
33850 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33852 b_conv.inner = (void*)(b & (~1));
33853 b_conv.is_owned = false;
33854 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33855 jboolean ret_val = Payee_eq(&a_conv, &b_conv);
33859 int8_tArray __attribute__((visibility("default"))) TS_Payee_write(uint32_t obj) {
33861 obj_conv.inner = (void*)(obj & (~1));
33862 obj_conv.is_owned = false;
33863 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33864 LDKCVec_u8Z ret_var = Payee_write(&obj_conv);
33865 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
33866 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33867 CVec_u8Z_free(ret_var);
33871 uint32_t __attribute__((visibility("default"))) TS_Payee_read(int8_tArray ser) {
33872 LDKu8slice ser_ref;
33873 ser_ref.datalen = ser->arr_len;
33874 ser_ref.data = ser->elems;
33875 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
33876 *ret_conv = Payee_read(ser_ref);
33877 return (uint64_t)ret_conv;
33880 uint32_t __attribute__((visibility("default"))) TS_Payee_from_node_id(int8_tArray pubkey) {
33881 LDKPublicKey pubkey_ref;
33882 CHECK(pubkey->arr_len == 33);
33883 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33);
33884 LDKPayee ret_var = Payee_from_node_id(pubkey_ref);
33885 uint64_t ret_ref = 0;
33886 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33887 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33888 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33889 ret_ref = (uint64_t)ret_var.inner;
33890 if (ret_var.is_owned) {
33896 uint32_t __attribute__((visibility("default"))) TS_Payee_for_keysend(int8_tArray pubkey) {
33897 LDKPublicKey pubkey_ref;
33898 CHECK(pubkey->arr_len == 33);
33899 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33);
33900 LDKPayee ret_var = Payee_for_keysend(pubkey_ref);
33901 uint64_t ret_ref = 0;
33902 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33903 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33904 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33905 ret_ref = (uint64_t)ret_var.inner;
33906 if (ret_var.is_owned) {
33912 void __attribute__((visibility("default"))) TS_RouteHint_free(uint32_t this_obj) {
33913 LDKRouteHint this_obj_conv;
33914 this_obj_conv.inner = (void*)(this_obj & (~1));
33915 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33916 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33917 RouteHint_free(this_obj_conv);
33920 uint32_tArray __attribute__((visibility("default"))) TS_RouteHint_get_a(uint32_t this_ptr) {
33921 LDKRouteHint this_ptr_conv;
33922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33923 this_ptr_conv.is_owned = false;
33924 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33925 LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
33926 uint32_tArray ret_arr = NULL;
33927 ret_arr = init_uint32_tArray(ret_var.datalen);
33928 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
33929 for (size_t o = 0; o < ret_var.datalen; o++) {
33930 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
33931 uint64_t ret_conv_14_ref = 0;
33932 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33933 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33934 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
33935 ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
33936 if (ret_conv_14_var.is_owned) {
33937 ret_conv_14_ref |= 1;
33939 ret_arr_ptr[o] = ret_conv_14_ref;
33942 FREE(ret_var.data);
33946 void __attribute__((visibility("default"))) TS_RouteHint_set_a(uint32_t this_ptr, uint32_tArray val) {
33947 LDKRouteHint this_ptr_conv;
33948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33949 this_ptr_conv.is_owned = false;
33950 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33951 LDKCVec_RouteHintHopZ val_constr;
33952 val_constr.datalen = val->arr_len;
33953 if (val_constr.datalen > 0)
33954 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
33956 val_constr.data = NULL;
33957 uint32_t* val_vals = val->elems;
33958 for (size_t o = 0; o < val_constr.datalen; o++) {
33959 uint32_t val_conv_14 = val_vals[o];
33960 LDKRouteHintHop val_conv_14_conv;
33961 val_conv_14_conv.inner = (void*)(val_conv_14 & (~1));
33962 val_conv_14_conv.is_owned = (val_conv_14 & 1) || (val_conv_14 == 0);
33963 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
33964 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
33965 val_constr.data[o] = val_conv_14_conv;
33967 RouteHint_set_a(&this_ptr_conv, val_constr);
33970 uint32_t __attribute__((visibility("default"))) TS_RouteHint_new(uint32_tArray a_arg) {
33971 LDKCVec_RouteHintHopZ a_arg_constr;
33972 a_arg_constr.datalen = a_arg->arr_len;
33973 if (a_arg_constr.datalen > 0)
33974 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
33976 a_arg_constr.data = NULL;
33977 uint32_t* a_arg_vals = a_arg->elems;
33978 for (size_t o = 0; o < a_arg_constr.datalen; o++) {
33979 uint32_t a_arg_conv_14 = a_arg_vals[o];
33980 LDKRouteHintHop a_arg_conv_14_conv;
33981 a_arg_conv_14_conv.inner = (void*)(a_arg_conv_14 & (~1));
33982 a_arg_conv_14_conv.is_owned = (a_arg_conv_14 & 1) || (a_arg_conv_14 == 0);
33983 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
33984 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
33985 a_arg_constr.data[o] = a_arg_conv_14_conv;
33987 LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
33988 uint64_t ret_ref = 0;
33989 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33990 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33991 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33992 ret_ref = (uint64_t)ret_var.inner;
33993 if (ret_var.is_owned) {
33999 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
34000 LDKRouteHint ret_var = RouteHint_clone(arg);
34001 uint64_t ret_ref = 0;
34002 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34003 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34004 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34005 ret_ref = (uint64_t)ret_var.inner;
34006 if (ret_var.is_owned) {
34011 int64_t __attribute__((visibility("default"))) TS_RouteHint_clone_ptr(uint32_t arg) {
34012 LDKRouteHint arg_conv;
34013 arg_conv.inner = (void*)(arg & (~1));
34014 arg_conv.is_owned = false;
34015 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34016 int64_t ret_val = RouteHint_clone_ptr(&arg_conv);
34020 uint32_t __attribute__((visibility("default"))) TS_RouteHint_clone(uint32_t orig) {
34021 LDKRouteHint orig_conv;
34022 orig_conv.inner = (void*)(orig & (~1));
34023 orig_conv.is_owned = false;
34024 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34025 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
34026 uint64_t ret_ref = 0;
34027 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34028 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34029 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34030 ret_ref = (uint64_t)ret_var.inner;
34031 if (ret_var.is_owned) {
34037 int64_t __attribute__((visibility("default"))) TS_RouteHint_hash(uint32_t o) {
34038 LDKRouteHint o_conv;
34039 o_conv.inner = (void*)(o & (~1));
34040 o_conv.is_owned = false;
34041 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34042 int64_t ret_val = RouteHint_hash(&o_conv);
34046 jboolean __attribute__((visibility("default"))) TS_RouteHint_eq(uint32_t a, uint32_t b) {
34047 LDKRouteHint a_conv;
34048 a_conv.inner = (void*)(a & (~1));
34049 a_conv.is_owned = false;
34050 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34051 LDKRouteHint b_conv;
34052 b_conv.inner = (void*)(b & (~1));
34053 b_conv.is_owned = false;
34054 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34055 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
34059 int8_tArray __attribute__((visibility("default"))) TS_RouteHint_write(uint32_t obj) {
34060 LDKRouteHint obj_conv;
34061 obj_conv.inner = (void*)(obj & (~1));
34062 obj_conv.is_owned = false;
34063 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34064 LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
34065 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
34066 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34067 CVec_u8Z_free(ret_var);
34071 uint32_t __attribute__((visibility("default"))) TS_RouteHint_read(int8_tArray ser) {
34072 LDKu8slice ser_ref;
34073 ser_ref.datalen = ser->arr_len;
34074 ser_ref.data = ser->elems;
34075 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
34076 *ret_conv = RouteHint_read(ser_ref);
34077 return (uint64_t)ret_conv;
34080 void __attribute__((visibility("default"))) TS_RouteHintHop_free(uint32_t this_obj) {
34081 LDKRouteHintHop this_obj_conv;
34082 this_obj_conv.inner = (void*)(this_obj & (~1));
34083 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34084 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34085 RouteHintHop_free(this_obj_conv);
34088 int8_tArray __attribute__((visibility("default"))) TS_RouteHintHop_get_src_node_id(uint32_t this_ptr) {
34089 LDKRouteHintHop this_ptr_conv;
34090 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34091 this_ptr_conv.is_owned = false;
34092 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34093 int8_tArray ret_arr = init_int8_tArray(33);
34094 memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
34098 void __attribute__((visibility("default"))) TS_RouteHintHop_set_src_node_id(uint32_t this_ptr, int8_tArray val) {
34099 LDKRouteHintHop this_ptr_conv;
34100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34101 this_ptr_conv.is_owned = false;
34102 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34103 LDKPublicKey val_ref;
34104 CHECK(val->arr_len == 33);
34105 memcpy(val_ref.compressed_form, val->elems, 33);
34106 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
34109 int64_t __attribute__((visibility("default"))) TS_RouteHintHop_get_short_channel_id(uint32_t this_ptr) {
34110 LDKRouteHintHop this_ptr_conv;
34111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34112 this_ptr_conv.is_owned = false;
34113 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34114 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
34118 void __attribute__((visibility("default"))) TS_RouteHintHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
34119 LDKRouteHintHop this_ptr_conv;
34120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34121 this_ptr_conv.is_owned = false;
34122 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34123 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
34126 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_fees(uint32_t this_ptr) {
34127 LDKRouteHintHop this_ptr_conv;
34128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34129 this_ptr_conv.is_owned = false;
34130 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34131 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
34132 uint64_t ret_ref = 0;
34133 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34134 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34135 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34136 ret_ref = (uint64_t)ret_var.inner;
34137 if (ret_var.is_owned) {
34143 void __attribute__((visibility("default"))) TS_RouteHintHop_set_fees(uint32_t this_ptr, uint32_t val) {
34144 LDKRouteHintHop this_ptr_conv;
34145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34146 this_ptr_conv.is_owned = false;
34147 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34148 LDKRoutingFees val_conv;
34149 val_conv.inner = (void*)(val & (~1));
34150 val_conv.is_owned = (val & 1) || (val == 0);
34151 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34152 val_conv = RoutingFees_clone(&val_conv);
34153 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
34156 int16_t __attribute__((visibility("default"))) TS_RouteHintHop_get_cltv_expiry_delta(uint32_t this_ptr) {
34157 LDKRouteHintHop this_ptr_conv;
34158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34159 this_ptr_conv.is_owned = false;
34160 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34161 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
34165 void __attribute__((visibility("default"))) TS_RouteHintHop_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
34166 LDKRouteHintHop this_ptr_conv;
34167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34168 this_ptr_conv.is_owned = false;
34169 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34170 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
34173 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_minimum_msat(uint32_t this_ptr) {
34174 LDKRouteHintHop this_ptr_conv;
34175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34176 this_ptr_conv.is_owned = false;
34177 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34178 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34179 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
34180 uint64_t ret_ref = (uint64_t)ret_copy;
34184 void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_minimum_msat(uint32_t this_ptr, uint32_t val) {
34185 LDKRouteHintHop this_ptr_conv;
34186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34187 this_ptr_conv.is_owned = false;
34188 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34189 void* val_ptr = (void*)(((uint64_t)val) & ~1);
34190 CHECK_ACCESS(val_ptr);
34191 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34192 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
34193 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
34196 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_maximum_msat(uint32_t this_ptr) {
34197 LDKRouteHintHop this_ptr_conv;
34198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34199 this_ptr_conv.is_owned = false;
34200 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34201 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34202 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
34203 uint64_t ret_ref = (uint64_t)ret_copy;
34207 void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
34208 LDKRouteHintHop this_ptr_conv;
34209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34210 this_ptr_conv.is_owned = false;
34211 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34212 void* val_ptr = (void*)(((uint64_t)val) & ~1);
34213 CHECK_ACCESS(val_ptr);
34214 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34215 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
34216 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
34219 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) {
34220 LDKPublicKey src_node_id_arg_ref;
34221 CHECK(src_node_id_arg->arr_len == 33);
34222 memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33);
34223 LDKRoutingFees fees_arg_conv;
34224 fees_arg_conv.inner = (void*)(fees_arg & (~1));
34225 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
34226 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
34227 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
34228 void* htlc_minimum_msat_arg_ptr = (void*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
34229 CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
34230 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
34231 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1));
34232 void* htlc_maximum_msat_arg_ptr = (void*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
34233 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
34234 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
34235 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
34236 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);
34237 uint64_t ret_ref = 0;
34238 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34239 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34240 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34241 ret_ref = (uint64_t)ret_var.inner;
34242 if (ret_var.is_owned) {
34248 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
34249 LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
34250 uint64_t ret_ref = 0;
34251 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34252 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34253 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34254 ret_ref = (uint64_t)ret_var.inner;
34255 if (ret_var.is_owned) {
34260 int64_t __attribute__((visibility("default"))) TS_RouteHintHop_clone_ptr(uint32_t arg) {
34261 LDKRouteHintHop arg_conv;
34262 arg_conv.inner = (void*)(arg & (~1));
34263 arg_conv.is_owned = false;
34264 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34265 int64_t ret_val = RouteHintHop_clone_ptr(&arg_conv);
34269 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_clone(uint32_t orig) {
34270 LDKRouteHintHop orig_conv;
34271 orig_conv.inner = (void*)(orig & (~1));
34272 orig_conv.is_owned = false;
34273 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34274 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
34275 uint64_t ret_ref = 0;
34276 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34277 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34278 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34279 ret_ref = (uint64_t)ret_var.inner;
34280 if (ret_var.is_owned) {
34286 int64_t __attribute__((visibility("default"))) TS_RouteHintHop_hash(uint32_t o) {
34287 LDKRouteHintHop o_conv;
34288 o_conv.inner = (void*)(o & (~1));
34289 o_conv.is_owned = false;
34290 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34291 int64_t ret_val = RouteHintHop_hash(&o_conv);
34295 jboolean __attribute__((visibility("default"))) TS_RouteHintHop_eq(uint32_t a, uint32_t b) {
34296 LDKRouteHintHop a_conv;
34297 a_conv.inner = (void*)(a & (~1));
34298 a_conv.is_owned = false;
34299 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34300 LDKRouteHintHop b_conv;
34301 b_conv.inner = (void*)(b & (~1));
34302 b_conv.is_owned = false;
34303 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34304 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
34308 int8_tArray __attribute__((visibility("default"))) TS_RouteHintHop_write(uint32_t obj) {
34309 LDKRouteHintHop obj_conv;
34310 obj_conv.inner = (void*)(obj & (~1));
34311 obj_conv.is_owned = false;
34312 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34313 LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
34314 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
34315 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34316 CVec_u8Z_free(ret_var);
34320 uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_read(int8_tArray ser) {
34321 LDKu8slice ser_ref;
34322 ser_ref.datalen = ser->arr_len;
34323 ser_ref.data = ser->elems;
34324 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
34325 *ret_conv = RouteHintHop_read(ser_ref);
34326 return (uint64_t)ret_conv;
34329 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) {
34330 LDKPublicKey our_node_pubkey_ref;
34331 CHECK(our_node_pubkey->arr_len == 33);
34332 memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33);
34333 LDKRouteParameters params_conv;
34334 params_conv.inner = (void*)(params & (~1));
34335 params_conv.is_owned = false;
34336 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
34337 LDKNetworkGraph network_conv;
34338 network_conv.inner = (void*)(network & (~1));
34339 network_conv.is_owned = false;
34340 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_conv);
34341 LDKCVec_ChannelDetailsZ first_hops_constr;
34342 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
34343 if (first_hops != 0) {
34344 first_hops_constr.datalen = first_hops->arr_len;
34345 if (first_hops_constr.datalen > 0)
34346 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
34348 first_hops_constr.data = NULL;
34349 uint32_t* first_hops_vals = first_hops->elems;
34350 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
34351 uint32_t first_hops_conv_16 = first_hops_vals[q];
34352 LDKChannelDetails first_hops_conv_16_conv;
34353 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
34354 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
34355 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
34356 first_hops_constr.data[q] = first_hops_conv_16_conv;
34358 first_hops_ptr = &first_hops_constr;
34360 void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
34361 CHECK_ACCESS(logger_ptr);
34362 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
34363 void* scorer_ptr = (void*)(((uint64_t)scorer) & ~1);
34364 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
34365 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
34366 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
34367 *ret_conv = find_route(our_node_pubkey_ref, ¶ms_conv, &network_conv, first_hops_ptr, logger_conv, scorer_conv);
34368 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
34369 return (uint64_t)ret_conv;
34372 void __attribute__((visibility("default"))) TS_Score_free(uint32_t this_ptr) {
34373 if ((this_ptr & 1) != 0) return;
34374 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
34375 CHECK_ACCESS(this_ptr_ptr);
34376 LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
34377 FREE((void*)this_ptr);
34378 Score_free(this_ptr_conv);
34381 void __attribute__((visibility("default"))) TS_LockableScore_free(uint32_t this_ptr) {
34382 if ((this_ptr & 1) != 0) return;
34383 void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1);
34384 CHECK_ACCESS(this_ptr_ptr);
34385 LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
34386 FREE((void*)this_ptr);
34387 LockableScore_free(this_ptr_conv);
34390 void __attribute__((visibility("default"))) TS_MultiThreadedLockableScore_free(uint32_t this_obj) {
34391 LDKMultiThreadedLockableScore this_obj_conv;
34392 this_obj_conv.inner = (void*)(this_obj & (~1));
34393 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34394 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34395 MultiThreadedLockableScore_free(this_obj_conv);
34398 uint32_t __attribute__((visibility("default"))) TS_MultiThreadedLockableScore_new(uint32_t score) {
34399 void* score_ptr = (void*)(((uint64_t)score) & ~1);
34400 CHECK_ACCESS(score_ptr);
34401 LDKScore score_conv = *(LDKScore*)(score_ptr);
34402 LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
34403 uint64_t ret_ref = 0;
34404 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34405 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34406 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34407 ret_ref = (uint64_t)ret_var.inner;
34408 if (ret_var.is_owned) {
34414 void __attribute__((visibility("default"))) TS_ScoringParameters_free(uint32_t this_obj) {
34415 LDKScoringParameters this_obj_conv;
34416 this_obj_conv.inner = (void*)(this_obj & (~1));
34417 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34418 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34419 ScoringParameters_free(this_obj_conv);
34422 int64_t __attribute__((visibility("default"))) TS_ScoringParameters_get_base_penalty_msat(uint32_t this_ptr) {
34423 LDKScoringParameters this_ptr_conv;
34424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34425 this_ptr_conv.is_owned = false;
34426 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34427 int64_t ret_val = ScoringParameters_get_base_penalty_msat(&this_ptr_conv);
34431 void __attribute__((visibility("default"))) TS_ScoringParameters_set_base_penalty_msat(uint32_t this_ptr, int64_t val) {
34432 LDKScoringParameters this_ptr_conv;
34433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34434 this_ptr_conv.is_owned = false;
34435 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34436 ScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
34439 int64_t __attribute__((visibility("default"))) TS_ScoringParameters_get_failure_penalty_msat(uint32_t this_ptr) {
34440 LDKScoringParameters this_ptr_conv;
34441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34442 this_ptr_conv.is_owned = false;
34443 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34444 int64_t ret_val = ScoringParameters_get_failure_penalty_msat(&this_ptr_conv);
34448 void __attribute__((visibility("default"))) TS_ScoringParameters_set_failure_penalty_msat(uint32_t this_ptr, int64_t val) {
34449 LDKScoringParameters this_ptr_conv;
34450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34451 this_ptr_conv.is_owned = false;
34452 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34453 ScoringParameters_set_failure_penalty_msat(&this_ptr_conv, val);
34456 int16_t __attribute__((visibility("default"))) TS_ScoringParameters_get_overuse_penalty_start_1024th(uint32_t this_ptr) {
34457 LDKScoringParameters this_ptr_conv;
34458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34459 this_ptr_conv.is_owned = false;
34460 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34461 int16_t ret_val = ScoringParameters_get_overuse_penalty_start_1024th(&this_ptr_conv);
34465 void __attribute__((visibility("default"))) TS_ScoringParameters_set_overuse_penalty_start_1024th(uint32_t this_ptr, int16_t val) {
34466 LDKScoringParameters this_ptr_conv;
34467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34468 this_ptr_conv.is_owned = false;
34469 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34470 ScoringParameters_set_overuse_penalty_start_1024th(&this_ptr_conv, val);
34473 int64_t __attribute__((visibility("default"))) TS_ScoringParameters_get_overuse_penalty_msat_per_1024th(uint32_t this_ptr) {
34474 LDKScoringParameters this_ptr_conv;
34475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34476 this_ptr_conv.is_owned = false;
34477 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34478 int64_t ret_val = ScoringParameters_get_overuse_penalty_msat_per_1024th(&this_ptr_conv);
34482 void __attribute__((visibility("default"))) TS_ScoringParameters_set_overuse_penalty_msat_per_1024th(uint32_t this_ptr, int64_t val) {
34483 LDKScoringParameters this_ptr_conv;
34484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34485 this_ptr_conv.is_owned = false;
34486 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34487 ScoringParameters_set_overuse_penalty_msat_per_1024th(&this_ptr_conv, val);
34490 int64_t __attribute__((visibility("default"))) TS_ScoringParameters_get_failure_penalty_half_life(uint32_t this_ptr) {
34491 LDKScoringParameters this_ptr_conv;
34492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34493 this_ptr_conv.is_owned = false;
34494 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34495 int64_t ret_val = ScoringParameters_get_failure_penalty_half_life(&this_ptr_conv);
34499 void __attribute__((visibility("default"))) TS_ScoringParameters_set_failure_penalty_half_life(uint32_t this_ptr, int64_t val) {
34500 LDKScoringParameters this_ptr_conv;
34501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34502 this_ptr_conv.is_owned = false;
34503 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34504 ScoringParameters_set_failure_penalty_half_life(&this_ptr_conv, val);
34507 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) {
34508 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);
34509 uint64_t ret_ref = 0;
34510 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34511 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34512 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34513 ret_ref = (uint64_t)ret_var.inner;
34514 if (ret_var.is_owned) {
34520 int8_tArray __attribute__((visibility("default"))) TS_ScoringParameters_write(uint32_t obj) {
34521 LDKScoringParameters obj_conv;
34522 obj_conv.inner = (void*)(obj & (~1));
34523 obj_conv.is_owned = false;
34524 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34525 LDKCVec_u8Z ret_var = ScoringParameters_write(&obj_conv);
34526 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen);
34527 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34528 CVec_u8Z_free(ret_var);
34532 uint32_t __attribute__((visibility("default"))) TS_ScoringParameters_read(int8_tArray ser) {
34533 LDKu8slice ser_ref;
34534 ser_ref.datalen = ser->arr_len;
34535 ser_ref.data = ser->elems;
34536 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
34537 *ret_conv = ScoringParameters_read(ser_ref);
34538 return (uint64_t)ret_conv;
34541 uint32_t __attribute__((visibility("default"))) TS_ScoringParameters_default() {
34542 LDKScoringParameters ret_var = ScoringParameters_default();
34543 uint64_t ret_ref = 0;
34544 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34545 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34546 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34547 ret_ref = (uint64_t)ret_var.inner;
34548 if (ret_var.is_owned) {