1 #define LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ
2 #define CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free CVec_TransactionOutputsZ_free
7 // These should be provided...somehow...
8 void *memset(void *s, int c, size_t n);
9 void *memcpy(void *dest, const void *src, size_t n);
10 int memcmp(const void *s1, const void *s2, size_t n);
12 extern void __attribute__((noreturn)) abort(void);
13 static inline void assert(bool expression) {
14 if (!expression) { abort(); }
17 uint32_t __attribute__((export_name("test_bigint_pass_deadbeef0badf00d"))) test_bigint_pass_deadbeef0badf00d(uint64_t val) {
18 return val == 0xdeadbeef0badf00dULL;
22 void *malloc(size_t size);
25 #define MALLOC(a, _) malloc(a)
26 #define do_MALLOC(a, _b, _c) malloc(a)
27 #define FREE(p) if ((unsigned long)(p) > 4096) { free(p); }
28 #define DO_ASSERT(a) (void)(a)
30 #define CHECK_ACCESS(p)
31 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
33 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
34 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
35 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
36 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
38 _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
40 #define DECL_ARR_TYPE(ty, name) \
41 struct name##array { \
45 typedef struct name##array * name##Array; \
46 static inline name##Array init_##name##Array(size_t arr_len, int lineno) { \
47 name##Array arr = (name##Array)do_MALLOC(arr_len * sizeof(ty) + sizeof(uint32_t), #name" array init", lineno); \
48 arr->arr_len = arr_len; \
52 DECL_ARR_TYPE(int64_t, int64_t);
53 DECL_ARR_TYPE(int8_t, int8_t);
54 DECL_ARR_TYPE(uint32_t, uint32_t);
55 DECL_ARR_TYPE(void*, ptr);
56 DECL_ARR_TYPE(char, char);
57 typedef charArray jstring;
59 static inline jstring str_ref_to_ts(const char* chars, size_t len) {
60 charArray arr = init_charArray(len, __LINE__);
61 memcpy(arr->elems, chars, len);
64 static inline LDKStr str_ref_to_owned_c(const jstring str) {
65 char* newchars = MALLOC(str->arr_len + 1, "String chars");
66 memcpy(newchars, str->elems, str->arr_len);
67 newchars[str->arr_len] = 0;
71 .chars_is_owned = true
76 typedef bool jboolean;
78 uint32_t __attribute__((export_name("TS_malloc"))) TS_malloc(uint32_t size) {
79 return (uint32_t)MALLOC(size, "JS-Called malloc");
81 void __attribute__((export_name("TS_free"))) TS_free(uint32_t ptr) {
85 jstring __attribute__((export_name("TS_get_ldk_c_bindings_version"))) TS_get_ldk_c_bindings_version() {
86 const char *res = check_get_ldk_bindings_version();
87 if (res == NULL) return NULL;
88 return str_ref_to_ts(res, strlen(res));
90 jstring __attribute__((export_name("TS_get_ldk_version"))) get_ldk_version() {
91 const char *res = check_get_ldk_version();
92 if (res == NULL) return NULL;
93 return str_ref_to_ts(res, strlen(res));
96 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
97 static inline LDKAccessError LDKAccessError_from_js(int32_t ord) {
99 case 0: return LDKAccessError_UnknownChain;
100 case 1: return LDKAccessError_UnknownTx;
104 static inline int32_t LDKAccessError_to_js(LDKAccessError val) {
106 case LDKAccessError_UnknownChain: return 0;
107 case LDKAccessError_UnknownTx: return 1;
111 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_js(int32_t ord) {
113 case 0: return LDKCOption_NoneZ_Some;
114 case 1: return LDKCOption_NoneZ_None;
118 static inline int32_t LDKCOption_NoneZ_to_js(LDKCOption_NoneZ val) {
120 case LDKCOption_NoneZ_Some: return 0;
121 case LDKCOption_NoneZ_None: return 1;
125 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_js(int32_t ord) {
127 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
128 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
132 static inline int32_t LDKChannelMonitorUpdateErr_to_js(LDKChannelMonitorUpdateErr val) {
134 case LDKChannelMonitorUpdateErr_TemporaryFailure: return 0;
135 case LDKChannelMonitorUpdateErr_PermanentFailure: return 1;
139 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
141 case 0: return LDKConfirmationTarget_Background;
142 case 1: return LDKConfirmationTarget_Normal;
143 case 2: return LDKConfirmationTarget_HighPriority;
147 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
149 case LDKConfirmationTarget_Background: return 0;
150 case LDKConfirmationTarget_Normal: return 1;
151 case LDKConfirmationTarget_HighPriority: return 2;
155 static inline LDKCreationError LDKCreationError_from_js(int32_t ord) {
157 case 0: return LDKCreationError_DescriptionTooLong;
158 case 1: return LDKCreationError_RouteTooLong;
159 case 2: return LDKCreationError_TimestampOutOfBounds;
160 case 3: return LDKCreationError_InvalidAmount;
161 case 4: return LDKCreationError_MissingRouteHints;
165 static inline int32_t LDKCreationError_to_js(LDKCreationError val) {
167 case LDKCreationError_DescriptionTooLong: return 0;
168 case LDKCreationError_RouteTooLong: return 1;
169 case LDKCreationError_TimestampOutOfBounds: return 2;
170 case LDKCreationError_InvalidAmount: return 3;
171 case LDKCreationError_MissingRouteHints: return 4;
175 static inline LDKCurrency LDKCurrency_from_js(int32_t ord) {
177 case 0: return LDKCurrency_Bitcoin;
178 case 1: return LDKCurrency_BitcoinTestnet;
179 case 2: return LDKCurrency_Regtest;
180 case 3: return LDKCurrency_Simnet;
181 case 4: return LDKCurrency_Signet;
185 static inline int32_t LDKCurrency_to_js(LDKCurrency val) {
187 case LDKCurrency_Bitcoin: return 0;
188 case LDKCurrency_BitcoinTestnet: return 1;
189 case LDKCurrency_Regtest: return 2;
190 case LDKCurrency_Simnet: return 3;
191 case LDKCurrency_Signet: return 4;
195 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
197 case 0: return LDKLevel_Gossip;
198 case 1: return LDKLevel_Trace;
199 case 2: return LDKLevel_Debug;
200 case 3: return LDKLevel_Info;
201 case 4: return LDKLevel_Warn;
202 case 5: return LDKLevel_Error;
206 static inline int32_t LDKLevel_to_js(LDKLevel val) {
208 case LDKLevel_Gossip: return 0;
209 case LDKLevel_Trace: return 1;
210 case LDKLevel_Debug: return 2;
211 case LDKLevel_Info: return 3;
212 case LDKLevel_Warn: return 4;
213 case LDKLevel_Error: return 5;
217 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
219 case 0: return LDKNetwork_Bitcoin;
220 case 1: return LDKNetwork_Testnet;
221 case 2: return LDKNetwork_Regtest;
222 case 3: return LDKNetwork_Signet;
226 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
228 case LDKNetwork_Bitcoin: return 0;
229 case LDKNetwork_Testnet: return 1;
230 case LDKNetwork_Regtest: return 2;
231 case LDKNetwork_Signet: return 3;
235 static inline LDKRecipient LDKRecipient_from_js(int32_t ord) {
237 case 0: return LDKRecipient_Node;
238 case 1: return LDKRecipient_PhantomNode;
242 static inline int32_t LDKRecipient_to_js(LDKRecipient val) {
244 case LDKRecipient_Node: return 0;
245 case LDKRecipient_PhantomNode: return 1;
249 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
251 case 0: return LDKSecp256k1Error_IncorrectSignature;
252 case 1: return LDKSecp256k1Error_InvalidMessage;
253 case 2: return LDKSecp256k1Error_InvalidPublicKey;
254 case 3: return LDKSecp256k1Error_InvalidSignature;
255 case 4: return LDKSecp256k1Error_InvalidSecretKey;
256 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
257 case 6: return LDKSecp256k1Error_InvalidTweak;
258 case 7: return LDKSecp256k1Error_TweakCheckFailed;
259 case 8: return LDKSecp256k1Error_NotEnoughMemory;
263 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
265 case LDKSecp256k1Error_IncorrectSignature: return 0;
266 case LDKSecp256k1Error_InvalidMessage: return 1;
267 case LDKSecp256k1Error_InvalidPublicKey: return 2;
268 case LDKSecp256k1Error_InvalidSignature: return 3;
269 case LDKSecp256k1Error_InvalidSecretKey: return 4;
270 case LDKSecp256k1Error_InvalidRecoveryId: return 5;
271 case LDKSecp256k1Error_InvalidTweak: return 6;
272 case LDKSecp256k1Error_TweakCheckFailed: return 7;
273 case LDKSecp256k1Error_NotEnoughMemory: return 8;
277 static inline LDKSemanticError LDKSemanticError_from_js(int32_t ord) {
279 case 0: return LDKSemanticError_NoPaymentHash;
280 case 1: return LDKSemanticError_MultiplePaymentHashes;
281 case 2: return LDKSemanticError_NoDescription;
282 case 3: return LDKSemanticError_MultipleDescriptions;
283 case 4: return LDKSemanticError_NoPaymentSecret;
284 case 5: return LDKSemanticError_MultiplePaymentSecrets;
285 case 6: return LDKSemanticError_InvalidFeatures;
286 case 7: return LDKSemanticError_InvalidRecoveryId;
287 case 8: return LDKSemanticError_InvalidSignature;
288 case 9: return LDKSemanticError_ImpreciseAmount;
292 static inline int32_t LDKSemanticError_to_js(LDKSemanticError val) {
294 case LDKSemanticError_NoPaymentHash: return 0;
295 case LDKSemanticError_MultiplePaymentHashes: return 1;
296 case LDKSemanticError_NoDescription: return 2;
297 case LDKSemanticError_MultipleDescriptions: return 3;
298 case LDKSemanticError_NoPaymentSecret: return 4;
299 case LDKSemanticError_MultiplePaymentSecrets: return 5;
300 case LDKSemanticError_InvalidFeatures: return 6;
301 case LDKSemanticError_InvalidRecoveryId: return 7;
302 case LDKSemanticError_InvalidSignature: return 8;
303 case LDKSemanticError_ImpreciseAmount: return 9;
307 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
309 case 0: return LDKSiPrefix_Milli;
310 case 1: return LDKSiPrefix_Micro;
311 case 2: return LDKSiPrefix_Nano;
312 case 3: return LDKSiPrefix_Pico;
316 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
318 case LDKSiPrefix_Milli: return 0;
319 case LDKSiPrefix_Micro: return 1;
320 case LDKSiPrefix_Nano: return 2;
321 case LDKSiPrefix_Pico: return 3;
325 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
326 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
327 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
330 struct LDKCVec_u8Z TxOut_get_script_pubkey (struct LDKTxOut* thing) { return CVec_u8Z_clone(&thing->script_pubkey);}int8_tArray __attribute__((export_name("TS_TxOut_get_script_pubkey"))) TS_TxOut_get_script_pubkey(uint32_t thing) {
331 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
332 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
333 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
334 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
335 CVec_u8Z_free(ret_var);
339 uint64_t TxOut_get_value (struct LDKTxOut* thing) { return thing->value;}int64_t __attribute__((export_name("TS_TxOut_get_value"))) TS_TxOut_get_value(uint32_t thing) {
340 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
341 int64_t ret_val = TxOut_get_value(thing_conv);
345 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
346 CHECK(owner->result_ok);
347 return *owner->contents.result;
349 void __attribute__((export_name("TS_CResult_NoneNoneZ_get_ok"))) TS_CResult_NoneNoneZ_get_ok(uint32_t owner) {
350 LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1);
351 CResult_NoneNoneZ_get_ok(owner_conv);
354 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
355 CHECK(!owner->result_ok);
356 return *owner->contents.err;
358 void __attribute__((export_name("TS_CResult_NoneNoneZ_get_err"))) TS_CResult_NoneNoneZ_get_err(uint32_t owner) {
359 LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1);
360 CResult_NoneNoneZ_get_err(owner_conv);
363 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
364 CHECK(owner->result_ok);
365 return CounterpartyCommitmentSecrets_clone(&*owner->contents.result);
367 uint32_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(uint32_t owner) {
368 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(owner & ~1);
369 LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
370 uint32_t ret_ref = 0;
371 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
372 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
373 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
374 ret_ref = (uintptr_t)ret_var.inner;
375 if (ret_var.is_owned) {
381 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
382 CHECK(!owner->result_ok);
383 return DecodeError_clone(&*owner->contents.err);
385 uint32_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(uint32_t owner) {
386 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(owner & ~1);
387 LDKDecodeError ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
388 uint32_t ret_ref = 0;
389 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
390 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
391 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
392 ret_ref = (uintptr_t)ret_var.inner;
393 if (ret_var.is_owned) {
399 static inline struct LDKSecretKey CResult_SecretKeyErrorZ_get_ok(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
400 CHECK(owner->result_ok);
401 return *owner->contents.result;
403 int8_tArray __attribute__((export_name("TS_CResult_SecretKeyErrorZ_get_ok"))) TS_CResult_SecretKeyErrorZ_get_ok(uint32_t owner) {
404 LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)(owner & ~1);
405 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
406 memcpy(ret_arr->elems, CResult_SecretKeyErrorZ_get_ok(owner_conv).bytes, 32);
410 static inline enum LDKSecp256k1Error CResult_SecretKeyErrorZ_get_err(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
411 CHECK(!owner->result_ok);
412 return *owner->contents.err;
414 uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_get_err"))) TS_CResult_SecretKeyErrorZ_get_err(uint32_t owner) {
415 LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)(owner & ~1);
416 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_SecretKeyErrorZ_get_err(owner_conv));
420 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
421 CHECK(owner->result_ok);
422 return *owner->contents.result;
424 int8_tArray __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_ok"))) TS_CResult_PublicKeyErrorZ_get_ok(uint32_t owner) {
425 LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)(owner & ~1);
426 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
427 memcpy(ret_arr->elems, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form, 33);
431 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
432 CHECK(!owner->result_ok);
433 return *owner->contents.err;
435 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_err"))) TS_CResult_PublicKeyErrorZ_get_err(uint32_t owner) {
436 LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)(owner & ~1);
437 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PublicKeyErrorZ_get_err(owner_conv));
441 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
442 CHECK(owner->result_ok);
443 return TxCreationKeys_clone(&*owner->contents.result);
445 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_ok(uint32_t owner) {
446 LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(owner & ~1);
447 LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
448 uint32_t ret_ref = 0;
449 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
450 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
451 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
452 ret_ref = (uintptr_t)ret_var.inner;
453 if (ret_var.is_owned) {
459 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
460 CHECK(!owner->result_ok);
461 return DecodeError_clone(&*owner->contents.err);
463 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_err(uint32_t owner) {
464 LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(owner & ~1);
465 LDKDecodeError ret_var = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
466 uint32_t ret_ref = 0;
467 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
468 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
469 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
470 ret_ref = (uintptr_t)ret_var.inner;
471 if (ret_var.is_owned) {
477 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
478 CHECK(owner->result_ok);
479 return ChannelPublicKeys_clone(&*owner->contents.result);
481 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint32_t owner) {
482 LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(owner & ~1);
483 LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
484 uint32_t ret_ref = 0;
485 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
486 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
487 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
488 ret_ref = (uintptr_t)ret_var.inner;
489 if (ret_var.is_owned) {
495 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
496 CHECK(!owner->result_ok);
497 return DecodeError_clone(&*owner->contents.err);
499 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err(uint32_t owner) {
500 LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(owner & ~1);
501 LDKDecodeError ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
502 uint32_t ret_ref = 0;
503 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
504 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
505 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
506 ret_ref = (uintptr_t)ret_var.inner;
507 if (ret_var.is_owned) {
513 static inline struct LDKTxCreationKeys CResult_TxCreationKeysErrorZ_get_ok(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
514 CHECK(owner->result_ok);
515 return TxCreationKeys_clone(&*owner->contents.result);
517 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_get_ok"))) TS_CResult_TxCreationKeysErrorZ_get_ok(uint32_t owner) {
518 LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)(owner & ~1);
519 LDKTxCreationKeys ret_var = CResult_TxCreationKeysErrorZ_get_ok(owner_conv);
520 uint32_t ret_ref = 0;
521 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
522 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
523 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
524 ret_ref = (uintptr_t)ret_var.inner;
525 if (ret_var.is_owned) {
531 static inline enum LDKSecp256k1Error CResult_TxCreationKeysErrorZ_get_err(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
532 CHECK(!owner->result_ok);
533 return *owner->contents.err;
535 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_get_err"))) TS_CResult_TxCreationKeysErrorZ_get_err(uint32_t owner) {
536 LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)(owner & ~1);
537 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_TxCreationKeysErrorZ_get_err(owner_conv));
541 uint32_t __attribute__((export_name("TS_LDKCOption_u32Z_ty_from_ptr"))) TS_LDKCOption_u32Z_ty_from_ptr(uint32_t ptr) {
542 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
544 case LDKCOption_u32Z_Some: return 0;
545 case LDKCOption_u32Z_None: return 1;
549 int32_t __attribute__((export_name("TS_LDKCOption_u32Z_Some_get_some"))) TS_LDKCOption_u32Z_Some_get_some(uint32_t ptr) {
550 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
551 assert(obj->tag == LDKCOption_u32Z_Some);
554 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
555 CHECK(owner->result_ok);
556 return HTLCOutputInCommitment_clone(&*owner->contents.result);
558 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint32_t owner) {
559 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(owner & ~1);
560 LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
561 uint32_t ret_ref = 0;
562 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
563 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
564 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
565 ret_ref = (uintptr_t)ret_var.inner;
566 if (ret_var.is_owned) {
572 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
573 CHECK(!owner->result_ok);
574 return DecodeError_clone(&*owner->contents.err);
576 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint32_t owner) {
577 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(owner & ~1);
578 LDKDecodeError ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
579 uint32_t ret_ref = 0;
580 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
581 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
582 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
583 ret_ref = (uintptr_t)ret_var.inner;
584 if (ret_var.is_owned) {
590 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
591 CHECK(owner->result_ok);
592 return CounterpartyChannelTransactionParameters_clone(&*owner->contents.result);
594 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t owner) {
595 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
596 LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
597 uint32_t ret_ref = 0;
598 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
599 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
600 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
601 ret_ref = (uintptr_t)ret_var.inner;
602 if (ret_var.is_owned) {
608 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
609 CHECK(!owner->result_ok);
610 return DecodeError_clone(&*owner->contents.err);
612 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint32_t owner) {
613 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
614 LDKDecodeError ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
615 uint32_t ret_ref = 0;
616 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
617 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
618 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
619 ret_ref = (uintptr_t)ret_var.inner;
620 if (ret_var.is_owned) {
626 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
627 CHECK(owner->result_ok);
628 return ChannelTransactionParameters_clone(&*owner->contents.result);
630 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t owner) {
631 LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
632 LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
633 uint32_t ret_ref = 0;
634 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
635 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
636 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
637 ret_ref = (uintptr_t)ret_var.inner;
638 if (ret_var.is_owned) {
644 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
645 CHECK(!owner->result_ok);
646 return DecodeError_clone(&*owner->contents.err);
648 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint32_t owner) {
649 LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
650 LDKDecodeError ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
651 uint32_t ret_ref = 0;
652 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
653 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
654 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
655 ret_ref = (uintptr_t)ret_var.inner;
656 if (ret_var.is_owned) {
662 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
663 CHECK(owner->result_ok);
664 return HolderCommitmentTransaction_clone(&*owner->contents.result);
666 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint32_t owner) {
667 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(owner & ~1);
668 LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
669 uint32_t ret_ref = 0;
670 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
671 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
672 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
673 ret_ref = (uintptr_t)ret_var.inner;
674 if (ret_var.is_owned) {
680 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
681 CHECK(!owner->result_ok);
682 return DecodeError_clone(&*owner->contents.err);
684 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint32_t owner) {
685 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(owner & ~1);
686 LDKDecodeError ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
687 uint32_t ret_ref = 0;
688 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
689 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
690 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
691 ret_ref = (uintptr_t)ret_var.inner;
692 if (ret_var.is_owned) {
698 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
699 CHECK(owner->result_ok);
700 return BuiltCommitmentTransaction_clone(&*owner->contents.result);
702 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint32_t owner) {
703 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(owner & ~1);
704 LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
705 uint32_t ret_ref = 0;
706 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
707 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
708 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
709 ret_ref = (uintptr_t)ret_var.inner;
710 if (ret_var.is_owned) {
716 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
717 CHECK(!owner->result_ok);
718 return DecodeError_clone(&*owner->contents.err);
720 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint32_t owner) {
721 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(owner & ~1);
722 LDKDecodeError ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
723 uint32_t ret_ref = 0;
724 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
725 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
726 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
727 ret_ref = (uintptr_t)ret_var.inner;
728 if (ret_var.is_owned) {
734 static inline struct LDKTrustedClosingTransaction *CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
735 CHECK(owner->result_ok);
736 return &*owner->contents.result;
738 uint32_t __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_get_ok(uint32_t owner) {
739 LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(owner & ~1);
740 LDKTrustedClosingTransaction ret_var = *CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
741 uint32_t ret_ref = 0;
742 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
743 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
744 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
745 ret_ref = (uintptr_t)ret_var.inner & ~1;
749 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
750 CHECK(!owner->result_ok);
751 return *owner->contents.err;
753 void __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_err"))) TS_CResult_TrustedClosingTransactionNoneZ_get_err(uint32_t owner) {
754 LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(owner & ~1);
755 CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
758 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
759 CHECK(owner->result_ok);
760 return CommitmentTransaction_clone(&*owner->contents.result);
762 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok(uint32_t owner) {
763 LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(owner & ~1);
764 LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
765 uint32_t ret_ref = 0;
766 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
767 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
768 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
769 ret_ref = (uintptr_t)ret_var.inner;
770 if (ret_var.is_owned) {
776 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
777 CHECK(!owner->result_ok);
778 return DecodeError_clone(&*owner->contents.err);
780 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_err(uint32_t owner) {
781 LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(owner & ~1);
782 LDKDecodeError ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
783 uint32_t ret_ref = 0;
784 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
785 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
786 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
787 ret_ref = (uintptr_t)ret_var.inner;
788 if (ret_var.is_owned) {
794 static inline struct LDKTrustedCommitmentTransaction *CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
795 CHECK(owner->result_ok);
796 return &*owner->contents.result;
798 uint32_t __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok(uint32_t owner) {
799 LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(owner & ~1);
800 LDKTrustedCommitmentTransaction ret_var = *CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
801 uint32_t ret_ref = 0;
802 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
803 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
804 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
805 ret_ref = (uintptr_t)ret_var.inner & ~1;
809 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
810 CHECK(!owner->result_ok);
811 return *owner->contents.err;
813 void __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_err(uint32_t owner) {
814 LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(owner & ~1);
815 CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
818 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
819 CHECK(owner->result_ok);
820 return *owner->contents.result;
822 ptrArray __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_ok"))) TS_CResult_CVec_SignatureZNoneZ_get_ok(uint32_t owner) {
823 LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)(owner & ~1);
824 LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
825 ptrArray ret_arr = NULL;
826 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
827 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
828 for (size_t m = 0; m < ret_var.datalen; m++) {
829 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
830 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
831 ret_arr_ptr[m] = ret_conv_12_arr;
837 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
838 CHECK(!owner->result_ok);
839 return *owner->contents.err;
841 void __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_err"))) TS_CResult_CVec_SignatureZNoneZ_get_err(uint32_t owner) {
842 LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)(owner & ~1);
843 CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
846 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
847 CHECK(owner->result_ok);
848 return ShutdownScript_clone(&*owner->contents.result);
850 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_ok(uint32_t owner) {
851 LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(owner & ~1);
852 LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
853 uint32_t ret_ref = 0;
854 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
855 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
856 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
857 ret_ref = (uintptr_t)ret_var.inner;
858 if (ret_var.is_owned) {
864 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
865 CHECK(!owner->result_ok);
866 return DecodeError_clone(&*owner->contents.err);
868 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_err(uint32_t owner) {
869 LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(owner & ~1);
870 LDKDecodeError ret_var = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
871 uint32_t ret_ref = 0;
872 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
873 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
874 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
875 ret_ref = (uintptr_t)ret_var.inner;
876 if (ret_var.is_owned) {
882 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
883 CHECK(owner->result_ok);
884 return ShutdownScript_clone(&*owner->contents.result);
886 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint32_t owner) {
887 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(owner & ~1);
888 LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
889 uint32_t ret_ref = 0;
890 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
891 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
892 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
893 ret_ref = (uintptr_t)ret_var.inner;
894 if (ret_var.is_owned) {
900 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
901 CHECK(!owner->result_ok);
902 return InvalidShutdownScript_clone(&*owner->contents.err);
904 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint32_t owner) {
905 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(owner & ~1);
906 LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
907 uint32_t ret_ref = 0;
908 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
909 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
910 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
911 ret_ref = (uintptr_t)ret_var.inner;
912 if (ret_var.is_owned) {
918 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
919 CHECK(owner->result_ok);
920 return RouteHop_clone(&*owner->contents.result);
922 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHopDecodeErrorZ_get_ok(uint32_t owner) {
923 LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)(owner & ~1);
924 LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
925 uint32_t ret_ref = 0;
926 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
927 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
928 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
929 ret_ref = (uintptr_t)ret_var.inner;
930 if (ret_var.is_owned) {
936 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
937 CHECK(!owner->result_ok);
938 return DecodeError_clone(&*owner->contents.err);
940 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_err"))) TS_CResult_RouteHopDecodeErrorZ_get_err(uint32_t owner) {
941 LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)(owner & ~1);
942 LDKDecodeError ret_var = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
943 uint32_t ret_ref = 0;
944 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
945 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
946 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
947 ret_ref = (uintptr_t)ret_var.inner;
948 if (ret_var.is_owned) {
954 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
955 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
956 for (size_t i = 0; i < ret.datalen; i++) {
957 ret.data[i] = RouteHop_clone(&orig->data[i]);
961 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
962 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
963 for (size_t i = 0; i < ret.datalen; i++) {
964 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
968 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
969 CHECK(owner->result_ok);
970 return Route_clone(&*owner->contents.result);
972 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_ok"))) TS_CResult_RouteDecodeErrorZ_get_ok(uint32_t owner) {
973 LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)(owner & ~1);
974 LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
975 uint32_t ret_ref = 0;
976 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
977 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
978 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
979 ret_ref = (uintptr_t)ret_var.inner;
980 if (ret_var.is_owned) {
986 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
987 CHECK(!owner->result_ok);
988 return DecodeError_clone(&*owner->contents.err);
990 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_err"))) TS_CResult_RouteDecodeErrorZ_get_err(uint32_t owner) {
991 LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)(owner & ~1);
992 LDKDecodeError ret_var = CResult_RouteDecodeErrorZ_get_err(owner_conv);
993 uint32_t ret_ref = 0;
994 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
995 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
996 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
997 ret_ref = (uintptr_t)ret_var.inner;
998 if (ret_var.is_owned) {
1004 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1005 CHECK(owner->result_ok);
1006 return RouteParameters_clone(&*owner->contents.result);
1008 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_ok"))) TS_CResult_RouteParametersDecodeErrorZ_get_ok(uint32_t owner) {
1009 LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(owner & ~1);
1010 LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
1011 uint32_t ret_ref = 0;
1012 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1013 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1014 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1015 ret_ref = (uintptr_t)ret_var.inner;
1016 if (ret_var.is_owned) {
1022 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1023 CHECK(!owner->result_ok);
1024 return DecodeError_clone(&*owner->contents.err);
1026 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_err"))) TS_CResult_RouteParametersDecodeErrorZ_get_err(uint32_t owner) {
1027 LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(owner & ~1);
1028 LDKDecodeError ret_var = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
1029 uint32_t ret_ref = 0;
1030 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1031 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1032 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1033 ret_ref = (uintptr_t)ret_var.inner;
1034 if (ret_var.is_owned) {
1040 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1041 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1042 for (size_t i = 0; i < ret.datalen; i++) {
1043 ret.data[i] = RouteHint_clone(&orig->data[i]);
1047 uint32_t __attribute__((export_name("TS_LDKCOption_u64Z_ty_from_ptr"))) TS_LDKCOption_u64Z_ty_from_ptr(uint32_t ptr) {
1048 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1050 case LDKCOption_u64Z_Some: return 0;
1051 case LDKCOption_u64Z_None: return 1;
1055 int64_t __attribute__((export_name("TS_LDKCOption_u64Z_Some_get_some"))) TS_LDKCOption_u64Z_Some_get_some(uint32_t ptr) {
1056 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1057 assert(obj->tag == LDKCOption_u64Z_Some);
1060 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1061 CHECK(owner->result_ok);
1062 return PaymentParameters_clone(&*owner->contents.result);
1064 uint32_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_get_ok(uint32_t owner) {
1065 LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(owner & ~1);
1066 LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
1067 uint32_t ret_ref = 0;
1068 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1069 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1070 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1071 ret_ref = (uintptr_t)ret_var.inner;
1072 if (ret_var.is_owned) {
1078 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1079 CHECK(!owner->result_ok);
1080 return DecodeError_clone(&*owner->contents.err);
1082 uint32_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_err"))) TS_CResult_PaymentParametersDecodeErrorZ_get_err(uint32_t owner) {
1083 LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(owner & ~1);
1084 LDKDecodeError ret_var = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
1085 uint32_t ret_ref = 0;
1086 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1087 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1088 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1089 ret_ref = (uintptr_t)ret_var.inner;
1090 if (ret_var.is_owned) {
1096 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
1097 LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
1098 for (size_t i = 0; i < ret.datalen; i++) {
1099 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
1103 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1104 CHECK(owner->result_ok);
1105 return RouteHint_clone(&*owner->contents.result);
1107 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_ok"))) TS_CResult_RouteHintDecodeErrorZ_get_ok(uint32_t owner) {
1108 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
1109 LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
1110 uint32_t ret_ref = 0;
1111 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1112 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1113 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1114 ret_ref = (uintptr_t)ret_var.inner;
1115 if (ret_var.is_owned) {
1121 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1122 CHECK(!owner->result_ok);
1123 return DecodeError_clone(&*owner->contents.err);
1125 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_err"))) TS_CResult_RouteHintDecodeErrorZ_get_err(uint32_t owner) {
1126 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
1127 LDKDecodeError ret_var = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
1128 uint32_t ret_ref = 0;
1129 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1130 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1131 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1132 ret_ref = (uintptr_t)ret_var.inner;
1133 if (ret_var.is_owned) {
1139 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1140 CHECK(owner->result_ok);
1141 return RouteHintHop_clone(&*owner->contents.result);
1143 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_get_ok(uint32_t owner) {
1144 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
1145 LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
1146 uint32_t ret_ref = 0;
1147 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1148 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1149 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1150 ret_ref = (uintptr_t)ret_var.inner;
1151 if (ret_var.is_owned) {
1157 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1158 CHECK(!owner->result_ok);
1159 return DecodeError_clone(&*owner->contents.err);
1161 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_err"))) TS_CResult_RouteHintHopDecodeErrorZ_get_err(uint32_t owner) {
1162 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
1163 LDKDecodeError ret_var = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
1164 uint32_t ret_ref = 0;
1165 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1166 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1167 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1168 ret_ref = (uintptr_t)ret_var.inner;
1169 if (ret_var.is_owned) {
1175 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1176 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1177 for (size_t i = 0; i < ret.datalen; i++) {
1178 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1182 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1183 CHECK(owner->result_ok);
1184 return Route_clone(&*owner->contents.result);
1186 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_ok"))) TS_CResult_RouteLightningErrorZ_get_ok(uint32_t owner) {
1187 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
1188 LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
1189 uint32_t ret_ref = 0;
1190 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1191 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1192 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1193 ret_ref = (uintptr_t)ret_var.inner;
1194 if (ret_var.is_owned) {
1200 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1201 CHECK(!owner->result_ok);
1202 return LightningError_clone(&*owner->contents.err);
1204 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_err"))) TS_CResult_RouteLightningErrorZ_get_err(uint32_t owner) {
1205 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
1206 LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
1207 uint32_t ret_ref = 0;
1208 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1209 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1210 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1211 ret_ref = (uintptr_t)ret_var.inner;
1212 if (ret_var.is_owned) {
1218 static inline struct LDKTxOut CResult_TxOutAccessErrorZ_get_ok(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
1219 CHECK(owner->result_ok);
1220 return TxOut_clone(&*owner->contents.result);
1222 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_get_ok"))) TS_CResult_TxOutAccessErrorZ_get_ok(uint32_t owner) {
1223 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
1224 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
1225 *ret_ref = CResult_TxOutAccessErrorZ_get_ok(owner_conv);
1226 return (uint32_t)ret_ref;
1229 static inline enum LDKAccessError CResult_TxOutAccessErrorZ_get_err(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
1230 CHECK(!owner->result_ok);
1231 return AccessError_clone(&*owner->contents.err);
1233 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_get_err"))) TS_CResult_TxOutAccessErrorZ_get_err(uint32_t owner) {
1234 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
1235 uint32_t ret_conv = LDKAccessError_to_js(CResult_TxOutAccessErrorZ_get_err(owner_conv));
1239 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
1242 uint32_t __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_a"))) TS_C2Tuple_usizeTransactionZ_get_a(uint32_t owner) {
1243 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
1244 uint32_t ret_val = C2Tuple_usizeTransactionZ_get_a(owner_conv);
1248 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
1251 int8_tArray __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_b"))) TS_C2Tuple_usizeTransactionZ_get_b(uint32_t owner) {
1252 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
1253 LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
1254 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
1255 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1259 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
1260 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
1261 for (size_t i = 0; i < ret.datalen; i++) {
1262 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
1266 static inline LDKCVec_TxidZ CVec_TxidZ_clone(const LDKCVec_TxidZ *orig) {
1267 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
1268 for (size_t i = 0; i < ret.datalen; i++) {
1269 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1273 static inline void CResult_NoneChannelMonitorUpdateErrZ_get_ok(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
1274 CHECK(owner->result_ok);
1275 return *owner->contents.result;
1277 void __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_get_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_get_ok(uint32_t owner) {
1278 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
1279 CResult_NoneChannelMonitorUpdateErrZ_get_ok(owner_conv);
1282 static inline enum LDKChannelMonitorUpdateErr CResult_NoneChannelMonitorUpdateErrZ_get_err(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
1283 CHECK(!owner->result_ok);
1284 return ChannelMonitorUpdateErr_clone(&*owner->contents.err);
1286 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_get_err"))) TS_CResult_NoneChannelMonitorUpdateErrZ_get_err(uint32_t owner) {
1287 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
1288 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(CResult_NoneChannelMonitorUpdateErrZ_get_err(owner_conv));
1292 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_ty_from_ptr"))) TS_LDKMonitorEvent_ty_from_ptr(uint32_t ptr) {
1293 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1295 case LDKMonitorEvent_HTLCEvent: return 0;
1296 case LDKMonitorEvent_CommitmentTxConfirmed: return 1;
1297 case LDKMonitorEvent_UpdateCompleted: return 2;
1298 case LDKMonitorEvent_UpdateFailed: return 3;
1302 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_HTLCEvent_get_htlc_event"))) TS_LDKMonitorEvent_HTLCEvent_get_htlc_event(uint32_t ptr) {
1303 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1304 assert(obj->tag == LDKMonitorEvent_HTLCEvent);
1305 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
1306 uint32_t htlc_event_ref = 0;
1307 CHECK((((uintptr_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1308 CHECK((((uintptr_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1309 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
1310 htlc_event_ref = (uintptr_t)htlc_event_var.inner & ~1;
1311 return htlc_event_ref;
1313 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed"))) TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed(uint32_t ptr) {
1314 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1315 assert(obj->tag == LDKMonitorEvent_CommitmentTxConfirmed);
1316 LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
1317 uint32_t commitment_tx_confirmed_ref = 0;
1318 CHECK((((uintptr_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1319 CHECK((((uintptr_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1320 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
1321 commitment_tx_confirmed_ref = (uintptr_t)commitment_tx_confirmed_var.inner & ~1;
1322 return commitment_tx_confirmed_ref;
1324 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateCompleted_get_funding_txo"))) TS_LDKMonitorEvent_UpdateCompleted_get_funding_txo(uint32_t ptr) {
1325 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1326 assert(obj->tag == LDKMonitorEvent_UpdateCompleted);
1327 LDKOutPoint funding_txo_var = obj->update_completed.funding_txo;
1328 uint32_t funding_txo_ref = 0;
1329 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1330 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1331 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
1332 funding_txo_ref = (uintptr_t)funding_txo_var.inner & ~1;
1333 return funding_txo_ref;
1335 int64_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateCompleted_get_monitor_update_id"))) TS_LDKMonitorEvent_UpdateCompleted_get_monitor_update_id(uint32_t ptr) {
1336 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1337 assert(obj->tag == LDKMonitorEvent_UpdateCompleted);
1338 return obj->update_completed.monitor_update_id;
1340 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateFailed_get_update_failed"))) TS_LDKMonitorEvent_UpdateFailed_get_update_failed(uint32_t ptr) {
1341 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1342 assert(obj->tag == LDKMonitorEvent_UpdateFailed);
1343 LDKOutPoint update_failed_var = obj->update_failed;
1344 uint32_t update_failed_ref = 0;
1345 CHECK((((uintptr_t)update_failed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1346 CHECK((((uintptr_t)&update_failed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1347 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
1348 update_failed_ref = (uintptr_t)update_failed_var.inner & ~1;
1349 return update_failed_ref;
1351 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1352 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1353 for (size_t i = 0; i < ret.datalen; i++) {
1354 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1358 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_usizeTransactionZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_ty_from_ptr(uint32_t ptr) {
1359 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
1361 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: return 0;
1362 case LDKCOption_C2Tuple_usizeTransactionZZ_None: return 1;
1366 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_usizeTransactionZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_Some_get_some(uint32_t ptr) {
1367 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
1368 assert(obj->tag == LDKCOption_C2Tuple_usizeTransactionZZ_Some);
1369 LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1370 *some_conv = obj->some;
1371 *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
1372 return ((uint32_t)some_conv);
1374 uint32_t __attribute__((export_name("TS_LDKClosureReason_ty_from_ptr"))) TS_LDKClosureReason_ty_from_ptr(uint32_t ptr) {
1375 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
1377 case LDKClosureReason_CounterpartyForceClosed: return 0;
1378 case LDKClosureReason_HolderForceClosed: return 1;
1379 case LDKClosureReason_CooperativeClosure: return 2;
1380 case LDKClosureReason_CommitmentTxConfirmed: return 3;
1381 case LDKClosureReason_FundingTimedOut: return 4;
1382 case LDKClosureReason_ProcessingError: return 5;
1383 case LDKClosureReason_DisconnectedPeer: return 6;
1384 case LDKClosureReason_OutdatedChannelManager: return 7;
1388 jstring __attribute__((export_name("TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg"))) TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(uint32_t ptr) {
1389 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
1390 assert(obj->tag == LDKClosureReason_CounterpartyForceClosed);
1391 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
1392 jstring peer_msg_conv = str_ref_to_ts(peer_msg_str.chars, peer_msg_str.len);
1393 return peer_msg_conv;
1395 jstring __attribute__((export_name("TS_LDKClosureReason_ProcessingError_get_err"))) TS_LDKClosureReason_ProcessingError_get_err(uint32_t ptr) {
1396 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
1397 assert(obj->tag == LDKClosureReason_ProcessingError);
1398 LDKStr err_str = obj->processing_error.err;
1399 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
1402 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_ty_from_ptr"))) TS_LDKCOption_ClosureReasonZ_ty_from_ptr(uint32_t ptr) {
1403 LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)(ptr & ~1);
1405 case LDKCOption_ClosureReasonZ_Some: return 0;
1406 case LDKCOption_ClosureReasonZ_None: return 1;
1410 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_Some_get_some"))) TS_LDKCOption_ClosureReasonZ_Some_get_some(uint32_t ptr) {
1411 LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)(ptr & ~1);
1412 assert(obj->tag == LDKCOption_ClosureReasonZ_Some);
1413 uint32_t some_ref = ((uintptr_t)&obj->some) | 1;
1416 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
1417 CHECK(owner->result_ok);
1418 return COption_ClosureReasonZ_clone(&*owner->contents.result);
1420 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint32_t owner) {
1421 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
1422 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
1423 *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
1424 uint32_t ret_ref = (uintptr_t)ret_copy;
1428 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
1429 CHECK(!owner->result_ok);
1430 return DecodeError_clone(&*owner->contents.err);
1432 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint32_t owner) {
1433 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
1434 LDKDecodeError ret_var = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
1435 uint32_t ret_ref = 0;
1436 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1437 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1438 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1439 ret_ref = (uintptr_t)ret_var.inner;
1440 if (ret_var.is_owned) {
1446 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ty_from_ptr"))) TS_LDKNetworkUpdate_ty_from_ptr(uint32_t ptr) {
1447 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1449 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
1450 case LDKNetworkUpdate_ChannelClosed: return 1;
1451 case LDKNetworkUpdate_NodeFailure: return 2;
1455 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg"))) TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(uint32_t ptr) {
1456 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1457 assert(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
1458 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1459 uint32_t msg_ref = 0;
1460 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1461 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1462 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1463 msg_ref = (uintptr_t)msg_var.inner & ~1;
1466 int64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelClosed_get_short_channel_id"))) TS_LDKNetworkUpdate_ChannelClosed_get_short_channel_id(uint32_t ptr) {
1467 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1468 assert(obj->tag == LDKNetworkUpdate_ChannelClosed);
1469 return obj->channel_closed.short_channel_id;
1471 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_ChannelClosed_get_is_permanent"))) TS_LDKNetworkUpdate_ChannelClosed_get_is_permanent(uint32_t ptr) {
1472 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1473 assert(obj->tag == LDKNetworkUpdate_ChannelClosed);
1474 return obj->channel_closed.is_permanent;
1476 int8_tArray __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_node_id"))) TS_LDKNetworkUpdate_NodeFailure_get_node_id(uint32_t ptr) {
1477 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1478 assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1479 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
1480 memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
1483 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_is_permanent"))) TS_LDKNetworkUpdate_NodeFailure_get_is_permanent(uint32_t ptr) {
1484 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1485 assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1486 return obj->node_failure.is_permanent;
1488 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_ty_from_ptr"))) TS_LDKCOption_NetworkUpdateZ_ty_from_ptr(uint32_t ptr) {
1489 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
1491 case LDKCOption_NetworkUpdateZ_Some: return 0;
1492 case LDKCOption_NetworkUpdateZ_None: return 1;
1496 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_Some_get_some"))) TS_LDKCOption_NetworkUpdateZ_Some_get_some(uint32_t ptr) {
1497 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
1498 assert(obj->tag == LDKCOption_NetworkUpdateZ_Some);
1499 uint32_t some_ref = ((uintptr_t)&obj->some) | 1;
1502 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_ty_from_ptr"))) TS_LDKSpendableOutputDescriptor_ty_from_ptr(uint32_t ptr) {
1503 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1505 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
1506 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
1507 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
1511 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(uint32_t ptr) {
1512 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1513 assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1514 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1515 uint32_t outpoint_ref = 0;
1516 CHECK((((uintptr_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1517 CHECK((((uintptr_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1518 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1519 outpoint_ref = (uintptr_t)outpoint_var.inner & ~1;
1520 return outpoint_ref;
1522 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_output"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_output(uint32_t ptr) {
1523 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1524 assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1525 uint32_t output_ref = ((uintptr_t)&obj->static_output.output) | 1;
1526 return (uint32_t)output_ref;
1528 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output"))) TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(uint32_t ptr) {
1529 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1530 assert(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
1531 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1532 uint32_t delayed_payment_output_ref = 0;
1533 CHECK((((uintptr_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1534 CHECK((((uintptr_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1535 CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1536 delayed_payment_output_ref = (uintptr_t)delayed_payment_output_var.inner & ~1;
1537 return delayed_payment_output_ref;
1539 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output"))) TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(uint32_t ptr) {
1540 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1541 assert(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
1542 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1543 uint32_t static_payment_output_ref = 0;
1544 CHECK((((uintptr_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1545 CHECK((((uintptr_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1546 CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1547 static_payment_output_ref = (uintptr_t)static_payment_output_var.inner & ~1;
1548 return static_payment_output_ref;
1550 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1551 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1552 for (size_t i = 0; i < ret.datalen; i++) {
1553 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1557 uint32_t __attribute__((export_name("TS_LDKPaymentPurpose_ty_from_ptr"))) TS_LDKPaymentPurpose_ty_from_ptr(uint32_t ptr) {
1558 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1560 case LDKPaymentPurpose_InvoicePayment: return 0;
1561 case LDKPaymentPurpose_SpontaneousPayment: return 1;
1565 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage(uint32_t ptr) {
1566 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1567 assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1568 int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
1569 memcpy(payment_preimage_arr->elems, obj->invoice_payment.payment_preimage.data, 32);
1570 return payment_preimage_arr;
1572 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret(uint32_t ptr) {
1573 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1574 assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1575 int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
1576 memcpy(payment_secret_arr->elems, obj->invoice_payment.payment_secret.data, 32);
1577 return payment_secret_arr;
1579 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment"))) TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(uint32_t ptr) {
1580 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
1581 assert(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
1582 int8_tArray spontaneous_payment_arr = init_int8_tArray(32, __LINE__);
1583 memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
1584 return spontaneous_payment_arr;
1586 uint32_t __attribute__((export_name("TS_LDKEvent_ty_from_ptr"))) TS_LDKEvent_ty_from_ptr(uint32_t ptr) {
1587 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1589 case LDKEvent_FundingGenerationReady: return 0;
1590 case LDKEvent_PaymentReceived: return 1;
1591 case LDKEvent_PaymentSent: return 2;
1592 case LDKEvent_PaymentPathFailed: return 3;
1593 case LDKEvent_PaymentFailed: return 4;
1594 case LDKEvent_PendingHTLCsForwardable: return 5;
1595 case LDKEvent_SpendableOutputs: return 6;
1596 case LDKEvent_PaymentForwarded: return 7;
1597 case LDKEvent_ChannelClosed: return 8;
1598 case LDKEvent_DiscardFunding: return 9;
1599 case LDKEvent_PaymentPathSuccessful: return 10;
1600 case LDKEvent_OpenChannelRequest: return 11;
1604 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id(uint32_t ptr) {
1605 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1606 assert(obj->tag == LDKEvent_FundingGenerationReady);
1607 int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
1608 memcpy(temporary_channel_id_arr->elems, obj->funding_generation_ready.temporary_channel_id.data, 32);
1609 return temporary_channel_id_arr;
1611 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis"))) TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(uint32_t ptr) {
1612 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1613 assert(obj->tag == LDKEvent_FundingGenerationReady);
1614 return obj->funding_generation_ready.channel_value_satoshis;
1616 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_output_script"))) TS_LDKEvent_FundingGenerationReady_get_output_script(uint32_t ptr) {
1617 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1618 assert(obj->tag == LDKEvent_FundingGenerationReady);
1619 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1620 int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen, __LINE__);
1621 memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
1622 return output_script_arr;
1624 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_user_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_user_channel_id(uint32_t ptr) {
1625 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1626 assert(obj->tag == LDKEvent_FundingGenerationReady);
1627 return obj->funding_generation_ready.user_channel_id;
1629 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_payment_hash"))) TS_LDKEvent_PaymentReceived_get_payment_hash(uint32_t ptr) {
1630 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1631 assert(obj->tag == LDKEvent_PaymentReceived);
1632 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1633 memcpy(payment_hash_arr->elems, obj->payment_received.payment_hash.data, 32);
1634 return payment_hash_arr;
1636 int64_t __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_amt"))) TS_LDKEvent_PaymentReceived_get_amt(uint32_t ptr) {
1637 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1638 assert(obj->tag == LDKEvent_PaymentReceived);
1639 return obj->payment_received.amt;
1641 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_purpose"))) TS_LDKEvent_PaymentReceived_get_purpose(uint32_t ptr) {
1642 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1643 assert(obj->tag == LDKEvent_PaymentReceived);
1644 uint32_t purpose_ref = ((uintptr_t)&obj->payment_received.purpose) | 1;
1647 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_id"))) TS_LDKEvent_PaymentSent_get_payment_id(uint32_t ptr) {
1648 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1649 assert(obj->tag == LDKEvent_PaymentSent);
1650 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1651 memcpy(payment_id_arr->elems, obj->payment_sent.payment_id.data, 32);
1652 return payment_id_arr;
1654 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_preimage"))) TS_LDKEvent_PaymentSent_get_payment_preimage(uint32_t ptr) {
1655 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1656 assert(obj->tag == LDKEvent_PaymentSent);
1657 int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
1658 memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
1659 return payment_preimage_arr;
1661 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_hash"))) TS_LDKEvent_PaymentSent_get_payment_hash(uint32_t ptr) {
1662 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1663 assert(obj->tag == LDKEvent_PaymentSent);
1664 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1665 memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
1666 return payment_hash_arr;
1668 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_fee_paid_msat"))) TS_LDKEvent_PaymentSent_get_fee_paid_msat(uint32_t ptr) {
1669 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1670 assert(obj->tag == LDKEvent_PaymentSent);
1671 uint32_t fee_paid_msat_ref = ((uintptr_t)&obj->payment_sent.fee_paid_msat) | 1;
1672 return fee_paid_msat_ref;
1674 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_id"))) TS_LDKEvent_PaymentPathFailed_get_payment_id(uint32_t ptr) {
1675 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1676 assert(obj->tag == LDKEvent_PaymentPathFailed);
1677 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1678 memcpy(payment_id_arr->elems, obj->payment_path_failed.payment_id.data, 32);
1679 return payment_id_arr;
1681 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_hash"))) TS_LDKEvent_PaymentPathFailed_get_payment_hash(uint32_t ptr) {
1682 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1683 assert(obj->tag == LDKEvent_PaymentPathFailed);
1684 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1685 memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
1686 return payment_hash_arr;
1688 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_rejected_by_dest"))) TS_LDKEvent_PaymentPathFailed_get_rejected_by_dest(uint32_t ptr) {
1689 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1690 assert(obj->tag == LDKEvent_PaymentPathFailed);
1691 return obj->payment_path_failed.rejected_by_dest;
1693 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_network_update"))) TS_LDKEvent_PaymentPathFailed_get_network_update(uint32_t ptr) {
1694 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1695 assert(obj->tag == LDKEvent_PaymentPathFailed);
1696 uint32_t network_update_ref = ((uintptr_t)&obj->payment_path_failed.network_update) | 1;
1697 return network_update_ref;
1699 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_all_paths_failed"))) TS_LDKEvent_PaymentPathFailed_get_all_paths_failed(uint32_t ptr) {
1700 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1701 assert(obj->tag == LDKEvent_PaymentPathFailed);
1702 return obj->payment_path_failed.all_paths_failed;
1704 uint32_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_path"))) TS_LDKEvent_PaymentPathFailed_get_path(uint32_t ptr) {
1705 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1706 assert(obj->tag == LDKEvent_PaymentPathFailed);
1707 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
1708 uint32_tArray path_arr = NULL;
1709 path_arr = init_uint32_tArray(path_var.datalen, __LINE__);
1710 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
1711 for (size_t k = 0; k < path_var.datalen; k++) {
1712 LDKRouteHop path_conv_10_var = path_var.data[k];
1713 uint32_t path_conv_10_ref = 0;
1714 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1715 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1716 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1717 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1;
1718 path_arr_ptr[k] = path_conv_10_ref;
1723 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_short_channel_id"))) TS_LDKEvent_PaymentPathFailed_get_short_channel_id(uint32_t ptr) {
1724 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1725 assert(obj->tag == LDKEvent_PaymentPathFailed);
1726 uint32_t short_channel_id_ref = ((uintptr_t)&obj->payment_path_failed.short_channel_id) | 1;
1727 return short_channel_id_ref;
1729 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_retry"))) TS_LDKEvent_PaymentPathFailed_get_retry(uint32_t ptr) {
1730 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1731 assert(obj->tag == LDKEvent_PaymentPathFailed);
1732 LDKRouteParameters retry_var = obj->payment_path_failed.retry;
1733 uint32_t retry_ref = 0;
1734 if ((uintptr_t)retry_var.inner > 4096) {
1735 CHECK((((uintptr_t)retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1736 CHECK((((uintptr_t)&retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1737 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
1738 retry_ref = (uintptr_t)retry_var.inner & ~1;
1742 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_id"))) TS_LDKEvent_PaymentFailed_get_payment_id(uint32_t ptr) {
1743 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1744 assert(obj->tag == LDKEvent_PaymentFailed);
1745 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1746 memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
1747 return payment_id_arr;
1749 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_hash"))) TS_LDKEvent_PaymentFailed_get_payment_hash(uint32_t ptr) {
1750 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1751 assert(obj->tag == LDKEvent_PaymentFailed);
1752 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1753 memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
1754 return payment_hash_arr;
1756 int64_t __attribute__((export_name("TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable"))) TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(uint32_t ptr) {
1757 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1758 assert(obj->tag == LDKEvent_PendingHTLCsForwardable);
1759 return obj->pending_htl_cs_forwardable.time_forwardable;
1761 uint32_tArray __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_outputs"))) TS_LDKEvent_SpendableOutputs_get_outputs(uint32_t ptr) {
1762 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1763 assert(obj->tag == LDKEvent_SpendableOutputs);
1764 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1765 uint32_tArray outputs_arr = NULL;
1766 outputs_arr = init_uint32_tArray(outputs_var.datalen, __LINE__);
1767 uint32_t *outputs_arr_ptr = (uint32_t*)(((uint8_t*)outputs_arr) + 4);
1768 for (size_t b = 0; b < outputs_var.datalen; b++) {
1769 uint32_t outputs_conv_27_ref = ((uintptr_t)&outputs_var.data[b]) | 1;
1770 outputs_arr_ptr[b] = outputs_conv_27_ref;
1775 uint32_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_fee_earned_msat"))) TS_LDKEvent_PaymentForwarded_get_fee_earned_msat(uint32_t ptr) {
1776 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1777 assert(obj->tag == LDKEvent_PaymentForwarded);
1778 uint32_t fee_earned_msat_ref = ((uintptr_t)&obj->payment_forwarded.fee_earned_msat) | 1;
1779 return fee_earned_msat_ref;
1781 jboolean __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx"))) TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(uint32_t ptr) {
1782 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1783 assert(obj->tag == LDKEvent_PaymentForwarded);
1784 return obj->payment_forwarded.claim_from_onchain_tx;
1786 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_id"))) TS_LDKEvent_ChannelClosed_get_channel_id(uint32_t ptr) {
1787 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1788 assert(obj->tag == LDKEvent_ChannelClosed);
1789 int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
1790 memcpy(channel_id_arr->elems, obj->channel_closed.channel_id.data, 32);
1791 return channel_id_arr;
1793 int64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_user_channel_id"))) TS_LDKEvent_ChannelClosed_get_user_channel_id(uint32_t ptr) {
1794 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1795 assert(obj->tag == LDKEvent_ChannelClosed);
1796 return obj->channel_closed.user_channel_id;
1798 uint32_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_reason"))) TS_LDKEvent_ChannelClosed_get_reason(uint32_t ptr) {
1799 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1800 assert(obj->tag == LDKEvent_ChannelClosed);
1801 uint32_t reason_ref = ((uintptr_t)&obj->channel_closed.reason) | 1;
1804 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_channel_id"))) TS_LDKEvent_DiscardFunding_get_channel_id(uint32_t ptr) {
1805 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1806 assert(obj->tag == LDKEvent_DiscardFunding);
1807 int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
1808 memcpy(channel_id_arr->elems, obj->discard_funding.channel_id.data, 32);
1809 return channel_id_arr;
1811 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_transaction"))) TS_LDKEvent_DiscardFunding_get_transaction(uint32_t ptr) {
1812 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1813 assert(obj->tag == LDKEvent_DiscardFunding);
1814 LDKTransaction transaction_var = obj->discard_funding.transaction;
1815 int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen, __LINE__);
1816 memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
1817 return transaction_arr;
1819 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_id"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_id(uint32_t ptr) {
1820 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1821 assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1822 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1823 memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
1824 return payment_id_arr;
1826 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_hash"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_hash(uint32_t ptr) {
1827 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1828 assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1829 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1830 memcpy(payment_hash_arr->elems, obj->payment_path_successful.payment_hash.data, 32);
1831 return payment_hash_arr;
1833 uint32_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_path"))) TS_LDKEvent_PaymentPathSuccessful_get_path(uint32_t ptr) {
1834 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1835 assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1836 LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
1837 uint32_tArray path_arr = NULL;
1838 path_arr = init_uint32_tArray(path_var.datalen, __LINE__);
1839 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
1840 for (size_t k = 0; k < path_var.datalen; k++) {
1841 LDKRouteHop path_conv_10_var = path_var.data[k];
1842 uint32_t path_conv_10_ref = 0;
1843 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1844 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1845 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1846 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1;
1847 path_arr_ptr[k] = path_conv_10_ref;
1852 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id"))) TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id(uint32_t ptr) {
1853 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1854 assert(obj->tag == LDKEvent_OpenChannelRequest);
1855 int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
1856 memcpy(temporary_channel_id_arr->elems, obj->open_channel_request.temporary_channel_id.data, 32);
1857 return temporary_channel_id_arr;
1859 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id"))) TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id(uint32_t ptr) {
1860 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1861 assert(obj->tag == LDKEvent_OpenChannelRequest);
1862 int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
1863 memcpy(counterparty_node_id_arr->elems, obj->open_channel_request.counterparty_node_id.compressed_form, 33);
1864 return counterparty_node_id_arr;
1866 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_funding_satoshis"))) TS_LDKEvent_OpenChannelRequest_get_funding_satoshis(uint32_t ptr) {
1867 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1868 assert(obj->tag == LDKEvent_OpenChannelRequest);
1869 return obj->open_channel_request.funding_satoshis;
1871 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_push_msat"))) TS_LDKEvent_OpenChannelRequest_get_push_msat(uint32_t ptr) {
1872 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1873 assert(obj->tag == LDKEvent_OpenChannelRequest);
1874 return obj->open_channel_request.push_msat;
1876 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_ty_from_ptr"))) TS_LDKCOption_EventZ_ty_from_ptr(uint32_t ptr) {
1877 LDKCOption_EventZ *obj = (LDKCOption_EventZ*)(ptr & ~1);
1879 case LDKCOption_EventZ_Some: return 0;
1880 case LDKCOption_EventZ_None: return 1;
1884 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_Some_get_some"))) TS_LDKCOption_EventZ_Some_get_some(uint32_t ptr) {
1885 LDKCOption_EventZ *obj = (LDKCOption_EventZ*)(ptr & ~1);
1886 assert(obj->tag == LDKCOption_EventZ_Some);
1887 uint32_t some_ref = ((uintptr_t)&obj->some) | 1;
1890 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
1891 CHECK(owner->result_ok);
1892 return COption_EventZ_clone(&*owner->contents.result);
1894 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_ok"))) TS_CResult_COption_EventZDecodeErrorZ_get_ok(uint32_t owner) {
1895 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
1896 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
1897 *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
1898 uint32_t ret_ref = (uintptr_t)ret_copy;
1902 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
1903 CHECK(!owner->result_ok);
1904 return DecodeError_clone(&*owner->contents.err);
1906 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_err"))) TS_CResult_COption_EventZDecodeErrorZ_get_err(uint32_t owner) {
1907 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
1908 LDKDecodeError ret_var = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
1909 uint32_t ret_ref = 0;
1910 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1911 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1912 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1913 ret_ref = (uintptr_t)ret_var.inner;
1914 if (ret_var.is_owned) {
1920 uint32_t __attribute__((export_name("TS_LDKErrorAction_ty_from_ptr"))) TS_LDKErrorAction_ty_from_ptr(uint32_t ptr) {
1921 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1923 case LDKErrorAction_DisconnectPeer: return 0;
1924 case LDKErrorAction_IgnoreError: return 1;
1925 case LDKErrorAction_IgnoreAndLog: return 2;
1926 case LDKErrorAction_IgnoreDuplicateGossip: return 3;
1927 case LDKErrorAction_SendErrorMessage: return 4;
1928 case LDKErrorAction_SendWarningMessage: return 5;
1932 uint32_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeer_get_msg"))) TS_LDKErrorAction_DisconnectPeer_get_msg(uint32_t ptr) {
1933 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1934 assert(obj->tag == LDKErrorAction_DisconnectPeer);
1935 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1936 uint32_t msg_ref = 0;
1937 if ((uintptr_t)msg_var.inner > 4096) {
1938 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1939 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1940 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1941 msg_ref = (uintptr_t)msg_var.inner & ~1;
1945 uint32_t __attribute__((export_name("TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log"))) TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(uint32_t ptr) {
1946 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1947 assert(obj->tag == LDKErrorAction_IgnoreAndLog);
1948 uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
1949 return ignore_and_log_conv;
1951 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendErrorMessage_get_msg"))) TS_LDKErrorAction_SendErrorMessage_get_msg(uint32_t ptr) {
1952 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1953 assert(obj->tag == LDKErrorAction_SendErrorMessage);
1954 LDKErrorMessage msg_var = obj->send_error_message.msg;
1955 uint32_t msg_ref = 0;
1956 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1957 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1958 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1959 msg_ref = (uintptr_t)msg_var.inner & ~1;
1962 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_msg"))) TS_LDKErrorAction_SendWarningMessage_get_msg(uint32_t ptr) {
1963 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1964 assert(obj->tag == LDKErrorAction_SendWarningMessage);
1965 LDKWarningMessage msg_var = obj->send_warning_message.msg;
1966 uint32_t msg_ref = 0;
1967 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1968 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1969 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1970 msg_ref = (uintptr_t)msg_var.inner & ~1;
1973 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_log_level"))) TS_LDKErrorAction_SendWarningMessage_get_log_level(uint32_t ptr) {
1974 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1975 assert(obj->tag == LDKErrorAction_SendWarningMessage);
1976 uint32_t log_level_conv = LDKLevel_to_js(obj->send_warning_message.log_level);
1977 return log_level_conv;
1979 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_ty_from_ptr"))) TS_LDKMessageSendEvent_ty_from_ptr(uint32_t ptr) {
1980 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
1982 case LDKMessageSendEvent_SendAcceptChannel: return 0;
1983 case LDKMessageSendEvent_SendOpenChannel: return 1;
1984 case LDKMessageSendEvent_SendFundingCreated: return 2;
1985 case LDKMessageSendEvent_SendFundingSigned: return 3;
1986 case LDKMessageSendEvent_SendFundingLocked: return 4;
1987 case LDKMessageSendEvent_SendAnnouncementSignatures: return 5;
1988 case LDKMessageSendEvent_UpdateHTLCs: return 6;
1989 case LDKMessageSendEvent_SendRevokeAndACK: return 7;
1990 case LDKMessageSendEvent_SendClosingSigned: return 8;
1991 case LDKMessageSendEvent_SendShutdown: return 9;
1992 case LDKMessageSendEvent_SendChannelReestablish: return 10;
1993 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 11;
1994 case LDKMessageSendEvent_BroadcastNodeAnnouncement: return 12;
1995 case LDKMessageSendEvent_BroadcastChannelUpdate: return 13;
1996 case LDKMessageSendEvent_SendChannelUpdate: return 14;
1997 case LDKMessageSendEvent_HandleError: return 15;
1998 case LDKMessageSendEvent_SendChannelRangeQuery: return 16;
1999 case LDKMessageSendEvent_SendShortIdsQuery: return 17;
2000 case LDKMessageSendEvent_SendReplyChannelRange: return 18;
2004 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id(uint32_t ptr) {
2005 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2006 assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2007 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2008 memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
2011 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_msg(uint32_t ptr) {
2012 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2013 assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2014 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
2015 uint32_t msg_ref = 0;
2016 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2017 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2018 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2019 msg_ref = (uintptr_t)msg_var.inner & ~1;
2022 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannel_get_node_id(uint32_t ptr) {
2023 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2024 assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2025 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2026 memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
2029 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannel_get_msg(uint32_t ptr) {
2030 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2031 assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2032 LDKOpenChannel msg_var = obj->send_open_channel.msg;
2033 uint32_t msg_ref = 0;
2034 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2035 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2036 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2037 msg_ref = (uintptr_t)msg_var.inner & ~1;
2040 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_node_id"))) TS_LDKMessageSendEvent_SendFundingCreated_get_node_id(uint32_t ptr) {
2041 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2042 assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2043 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2044 memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
2047 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_msg"))) TS_LDKMessageSendEvent_SendFundingCreated_get_msg(uint32_t ptr) {
2048 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2049 assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2050 LDKFundingCreated msg_var = obj->send_funding_created.msg;
2051 uint32_t msg_ref = 0;
2052 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2053 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2054 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2055 msg_ref = (uintptr_t)msg_var.inner & ~1;
2058 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendFundingSigned_get_node_id(uint32_t ptr) {
2059 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2060 assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2061 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2062 memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
2065 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_msg"))) TS_LDKMessageSendEvent_SendFundingSigned_get_msg(uint32_t ptr) {
2066 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2067 assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2068 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
2069 uint32_t msg_ref = 0;
2070 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2071 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2072 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2073 msg_ref = (uintptr_t)msg_var.inner & ~1;
2076 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingLocked_get_node_id"))) TS_LDKMessageSendEvent_SendFundingLocked_get_node_id(uint32_t ptr) {
2077 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2078 assert(obj->tag == LDKMessageSendEvent_SendFundingLocked);
2079 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2080 memcpy(node_id_arr->elems, obj->send_funding_locked.node_id.compressed_form, 33);
2083 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingLocked_get_msg"))) TS_LDKMessageSendEvent_SendFundingLocked_get_msg(uint32_t ptr) {
2084 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2085 assert(obj->tag == LDKMessageSendEvent_SendFundingLocked);
2086 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
2087 uint32_t msg_ref = 0;
2088 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2089 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2090 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2091 msg_ref = (uintptr_t)msg_var.inner & ~1;
2094 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(uint32_t ptr) {
2095 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2096 assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2097 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2098 memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
2101 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(uint32_t ptr) {
2102 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2103 assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2104 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
2105 uint32_t msg_ref = 0;
2106 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2107 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2108 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2109 msg_ref = (uintptr_t)msg_var.inner & ~1;
2112 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id(uint32_t ptr) {
2113 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2114 assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
2115 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2116 memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
2119 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_updates"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_updates(uint32_t ptr) {
2120 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2121 assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
2122 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
2123 uint32_t updates_ref = 0;
2124 CHECK((((uintptr_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2125 CHECK((((uintptr_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2126 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
2127 updates_ref = (uintptr_t)updates_var.inner & ~1;
2130 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(uint32_t ptr) {
2131 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2132 assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
2133 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2134 memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
2137 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg(uint32_t ptr) {
2138 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2139 assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
2140 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
2141 uint32_t msg_ref = 0;
2142 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2143 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2144 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2145 msg_ref = (uintptr_t)msg_var.inner & ~1;
2148 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendClosingSigned_get_node_id(uint32_t ptr) {
2149 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2150 assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
2151 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2152 memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
2155 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_msg"))) TS_LDKMessageSendEvent_SendClosingSigned_get_msg(uint32_t ptr) {
2156 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2157 assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
2158 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
2159 uint32_t msg_ref = 0;
2160 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2161 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2162 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2163 msg_ref = (uintptr_t)msg_var.inner & ~1;
2166 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_node_id"))) TS_LDKMessageSendEvent_SendShutdown_get_node_id(uint32_t ptr) {
2167 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2168 assert(obj->tag == LDKMessageSendEvent_SendShutdown);
2169 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2170 memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
2173 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_msg"))) TS_LDKMessageSendEvent_SendShutdown_get_msg(uint32_t ptr) {
2174 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2175 assert(obj->tag == LDKMessageSendEvent_SendShutdown);
2176 LDKShutdown msg_var = obj->send_shutdown.msg;
2177 uint32_t msg_ref = 0;
2178 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2179 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2180 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2181 msg_ref = (uintptr_t)msg_var.inner & ~1;
2184 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id(uint32_t ptr) {
2185 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2186 assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
2187 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2188 memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
2191 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_msg"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_msg(uint32_t ptr) {
2192 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2193 assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
2194 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
2195 uint32_t msg_ref = 0;
2196 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2197 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2198 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2199 msg_ref = (uintptr_t)msg_var.inner & ~1;
2202 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(uint32_t ptr) {
2203 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2204 assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
2205 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
2206 uint32_t msg_ref = 0;
2207 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2208 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2209 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2210 msg_ref = (uintptr_t)msg_var.inner & ~1;
2213 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(uint32_t ptr) {
2214 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2215 assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
2216 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
2217 uint32_t update_msg_ref = 0;
2218 CHECK((((uintptr_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2219 CHECK((((uintptr_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2220 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
2221 update_msg_ref = (uintptr_t)update_msg_var.inner & ~1;
2222 return update_msg_ref;
2224 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg(uint32_t ptr) {
2225 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2226 assert(obj->tag == LDKMessageSendEvent_BroadcastNodeAnnouncement);
2227 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
2228 uint32_t msg_ref = 0;
2229 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2230 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2231 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2232 msg_ref = (uintptr_t)msg_var.inner & ~1;
2235 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(uint32_t ptr) {
2236 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2237 assert(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
2238 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
2239 uint32_t msg_ref = 0;
2240 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2241 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2242 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2243 msg_ref = (uintptr_t)msg_var.inner & ~1;
2246 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id(uint32_t ptr) {
2247 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2248 assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
2249 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2250 memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
2253 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_msg(uint32_t ptr) {
2254 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2255 assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
2256 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
2257 uint32_t msg_ref = 0;
2258 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2259 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2260 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2261 msg_ref = (uintptr_t)msg_var.inner & ~1;
2264 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_node_id"))) TS_LDKMessageSendEvent_HandleError_get_node_id(uint32_t ptr) {
2265 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2266 assert(obj->tag == LDKMessageSendEvent_HandleError);
2267 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2268 memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
2271 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_action"))) TS_LDKMessageSendEvent_HandleError_get_action(uint32_t ptr) {
2272 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2273 assert(obj->tag == LDKMessageSendEvent_HandleError);
2274 uint32_t action_ref = ((uintptr_t)&obj->handle_error.action) | 1;
2277 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(uint32_t ptr) {
2278 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2279 assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
2280 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2281 memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
2284 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(uint32_t ptr) {
2285 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2286 assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
2287 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
2288 uint32_t msg_ref = 0;
2289 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2290 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2291 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2292 msg_ref = (uintptr_t)msg_var.inner & ~1;
2295 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(uint32_t ptr) {
2296 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2297 assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
2298 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2299 memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
2302 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg(uint32_t ptr) {
2303 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2304 assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
2305 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
2306 uint32_t msg_ref = 0;
2307 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2308 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2309 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2310 msg_ref = (uintptr_t)msg_var.inner & ~1;
2313 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(uint32_t ptr) {
2314 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2315 assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
2316 int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2317 memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
2320 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg(uint32_t ptr) {
2321 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2322 assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
2323 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
2324 uint32_t msg_ref = 0;
2325 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2326 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2327 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2328 msg_ref = (uintptr_t)msg_var.inner & ~1;
2331 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
2332 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
2333 for (size_t i = 0; i < ret.datalen; i++) {
2334 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
2338 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2339 CHECK(owner->result_ok);
2340 return FixedPenaltyScorer_clone(&*owner->contents.result);
2342 uint32_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(uint32_t owner) {
2343 LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(owner & ~1);
2344 LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
2345 uint32_t ret_ref = 0;
2346 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2347 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2348 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2349 ret_ref = (uintptr_t)ret_var.inner;
2350 if (ret_var.is_owned) {
2356 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2357 CHECK(!owner->result_ok);
2358 return DecodeError_clone(&*owner->contents.err);
2360 uint32_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err(uint32_t owner) {
2361 LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(owner & ~1);
2362 LDKDecodeError ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
2363 uint32_t ret_ref = 0;
2364 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2365 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2366 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2367 ret_ref = (uintptr_t)ret_var.inner;
2368 if (ret_var.is_owned) {
2374 static inline struct LDKScoringParameters CResult_ScoringParametersDecodeErrorZ_get_ok(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR owner){
2375 CHECK(owner->result_ok);
2376 return ScoringParameters_clone(&*owner->contents.result);
2378 uint32_t __attribute__((export_name("TS_CResult_ScoringParametersDecodeErrorZ_get_ok"))) TS_CResult_ScoringParametersDecodeErrorZ_get_ok(uint32_t owner) {
2379 LDKCResult_ScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(owner & ~1);
2380 LDKScoringParameters ret_var = CResult_ScoringParametersDecodeErrorZ_get_ok(owner_conv);
2381 uint32_t ret_ref = 0;
2382 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2383 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2384 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2385 ret_ref = (uintptr_t)ret_var.inner;
2386 if (ret_var.is_owned) {
2392 static inline struct LDKDecodeError CResult_ScoringParametersDecodeErrorZ_get_err(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR owner){
2393 CHECK(!owner->result_ok);
2394 return DecodeError_clone(&*owner->contents.err);
2396 uint32_t __attribute__((export_name("TS_CResult_ScoringParametersDecodeErrorZ_get_err"))) TS_CResult_ScoringParametersDecodeErrorZ_get_err(uint32_t owner) {
2397 LDKCResult_ScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(owner & ~1);
2398 LDKDecodeError ret_var = CResult_ScoringParametersDecodeErrorZ_get_err(owner_conv);
2399 uint32_t ret_ref = 0;
2400 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2401 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2402 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2403 ret_ref = (uintptr_t)ret_var.inner;
2404 if (ret_var.is_owned) {
2410 static inline struct LDKScorer *CResult_ScorerDecodeErrorZ_get_ok(LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR owner){
2411 CHECK(owner->result_ok);
2412 return &*owner->contents.result;
2414 uint32_t __attribute__((export_name("TS_CResult_ScorerDecodeErrorZ_get_ok"))) TS_CResult_ScorerDecodeErrorZ_get_ok(uint32_t owner) {
2415 LDKCResult_ScorerDecodeErrorZ* owner_conv = (LDKCResult_ScorerDecodeErrorZ*)(owner & ~1);
2416 LDKScorer ret_var = *CResult_ScorerDecodeErrorZ_get_ok(owner_conv);
2417 uint32_t ret_ref = 0;
2418 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2419 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2420 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2421 ret_ref = (uintptr_t)ret_var.inner & ~1;
2425 static inline struct LDKDecodeError CResult_ScorerDecodeErrorZ_get_err(LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR owner){
2426 CHECK(!owner->result_ok);
2427 return DecodeError_clone(&*owner->contents.err);
2429 uint32_t __attribute__((export_name("TS_CResult_ScorerDecodeErrorZ_get_err"))) TS_CResult_ScorerDecodeErrorZ_get_err(uint32_t owner) {
2430 LDKCResult_ScorerDecodeErrorZ* owner_conv = (LDKCResult_ScorerDecodeErrorZ*)(owner & ~1);
2431 LDKDecodeError ret_var = CResult_ScorerDecodeErrorZ_get_err(owner_conv);
2432 uint32_t ret_ref = 0;
2433 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2434 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2435 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2436 ret_ref = (uintptr_t)ret_var.inner;
2437 if (ret_var.is_owned) {
2443 static inline struct LDKProbabilisticScoringParameters CResult_ProbabilisticScoringParametersDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR owner){
2444 CHECK(owner->result_ok);
2445 return ProbabilisticScoringParameters_clone(&*owner->contents.result);
2447 uint32_t __attribute__((export_name("TS_CResult_ProbabilisticScoringParametersDecodeErrorZ_get_ok"))) TS_CResult_ProbabilisticScoringParametersDecodeErrorZ_get_ok(uint32_t owner) {
2448 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(owner & ~1);
2449 LDKProbabilisticScoringParameters ret_var = CResult_ProbabilisticScoringParametersDecodeErrorZ_get_ok(owner_conv);
2450 uint32_t ret_ref = 0;
2451 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2452 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2453 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2454 ret_ref = (uintptr_t)ret_var.inner;
2455 if (ret_var.is_owned) {
2461 static inline struct LDKDecodeError CResult_ProbabilisticScoringParametersDecodeErrorZ_get_err(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR owner){
2462 CHECK(!owner->result_ok);
2463 return DecodeError_clone(&*owner->contents.err);
2465 uint32_t __attribute__((export_name("TS_CResult_ProbabilisticScoringParametersDecodeErrorZ_get_err"))) TS_CResult_ProbabilisticScoringParametersDecodeErrorZ_get_err(uint32_t owner) {
2466 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(owner & ~1);
2467 LDKDecodeError ret_var = CResult_ProbabilisticScoringParametersDecodeErrorZ_get_err(owner_conv);
2468 uint32_t ret_ref = 0;
2469 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2470 CHECK((((uintptr_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 = (uintptr_t)ret_var.inner;
2473 if (ret_var.is_owned) {
2479 static inline struct LDKProbabilisticScoringParameters C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_a(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ *NONNULL_PTR owner){
2480 return ProbabilisticScoringParameters_clone(&owner->a);
2482 uint32_t __attribute__((export_name("TS_C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_a"))) TS_C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_a(uint32_t owner) {
2483 LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* owner_conv = (LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(owner & ~1);
2484 LDKProbabilisticScoringParameters ret_var = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_a(owner_conv);
2485 uint32_t ret_ref = 0;
2486 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2487 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2488 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2489 ret_ref = (uintptr_t)ret_var.inner;
2490 if (ret_var.is_owned) {
2496 static inline struct LDKNetworkGraph C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_b(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ *NONNULL_PTR owner){
2497 return NetworkGraph_clone(&owner->b);
2499 uint32_t __attribute__((export_name("TS_C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_b"))) TS_C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_b(uint32_t owner) {
2500 LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* owner_conv = (LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(owner & ~1);
2501 LDKNetworkGraph ret_var = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_b(owner_conv);
2502 uint32_t ret_ref = 0;
2503 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2504 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2505 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2506 ret_ref = (uintptr_t)ret_var.inner;
2507 if (ret_var.is_owned) {
2513 static inline struct LDKProbabilisticScorer *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2514 CHECK(owner->result_ok);
2515 return &*owner->contents.result;
2517 uint32_t __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok(uint32_t owner) {
2518 LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(owner & ~1);
2519 LDKProbabilisticScorer ret_var = *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
2520 uint32_t ret_ref = 0;
2521 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2522 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2523 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2524 ret_ref = (uintptr_t)ret_var.inner & ~1;
2528 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2529 CHECK(!owner->result_ok);
2530 return DecodeError_clone(&*owner->contents.err);
2532 uint32_t __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err(uint32_t owner) {
2533 LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(owner & ~1);
2534 LDKDecodeError ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
2535 uint32_t ret_ref = 0;
2536 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2537 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2538 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2539 ret_ref = (uintptr_t)ret_var.inner;
2540 if (ret_var.is_owned) {
2546 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
2547 CHECK(owner->result_ok);
2548 return InitFeatures_clone(&*owner->contents.result);
2550 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
2551 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
2552 LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
2553 uint32_t ret_ref = 0;
2554 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2555 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2556 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2557 ret_ref = (uintptr_t)ret_var.inner;
2558 if (ret_var.is_owned) {
2564 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
2565 CHECK(!owner->result_ok);
2566 return DecodeError_clone(&*owner->contents.err);
2568 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_err"))) TS_CResult_InitFeaturesDecodeErrorZ_get_err(uint32_t owner) {
2569 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
2570 LDKDecodeError ret_var = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
2571 uint32_t ret_ref = 0;
2572 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2573 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2574 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2575 ret_ref = (uintptr_t)ret_var.inner;
2576 if (ret_var.is_owned) {
2582 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
2583 CHECK(owner->result_ok);
2584 return ChannelFeatures_clone(&*owner->contents.result);
2586 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
2587 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
2588 LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
2589 uint32_t ret_ref = 0;
2590 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2591 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2592 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2593 ret_ref = (uintptr_t)ret_var.inner;
2594 if (ret_var.is_owned) {
2600 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
2601 CHECK(!owner->result_ok);
2602 return DecodeError_clone(&*owner->contents.err);
2604 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_err(uint32_t owner) {
2605 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
2606 LDKDecodeError ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
2607 uint32_t ret_ref = 0;
2608 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2609 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2610 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2611 ret_ref = (uintptr_t)ret_var.inner;
2612 if (ret_var.is_owned) {
2618 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2619 CHECK(owner->result_ok);
2620 return NodeFeatures_clone(&*owner->contents.result);
2622 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
2623 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
2624 LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
2625 uint32_t ret_ref = 0;
2626 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2627 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2628 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2629 ret_ref = (uintptr_t)ret_var.inner;
2630 if (ret_var.is_owned) {
2636 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2637 CHECK(!owner->result_ok);
2638 return DecodeError_clone(&*owner->contents.err);
2640 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_err(uint32_t owner) {
2641 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
2642 LDKDecodeError ret_var = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
2643 uint32_t ret_ref = 0;
2644 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2645 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2646 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2647 ret_ref = (uintptr_t)ret_var.inner;
2648 if (ret_var.is_owned) {
2654 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
2655 CHECK(owner->result_ok);
2656 return InvoiceFeatures_clone(&*owner->contents.result);
2658 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
2659 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
2660 LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
2661 uint32_t ret_ref = 0;
2662 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2663 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2664 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2665 ret_ref = (uintptr_t)ret_var.inner;
2666 if (ret_var.is_owned) {
2672 static inline struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
2673 CHECK(!owner->result_ok);
2674 return DecodeError_clone(&*owner->contents.err);
2676 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err(uint32_t owner) {
2677 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
2678 LDKDecodeError ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
2679 uint32_t ret_ref = 0;
2680 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2681 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2682 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2683 ret_ref = (uintptr_t)ret_var.inner;
2684 if (ret_var.is_owned) {
2690 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2691 CHECK(owner->result_ok);
2692 return ChannelTypeFeatures_clone(&*owner->contents.result);
2694 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
2695 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
2696 LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
2697 uint32_t ret_ref = 0;
2698 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2699 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2700 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2701 ret_ref = (uintptr_t)ret_var.inner;
2702 if (ret_var.is_owned) {
2708 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2709 CHECK(!owner->result_ok);
2710 return DecodeError_clone(&*owner->contents.err);
2712 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint32_t owner) {
2713 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
2714 LDKDecodeError ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
2715 uint32_t ret_ref = 0;
2716 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2717 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2718 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2719 ret_ref = (uintptr_t)ret_var.inner;
2720 if (ret_var.is_owned) {
2726 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2727 CHECK(owner->result_ok);
2728 return DelayedPaymentOutputDescriptor_clone(&*owner->contents.result);
2730 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t owner) {
2731 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
2732 LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
2733 uint32_t ret_ref = 0;
2734 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2735 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2736 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2737 ret_ref = (uintptr_t)ret_var.inner;
2738 if (ret_var.is_owned) {
2744 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2745 CHECK(!owner->result_ok);
2746 return DecodeError_clone(&*owner->contents.err);
2748 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t owner) {
2749 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
2750 LDKDecodeError ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
2751 uint32_t ret_ref = 0;
2752 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2753 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2754 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2755 ret_ref = (uintptr_t)ret_var.inner;
2756 if (ret_var.is_owned) {
2762 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2763 CHECK(owner->result_ok);
2764 return StaticPaymentOutputDescriptor_clone(&*owner->contents.result);
2766 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t owner) {
2767 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
2768 LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
2769 uint32_t ret_ref = 0;
2770 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2771 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2772 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2773 ret_ref = (uintptr_t)ret_var.inner;
2774 if (ret_var.is_owned) {
2780 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2781 CHECK(!owner->result_ok);
2782 return DecodeError_clone(&*owner->contents.err);
2784 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t owner) {
2785 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
2786 LDKDecodeError ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
2787 uint32_t ret_ref = 0;
2788 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2789 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2790 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2791 ret_ref = (uintptr_t)ret_var.inner;
2792 if (ret_var.is_owned) {
2798 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2799 CHECK(owner->result_ok);
2800 return SpendableOutputDescriptor_clone(&*owner->contents.result);
2802 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint32_t owner) {
2803 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
2804 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
2805 *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
2806 uint32_t ret_ref = (uintptr_t)ret_copy;
2810 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2811 CHECK(!owner->result_ok);
2812 return DecodeError_clone(&*owner->contents.err);
2814 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint32_t owner) {
2815 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
2816 LDKDecodeError ret_var = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
2817 uint32_t ret_ref = 0;
2818 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2819 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2820 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2821 ret_ref = (uintptr_t)ret_var.inner;
2822 if (ret_var.is_owned) {
2828 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
2829 LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
2830 for (size_t i = 0; i < ret.datalen; i++) {
2831 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
2835 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
2838 int8_tArray __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_a"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_a(uint32_t owner) {
2839 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
2840 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
2841 memcpy(ret_arr->elems, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form, 64);
2845 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
2848 ptrArray __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_b"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_b(uint32_t owner) {
2849 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
2850 LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
2851 ptrArray ret_arr = NULL;
2852 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
2853 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
2854 for (size_t m = 0; m < ret_var.datalen; m++) {
2855 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
2856 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
2857 ret_arr_ptr[m] = ret_conv_12_arr;
2863 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
2864 CHECK(owner->result_ok);
2865 return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
2867 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint32_t owner) {
2868 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
2869 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
2870 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
2871 return ((uint32_t)ret_conv);
2874 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
2875 CHECK(!owner->result_ok);
2876 return *owner->contents.err;
2878 void __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint32_t owner) {
2879 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
2880 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
2883 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
2884 CHECK(owner->result_ok);
2885 return *owner->contents.result;
2887 int8_tArray __attribute__((export_name("TS_CResult_SignatureNoneZ_get_ok"))) TS_CResult_SignatureNoneZ_get_ok(uint32_t owner) {
2888 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
2889 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
2890 memcpy(ret_arr->elems, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form, 64);
2894 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
2895 CHECK(!owner->result_ok);
2896 return *owner->contents.err;
2898 void __attribute__((export_name("TS_CResult_SignatureNoneZ_get_err"))) TS_CResult_SignatureNoneZ_get_err(uint32_t owner) {
2899 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
2900 CResult_SignatureNoneZ_get_err(owner_conv);
2903 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_a(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
2906 int8_tArray __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_get_a"))) TS_C2Tuple_SignatureSignatureZ_get_a(uint32_t owner) {
2907 LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)(owner & ~1);
2908 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
2909 memcpy(ret_arr->elems, C2Tuple_SignatureSignatureZ_get_a(owner_conv).compact_form, 64);
2913 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_b(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
2916 int8_tArray __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_get_b"))) TS_C2Tuple_SignatureSignatureZ_get_b(uint32_t owner) {
2917 LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)(owner & ~1);
2918 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
2919 memcpy(ret_arr->elems, C2Tuple_SignatureSignatureZ_get_b(owner_conv).compact_form, 64);
2923 static inline struct LDKC2Tuple_SignatureSignatureZ CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
2924 CHECK(owner->result_ok);
2925 return C2Tuple_SignatureSignatureZ_clone(&*owner->contents.result);
2927 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(uint32_t owner) {
2928 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(owner & ~1);
2929 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
2930 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(owner_conv);
2931 return ((uint32_t)ret_conv);
2934 static inline void CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
2935 CHECK(!owner->result_ok);
2936 return *owner->contents.err;
2938 void __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(uint32_t owner) {
2939 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(owner & ~1);
2940 CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(owner_conv);
2943 static inline struct LDKSecretKey CResult_SecretKeyNoneZ_get_ok(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
2944 CHECK(owner->result_ok);
2945 return *owner->contents.result;
2947 int8_tArray __attribute__((export_name("TS_CResult_SecretKeyNoneZ_get_ok"))) TS_CResult_SecretKeyNoneZ_get_ok(uint32_t owner) {
2948 LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)(owner & ~1);
2949 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
2950 memcpy(ret_arr->elems, CResult_SecretKeyNoneZ_get_ok(owner_conv).bytes, 32);
2954 static inline void CResult_SecretKeyNoneZ_get_err(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
2955 CHECK(!owner->result_ok);
2956 return *owner->contents.err;
2958 void __attribute__((export_name("TS_CResult_SecretKeyNoneZ_get_err"))) TS_CResult_SecretKeyNoneZ_get_err(uint32_t owner) {
2959 LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)(owner & ~1);
2960 CResult_SecretKeyNoneZ_get_err(owner_conv);
2963 typedef struct LDKBaseSign_JCalls {
2964 atomic_size_t refcnt;
2965 uint32_t instance_ptr;
2966 } LDKBaseSign_JCalls;
2967 static void LDKBaseSign_JCalls_free(void* this_arg) {
2968 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2969 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2973 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2974 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2975 int8_tArray ret = (int8_tArray)js_invoke_function_1(j_calls->instance_ptr, 0, (uint32_t)idx);
2976 LDKPublicKey ret_ref;
2977 CHECK(ret->arr_len == 33);
2978 memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
2981 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2982 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2983 int8_tArray ret = (int8_tArray)js_invoke_function_1(j_calls->instance_ptr, 1, (uint32_t)idx);
2984 LDKThirtyTwoBytes ret_ref;
2985 CHECK(ret->arr_len == 32);
2986 memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
2989 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
2990 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2991 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
2992 uint32_t holder_tx_ref = 0;
2993 holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
2994 CHECK((((uintptr_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2995 CHECK((((uintptr_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2996 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
2997 holder_tx_ref = (uintptr_t)holder_tx_var.inner;
2998 if (holder_tx_var.is_owned) {
3001 LDKCVec_PaymentPreimageZ preimages_var = preimages;
3002 ptrArray preimages_arr = NULL;
3003 preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
3004 int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 4);
3005 for (size_t m = 0; m < preimages_var.datalen; m++) {
3006 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
3007 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
3008 preimages_arr_ptr[m] = preimages_conv_12_arr;
3011 FREE(preimages_var.data);
3012 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 2, (uint32_t)holder_tx_ref, (uint32_t)preimages_arr);
3013 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3014 CHECK_ACCESS(ret_ptr);
3015 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3019 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
3020 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3021 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 3);
3022 LDKThirtyTwoBytes ret_ref;
3023 CHECK(ret->arr_len == 32);
3024 memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
3027 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
3028 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3029 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
3030 uint32_t commitment_tx_ref = 0;
3031 commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
3032 CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3033 CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3034 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3035 commitment_tx_ref = (uintptr_t)commitment_tx_var.inner;
3036 if (commitment_tx_var.is_owned) {
3037 commitment_tx_ref |= 1;
3039 LDKCVec_PaymentPreimageZ preimages_var = preimages;
3040 ptrArray preimages_arr = NULL;
3041 preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
3042 int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 4);
3043 for (size_t m = 0; m < preimages_var.datalen; m++) {
3044 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
3045 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
3046 preimages_arr_ptr[m] = preimages_conv_12_arr;
3049 FREE(preimages_var.data);
3050 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 4, (uint32_t)commitment_tx_ref, (uint32_t)preimages_arr);
3051 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3052 CHECK_ACCESS(ret_ptr);
3053 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3057 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
3058 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3059 int8_tArray secret_arr = init_int8_tArray(32, __LINE__);
3060 memcpy(secret_arr->elems, *secret, 32);
3061 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 5, (uint32_t)idx, (uint32_t)secret_arr);
3062 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3063 CHECK_ACCESS(ret_ptr);
3064 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3068 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
3069 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3070 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
3071 uint32_t commitment_tx_ref = 0;
3072 commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
3073 CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3074 CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3075 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3076 commitment_tx_ref = (uintptr_t)commitment_tx_var.inner;
3077 if (commitment_tx_var.is_owned) {
3078 commitment_tx_ref |= 1;
3080 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 6, (uint32_t)commitment_tx_ref);
3081 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3082 CHECK_ACCESS(ret_ptr);
3083 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3087 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]) {
3088 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3089 LDKTransaction justice_tx_var = justice_tx;
3090 int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
3091 memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
3092 Transaction_free(justice_tx_var);
3093 int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
3094 memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
3095 uint32_t ret = js_invoke_function_4(j_calls->instance_ptr, 7, (uint32_t)justice_tx_arr, (uint32_t)input, (uint32_t)amount, (uint32_t)per_commitment_key_arr);
3096 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3097 CHECK_ACCESS(ret_ptr);
3098 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3102 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) {
3103 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3104 LDKTransaction justice_tx_var = justice_tx;
3105 int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
3106 memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
3107 Transaction_free(justice_tx_var);
3108 int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
3109 memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
3110 LDKHTLCOutputInCommitment htlc_var = *htlc;
3111 uint32_t htlc_ref = 0;
3112 htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3113 CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3114 CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3115 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3116 htlc_ref = (uintptr_t)htlc_var.inner;
3117 if (htlc_var.is_owned) {
3120 uint32_t ret = js_invoke_function_5(j_calls->instance_ptr, 8, (uint32_t)justice_tx_arr, (uint32_t)input, (uint32_t)amount, (uint32_t)per_commitment_key_arr, (uint32_t)htlc_ref);
3121 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3122 CHECK_ACCESS(ret_ptr);
3123 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3127 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) {
3128 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3129 LDKTransaction htlc_tx_var = htlc_tx;
3130 int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
3131 memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
3132 Transaction_free(htlc_tx_var);
3133 int8_tArray per_commitment_point_arr = init_int8_tArray(33, __LINE__);
3134 memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
3135 LDKHTLCOutputInCommitment htlc_var = *htlc;
3136 uint32_t htlc_ref = 0;
3137 htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3138 CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3139 CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3140 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3141 htlc_ref = (uintptr_t)htlc_var.inner;
3142 if (htlc_var.is_owned) {
3145 uint32_t ret = js_invoke_function_5(j_calls->instance_ptr, 9, (uint32_t)htlc_tx_arr, (uint32_t)input, (uint32_t)amount, (uint32_t)per_commitment_point_arr, (uint32_t)htlc_ref);
3146 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3147 CHECK_ACCESS(ret_ptr);
3148 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3152 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
3153 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3154 LDKClosingTransaction closing_tx_var = *closing_tx;
3155 uint32_t closing_tx_ref = 0;
3156 closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
3157 CHECK((((uintptr_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3158 CHECK((((uintptr_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3159 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
3160 closing_tx_ref = (uintptr_t)closing_tx_var.inner;
3161 if (closing_tx_var.is_owned) {
3162 closing_tx_ref |= 1;
3164 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 10, (uint32_t)closing_tx_ref);
3165 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3166 CHECK_ACCESS(ret_ptr);
3167 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3171 LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
3172 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3173 LDKUnsignedChannelAnnouncement msg_var = *msg;
3174 uint32_t msg_ref = 0;
3175 msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
3176 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3177 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3178 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3179 msg_ref = (uintptr_t)msg_var.inner;
3180 if (msg_var.is_owned) {
3183 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 11, (uint32_t)msg_ref);
3184 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3185 CHECK_ACCESS(ret_ptr);
3186 LDKCResult_C2Tuple_SignatureSignatureZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(ret_ptr);
3190 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
3191 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3192 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
3193 uint32_t channel_parameters_ref = 0;
3194 channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
3195 CHECK((((uintptr_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3196 CHECK((((uintptr_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3197 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
3198 channel_parameters_ref = (uintptr_t)channel_parameters_var.inner;
3199 if (channel_parameters_var.is_owned) {
3200 channel_parameters_ref |= 1;
3202 js_invoke_function_1(j_calls->instance_ptr, 12, (uint32_t)channel_parameters_ref);
3204 static void LDKBaseSign_JCalls_cloned(LDKBaseSign* new_obj) {
3205 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) new_obj->this_arg;
3206 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3208 static inline LDKBaseSign LDKBaseSign_init (JSValue o, uint32_t pubkeys) {
3209 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
3210 atomic_init(&calls->refcnt, 1);
3211 calls->instance_ptr = o;
3213 LDKChannelPublicKeys pubkeys_conv;
3214 pubkeys_conv.inner = (void*)(pubkeys & (~1));
3215 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
3216 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3219 .this_arg = (void*) calls,
3220 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
3221 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
3222 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
3223 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
3224 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
3225 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
3226 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
3227 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
3228 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
3229 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
3230 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
3231 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
3232 .ready_channel = ready_channel_LDKBaseSign_jcall,
3233 .free = LDKBaseSign_JCalls_free,
3234 .pubkeys = pubkeys_conv,
3235 .set_pubkeys = NULL,
3239 long __attribute__((export_name("TS_LDKBaseSign_new"))) TS_LDKBaseSign_new(JSValue o, uint32_t pubkeys) {
3240 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
3241 *res_ptr = LDKBaseSign_init(o, pubkeys);
3242 return (long)res_ptr;
3244 int8_tArray __attribute__((export_name("TS_BaseSign_get_per_commitment_point"))) TS_BaseSign_get_per_commitment_point(uint32_t this_arg, int64_t idx) {
3245 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3246 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3247 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3248 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3249 memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
3253 int8_tArray __attribute__((export_name("TS_BaseSign_release_commitment_secret"))) TS_BaseSign_release_commitment_secret(uint32_t this_arg, int64_t idx) {
3254 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3255 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3256 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3257 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3258 memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
3262 uint32_t __attribute__((export_name("TS_BaseSign_validate_holder_commitment"))) TS_BaseSign_validate_holder_commitment(uint32_t this_arg, uint32_t holder_tx, ptrArray preimages) {
3263 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3264 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3265 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3266 LDKHolderCommitmentTransaction holder_tx_conv;
3267 holder_tx_conv.inner = (void*)(holder_tx & (~1));
3268 holder_tx_conv.is_owned = false;
3269 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
3270 LDKCVec_PaymentPreimageZ preimages_constr;
3271 preimages_constr.datalen = preimages->arr_len;
3272 if (preimages_constr.datalen > 0)
3273 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
3275 preimages_constr.data = NULL;
3276 int8_tArray* preimages_vals = (void*) preimages->elems /* XXX preimages leaks */;
3277 for (size_t m = 0; m < preimages_constr.datalen; m++) {
3278 int8_tArray preimages_conv_12 = preimages_vals[m];
3279 LDKThirtyTwoBytes preimages_conv_12_ref;
3280 CHECK(preimages_conv_12->arr_len == 32);
3281 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
3282 preimages_constr.data[m] = preimages_conv_12_ref;
3284 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
3285 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
3286 return (uint32_t)ret_conv;
3289 int8_tArray __attribute__((export_name("TS_BaseSign_channel_keys_id"))) TS_BaseSign_channel_keys_id(uint32_t this_arg) {
3290 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3291 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3292 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3293 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3294 memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
3298 uint32_t __attribute__((export_name("TS_BaseSign_sign_counterparty_commitment"))) TS_BaseSign_sign_counterparty_commitment(uint32_t this_arg, uint32_t commitment_tx, ptrArray preimages) {
3299 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3300 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3301 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3302 LDKCommitmentTransaction commitment_tx_conv;
3303 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
3304 commitment_tx_conv.is_owned = false;
3305 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
3306 LDKCVec_PaymentPreimageZ preimages_constr;
3307 preimages_constr.datalen = preimages->arr_len;
3308 if (preimages_constr.datalen > 0)
3309 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
3311 preimages_constr.data = NULL;
3312 int8_tArray* preimages_vals = (void*) preimages->elems /* XXX preimages leaks */;
3313 for (size_t m = 0; m < preimages_constr.datalen; m++) {
3314 int8_tArray preimages_conv_12 = preimages_vals[m];
3315 LDKThirtyTwoBytes preimages_conv_12_ref;
3316 CHECK(preimages_conv_12->arr_len == 32);
3317 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
3318 preimages_constr.data[m] = preimages_conv_12_ref;
3320 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
3321 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
3322 return (uint32_t)ret_conv;
3325 uint32_t __attribute__((export_name("TS_BaseSign_validate_counterparty_revocation"))) TS_BaseSign_validate_counterparty_revocation(uint32_t this_arg, int64_t idx, int8_tArray secret) {
3326 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3327 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3328 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3329 unsigned char secret_arr[32];
3330 CHECK(secret->arr_len == 32);
3331 memcpy(secret_arr, secret->elems, 32); FREE(secret);
3332 unsigned char (*secret_ref)[32] = &secret_arr;
3333 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
3334 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
3335 return (uint32_t)ret_conv;
3338 uint32_t __attribute__((export_name("TS_BaseSign_sign_holder_commitment_and_htlcs"))) TS_BaseSign_sign_holder_commitment_and_htlcs(uint32_t this_arg, uint32_t commitment_tx) {
3339 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3340 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3341 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3342 LDKHolderCommitmentTransaction commitment_tx_conv;
3343 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
3344 commitment_tx_conv.is_owned = false;
3345 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
3346 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
3347 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
3348 return (uint32_t)ret_conv;
3351 uint32_t __attribute__((export_name("TS_BaseSign_sign_justice_revoked_output"))) TS_BaseSign_sign_justice_revoked_output(uint32_t this_arg, int8_tArray justice_tx, uint32_t input, int64_t amount, int8_tArray per_commitment_key) {
3352 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3353 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3354 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3355 LDKTransaction justice_tx_ref;
3356 justice_tx_ref.datalen = justice_tx->arr_len;
3357 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3358 memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
3359 justice_tx_ref.data_is_owned = true;
3360 unsigned char per_commitment_key_arr[32];
3361 CHECK(per_commitment_key->arr_len == 32);
3362 memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
3363 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3364 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3365 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
3366 return (uint32_t)ret_conv;
3369 uint32_t __attribute__((export_name("TS_BaseSign_sign_justice_revoked_htlc"))) TS_BaseSign_sign_justice_revoked_htlc(uint32_t this_arg, int8_tArray justice_tx, uint32_t input, int64_t amount, int8_tArray per_commitment_key, uint32_t htlc) {
3370 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3371 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3372 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3373 LDKTransaction justice_tx_ref;
3374 justice_tx_ref.datalen = justice_tx->arr_len;
3375 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3376 memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
3377 justice_tx_ref.data_is_owned = true;
3378 unsigned char per_commitment_key_arr[32];
3379 CHECK(per_commitment_key->arr_len == 32);
3380 memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
3381 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3382 LDKHTLCOutputInCommitment htlc_conv;
3383 htlc_conv.inner = (void*)(htlc & (~1));
3384 htlc_conv.is_owned = false;
3385 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
3386 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3387 *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);
3388 return (uint32_t)ret_conv;
3391 uint32_t __attribute__((export_name("TS_BaseSign_sign_counterparty_htlc_transaction"))) TS_BaseSign_sign_counterparty_htlc_transaction(uint32_t this_arg, int8_tArray htlc_tx, uint32_t input, int64_t amount, int8_tArray per_commitment_point, uint32_t htlc) {
3392 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3393 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3394 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3395 LDKTransaction htlc_tx_ref;
3396 htlc_tx_ref.datalen = htlc_tx->arr_len;
3397 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
3398 memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
3399 htlc_tx_ref.data_is_owned = true;
3400 LDKPublicKey per_commitment_point_ref;
3401 CHECK(per_commitment_point->arr_len == 33);
3402 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
3403 LDKHTLCOutputInCommitment htlc_conv;
3404 htlc_conv.inner = (void*)(htlc & (~1));
3405 htlc_conv.is_owned = false;
3406 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
3407 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3408 *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);
3409 return (uint32_t)ret_conv;
3412 uint32_t __attribute__((export_name("TS_BaseSign_sign_closing_transaction"))) TS_BaseSign_sign_closing_transaction(uint32_t this_arg, uint32_t closing_tx) {
3413 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3414 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3415 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3416 LDKClosingTransaction closing_tx_conv;
3417 closing_tx_conv.inner = (void*)(closing_tx & (~1));
3418 closing_tx_conv.is_owned = false;
3419 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
3420 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3421 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
3422 return (uint32_t)ret_conv;
3425 uint32_t __attribute__((export_name("TS_BaseSign_sign_channel_announcement"))) TS_BaseSign_sign_channel_announcement(uint32_t this_arg, uint32_t msg) {
3426 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3427 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3428 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3429 LDKUnsignedChannelAnnouncement msg_conv;
3430 msg_conv.inner = (void*)(msg & (~1));
3431 msg_conv.is_owned = false;
3432 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
3433 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
3434 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
3435 return (uint32_t)ret_conv;
3438 void __attribute__((export_name("TS_BaseSign_ready_channel"))) TS_BaseSign_ready_channel(uint32_t this_arg, uint32_t channel_parameters) {
3439 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3440 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3441 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3442 LDKChannelTransactionParameters channel_parameters_conv;
3443 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
3444 channel_parameters_conv.is_owned = false;
3445 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
3446 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
3449 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
3450 if (this_arg->set_pubkeys != NULL)
3451 this_arg->set_pubkeys(this_arg);
3452 return this_arg->pubkeys;
3454 uint32_t __attribute__((export_name("TS_BaseSign_get_pubkeys"))) TS_BaseSign_get_pubkeys(uint32_t this_arg) {
3455 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3456 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3457 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3458 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
3459 uint32_t ret_ref = 0;
3460 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3461 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3462 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3463 ret_ref = (uintptr_t)ret_var.inner;
3464 if (ret_var.is_owned) {
3470 typedef struct LDKSign_JCalls {
3471 atomic_size_t refcnt;
3472 uint32_t instance_ptr;
3473 LDKBaseSign_JCalls* BaseSign;
3475 static void LDKSign_JCalls_free(void* this_arg) {
3476 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
3477 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3481 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
3482 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
3483 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 13);
3484 LDKCVec_u8Z ret_ref;
3485 ret_ref.datalen = ret->arr_len;
3486 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3487 memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
3490 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
3491 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
3492 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3493 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
3495 static inline LDKSign LDKSign_init (JSValue o, JSValue BaseSign, uint32_t pubkeys) {
3496 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
3497 atomic_init(&calls->refcnt, 1);
3498 calls->instance_ptr = o;
3500 LDKChannelPublicKeys pubkeys_conv;
3501 pubkeys_conv.inner = (void*)(pubkeys & (~1));
3502 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
3503 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3506 .this_arg = (void*) calls,
3507 .write = write_LDKSign_jcall,
3508 .cloned = LDKSign_JCalls_cloned,
3509 .free = LDKSign_JCalls_free,
3510 .BaseSign = LDKBaseSign_init(BaseSign, pubkeys),
3512 calls->BaseSign = ret.BaseSign.this_arg;
3515 long __attribute__((export_name("TS_LDKSign_new"))) TS_LDKSign_new(JSValue o, JSValue BaseSign, uint32_t pubkeys) {
3516 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
3517 *res_ptr = LDKSign_init(o, BaseSign, pubkeys);
3518 return (long)res_ptr;
3520 int8_tArray __attribute__((export_name("TS_Sign_write"))) TS_Sign_write(uint32_t this_arg) {
3521 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3522 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3523 LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
3524 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
3525 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
3526 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
3527 CVec_u8Z_free(ret_var);
3531 static inline struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
3532 CHECK(owner->result_ok);
3533 return Sign_clone(&*owner->contents.result);
3535 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_get_ok"))) TS_CResult_SignDecodeErrorZ_get_ok(uint32_t owner) {
3536 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
3537 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
3538 *ret_ret = CResult_SignDecodeErrorZ_get_ok(owner_conv);
3539 return (uint32_t)ret_ret;
3542 static inline struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
3543 CHECK(!owner->result_ok);
3544 return DecodeError_clone(&*owner->contents.err);
3546 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_get_err"))) TS_CResult_SignDecodeErrorZ_get_err(uint32_t owner) {
3547 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
3548 LDKDecodeError ret_var = CResult_SignDecodeErrorZ_get_err(owner_conv);
3549 uint32_t ret_ref = 0;
3550 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3551 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3552 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3553 ret_ref = (uintptr_t)ret_var.inner;
3554 if (ret_var.is_owned) {
3560 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
3561 CHECK(owner->result_ok);
3562 return *owner->contents.result;
3564 int8_tArray __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_ok"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint32_t owner) {
3565 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
3566 int8_tArray ret_arr = init_int8_tArray(68, __LINE__);
3567 memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
3571 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
3572 CHECK(!owner->result_ok);
3573 return *owner->contents.err;
3575 void __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_err"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint32_t owner) {
3576 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
3577 CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
3580 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
3581 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
3582 for (size_t i = 0; i < ret.datalen; i++) {
3583 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
3587 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
3588 CHECK(owner->result_ok);
3589 return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
3591 ptrArray __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok(uint32_t owner) {
3592 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
3593 LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
3594 ptrArray ret_arr = NULL;
3595 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
3596 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
3597 for (size_t m = 0; m < ret_var.datalen; m++) {
3598 LDKCVec_u8Z ret_conv_12_var = ret_var.data[m];
3599 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
3600 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
3601 CVec_u8Z_free(ret_conv_12_var);
3602 ret_arr_ptr[m] = ret_conv_12_arr;
3609 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
3610 CHECK(!owner->result_ok);
3611 return *owner->contents.err;
3613 void __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_err(uint32_t owner) {
3614 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
3615 CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
3618 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
3619 CHECK(owner->result_ok);
3620 return InMemorySigner_clone(&*owner->contents.result);
3622 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_get_ok(uint32_t owner) {
3623 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
3624 LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
3625 uint32_t ret_ref = 0;
3626 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3627 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3628 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3629 ret_ref = (uintptr_t)ret_var.inner;
3630 if (ret_var.is_owned) {
3636 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
3637 CHECK(!owner->result_ok);
3638 return DecodeError_clone(&*owner->contents.err);
3640 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_err"))) TS_CResult_InMemorySignerDecodeErrorZ_get_err(uint32_t owner) {
3641 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
3642 LDKDecodeError ret_var = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
3643 uint32_t ret_ref = 0;
3644 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3645 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3646 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3647 ret_ref = (uintptr_t)ret_var.inner;
3648 if (ret_var.is_owned) {
3654 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
3655 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
3656 for (size_t i = 0; i < ret.datalen; i++) {
3657 ret.data[i] = TxOut_clone(&orig->data[i]);
3661 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
3662 CHECK(owner->result_ok);
3663 return *owner->contents.result;
3665 int8_tArray __attribute__((export_name("TS_CResult_TransactionNoneZ_get_ok"))) TS_CResult_TransactionNoneZ_get_ok(uint32_t owner) {
3666 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
3667 LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
3668 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
3669 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
3673 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
3674 CHECK(!owner->result_ok);
3675 return *owner->contents.err;
3677 void __attribute__((export_name("TS_CResult_TransactionNoneZ_get_err"))) TS_CResult_TransactionNoneZ_get_err(uint32_t owner) {
3678 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
3679 CResult_TransactionNoneZ_get_err(owner_conv);
3682 uint32_t __attribute__((export_name("TS_LDKCOption_u16Z_ty_from_ptr"))) TS_LDKCOption_u16Z_ty_from_ptr(uint32_t ptr) {
3683 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
3685 case LDKCOption_u16Z_Some: return 0;
3686 case LDKCOption_u16Z_None: return 1;
3690 int16_t __attribute__((export_name("TS_LDKCOption_u16Z_Some_get_some"))) TS_LDKCOption_u16Z_Some_get_some(uint32_t ptr) {
3691 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
3692 assert(obj->tag == LDKCOption_u16Z_Some);
3695 uint32_t __attribute__((export_name("TS_LDKAPIError_ty_from_ptr"))) TS_LDKAPIError_ty_from_ptr(uint32_t ptr) {
3696 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
3698 case LDKAPIError_APIMisuseError: return 0;
3699 case LDKAPIError_FeeRateTooHigh: return 1;
3700 case LDKAPIError_RouteError: return 2;
3701 case LDKAPIError_ChannelUnavailable: return 3;
3702 case LDKAPIError_MonitorUpdateFailed: return 4;
3703 case LDKAPIError_IncompatibleShutdownScript: return 5;
3707 jstring __attribute__((export_name("TS_LDKAPIError_APIMisuseError_get_err"))) TS_LDKAPIError_APIMisuseError_get_err(uint32_t ptr) {
3708 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
3709 assert(obj->tag == LDKAPIError_APIMisuseError);
3710 LDKStr err_str = obj->api_misuse_error.err;
3711 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
3714 jstring __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_err"))) TS_LDKAPIError_FeeRateTooHigh_get_err(uint32_t ptr) {
3715 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
3716 assert(obj->tag == LDKAPIError_FeeRateTooHigh);
3717 LDKStr err_str = obj->fee_rate_too_high.err;
3718 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
3721 int32_t __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_feerate"))) TS_LDKAPIError_FeeRateTooHigh_get_feerate(uint32_t ptr) {
3722 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
3723 assert(obj->tag == LDKAPIError_FeeRateTooHigh);
3724 return obj->fee_rate_too_high.feerate;
3726 jstring __attribute__((export_name("TS_LDKAPIError_RouteError_get_err"))) TS_LDKAPIError_RouteError_get_err(uint32_t ptr) {
3727 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
3728 assert(obj->tag == LDKAPIError_RouteError);
3729 LDKStr err_str = obj->route_error.err;
3730 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
3733 jstring __attribute__((export_name("TS_LDKAPIError_ChannelUnavailable_get_err"))) TS_LDKAPIError_ChannelUnavailable_get_err(uint32_t ptr) {
3734 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
3735 assert(obj->tag == LDKAPIError_ChannelUnavailable);
3736 LDKStr err_str = obj->channel_unavailable.err;
3737 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
3740 uint32_t __attribute__((export_name("TS_LDKAPIError_IncompatibleShutdownScript_get_script"))) TS_LDKAPIError_IncompatibleShutdownScript_get_script(uint32_t ptr) {
3741 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
3742 assert(obj->tag == LDKAPIError_IncompatibleShutdownScript);
3743 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
3744 uint32_t script_ref = 0;
3745 CHECK((((uintptr_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3746 CHECK((((uintptr_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3747 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
3748 script_ref = (uintptr_t)script_var.inner & ~1;
3751 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
3752 CHECK(owner->result_ok);
3753 return *owner->contents.result;
3755 void __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_ok"))) TS_CResult_NoneAPIErrorZ_get_ok(uint32_t owner) {
3756 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
3757 CResult_NoneAPIErrorZ_get_ok(owner_conv);
3760 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
3761 CHECK(!owner->result_ok);
3762 return APIError_clone(&*owner->contents.err);
3764 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_err"))) TS_CResult_NoneAPIErrorZ_get_err(uint32_t owner) {
3765 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
3766 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
3767 *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
3768 uint32_t ret_ref = (uintptr_t)ret_copy;
3772 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
3773 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
3774 for (size_t i = 0; i < ret.datalen; i++) {
3775 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
3779 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
3780 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
3781 for (size_t i = 0; i < ret.datalen; i++) {
3782 ret.data[i] = APIError_clone(&orig->data[i]);
3786 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
3787 CHECK(owner->result_ok);
3788 return ThirtyTwoBytes_clone(&*owner->contents.result);
3790 int8_tArray __attribute__((export_name("TS_CResult__u832APIErrorZ_get_ok"))) TS_CResult__u832APIErrorZ_get_ok(uint32_t owner) {
3791 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
3792 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3793 memcpy(ret_arr->elems, CResult__u832APIErrorZ_get_ok(owner_conv).data, 32);
3797 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
3798 CHECK(!owner->result_ok);
3799 return APIError_clone(&*owner->contents.err);
3801 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_get_err"))) TS_CResult__u832APIErrorZ_get_err(uint32_t owner) {
3802 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
3803 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
3804 *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
3805 uint32_t ret_ref = (uintptr_t)ret_copy;
3809 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ty_from_ptr"))) TS_LDKPaymentSendFailure_ty_from_ptr(uint32_t ptr) {
3810 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
3812 case LDKPaymentSendFailure_ParameterError: return 0;
3813 case LDKPaymentSendFailure_PathParameterError: return 1;
3814 case LDKPaymentSendFailure_AllFailedRetrySafe: return 2;
3815 case LDKPaymentSendFailure_PartialFailure: return 3;
3819 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ParameterError_get_parameter_error"))) TS_LDKPaymentSendFailure_ParameterError_get_parameter_error(uint32_t ptr) {
3820 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
3821 assert(obj->tag == LDKPaymentSendFailure_ParameterError);
3822 uint32_t parameter_error_ref = ((uintptr_t)&obj->parameter_error) | 1;
3823 return parameter_error_ref;
3825 uint32_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error"))) TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(uint32_t ptr) {
3826 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
3827 assert(obj->tag == LDKPaymentSendFailure_PathParameterError);
3828 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
3829 uint32_tArray path_parameter_error_arr = NULL;
3830 path_parameter_error_arr = init_uint32_tArray(path_parameter_error_var.datalen, __LINE__);
3831 uint32_t *path_parameter_error_arr_ptr = (uint32_t*)(((uint8_t*)path_parameter_error_arr) + 4);
3832 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
3833 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3834 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
3835 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
3836 path_parameter_error_arr_ptr[w] = (uint32_t)path_parameter_error_conv_22_conv;
3839 return path_parameter_error_arr;
3841 uint32_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_AllFailedRetrySafe_get_all_failed_retry_safe"))) TS_LDKPaymentSendFailure_AllFailedRetrySafe_get_all_failed_retry_safe(uint32_t ptr) {
3842 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
3843 assert(obj->tag == LDKPaymentSendFailure_AllFailedRetrySafe);
3844 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
3845 uint32_tArray all_failed_retry_safe_arr = NULL;
3846 all_failed_retry_safe_arr = init_uint32_tArray(all_failed_retry_safe_var.datalen, __LINE__);
3847 uint32_t *all_failed_retry_safe_arr_ptr = (uint32_t*)(((uint8_t*)all_failed_retry_safe_arr) + 4);
3848 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
3849 uint32_t all_failed_retry_safe_conv_10_ref = ((uintptr_t)&all_failed_retry_safe_var.data[k]) | 1;
3850 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
3853 return all_failed_retry_safe_arr;
3855 uint32_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_results"))) TS_LDKPaymentSendFailure_PartialFailure_get_results(uint32_t ptr) {
3856 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
3857 assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
3858 LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
3859 uint32_tArray results_arr = NULL;
3860 results_arr = init_uint32_tArray(results_var.datalen, __LINE__);
3861 uint32_t *results_arr_ptr = (uint32_t*)(((uint8_t*)results_arr) + 4);
3862 for (size_t w = 0; w < results_var.datalen; w++) {
3863 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3864 *results_conv_22_conv = results_var.data[w];
3865 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
3866 results_arr_ptr[w] = (uint32_t)results_conv_22_conv;
3871 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry"))) TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(uint32_t ptr) {
3872 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
3873 assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
3874 LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
3875 uint32_t failed_paths_retry_ref = 0;
3876 if ((uintptr_t)failed_paths_retry_var.inner > 4096) {
3877 CHECK((((uintptr_t)failed_paths_retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3878 CHECK((((uintptr_t)&failed_paths_retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3879 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
3880 failed_paths_retry_ref = (uintptr_t)failed_paths_retry_var.inner & ~1;
3882 return failed_paths_retry_ref;
3884 int8_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_payment_id"))) TS_LDKPaymentSendFailure_PartialFailure_get_payment_id(uint32_t ptr) {
3885 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
3886 assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
3887 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
3888 memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
3889 return payment_id_arr;
3891 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentSendFailureZ_get_ok(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
3892 CHECK(owner->result_ok);
3893 return ThirtyTwoBytes_clone(&*owner->contents.result);
3895 int8_tArray __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_get_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_get_ok(uint32_t owner) {
3896 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
3897 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3898 memcpy(ret_arr->elems, CResult_PaymentIdPaymentSendFailureZ_get_ok(owner_conv).data, 32);
3902 static inline struct LDKPaymentSendFailure CResult_PaymentIdPaymentSendFailureZ_get_err(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
3903 CHECK(!owner->result_ok);
3904 return PaymentSendFailure_clone(&*owner->contents.err);
3906 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_get_err"))) TS_CResult_PaymentIdPaymentSendFailureZ_get_err(uint32_t owner) {
3907 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
3908 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
3909 *ret_copy = CResult_PaymentIdPaymentSendFailureZ_get_err(owner_conv);
3910 uint32_t ret_ref = (uintptr_t)ret_copy;
3914 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
3915 CHECK(owner->result_ok);
3916 return *owner->contents.result;
3918 void __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_ok"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint32_t owner) {
3919 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
3920 CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
3923 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
3924 CHECK(!owner->result_ok);
3925 return PaymentSendFailure_clone(&*owner->contents.err);
3927 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_err"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint32_t owner) {
3928 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
3929 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
3930 *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
3931 uint32_t ret_ref = (uintptr_t)ret_copy;
3935 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
3936 return ThirtyTwoBytes_clone(&owner->a);
3938 int8_tArray __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_a"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_a(uint32_t owner) {
3939 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
3940 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3941 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data, 32);
3945 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
3946 return ThirtyTwoBytes_clone(&owner->b);
3948 int8_tArray __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_b"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_b(uint32_t owner) {
3949 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
3950 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3951 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data, 32);
3955 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
3956 CHECK(owner->result_ok);
3957 return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
3959 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(uint32_t owner) {
3960 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
3961 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
3962 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
3963 return ((uint32_t)ret_conv);
3966 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
3967 CHECK(!owner->result_ok);
3968 return PaymentSendFailure_clone(&*owner->contents.err);
3970 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(uint32_t owner) {
3971 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
3972 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
3973 *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
3974 uint32_t ret_ref = (uintptr_t)ret_copy;
3978 uint32_t __attribute__((export_name("TS_LDKNetAddress_ty_from_ptr"))) TS_LDKNetAddress_ty_from_ptr(uint32_t ptr) {
3979 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3981 case LDKNetAddress_IPv4: return 0;
3982 case LDKNetAddress_IPv6: return 1;
3983 case LDKNetAddress_OnionV2: return 2;
3984 case LDKNetAddress_OnionV3: return 3;
3988 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv4_get_addr"))) TS_LDKNetAddress_IPv4_get_addr(uint32_t ptr) {
3989 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3990 assert(obj->tag == LDKNetAddress_IPv4);
3991 int8_tArray addr_arr = init_int8_tArray(4, __LINE__);
3992 memcpy(addr_arr->elems, obj->i_pv4.addr.data, 4);
3995 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv4_get_port"))) TS_LDKNetAddress_IPv4_get_port(uint32_t ptr) {
3996 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3997 assert(obj->tag == LDKNetAddress_IPv4);
3998 return obj->i_pv4.port;
4000 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv6_get_addr"))) TS_LDKNetAddress_IPv6_get_addr(uint32_t ptr) {
4001 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
4002 assert(obj->tag == LDKNetAddress_IPv6);
4003 int8_tArray addr_arr = init_int8_tArray(16, __LINE__);
4004 memcpy(addr_arr->elems, obj->i_pv6.addr.data, 16);
4007 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv6_get_port"))) TS_LDKNetAddress_IPv6_get_port(uint32_t ptr) {
4008 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
4009 assert(obj->tag == LDKNetAddress_IPv6);
4010 return obj->i_pv6.port;
4012 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV2_get_onion_v2"))) TS_LDKNetAddress_OnionV2_get_onion_v2(uint32_t ptr) {
4013 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
4014 assert(obj->tag == LDKNetAddress_OnionV2);
4015 int8_tArray onion_v2_arr = init_int8_tArray(12, __LINE__);
4016 memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
4017 return onion_v2_arr;
4019 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_ed25519_pubkey"))) TS_LDKNetAddress_OnionV3_get_ed25519_pubkey(uint32_t ptr) {
4020 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
4021 assert(obj->tag == LDKNetAddress_OnionV3);
4022 int8_tArray ed25519_pubkey_arr = init_int8_tArray(32, __LINE__);
4023 memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
4024 return ed25519_pubkey_arr;
4026 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_checksum"))) TS_LDKNetAddress_OnionV3_get_checksum(uint32_t ptr) {
4027 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
4028 assert(obj->tag == LDKNetAddress_OnionV3);
4029 return obj->onion_v3.checksum;
4031 int8_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_version"))) TS_LDKNetAddress_OnionV3_get_version(uint32_t ptr) {
4032 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
4033 assert(obj->tag == LDKNetAddress_OnionV3);
4034 return obj->onion_v3.version;
4036 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_port"))) TS_LDKNetAddress_OnionV3_get_port(uint32_t ptr) {
4037 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
4038 assert(obj->tag == LDKNetAddress_OnionV3);
4039 return obj->onion_v3.port;
4041 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
4042 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
4043 for (size_t i = 0; i < ret.datalen; i++) {
4044 ret.data[i] = NetAddress_clone(&orig->data[i]);
4048 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
4049 return ThirtyTwoBytes_clone(&owner->a);
4051 int8_tArray __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_a"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_a(uint32_t owner) {
4052 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
4053 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4054 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data, 32);
4058 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
4059 return ThirtyTwoBytes_clone(&owner->b);
4061 int8_tArray __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_b"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_b(uint32_t owner) {
4062 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
4063 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4064 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data, 32);
4068 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
4069 CHECK(owner->result_ok);
4070 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
4072 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(uint32_t owner) {
4073 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
4074 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
4075 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
4076 return ((uint32_t)ret_conv);
4079 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
4080 CHECK(!owner->result_ok);
4081 return *owner->contents.err;
4083 void __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(uint32_t owner) {
4084 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
4085 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
4088 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
4089 CHECK(owner->result_ok);
4090 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
4092 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(uint32_t owner) {
4093 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
4094 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
4095 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
4096 return ((uint32_t)ret_conv);
4099 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
4100 CHECK(!owner->result_ok);
4101 return APIError_clone(&*owner->contents.err);
4103 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(uint32_t owner) {
4104 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
4105 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4106 *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
4107 uint32_t ret_ref = (uintptr_t)ret_copy;
4111 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
4112 CHECK(owner->result_ok);
4113 return ThirtyTwoBytes_clone(&*owner->contents.result);
4115 int8_tArray __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_ok"))) TS_CResult_PaymentSecretNoneZ_get_ok(uint32_t owner) {
4116 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
4117 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4118 memcpy(ret_arr->elems, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data, 32);
4122 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
4123 CHECK(!owner->result_ok);
4124 return *owner->contents.err;
4126 void __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_err"))) TS_CResult_PaymentSecretNoneZ_get_err(uint32_t owner) {
4127 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
4128 CResult_PaymentSecretNoneZ_get_err(owner_conv);
4131 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
4132 CHECK(owner->result_ok);
4133 return ThirtyTwoBytes_clone(&*owner->contents.result);
4135 int8_tArray __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_ok"))) TS_CResult_PaymentSecretAPIErrorZ_get_ok(uint32_t owner) {
4136 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
4137 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4138 memcpy(ret_arr->elems, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data, 32);
4142 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
4143 CHECK(!owner->result_ok);
4144 return APIError_clone(&*owner->contents.err);
4146 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_err"))) TS_CResult_PaymentSecretAPIErrorZ_get_err(uint32_t owner) {
4147 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
4148 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4149 *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
4150 uint32_t ret_ref = (uintptr_t)ret_copy;
4154 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
4155 CHECK(owner->result_ok);
4156 return ThirtyTwoBytes_clone(&*owner->contents.result);
4158 int8_tArray __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_get_ok(uint32_t owner) {
4159 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
4160 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4161 memcpy(ret_arr->elems, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data, 32);
4165 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
4166 CHECK(!owner->result_ok);
4167 return APIError_clone(&*owner->contents.err);
4169 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_err"))) TS_CResult_PaymentPreimageAPIErrorZ_get_err(uint32_t owner) {
4170 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
4171 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4172 *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
4173 uint32_t ret_ref = (uintptr_t)ret_copy;
4177 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
4178 CHECK(owner->result_ok);
4179 return CounterpartyForwardingInfo_clone(&*owner->contents.result);
4181 uint32_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(uint32_t owner) {
4182 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(owner & ~1);
4183 LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
4184 uint32_t ret_ref = 0;
4185 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4186 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4187 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4188 ret_ref = (uintptr_t)ret_var.inner;
4189 if (ret_var.is_owned) {
4195 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
4196 CHECK(!owner->result_ok);
4197 return DecodeError_clone(&*owner->contents.err);
4199 uint32_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(uint32_t owner) {
4200 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(owner & ~1);
4201 LDKDecodeError ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
4202 uint32_t ret_ref = 0;
4203 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4204 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4205 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4206 ret_ref = (uintptr_t)ret_var.inner;
4207 if (ret_var.is_owned) {
4213 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
4214 CHECK(owner->result_ok);
4215 return ChannelCounterparty_clone(&*owner->contents.result);
4217 uint32_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok(uint32_t owner) {
4218 LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(owner & ~1);
4219 LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
4220 uint32_t ret_ref = 0;
4221 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4222 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4223 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4224 ret_ref = (uintptr_t)ret_var.inner;
4225 if (ret_var.is_owned) {
4231 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
4232 CHECK(!owner->result_ok);
4233 return DecodeError_clone(&*owner->contents.err);
4235 uint32_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err(uint32_t owner) {
4236 LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(owner & ~1);
4237 LDKDecodeError ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
4238 uint32_t ret_ref = 0;
4239 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4240 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4241 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4242 ret_ref = (uintptr_t)ret_var.inner;
4243 if (ret_var.is_owned) {
4249 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
4250 CHECK(owner->result_ok);
4251 return ChannelDetails_clone(&*owner->contents.result);
4253 uint32_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_ok(uint32_t owner) {
4254 LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(owner & ~1);
4255 LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
4256 uint32_t ret_ref = 0;
4257 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4258 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4259 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4260 ret_ref = (uintptr_t)ret_var.inner;
4261 if (ret_var.is_owned) {
4267 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
4268 CHECK(!owner->result_ok);
4269 return DecodeError_clone(&*owner->contents.err);
4271 uint32_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_err(uint32_t owner) {
4272 LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(owner & ~1);
4273 LDKDecodeError ret_var = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
4274 uint32_t ret_ref = 0;
4275 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4276 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4277 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4278 ret_ref = (uintptr_t)ret_var.inner;
4279 if (ret_var.is_owned) {
4285 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
4286 CHECK(owner->result_ok);
4287 return PhantomRouteHints_clone(&*owner->contents.result);
4289 uint32_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok(uint32_t owner) {
4290 LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(owner & ~1);
4291 LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
4292 uint32_t ret_ref = 0;
4293 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4294 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4295 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4296 ret_ref = (uintptr_t)ret_var.inner;
4297 if (ret_var.is_owned) {
4303 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
4304 CHECK(!owner->result_ok);
4305 return DecodeError_clone(&*owner->contents.err);
4307 uint32_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err(uint32_t owner) {
4308 LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(owner & ~1);
4309 LDKDecodeError ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
4310 uint32_t ret_ref = 0;
4311 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4312 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4313 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4314 ret_ref = (uintptr_t)ret_var.inner;
4315 if (ret_var.is_owned) {
4321 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
4322 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
4323 for (size_t i = 0; i < ret.datalen; i++) {
4324 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
4328 typedef struct LDKWatch_JCalls {
4329 atomic_size_t refcnt;
4330 uint32_t instance_ptr;
4332 static void LDKWatch_JCalls_free(void* this_arg) {
4333 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4334 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4338 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
4339 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4340 LDKOutPoint funding_txo_var = funding_txo;
4341 uint32_t funding_txo_ref = 0;
4342 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4343 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4344 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
4345 funding_txo_ref = (uintptr_t)funding_txo_var.inner;
4346 if (funding_txo_var.is_owned) {
4347 funding_txo_ref |= 1;
4349 LDKChannelMonitor monitor_var = monitor;
4350 uint32_t monitor_ref = 0;
4351 CHECK((((uintptr_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4352 CHECK((((uintptr_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4353 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
4354 monitor_ref = (uintptr_t)monitor_var.inner;
4355 if (monitor_var.is_owned) {
4358 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 14, (uint32_t)funding_txo_ref, (uint32_t)monitor_ref);
4359 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4360 CHECK_ACCESS(ret_ptr);
4361 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
4365 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
4366 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4367 LDKOutPoint funding_txo_var = funding_txo;
4368 uint32_t funding_txo_ref = 0;
4369 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4370 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4371 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
4372 funding_txo_ref = (uintptr_t)funding_txo_var.inner;
4373 if (funding_txo_var.is_owned) {
4374 funding_txo_ref |= 1;
4376 LDKChannelMonitorUpdate update_var = update;
4377 uint32_t update_ref = 0;
4378 CHECK((((uintptr_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4379 CHECK((((uintptr_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4380 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
4381 update_ref = (uintptr_t)update_var.inner;
4382 if (update_var.is_owned) {
4385 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 15, (uint32_t)funding_txo_ref, (uint32_t)update_ref);
4386 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4387 CHECK_ACCESS(ret_ptr);
4388 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
4392 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
4393 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4394 uint32_tArray ret = (uint32_tArray)js_invoke_function_0(j_calls->instance_ptr, 16);
4395 LDKCVec_MonitorEventZ ret_constr;
4396 ret_constr.datalen = ret->arr_len;
4397 if (ret_constr.datalen > 0)
4398 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
4400 ret_constr.data = NULL;
4401 uint32_t* ret_vals = ret->elems /* XXX ret leaks */;
4402 for (size_t o = 0; o < ret_constr.datalen; o++) {
4403 uint32_t ret_conv_14 = ret_vals[o];
4404 void* ret_conv_14_ptr = (void*)(((uintptr_t)ret_conv_14) & ~1);
4405 CHECK_ACCESS(ret_conv_14_ptr);
4406 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(ret_conv_14_ptr);
4407 FREE((void*)ret_conv_14);
4408 ret_constr.data[o] = ret_conv_14_conv;
4412 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
4413 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
4414 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4416 static inline LDKWatch LDKWatch_init (JSValue o) {
4417 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
4418 atomic_init(&calls->refcnt, 1);
4419 calls->instance_ptr = o;
4422 .this_arg = (void*) calls,
4423 .watch_channel = watch_channel_LDKWatch_jcall,
4424 .update_channel = update_channel_LDKWatch_jcall,
4425 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
4426 .free = LDKWatch_JCalls_free,
4430 long __attribute__((export_name("TS_LDKWatch_new"))) TS_LDKWatch_new(JSValue o) {
4431 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
4432 *res_ptr = LDKWatch_init(o);
4433 return (long)res_ptr;
4435 uint32_t __attribute__((export_name("TS_Watch_watch_channel"))) TS_Watch_watch_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t monitor) {
4436 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4437 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4438 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
4439 LDKOutPoint funding_txo_conv;
4440 funding_txo_conv.inner = (void*)(funding_txo & (~1));
4441 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
4442 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
4443 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
4444 LDKChannelMonitor monitor_conv;
4445 monitor_conv.inner = (void*)(monitor & (~1));
4446 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
4447 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
4448 monitor_conv = ChannelMonitor_clone(&monitor_conv);
4449 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4450 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
4451 return (uint32_t)ret_conv;
4454 uint32_t __attribute__((export_name("TS_Watch_update_channel"))) TS_Watch_update_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t update) {
4455 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4456 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4457 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
4458 LDKOutPoint funding_txo_conv;
4459 funding_txo_conv.inner = (void*)(funding_txo & (~1));
4460 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
4461 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
4462 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
4463 LDKChannelMonitorUpdate update_conv;
4464 update_conv.inner = (void*)(update & (~1));
4465 update_conv.is_owned = (update & 1) || (update == 0);
4466 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
4467 update_conv = ChannelMonitorUpdate_clone(&update_conv);
4468 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4469 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
4470 return (uint32_t)ret_conv;
4473 uint32_tArray __attribute__((export_name("TS_Watch_release_pending_monitor_events"))) TS_Watch_release_pending_monitor_events(uint32_t this_arg) {
4474 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4475 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4476 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
4477 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
4478 uint32_tArray ret_arr = NULL;
4479 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
4480 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
4481 for (size_t o = 0; o < ret_var.datalen; o++) {
4482 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
4483 *ret_conv_14_copy = ret_var.data[o];
4484 uint32_t ret_conv_14_ref = (uintptr_t)ret_conv_14_copy;
4485 ret_arr_ptr[o] = ret_conv_14_ref;
4492 typedef struct LDKBroadcasterInterface_JCalls {
4493 atomic_size_t refcnt;
4494 uint32_t instance_ptr;
4495 } LDKBroadcasterInterface_JCalls;
4496 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
4497 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
4498 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4502 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
4503 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
4504 LDKTransaction tx_var = tx;
4505 int8_tArray tx_arr = init_int8_tArray(tx_var.datalen, __LINE__);
4506 memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
4507 Transaction_free(tx_var);
4508 js_invoke_function_1(j_calls->instance_ptr, 17, (uint32_t)tx_arr);
4510 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
4511 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
4512 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4514 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JSValue o) {
4515 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
4516 atomic_init(&calls->refcnt, 1);
4517 calls->instance_ptr = o;
4519 LDKBroadcasterInterface ret = {
4520 .this_arg = (void*) calls,
4521 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
4522 .free = LDKBroadcasterInterface_JCalls_free,
4526 long __attribute__((export_name("TS_LDKBroadcasterInterface_new"))) TS_LDKBroadcasterInterface_new(JSValue o) {
4527 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
4528 *res_ptr = LDKBroadcasterInterface_init(o);
4529 return (long)res_ptr;
4531 void __attribute__((export_name("TS_BroadcasterInterface_broadcast_transaction"))) TS_BroadcasterInterface_broadcast_transaction(uint32_t this_arg, int8_tArray tx) {
4532 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4533 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4534 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
4535 LDKTransaction tx_ref;
4536 tx_ref.datalen = tx->arr_len;
4537 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
4538 memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
4539 tx_ref.data_is_owned = true;
4540 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
4543 typedef struct LDKKeysInterface_JCalls {
4544 atomic_size_t refcnt;
4545 uint32_t instance_ptr;
4546 } LDKKeysInterface_JCalls;
4547 static void LDKKeysInterface_JCalls_free(void* this_arg) {
4548 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4549 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4553 LDKCResult_SecretKeyNoneZ get_node_secret_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) {
4554 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4555 uint32_t recipient_conv = LDKRecipient_to_js(recipient);
4556 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 18, (uint32_t)recipient_conv);
4557 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4558 CHECK_ACCESS(ret_ptr);
4559 LDKCResult_SecretKeyNoneZ ret_conv = *(LDKCResult_SecretKeyNoneZ*)(ret_ptr);
4563 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
4564 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4565 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 19);
4566 LDKCVec_u8Z ret_ref;
4567 ret_ref.datalen = ret->arr_len;
4568 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4569 memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
4572 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
4573 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4574 uint32_t ret = js_invoke_function_0(j_calls->instance_ptr, 20);
4575 LDKShutdownScript ret_conv;
4576 ret_conv.inner = (void*)(ret & (~1));
4577 ret_conv.is_owned = (ret & 1) || (ret == 0);
4578 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
4581 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
4582 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4583 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 21, (uint32_t)inbound, (uint32_t)channel_value_satoshis);
4584 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4585 CHECK_ACCESS(ret_ptr);
4586 LDKSign ret_conv = *(LDKSign*)(ret_ptr);
4590 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
4591 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4592 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 22);
4593 LDKThirtyTwoBytes ret_ref;
4594 CHECK(ret->arr_len == 32);
4595 memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
4598 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
4599 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4600 LDKu8slice reader_var = reader;
4601 int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__);
4602 memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
4603 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 23, (uint32_t)reader_arr);
4604 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4605 CHECK_ACCESS(ret_ptr);
4606 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
4610 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_u5Z invoice_data, LDKRecipient receipient) {
4611 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4612 LDKu8slice hrp_bytes_var = hrp_bytes;
4613 int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__);
4614 memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen);
4615 LDKCVec_u5Z invoice_data_var = invoice_data;
4616 ptrArray invoice_data_arr = NULL;
4617 invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__);
4618 int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 4);
4619 for (size_t h = 0; h < invoice_data_var.datalen; h++) {
4620 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
4621 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
4624 FREE(invoice_data_var.data);
4625 uint32_t receipient_conv = LDKRecipient_to_js(receipient);
4626 uint32_t ret = js_invoke_function_3(j_calls->instance_ptr, 24, (uint32_t)hrp_bytes_arr, (uint32_t)invoice_data_arr, (uint32_t)receipient_conv);
4627 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4628 CHECK_ACCESS(ret_ptr);
4629 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
4633 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) {
4634 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4635 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 25);
4636 LDKThirtyTwoBytes ret_ref;
4637 CHECK(ret->arr_len == 32);
4638 memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
4641 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
4642 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
4643 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4645 static inline LDKKeysInterface LDKKeysInterface_init (JSValue o) {
4646 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
4647 atomic_init(&calls->refcnt, 1);
4648 calls->instance_ptr = o;
4650 LDKKeysInterface ret = {
4651 .this_arg = (void*) calls,
4652 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
4653 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
4654 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
4655 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
4656 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
4657 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
4658 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
4659 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall,
4660 .free = LDKKeysInterface_JCalls_free,
4664 long __attribute__((export_name("TS_LDKKeysInterface_new"))) TS_LDKKeysInterface_new(JSValue o) {
4665 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
4666 *res_ptr = LDKKeysInterface_init(o);
4667 return (long)res_ptr;
4669 uint32_t __attribute__((export_name("TS_KeysInterface_get_node_secret"))) TS_KeysInterface_get_node_secret(uint32_t this_arg, uint32_t recipient) {
4670 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4671 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4672 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4673 LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
4674 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
4675 *ret_conv = (this_arg_conv->get_node_secret)(this_arg_conv->this_arg, recipient_conv);
4676 return (uint32_t)ret_conv;
4679 int8_tArray __attribute__((export_name("TS_KeysInterface_get_destination_script"))) TS_KeysInterface_get_destination_script(uint32_t this_arg) {
4680 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4681 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4682 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4683 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
4684 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
4685 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
4686 CVec_u8Z_free(ret_var);
4690 uint32_t __attribute__((export_name("TS_KeysInterface_get_shutdown_scriptpubkey"))) TS_KeysInterface_get_shutdown_scriptpubkey(uint32_t this_arg) {
4691 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4692 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4693 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4694 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
4695 uint32_t ret_ref = 0;
4696 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4697 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4698 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4699 ret_ref = (uintptr_t)ret_var.inner;
4700 if (ret_var.is_owned) {
4706 uint32_t __attribute__((export_name("TS_KeysInterface_get_channel_signer"))) TS_KeysInterface_get_channel_signer(uint32_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
4707 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4708 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4709 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4710 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
4711 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
4712 return (uint32_t)ret_ret;
4715 int8_tArray __attribute__((export_name("TS_KeysInterface_get_secure_random_bytes"))) TS_KeysInterface_get_secure_random_bytes(uint32_t this_arg) {
4716 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4717 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4718 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4719 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4720 memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
4724 uint32_t __attribute__((export_name("TS_KeysInterface_read_chan_signer"))) TS_KeysInterface_read_chan_signer(uint32_t this_arg, int8_tArray reader) {
4725 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4726 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4727 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4728 LDKu8slice reader_ref;
4729 reader_ref.datalen = reader->arr_len;
4730 reader_ref.data = reader->elems /* XXX reader leaks */;
4731 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
4732 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
4733 return (uint32_t)ret_conv;
4736 uint32_t __attribute__((export_name("TS_KeysInterface_sign_invoice"))) TS_KeysInterface_sign_invoice(uint32_t this_arg, int8_tArray hrp_bytes, ptrArray invoice_data, uint32_t receipient) {
4737 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4738 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4739 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4740 LDKu8slice hrp_bytes_ref;
4741 hrp_bytes_ref.datalen = hrp_bytes->arr_len;
4742 hrp_bytes_ref.data = hrp_bytes->elems /* XXX hrp_bytes leaks */;
4743 LDKCVec_u5Z invoice_data_constr;
4744 invoice_data_constr.datalen = invoice_data->arr_len;
4745 if (invoice_data_constr.datalen > 0)
4746 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
4748 invoice_data_constr.data = NULL;
4749 int8_t* invoice_data_vals = (void*) invoice_data->elems /* XXX invoice_data leaks */;
4750 for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
4751 int8_t invoice_data_conv_7 = invoice_data_vals[h];
4753 invoice_data_constr.data[h] = (LDKu5){ ._0 = invoice_data_conv_7 };
4755 LDKRecipient receipient_conv = LDKRecipient_from_js(receipient);
4756 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
4757 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, receipient_conv);
4758 return (uint32_t)ret_conv;
4761 int8_tArray __attribute__((export_name("TS_KeysInterface_get_inbound_payment_key_material"))) TS_KeysInterface_get_inbound_payment_key_material(uint32_t this_arg) {
4762 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4763 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4764 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4765 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4766 memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
4770 typedef struct LDKFeeEstimator_JCalls {
4771 atomic_size_t refcnt;
4772 uint32_t instance_ptr;
4773 } LDKFeeEstimator_JCalls;
4774 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
4775 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
4776 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4780 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
4781 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
4782 uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
4783 return js_invoke_function_1(j_calls->instance_ptr, 26, (uint32_t)confirmation_target_conv);
4785 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
4786 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
4787 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4789 static inline LDKFeeEstimator LDKFeeEstimator_init (JSValue o) {
4790 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
4791 atomic_init(&calls->refcnt, 1);
4792 calls->instance_ptr = o;
4794 LDKFeeEstimator ret = {
4795 .this_arg = (void*) calls,
4796 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
4797 .free = LDKFeeEstimator_JCalls_free,
4801 long __attribute__((export_name("TS_LDKFeeEstimator_new"))) TS_LDKFeeEstimator_new(JSValue o) {
4802 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
4803 *res_ptr = LDKFeeEstimator_init(o);
4804 return (long)res_ptr;
4806 int32_t __attribute__((export_name("TS_FeeEstimator_get_est_sat_per_1000_weight"))) TS_FeeEstimator_get_est_sat_per_1000_weight(uint32_t this_arg, uint32_t confirmation_target) {
4807 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4808 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4809 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
4810 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
4811 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
4815 typedef struct LDKLogger_JCalls {
4816 atomic_size_t refcnt;
4817 uint32_t instance_ptr;
4819 static void LDKLogger_JCalls_free(void* this_arg) {
4820 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4821 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4825 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
4826 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4827 LDKRecord record_var = *record;
4828 uint32_t record_ref = 0;
4829 record_var = Record_clone(&record_var);
4830 CHECK((((uintptr_t)record_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4831 CHECK((((uintptr_t)&record_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4832 CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
4833 record_ref = (uintptr_t)record_var.inner;
4834 if (record_var.is_owned) {
4837 js_invoke_function_1(j_calls->instance_ptr, 27, (uint32_t)record_ref);
4839 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
4840 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
4841 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4843 static inline LDKLogger LDKLogger_init (JSValue o) {
4844 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
4845 atomic_init(&calls->refcnt, 1);
4846 calls->instance_ptr = o;
4849 .this_arg = (void*) calls,
4850 .log = log_LDKLogger_jcall,
4851 .free = LDKLogger_JCalls_free,
4855 long __attribute__((export_name("TS_LDKLogger_new"))) TS_LDKLogger_new(JSValue o) {
4856 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
4857 *res_ptr = LDKLogger_init(o);
4858 return (long)res_ptr;
4860 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
4861 return ThirtyTwoBytes_clone(&owner->a);
4863 int8_tArray __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_a"))) TS_C2Tuple_BlockHashChannelManagerZ_get_a(uint32_t owner) {
4864 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
4865 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4866 memcpy(ret_arr->elems, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data, 32);
4870 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
4873 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_b"))) TS_C2Tuple_BlockHashChannelManagerZ_get_b(uint32_t owner) {
4874 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
4875 LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
4876 uint32_t ret_ref = 0;
4877 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4878 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4879 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4880 ret_ref = (uintptr_t)ret_var.inner & ~1;
4884 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
4885 CHECK(owner->result_ok);
4886 return &*owner->contents.result;
4888 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint32_t owner) {
4889 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
4890 uint32_t ret_ret = (uintptr_t)CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv) | 1;
4894 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
4895 CHECK(!owner->result_ok);
4896 return DecodeError_clone(&*owner->contents.err);
4898 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint32_t owner) {
4899 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
4900 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
4901 uint32_t ret_ref = 0;
4902 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4903 CHECK((((uintptr_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 = (uintptr_t)ret_var.inner;
4906 if (ret_var.is_owned) {
4912 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
4913 CHECK(owner->result_ok);
4914 return ChannelConfig_clone(&*owner->contents.result);
4916 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_get_ok(uint32_t owner) {
4917 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
4918 LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
4919 uint32_t ret_ref = 0;
4920 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4921 CHECK((((uintptr_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 = (uintptr_t)ret_var.inner;
4924 if (ret_var.is_owned) {
4930 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
4931 CHECK(!owner->result_ok);
4932 return DecodeError_clone(&*owner->contents.err);
4934 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_err"))) TS_CResult_ChannelConfigDecodeErrorZ_get_err(uint32_t owner) {
4935 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
4936 LDKDecodeError ret_var = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
4937 uint32_t ret_ref = 0;
4938 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4939 CHECK((((uintptr_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 = (uintptr_t)ret_var.inner;
4942 if (ret_var.is_owned) {
4948 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
4949 CHECK(owner->result_ok);
4950 return OutPoint_clone(&*owner->contents.result);
4952 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_ok"))) TS_CResult_OutPointDecodeErrorZ_get_ok(uint32_t owner) {
4953 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
4954 LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
4955 uint32_t ret_ref = 0;
4956 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4957 CHECK((((uintptr_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 = (uintptr_t)ret_var.inner;
4960 if (ret_var.is_owned) {
4966 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
4967 CHECK(!owner->result_ok);
4968 return DecodeError_clone(&*owner->contents.err);
4970 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_err"))) TS_CResult_OutPointDecodeErrorZ_get_err(uint32_t owner) {
4971 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
4972 LDKDecodeError ret_var = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
4973 uint32_t ret_ref = 0;
4974 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4975 CHECK((((uintptr_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 = (uintptr_t)ret_var.inner;
4978 if (ret_var.is_owned) {
4984 typedef struct LDKType_JCalls {
4985 atomic_size_t refcnt;
4986 uint32_t instance_ptr;
4988 static void LDKType_JCalls_free(void* this_arg) {
4989 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
4990 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4994 uint16_t type_id_LDKType_jcall(const void* this_arg) {
4995 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
4996 return js_invoke_function_0(j_calls->instance_ptr, 28);
4998 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
4999 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5000 jstring ret = (jstring)js_invoke_function_0(j_calls->instance_ptr, 29);
5001 LDKStr ret_conv = str_ref_to_owned_c(ret);
5004 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
5005 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5006 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 30);
5007 LDKCVec_u8Z ret_ref;
5008 ret_ref.datalen = ret->arr_len;
5009 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5010 memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
5013 static void LDKType_JCalls_cloned(LDKType* new_obj) {
5014 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
5015 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5017 static inline LDKType LDKType_init (JSValue o) {
5018 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
5019 atomic_init(&calls->refcnt, 1);
5020 calls->instance_ptr = o;
5023 .this_arg = (void*) calls,
5024 .type_id = type_id_LDKType_jcall,
5025 .debug_str = debug_str_LDKType_jcall,
5026 .write = write_LDKType_jcall,
5027 .cloned = LDKType_JCalls_cloned,
5028 .free = LDKType_JCalls_free,
5032 long __attribute__((export_name("TS_LDKType_new"))) TS_LDKType_new(JSValue o) {
5033 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
5034 *res_ptr = LDKType_init(o);
5035 return (long)res_ptr;
5037 int16_t __attribute__((export_name("TS_Type_type_id"))) TS_Type_type_id(uint32_t this_arg) {
5038 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5039 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5040 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5041 int16_t ret_val = (this_arg_conv->type_id)(this_arg_conv->this_arg);
5045 jstring __attribute__((export_name("TS_Type_debug_str"))) TS_Type_debug_str(uint32_t this_arg) {
5046 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5047 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5048 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5049 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
5050 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
5055 int8_tArray __attribute__((export_name("TS_Type_write"))) TS_Type_write(uint32_t this_arg) {
5056 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5057 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5058 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5059 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
5060 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5061 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5062 CVec_u8Z_free(ret_var);
5066 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_ty_from_ptr"))) TS_LDKCOption_TypeZ_ty_from_ptr(uint32_t ptr) {
5067 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
5069 case LDKCOption_TypeZ_Some: return 0;
5070 case LDKCOption_TypeZ_None: return 1;
5074 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_Some_get_some"))) TS_LDKCOption_TypeZ_Some_get_some(uint32_t ptr) {
5075 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
5076 assert(obj->tag == LDKCOption_TypeZ_Some);
5077 LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
5078 *some_ret = Type_clone(&obj->some);
5079 return (uint32_t)some_ret;
5081 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
5082 CHECK(owner->result_ok);
5083 return COption_TypeZ_clone(&*owner->contents.result);
5085 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_get_ok(uint32_t owner) {
5086 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
5087 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
5088 *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
5089 uint32_t ret_ref = (uintptr_t)ret_copy;
5093 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
5094 CHECK(!owner->result_ok);
5095 return DecodeError_clone(&*owner->contents.err);
5097 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_err"))) TS_CResult_COption_TypeZDecodeErrorZ_get_err(uint32_t owner) {
5098 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
5099 LDKDecodeError ret_var = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
5100 uint32_t ret_ref = 0;
5101 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5102 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5103 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5104 ret_ref = (uintptr_t)ret_var.inner;
5105 if (ret_var.is_owned) {
5111 uint32_t __attribute__((export_name("TS_LDKPaymentError_ty_from_ptr"))) TS_LDKPaymentError_ty_from_ptr(uint32_t ptr) {
5112 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
5114 case LDKPaymentError_Invoice: return 0;
5115 case LDKPaymentError_Routing: return 1;
5116 case LDKPaymentError_Sending: return 2;
5120 jstring __attribute__((export_name("TS_LDKPaymentError_Invoice_get_invoice"))) TS_LDKPaymentError_Invoice_get_invoice(uint32_t ptr) {
5121 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
5122 assert(obj->tag == LDKPaymentError_Invoice);
5123 LDKStr invoice_str = obj->invoice;
5124 jstring invoice_conv = str_ref_to_ts(invoice_str.chars, invoice_str.len);
5125 return invoice_conv;
5127 uint32_t __attribute__((export_name("TS_LDKPaymentError_Routing_get_routing"))) TS_LDKPaymentError_Routing_get_routing(uint32_t ptr) {
5128 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
5129 assert(obj->tag == LDKPaymentError_Routing);
5130 LDKLightningError routing_var = obj->routing;
5131 uint32_t routing_ref = 0;
5132 CHECK((((uintptr_t)routing_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5133 CHECK((((uintptr_t)&routing_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5134 CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var);
5135 routing_ref = (uintptr_t)routing_var.inner & ~1;
5138 uint32_t __attribute__((export_name("TS_LDKPaymentError_Sending_get_sending"))) TS_LDKPaymentError_Sending_get_sending(uint32_t ptr) {
5139 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
5140 assert(obj->tag == LDKPaymentError_Sending);
5141 uint32_t sending_ref = ((uintptr_t)&obj->sending) | 1;
5144 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
5145 CHECK(owner->result_ok);
5146 return ThirtyTwoBytes_clone(&*owner->contents.result);
5148 int8_tArray __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_ok"))) TS_CResult_PaymentIdPaymentErrorZ_get_ok(uint32_t owner) {
5149 LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(owner & ~1);
5150 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5151 memcpy(ret_arr->elems, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data, 32);
5155 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
5156 CHECK(!owner->result_ok);
5157 return PaymentError_clone(&*owner->contents.err);
5159 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_err"))) TS_CResult_PaymentIdPaymentErrorZ_get_err(uint32_t owner) {
5160 LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(owner & ~1);
5161 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
5162 *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
5163 uint32_t ret_ref = (uintptr_t)ret_copy;
5167 static inline enum LDKSiPrefix CResult_SiPrefixNoneZ_get_ok(LDKCResult_SiPrefixNoneZ *NONNULL_PTR owner){
5168 CHECK(owner->result_ok);
5169 return SiPrefix_clone(&*owner->contents.result);
5171 uint32_t __attribute__((export_name("TS_CResult_SiPrefixNoneZ_get_ok"))) TS_CResult_SiPrefixNoneZ_get_ok(uint32_t owner) {
5172 LDKCResult_SiPrefixNoneZ* owner_conv = (LDKCResult_SiPrefixNoneZ*)(owner & ~1);
5173 uint32_t ret_conv = LDKSiPrefix_to_js(CResult_SiPrefixNoneZ_get_ok(owner_conv));
5177 static inline void CResult_SiPrefixNoneZ_get_err(LDKCResult_SiPrefixNoneZ *NONNULL_PTR owner){
5178 CHECK(!owner->result_ok);
5179 return *owner->contents.err;
5181 void __attribute__((export_name("TS_CResult_SiPrefixNoneZ_get_err"))) TS_CResult_SiPrefixNoneZ_get_err(uint32_t owner) {
5182 LDKCResult_SiPrefixNoneZ* owner_conv = (LDKCResult_SiPrefixNoneZ*)(owner & ~1);
5183 CResult_SiPrefixNoneZ_get_err(owner_conv);
5186 static inline struct LDKInvoice CResult_InvoiceNoneZ_get_ok(LDKCResult_InvoiceNoneZ *NONNULL_PTR owner){
5187 CHECK(owner->result_ok);
5188 return Invoice_clone(&*owner->contents.result);
5190 uint32_t __attribute__((export_name("TS_CResult_InvoiceNoneZ_get_ok"))) TS_CResult_InvoiceNoneZ_get_ok(uint32_t owner) {
5191 LDKCResult_InvoiceNoneZ* owner_conv = (LDKCResult_InvoiceNoneZ*)(owner & ~1);
5192 LDKInvoice ret_var = CResult_InvoiceNoneZ_get_ok(owner_conv);
5193 uint32_t ret_ref = 0;
5194 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5195 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5196 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5197 ret_ref = (uintptr_t)ret_var.inner;
5198 if (ret_var.is_owned) {
5204 static inline void CResult_InvoiceNoneZ_get_err(LDKCResult_InvoiceNoneZ *NONNULL_PTR owner){
5205 CHECK(!owner->result_ok);
5206 return *owner->contents.err;
5208 void __attribute__((export_name("TS_CResult_InvoiceNoneZ_get_err"))) TS_CResult_InvoiceNoneZ_get_err(uint32_t owner) {
5209 LDKCResult_InvoiceNoneZ* owner_conv = (LDKCResult_InvoiceNoneZ*)(owner & ~1);
5210 CResult_InvoiceNoneZ_get_err(owner_conv);
5213 static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceNoneZ_get_ok(LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR owner){
5214 CHECK(owner->result_ok);
5215 return SignedRawInvoice_clone(&*owner->contents.result);
5217 uint32_t __attribute__((export_name("TS_CResult_SignedRawInvoiceNoneZ_get_ok"))) TS_CResult_SignedRawInvoiceNoneZ_get_ok(uint32_t owner) {
5218 LDKCResult_SignedRawInvoiceNoneZ* owner_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(owner & ~1);
5219 LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceNoneZ_get_ok(owner_conv);
5220 uint32_t ret_ref = 0;
5221 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5222 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5223 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5224 ret_ref = (uintptr_t)ret_var.inner;
5225 if (ret_var.is_owned) {
5231 static inline void CResult_SignedRawInvoiceNoneZ_get_err(LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR owner){
5232 CHECK(!owner->result_ok);
5233 return *owner->contents.err;
5235 void __attribute__((export_name("TS_CResult_SignedRawInvoiceNoneZ_get_err"))) TS_CResult_SignedRawInvoiceNoneZ_get_err(uint32_t owner) {
5236 LDKCResult_SignedRawInvoiceNoneZ* owner_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(owner & ~1);
5237 CResult_SignedRawInvoiceNoneZ_get_err(owner_conv);
5240 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
5241 return RawInvoice_clone(&owner->a);
5243 uint32_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(uint32_t owner) {
5244 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
5245 LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv);
5246 uint32_t ret_ref = 0;
5247 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5248 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5249 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5250 ret_ref = (uintptr_t)ret_var.inner;
5251 if (ret_var.is_owned) {
5257 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
5258 return ThirtyTwoBytes_clone(&owner->b);
5260 int8_tArray __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(uint32_t owner) {
5261 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
5262 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5263 memcpy(ret_arr->elems, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data, 32);
5267 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
5268 return InvoiceSignature_clone(&owner->c);
5270 uint32_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(uint32_t owner) {
5271 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
5272 LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(owner_conv);
5273 uint32_t ret_ref = 0;
5274 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5275 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5276 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5277 ret_ref = (uintptr_t)ret_var.inner;
5278 if (ret_var.is_owned) {
5284 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
5285 CHECK(owner->result_ok);
5286 return PayeePubKey_clone(&*owner->contents.result);
5288 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_ok"))) TS_CResult_PayeePubKeyErrorZ_get_ok(uint32_t owner) {
5289 LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)(owner & ~1);
5290 LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
5291 uint32_t ret_ref = 0;
5292 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5293 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5294 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5295 ret_ref = (uintptr_t)ret_var.inner;
5296 if (ret_var.is_owned) {
5302 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
5303 CHECK(!owner->result_ok);
5304 return *owner->contents.err;
5306 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_err"))) TS_CResult_PayeePubKeyErrorZ_get_err(uint32_t owner) {
5307 LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)(owner & ~1);
5308 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PayeePubKeyErrorZ_get_err(owner_conv));
5312 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
5313 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
5314 for (size_t i = 0; i < ret.datalen; i++) {
5315 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
5319 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
5320 CHECK(owner->result_ok);
5321 return PositiveTimestamp_clone(&*owner->contents.result);
5323 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_get_ok(uint32_t owner) {
5324 LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(owner & ~1);
5325 LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
5326 uint32_t ret_ref = 0;
5327 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5328 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5329 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5330 ret_ref = (uintptr_t)ret_var.inner;
5331 if (ret_var.is_owned) {
5337 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
5338 CHECK(!owner->result_ok);
5339 return CreationError_clone(&*owner->contents.err);
5341 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_err"))) TS_CResult_PositiveTimestampCreationErrorZ_get_err(uint32_t owner) {
5342 LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(owner & ~1);
5343 uint32_t ret_conv = LDKCreationError_to_js(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
5347 static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
5348 CHECK(owner->result_ok);
5349 return *owner->contents.result;
5351 void __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_ok"))) TS_CResult_NoneSemanticErrorZ_get_ok(uint32_t owner) {
5352 LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)(owner & ~1);
5353 CResult_NoneSemanticErrorZ_get_ok(owner_conv);
5356 static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
5357 CHECK(!owner->result_ok);
5358 return SemanticError_clone(&*owner->contents.err);
5360 uint32_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_err"))) TS_CResult_NoneSemanticErrorZ_get_err(uint32_t owner) {
5361 LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)(owner & ~1);
5362 uint32_t ret_conv = LDKSemanticError_to_js(CResult_NoneSemanticErrorZ_get_err(owner_conv));
5366 static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
5367 CHECK(owner->result_ok);
5368 return Invoice_clone(&*owner->contents.result);
5370 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_ok"))) TS_CResult_InvoiceSemanticErrorZ_get_ok(uint32_t owner) {
5371 LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)(owner & ~1);
5372 LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv);
5373 uint32_t ret_ref = 0;
5374 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5375 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5376 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5377 ret_ref = (uintptr_t)ret_var.inner;
5378 if (ret_var.is_owned) {
5384 static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
5385 CHECK(!owner->result_ok);
5386 return SemanticError_clone(&*owner->contents.err);
5388 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_err"))) TS_CResult_InvoiceSemanticErrorZ_get_err(uint32_t owner) {
5389 LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)(owner & ~1);
5390 uint32_t ret_conv = LDKSemanticError_to_js(CResult_InvoiceSemanticErrorZ_get_err(owner_conv));
5394 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
5395 CHECK(owner->result_ok);
5396 return Description_clone(&*owner->contents.result);
5398 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_ok"))) TS_CResult_DescriptionCreationErrorZ_get_ok(uint32_t owner) {
5399 LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)(owner & ~1);
5400 LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
5401 uint32_t ret_ref = 0;
5402 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5403 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5404 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5405 ret_ref = (uintptr_t)ret_var.inner;
5406 if (ret_var.is_owned) {
5412 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
5413 CHECK(!owner->result_ok);
5414 return CreationError_clone(&*owner->contents.err);
5416 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_err"))) TS_CResult_DescriptionCreationErrorZ_get_err(uint32_t owner) {
5417 LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)(owner & ~1);
5418 uint32_t ret_conv = LDKCreationError_to_js(CResult_DescriptionCreationErrorZ_get_err(owner_conv));
5422 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
5423 CHECK(owner->result_ok);
5424 return PrivateRoute_clone(&*owner->contents.result);
5426 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_ok"))) TS_CResult_PrivateRouteCreationErrorZ_get_ok(uint32_t owner) {
5427 LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(owner & ~1);
5428 LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
5429 uint32_t ret_ref = 0;
5430 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5431 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5432 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5433 ret_ref = (uintptr_t)ret_var.inner;
5434 if (ret_var.is_owned) {
5440 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
5441 CHECK(!owner->result_ok);
5442 return CreationError_clone(&*owner->contents.err);
5444 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_err"))) TS_CResult_PrivateRouteCreationErrorZ_get_err(uint32_t owner) {
5445 LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(owner & ~1);
5446 uint32_t ret_conv = LDKCreationError_to_js(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
5450 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
5451 CHECK(owner->result_ok);
5452 return *owner->contents.result;
5454 jstring __attribute__((export_name("TS_CResult_StringErrorZ_get_ok"))) TS_CResult_StringErrorZ_get_ok(uint32_t owner) {
5455 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
5456 LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
5457 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
5461 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
5462 CHECK(!owner->result_ok);
5463 return *owner->contents.err;
5465 uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_get_err"))) TS_CResult_StringErrorZ_get_err(uint32_t owner) {
5466 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
5467 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StringErrorZ_get_err(owner_conv));
5471 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
5472 CHECK(owner->result_ok);
5473 return ChannelMonitorUpdate_clone(&*owner->contents.result);
5475 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint32_t owner) {
5476 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
5477 LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
5478 uint32_t ret_ref = 0;
5479 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5480 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5481 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5482 ret_ref = (uintptr_t)ret_var.inner;
5483 if (ret_var.is_owned) {
5489 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
5490 CHECK(!owner->result_ok);
5491 return DecodeError_clone(&*owner->contents.err);
5493 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint32_t owner) {
5494 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
5495 LDKDecodeError ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
5496 uint32_t ret_ref = 0;
5497 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5498 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5499 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5500 ret_ref = (uintptr_t)ret_var.inner;
5501 if (ret_var.is_owned) {
5507 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_ty_from_ptr"))) TS_LDKCOption_MonitorEventZ_ty_from_ptr(uint32_t ptr) {
5508 LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)(ptr & ~1);
5510 case LDKCOption_MonitorEventZ_Some: return 0;
5511 case LDKCOption_MonitorEventZ_None: return 1;
5515 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_Some_get_some"))) TS_LDKCOption_MonitorEventZ_Some_get_some(uint32_t ptr) {
5516 LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)(ptr & ~1);
5517 assert(obj->tag == LDKCOption_MonitorEventZ_Some);
5518 uint32_t some_ref = ((uintptr_t)&obj->some) | 1;
5521 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
5522 CHECK(owner->result_ok);
5523 return COption_MonitorEventZ_clone(&*owner->contents.result);
5525 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint32_t owner) {
5526 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
5527 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
5528 *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
5529 uint32_t ret_ref = (uintptr_t)ret_copy;
5533 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
5534 CHECK(!owner->result_ok);
5535 return DecodeError_clone(&*owner->contents.err);
5537 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint32_t owner) {
5538 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
5539 LDKDecodeError ret_var = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
5540 uint32_t ret_ref = 0;
5541 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5542 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5543 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5544 ret_ref = (uintptr_t)ret_var.inner;
5545 if (ret_var.is_owned) {
5551 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
5552 CHECK(owner->result_ok);
5553 return HTLCUpdate_clone(&*owner->contents.result);
5555 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint32_t owner) {
5556 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
5557 LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
5558 uint32_t ret_ref = 0;
5559 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5560 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5561 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5562 ret_ref = (uintptr_t)ret_var.inner;
5563 if (ret_var.is_owned) {
5569 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
5570 CHECK(!owner->result_ok);
5571 return DecodeError_clone(&*owner->contents.err);
5573 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint32_t owner) {
5574 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
5575 LDKDecodeError ret_var = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
5576 uint32_t ret_ref = 0;
5577 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5578 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5579 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5580 ret_ref = (uintptr_t)ret_var.inner;
5581 if (ret_var.is_owned) {
5587 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
5588 return OutPoint_clone(&owner->a);
5590 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_a"))) TS_C2Tuple_OutPointScriptZ_get_a(uint32_t owner) {
5591 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
5592 LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
5593 uint32_t ret_ref = 0;
5594 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5595 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5596 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5597 ret_ref = (uintptr_t)ret_var.inner;
5598 if (ret_var.is_owned) {
5604 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
5605 return CVec_u8Z_clone(&owner->b);
5607 int8_tArray __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_b"))) TS_C2Tuple_OutPointScriptZ_get_b(uint32_t owner) {
5608 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
5609 LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
5610 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5611 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5612 CVec_u8Z_free(ret_var);
5616 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
5619 int32_t __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_a"))) TS_C2Tuple_u32ScriptZ_get_a(uint32_t owner) {
5620 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
5621 int32_t ret_val = C2Tuple_u32ScriptZ_get_a(owner_conv);
5625 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
5626 return CVec_u8Z_clone(&owner->b);
5628 int8_tArray __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_b"))) TS_C2Tuple_u32ScriptZ_get_b(uint32_t owner) {
5629 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
5630 LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
5631 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5632 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5633 CVec_u8Z_free(ret_var);
5637 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
5638 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
5639 for (size_t i = 0; i < ret.datalen; i++) {
5640 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
5644 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
5645 return ThirtyTwoBytes_clone(&owner->a);
5647 int8_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint32_t owner) {
5648 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
5649 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5650 memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data, 32);
5654 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
5655 return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
5657 uint32_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint32_t owner) {
5658 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
5659 LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
5660 uint32_tArray ret_arr = NULL;
5661 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
5662 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
5663 for (size_t v = 0; v < ret_var.datalen; v++) {
5664 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
5665 *ret_conv_21_conv = ret_var.data[v];
5666 ret_arr_ptr[v] = ((uint32_t)ret_conv_21_conv);
5673 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
5674 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * orig->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ clone bytes"), .datalen = orig->datalen };
5675 for (size_t i = 0; i < ret.datalen; i++) {
5676 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
5680 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
5681 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
5682 for (size_t i = 0; i < ret.datalen; i++) {
5683 ret.data[i] = Event_clone(&orig->data[i]);
5687 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
5690 int32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_a"))) TS_C2Tuple_u32TxOutZ_get_a(uint32_t owner) {
5691 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
5692 int32_t ret_val = C2Tuple_u32TxOutZ_get_a(owner_conv);
5696 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
5697 return TxOut_clone(&owner->b);
5699 uint32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_b"))) TS_C2Tuple_u32TxOutZ_get_b(uint32_t owner) {
5700 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
5701 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
5702 *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
5703 return (uint32_t)ret_ref;
5706 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
5707 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
5708 for (size_t i = 0; i < ret.datalen; i++) {
5709 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
5713 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
5714 return ThirtyTwoBytes_clone(&owner->a);
5716 int8_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint32_t owner) {
5717 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
5718 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5719 memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
5723 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
5724 return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
5726 uint32_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint32_t owner) {
5727 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
5728 LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
5729 uint32_tArray ret_arr = NULL;
5730 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
5731 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
5732 for (size_t u = 0; u < ret_var.datalen; u++) {
5733 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
5734 *ret_conv_20_conv = ret_var.data[u];
5735 ret_arr_ptr[u] = ((uint32_t)ret_conv_20_conv);
5742 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
5743 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 };
5744 for (size_t i = 0; i < ret.datalen; i++) {
5745 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
5749 uint32_t __attribute__((export_name("TS_LDKBalance_ty_from_ptr"))) TS_LDKBalance_ty_from_ptr(uint32_t ptr) {
5750 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
5752 case LDKBalance_ClaimableOnChannelClose: return 0;
5753 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
5754 case LDKBalance_ContentiousClaimable: return 2;
5755 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: return 3;
5759 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis(uint32_t ptr) {
5760 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
5761 assert(obj->tag == LDKBalance_ClaimableOnChannelClose);
5762 return obj->claimable_on_channel_close.claimable_amount_satoshis;
5764 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis(uint32_t ptr) {
5765 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
5766 assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
5767 return obj->claimable_awaiting_confirmations.claimable_amount_satoshis;
5769 int32_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(uint32_t ptr) {
5770 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
5771 assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
5772 return obj->claimable_awaiting_confirmations.confirmation_height;
5774 int64_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis"))) TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis(uint32_t ptr) {
5775 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
5776 assert(obj->tag == LDKBalance_ContentiousClaimable);
5777 return obj->contentious_claimable.claimable_amount_satoshis;
5779 int32_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_timeout_height"))) TS_LDKBalance_ContentiousClaimable_get_timeout_height(uint32_t ptr) {
5780 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
5781 assert(obj->tag == LDKBalance_ContentiousClaimable);
5782 return obj->contentious_claimable.timeout_height;
5784 int64_t __attribute__((export_name("TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_amount_satoshis"))) TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_amount_satoshis(uint32_t ptr) {
5785 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
5786 assert(obj->tag == LDKBalance_MaybeClaimableHTLCAwaitingTimeout);
5787 return obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis;
5789 int32_t __attribute__((export_name("TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_height"))) TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_height(uint32_t ptr) {
5790 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
5791 assert(obj->tag == LDKBalance_MaybeClaimableHTLCAwaitingTimeout);
5792 return obj->maybe_claimable_htlc_awaiting_timeout.claimable_height;
5794 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
5795 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
5796 for (size_t i = 0; i < ret.datalen; i++) {
5797 ret.data[i] = Balance_clone(&orig->data[i]);
5801 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
5802 return ThirtyTwoBytes_clone(&owner->a);
5804 int8_tArray __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_a"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_a(uint32_t owner) {
5805 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
5806 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5807 memcpy(ret_arr->elems, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data, 32);
5811 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
5812 return ChannelMonitor_clone(&owner->b);
5814 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_b"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_b(uint32_t owner) {
5815 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
5816 LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
5817 uint32_t ret_ref = 0;
5818 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5819 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5820 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5821 ret_ref = (uintptr_t)ret_var.inner;
5822 if (ret_var.is_owned) {
5828 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
5829 CHECK(owner->result_ok);
5830 return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
5832 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint32_t owner) {
5833 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
5834 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
5835 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
5836 return ((uint32_t)ret_conv);
5839 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
5840 CHECK(!owner->result_ok);
5841 return DecodeError_clone(&*owner->contents.err);
5843 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint32_t owner) {
5844 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
5845 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
5846 uint32_t ret_ref = 0;
5847 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5848 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5849 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5850 ret_ref = (uintptr_t)ret_var.inner;
5851 if (ret_var.is_owned) {
5857 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
5858 CHECK(owner->result_ok);
5859 return *owner->contents.result;
5861 void __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_ok"))) TS_CResult_NoneLightningErrorZ_get_ok(uint32_t owner) {
5862 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
5863 CResult_NoneLightningErrorZ_get_ok(owner_conv);
5866 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
5867 CHECK(!owner->result_ok);
5868 return LightningError_clone(&*owner->contents.err);
5870 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_err"))) TS_CResult_NoneLightningErrorZ_get_err(uint32_t owner) {
5871 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
5872 LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
5873 uint32_t ret_ref = 0;
5874 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5875 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5876 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5877 ret_ref = (uintptr_t)ret_var.inner;
5878 if (ret_var.is_owned) {
5884 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
5887 int8_tArray __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_a"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint32_t owner) {
5888 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
5889 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
5890 memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
5894 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
5895 return Type_clone(&owner->b);
5897 uint32_t __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_b"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint32_t owner) {
5898 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
5899 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
5900 *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
5901 return (uint32_t)ret_ret;
5904 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
5905 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
5906 for (size_t i = 0; i < ret.datalen; i++) {
5907 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
5911 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
5912 CHECK(owner->result_ok);
5913 return *owner->contents.result;
5915 jboolean __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_ok"))) TS_CResult_boolLightningErrorZ_get_ok(uint32_t owner) {
5916 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
5917 jboolean ret_val = CResult_boolLightningErrorZ_get_ok(owner_conv);
5921 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
5922 CHECK(!owner->result_ok);
5923 return LightningError_clone(&*owner->contents.err);
5925 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_err"))) TS_CResult_boolLightningErrorZ_get_err(uint32_t owner) {
5926 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
5927 LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
5928 uint32_t ret_ref = 0;
5929 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5930 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5931 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5932 ret_ref = (uintptr_t)ret_var.inner;
5933 if (ret_var.is_owned) {
5939 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5940 return ChannelAnnouncement_clone(&owner->a);
5942 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint32_t owner) {
5943 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
5944 LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
5945 uint32_t ret_ref = 0;
5946 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5947 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5948 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5949 ret_ref = (uintptr_t)ret_var.inner;
5950 if (ret_var.is_owned) {
5956 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5957 return ChannelUpdate_clone(&owner->b);
5959 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint32_t owner) {
5960 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
5961 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
5962 uint32_t ret_ref = 0;
5963 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5964 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5965 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5966 ret_ref = (uintptr_t)ret_var.inner;
5967 if (ret_var.is_owned) {
5973 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5974 return ChannelUpdate_clone(&owner->c);
5976 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint32_t owner) {
5977 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
5978 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
5979 uint32_t ret_ref = 0;
5980 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5981 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5982 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5983 ret_ref = (uintptr_t)ret_var.inner;
5984 if (ret_var.is_owned) {
5990 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
5991 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
5992 for (size_t i = 0; i < ret.datalen; i++) {
5993 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
5997 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
5998 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
5999 for (size_t i = 0; i < ret.datalen; i++) {
6000 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
6004 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
6005 CHECK(owner->result_ok);
6006 return CVec_u8Z_clone(&*owner->contents.result);
6008 int8_tArray __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint32_t owner) {
6009 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
6010 LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
6011 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6012 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6013 CVec_u8Z_free(ret_var);
6017 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
6018 CHECK(!owner->result_ok);
6019 return PeerHandleError_clone(&*owner->contents.err);
6021 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err(uint32_t owner) {
6022 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
6023 LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
6024 uint32_t ret_ref = 0;
6025 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6026 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6027 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6028 ret_ref = (uintptr_t)ret_var.inner;
6029 if (ret_var.is_owned) {
6035 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
6036 CHECK(owner->result_ok);
6037 return *owner->contents.result;
6039 void __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_ok"))) TS_CResult_NonePeerHandleErrorZ_get_ok(uint32_t owner) {
6040 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
6041 CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
6044 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
6045 CHECK(!owner->result_ok);
6046 return PeerHandleError_clone(&*owner->contents.err);
6048 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_err"))) TS_CResult_NonePeerHandleErrorZ_get_err(uint32_t owner) {
6049 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
6050 LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
6051 uint32_t ret_ref = 0;
6052 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6053 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6054 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6055 ret_ref = (uintptr_t)ret_var.inner;
6056 if (ret_var.is_owned) {
6062 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
6063 CHECK(owner->result_ok);
6064 return *owner->contents.result;
6066 jboolean __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_ok"))) TS_CResult_boolPeerHandleErrorZ_get_ok(uint32_t owner) {
6067 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
6068 jboolean ret_val = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
6072 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
6073 CHECK(!owner->result_ok);
6074 return PeerHandleError_clone(&*owner->contents.err);
6076 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_err"))) TS_CResult_boolPeerHandleErrorZ_get_err(uint32_t owner) {
6077 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
6078 LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
6079 uint32_t ret_ref = 0;
6080 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6081 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6082 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6083 ret_ref = (uintptr_t)ret_var.inner;
6084 if (ret_var.is_owned) {
6090 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
6091 CHECK(owner->result_ok);
6092 return NodeId_clone(&*owner->contents.result);
6094 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_ok"))) TS_CResult_NodeIdDecodeErrorZ_get_ok(uint32_t owner) {
6095 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
6096 LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
6097 uint32_t ret_ref = 0;
6098 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6099 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6100 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6101 ret_ref = (uintptr_t)ret_var.inner;
6102 if (ret_var.is_owned) {
6108 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
6109 CHECK(!owner->result_ok);
6110 return DecodeError_clone(&*owner->contents.err);
6112 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_err"))) TS_CResult_NodeIdDecodeErrorZ_get_err(uint32_t owner) {
6113 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
6114 LDKDecodeError ret_var = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
6115 uint32_t ret_ref = 0;
6116 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6117 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6118 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6119 ret_ref = (uintptr_t)ret_var.inner;
6120 if (ret_var.is_owned) {
6126 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
6127 CHECK(owner->result_ok);
6128 return COption_NetworkUpdateZ_clone(&*owner->contents.result);
6130 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint32_t owner) {
6131 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
6132 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
6133 *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
6134 uint32_t ret_ref = (uintptr_t)ret_copy;
6138 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
6139 CHECK(!owner->result_ok);
6140 return DecodeError_clone(&*owner->contents.err);
6142 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint32_t owner) {
6143 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
6144 LDKDecodeError ret_var = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
6145 uint32_t ret_ref = 0;
6146 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6147 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6148 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6149 ret_ref = (uintptr_t)ret_var.inner;
6150 if (ret_var.is_owned) {
6156 typedef struct LDKAccess_JCalls {
6157 atomic_size_t refcnt;
6158 uint32_t instance_ptr;
6160 static void LDKAccess_JCalls_free(void* this_arg) {
6161 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6162 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6166 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
6167 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6168 int8_tArray genesis_hash_arr = init_int8_tArray(32, __LINE__);
6169 memcpy(genesis_hash_arr->elems, *genesis_hash, 32);
6170 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 31, (uint32_t)genesis_hash_arr, (uint32_t)short_channel_id);
6171 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
6172 CHECK_ACCESS(ret_ptr);
6173 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
6177 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
6178 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
6179 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6181 static inline LDKAccess LDKAccess_init (JSValue o) {
6182 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
6183 atomic_init(&calls->refcnt, 1);
6184 calls->instance_ptr = o;
6187 .this_arg = (void*) calls,
6188 .get_utxo = get_utxo_LDKAccess_jcall,
6189 .free = LDKAccess_JCalls_free,
6193 long __attribute__((export_name("TS_LDKAccess_new"))) TS_LDKAccess_new(JSValue o) {
6194 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
6195 *res_ptr = LDKAccess_init(o);
6196 return (long)res_ptr;
6198 uint32_t __attribute__((export_name("TS_Access_get_utxo"))) TS_Access_get_utxo(uint32_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
6199 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6200 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6201 LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
6202 unsigned char genesis_hash_arr[32];
6203 CHECK(genesis_hash->arr_len == 32);
6204 memcpy(genesis_hash_arr, genesis_hash->elems, 32); FREE(genesis_hash);
6205 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
6206 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6207 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
6208 return (uint32_t)ret_conv;
6211 uint32_t __attribute__((export_name("TS_LDKCOption_AccessZ_ty_from_ptr"))) TS_LDKCOption_AccessZ_ty_from_ptr(uint32_t ptr) {
6212 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
6214 case LDKCOption_AccessZ_Some: return 0;
6215 case LDKCOption_AccessZ_None: return 1;
6219 uint32_t __attribute__((export_name("TS_LDKCOption_AccessZ_Some_get_some"))) TS_LDKCOption_AccessZ_Some_get_some(uint32_t ptr) {
6220 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
6221 assert(obj->tag == LDKCOption_AccessZ_Some);
6222 LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
6223 *some_ret = obj->some;
6224 // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
6225 return (uint32_t)some_ret;
6227 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
6228 CHECK(owner->result_ok);
6229 return ChannelUpdateInfo_clone(&*owner->contents.result);
6231 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(uint32_t owner) {
6232 LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(owner & ~1);
6233 LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
6234 uint32_t ret_ref = 0;
6235 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6236 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6237 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6238 ret_ref = (uintptr_t)ret_var.inner;
6239 if (ret_var.is_owned) {
6245 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
6246 CHECK(!owner->result_ok);
6247 return DecodeError_clone(&*owner->contents.err);
6249 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err(uint32_t owner) {
6250 LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(owner & ~1);
6251 LDKDecodeError ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
6252 uint32_t ret_ref = 0;
6253 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6254 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6255 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6256 ret_ref = (uintptr_t)ret_var.inner;
6257 if (ret_var.is_owned) {
6263 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
6264 CHECK(owner->result_ok);
6265 return ChannelInfo_clone(&*owner->contents.result);
6267 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_get_ok(uint32_t owner) {
6268 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
6269 LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
6270 uint32_t ret_ref = 0;
6271 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6272 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6273 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6274 ret_ref = (uintptr_t)ret_var.inner;
6275 if (ret_var.is_owned) {
6281 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
6282 CHECK(!owner->result_ok);
6283 return DecodeError_clone(&*owner->contents.err);
6285 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelInfoDecodeErrorZ_get_err(uint32_t owner) {
6286 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
6287 LDKDecodeError ret_var = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
6288 uint32_t ret_ref = 0;
6289 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6290 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6291 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6292 ret_ref = (uintptr_t)ret_var.inner;
6293 if (ret_var.is_owned) {
6299 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
6300 CHECK(owner->result_ok);
6301 return RoutingFees_clone(&*owner->contents.result);
6303 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_get_ok(uint32_t owner) {
6304 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
6305 LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
6306 uint32_t ret_ref = 0;
6307 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6308 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6309 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6310 ret_ref = (uintptr_t)ret_var.inner;
6311 if (ret_var.is_owned) {
6317 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
6318 CHECK(!owner->result_ok);
6319 return DecodeError_clone(&*owner->contents.err);
6321 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_err"))) TS_CResult_RoutingFeesDecodeErrorZ_get_err(uint32_t owner) {
6322 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
6323 LDKDecodeError ret_var = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
6324 uint32_t ret_ref = 0;
6325 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6326 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6327 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6328 ret_ref = (uintptr_t)ret_var.inner;
6329 if (ret_var.is_owned) {
6335 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
6336 CHECK(owner->result_ok);
6337 return NodeAnnouncementInfo_clone(&*owner->contents.result);
6339 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint32_t owner) {
6340 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
6341 LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
6342 uint32_t ret_ref = 0;
6343 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6344 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6345 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6346 ret_ref = (uintptr_t)ret_var.inner;
6347 if (ret_var.is_owned) {
6353 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
6354 CHECK(!owner->result_ok);
6355 return DecodeError_clone(&*owner->contents.err);
6357 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint32_t owner) {
6358 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
6359 LDKDecodeError ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
6360 uint32_t ret_ref = 0;
6361 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6362 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6363 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6364 ret_ref = (uintptr_t)ret_var.inner;
6365 if (ret_var.is_owned) {
6371 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
6372 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
6373 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
6376 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
6377 CHECK(owner->result_ok);
6378 return NodeInfo_clone(&*owner->contents.result);
6380 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeInfoDecodeErrorZ_get_ok(uint32_t owner) {
6381 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
6382 LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
6383 uint32_t ret_ref = 0;
6384 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6385 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6386 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6387 ret_ref = (uintptr_t)ret_var.inner;
6388 if (ret_var.is_owned) {
6394 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
6395 CHECK(!owner->result_ok);
6396 return DecodeError_clone(&*owner->contents.err);
6398 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_err"))) TS_CResult_NodeInfoDecodeErrorZ_get_err(uint32_t owner) {
6399 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
6400 LDKDecodeError ret_var = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
6401 uint32_t ret_ref = 0;
6402 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6403 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6404 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6405 ret_ref = (uintptr_t)ret_var.inner;
6406 if (ret_var.is_owned) {
6412 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
6413 CHECK(owner->result_ok);
6414 return NetworkGraph_clone(&*owner->contents.result);
6416 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_get_ok(uint32_t owner) {
6417 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
6418 LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
6419 uint32_t ret_ref = 0;
6420 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6421 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6422 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6423 ret_ref = (uintptr_t)ret_var.inner;
6424 if (ret_var.is_owned) {
6430 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
6431 CHECK(!owner->result_ok);
6432 return DecodeError_clone(&*owner->contents.err);
6434 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_err"))) TS_CResult_NetworkGraphDecodeErrorZ_get_err(uint32_t owner) {
6435 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
6436 LDKDecodeError ret_var = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
6437 uint32_t ret_ref = 0;
6438 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6439 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6440 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6441 ret_ref = (uintptr_t)ret_var.inner;
6442 if (ret_var.is_owned) {
6448 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr"))) TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr(uint32_t ptr) {
6449 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
6451 case LDKCOption_CVec_NetAddressZZ_Some: return 0;
6452 case LDKCOption_CVec_NetAddressZZ_None: return 1;
6456 uint32_tArray __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_Some_get_some"))) TS_LDKCOption_CVec_NetAddressZZ_Some_get_some(uint32_t ptr) {
6457 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
6458 assert(obj->tag == LDKCOption_CVec_NetAddressZZ_Some);
6459 LDKCVec_NetAddressZ some_var = obj->some;
6460 uint32_tArray some_arr = NULL;
6461 some_arr = init_uint32_tArray(some_var.datalen, __LINE__);
6462 uint32_t *some_arr_ptr = (uint32_t*)(((uint8_t*)some_arr) + 4);
6463 for (size_t m = 0; m < some_var.datalen; m++) {
6464 uint32_t some_conv_12_ref = ((uintptr_t)&some_var.data[m]) | 1;
6465 some_arr_ptr[m] = some_conv_12_ref;
6470 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
6471 CHECK(owner->result_ok);
6472 return NetAddress_clone(&*owner->contents.result);
6474 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_ok"))) TS_CResult_NetAddressDecodeErrorZ_get_ok(uint32_t owner) {
6475 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
6476 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
6477 *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
6478 uint32_t ret_ref = (uintptr_t)ret_copy;
6482 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
6483 CHECK(!owner->result_ok);
6484 return DecodeError_clone(&*owner->contents.err);
6486 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_err"))) TS_CResult_NetAddressDecodeErrorZ_get_err(uint32_t owner) {
6487 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
6488 LDKDecodeError ret_var = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
6489 uint32_t ret_ref = 0;
6490 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6491 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6492 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6493 ret_ref = (uintptr_t)ret_var.inner;
6494 if (ret_var.is_owned) {
6500 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
6501 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
6502 for (size_t i = 0; i < ret.datalen; i++) {
6503 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
6507 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
6508 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
6509 for (size_t i = 0; i < ret.datalen; i++) {
6510 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
6514 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
6515 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
6516 for (size_t i = 0; i < ret.datalen; i++) {
6517 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
6521 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
6522 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
6523 for (size_t i = 0; i < ret.datalen; i++) {
6524 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
6528 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
6529 CHECK(owner->result_ok);
6530 return AcceptChannel_clone(&*owner->contents.result);
6532 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint32_t owner) {
6533 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
6534 LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
6535 uint32_t ret_ref = 0;
6536 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6537 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6538 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6539 ret_ref = (uintptr_t)ret_var.inner;
6540 if (ret_var.is_owned) {
6546 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
6547 CHECK(!owner->result_ok);
6548 return DecodeError_clone(&*owner->contents.err);
6550 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_err"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint32_t owner) {
6551 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
6552 LDKDecodeError ret_var = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
6553 uint32_t ret_ref = 0;
6554 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6555 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6556 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6557 ret_ref = (uintptr_t)ret_var.inner;
6558 if (ret_var.is_owned) {
6564 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
6565 CHECK(owner->result_ok);
6566 return AnnouncementSignatures_clone(&*owner->contents.result);
6568 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint32_t owner) {
6569 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
6570 LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
6571 uint32_t ret_ref = 0;
6572 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6573 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6574 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6575 ret_ref = (uintptr_t)ret_var.inner;
6576 if (ret_var.is_owned) {
6582 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
6583 CHECK(!owner->result_ok);
6584 return DecodeError_clone(&*owner->contents.err);
6586 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint32_t owner) {
6587 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
6588 LDKDecodeError ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
6589 uint32_t ret_ref = 0;
6590 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6591 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6592 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6593 ret_ref = (uintptr_t)ret_var.inner;
6594 if (ret_var.is_owned) {
6600 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
6601 CHECK(owner->result_ok);
6602 return ChannelReestablish_clone(&*owner->contents.result);
6604 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint32_t owner) {
6605 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
6606 LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
6607 uint32_t ret_ref = 0;
6608 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6609 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6610 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6611 ret_ref = (uintptr_t)ret_var.inner;
6612 if (ret_var.is_owned) {
6618 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
6619 CHECK(!owner->result_ok);
6620 return DecodeError_clone(&*owner->contents.err);
6622 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint32_t owner) {
6623 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
6624 LDKDecodeError ret_var = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
6625 uint32_t ret_ref = 0;
6626 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6627 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6628 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6629 ret_ref = (uintptr_t)ret_var.inner;
6630 if (ret_var.is_owned) {
6636 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
6637 CHECK(owner->result_ok);
6638 return ClosingSigned_clone(&*owner->contents.result);
6640 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint32_t owner) {
6641 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
6642 LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
6643 uint32_t ret_ref = 0;
6644 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6645 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6646 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6647 ret_ref = (uintptr_t)ret_var.inner;
6648 if (ret_var.is_owned) {
6654 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
6655 CHECK(!owner->result_ok);
6656 return DecodeError_clone(&*owner->contents.err);
6658 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint32_t owner) {
6659 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
6660 LDKDecodeError ret_var = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
6661 uint32_t ret_ref = 0;
6662 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6663 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6664 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6665 ret_ref = (uintptr_t)ret_var.inner;
6666 if (ret_var.is_owned) {
6672 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
6673 CHECK(owner->result_ok);
6674 return ClosingSignedFeeRange_clone(&*owner->contents.result);
6676 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint32_t owner) {
6677 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
6678 LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
6679 uint32_t ret_ref = 0;
6680 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6681 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6682 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6683 ret_ref = (uintptr_t)ret_var.inner;
6684 if (ret_var.is_owned) {
6690 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
6691 CHECK(!owner->result_ok);
6692 return DecodeError_clone(&*owner->contents.err);
6694 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint32_t owner) {
6695 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
6696 LDKDecodeError ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
6697 uint32_t ret_ref = 0;
6698 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6699 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6700 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6701 ret_ref = (uintptr_t)ret_var.inner;
6702 if (ret_var.is_owned) {
6708 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
6709 CHECK(owner->result_ok);
6710 return CommitmentSigned_clone(&*owner->contents.result);
6712 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_ok(uint32_t owner) {
6713 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
6714 LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
6715 uint32_t ret_ref = 0;
6716 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6717 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6718 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6719 ret_ref = (uintptr_t)ret_var.inner;
6720 if (ret_var.is_owned) {
6726 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
6727 CHECK(!owner->result_ok);
6728 return DecodeError_clone(&*owner->contents.err);
6730 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_err(uint32_t owner) {
6731 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
6732 LDKDecodeError ret_var = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
6733 uint32_t ret_ref = 0;
6734 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6735 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6736 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6737 ret_ref = (uintptr_t)ret_var.inner;
6738 if (ret_var.is_owned) {
6744 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
6745 CHECK(owner->result_ok);
6746 return FundingCreated_clone(&*owner->contents.result);
6748 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_get_ok(uint32_t owner) {
6749 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
6750 LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
6751 uint32_t ret_ref = 0;
6752 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6753 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6754 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6755 ret_ref = (uintptr_t)ret_var.inner;
6756 if (ret_var.is_owned) {
6762 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
6763 CHECK(!owner->result_ok);
6764 return DecodeError_clone(&*owner->contents.err);
6766 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_err"))) TS_CResult_FundingCreatedDecodeErrorZ_get_err(uint32_t owner) {
6767 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
6768 LDKDecodeError ret_var = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
6769 uint32_t ret_ref = 0;
6770 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6771 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6772 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6773 ret_ref = (uintptr_t)ret_var.inner;
6774 if (ret_var.is_owned) {
6780 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
6781 CHECK(owner->result_ok);
6782 return FundingSigned_clone(&*owner->contents.result);
6784 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_ok"))) TS_CResult_FundingSignedDecodeErrorZ_get_ok(uint32_t owner) {
6785 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
6786 LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
6787 uint32_t ret_ref = 0;
6788 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6789 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6790 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6791 ret_ref = (uintptr_t)ret_var.inner;
6792 if (ret_var.is_owned) {
6798 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
6799 CHECK(!owner->result_ok);
6800 return DecodeError_clone(&*owner->contents.err);
6802 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_err"))) TS_CResult_FundingSignedDecodeErrorZ_get_err(uint32_t owner) {
6803 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
6804 LDKDecodeError ret_var = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
6805 uint32_t ret_ref = 0;
6806 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6807 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6808 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6809 ret_ref = (uintptr_t)ret_var.inner;
6810 if (ret_var.is_owned) {
6816 static inline struct LDKFundingLocked CResult_FundingLockedDecodeErrorZ_get_ok(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR owner){
6817 CHECK(owner->result_ok);
6818 return FundingLocked_clone(&*owner->contents.result);
6820 uint32_t __attribute__((export_name("TS_CResult_FundingLockedDecodeErrorZ_get_ok"))) TS_CResult_FundingLockedDecodeErrorZ_get_ok(uint32_t owner) {
6821 LDKCResult_FundingLockedDecodeErrorZ* owner_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(owner & ~1);
6822 LDKFundingLocked ret_var = CResult_FundingLockedDecodeErrorZ_get_ok(owner_conv);
6823 uint32_t ret_ref = 0;
6824 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6825 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6826 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6827 ret_ref = (uintptr_t)ret_var.inner;
6828 if (ret_var.is_owned) {
6834 static inline struct LDKDecodeError CResult_FundingLockedDecodeErrorZ_get_err(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR owner){
6835 CHECK(!owner->result_ok);
6836 return DecodeError_clone(&*owner->contents.err);
6838 uint32_t __attribute__((export_name("TS_CResult_FundingLockedDecodeErrorZ_get_err"))) TS_CResult_FundingLockedDecodeErrorZ_get_err(uint32_t owner) {
6839 LDKCResult_FundingLockedDecodeErrorZ* owner_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(owner & ~1);
6840 LDKDecodeError ret_var = CResult_FundingLockedDecodeErrorZ_get_err(owner_conv);
6841 uint32_t ret_ref = 0;
6842 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6843 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6844 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6845 ret_ref = (uintptr_t)ret_var.inner;
6846 if (ret_var.is_owned) {
6852 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
6853 CHECK(owner->result_ok);
6854 return Init_clone(&*owner->contents.result);
6856 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_ok"))) TS_CResult_InitDecodeErrorZ_get_ok(uint32_t owner) {
6857 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
6858 LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
6859 uint32_t ret_ref = 0;
6860 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6861 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6862 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6863 ret_ref = (uintptr_t)ret_var.inner;
6864 if (ret_var.is_owned) {
6870 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
6871 CHECK(!owner->result_ok);
6872 return DecodeError_clone(&*owner->contents.err);
6874 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_err"))) TS_CResult_InitDecodeErrorZ_get_err(uint32_t owner) {
6875 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
6876 LDKDecodeError ret_var = CResult_InitDecodeErrorZ_get_err(owner_conv);
6877 uint32_t ret_ref = 0;
6878 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6879 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6880 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6881 ret_ref = (uintptr_t)ret_var.inner;
6882 if (ret_var.is_owned) {
6888 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
6889 CHECK(owner->result_ok);
6890 return OpenChannel_clone(&*owner->contents.result);
6892 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_ok"))) TS_CResult_OpenChannelDecodeErrorZ_get_ok(uint32_t owner) {
6893 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
6894 LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
6895 uint32_t ret_ref = 0;
6896 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6897 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6898 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6899 ret_ref = (uintptr_t)ret_var.inner;
6900 if (ret_var.is_owned) {
6906 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
6907 CHECK(!owner->result_ok);
6908 return DecodeError_clone(&*owner->contents.err);
6910 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_err"))) TS_CResult_OpenChannelDecodeErrorZ_get_err(uint32_t owner) {
6911 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
6912 LDKDecodeError ret_var = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
6913 uint32_t ret_ref = 0;
6914 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6915 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6916 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6917 ret_ref = (uintptr_t)ret_var.inner;
6918 if (ret_var.is_owned) {
6924 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
6925 CHECK(owner->result_ok);
6926 return RevokeAndACK_clone(&*owner->contents.result);
6928 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_ok(uint32_t owner) {
6929 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
6930 LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
6931 uint32_t ret_ref = 0;
6932 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6933 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6934 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6935 ret_ref = (uintptr_t)ret_var.inner;
6936 if (ret_var.is_owned) {
6942 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
6943 CHECK(!owner->result_ok);
6944 return DecodeError_clone(&*owner->contents.err);
6946 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_err(uint32_t owner) {
6947 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
6948 LDKDecodeError ret_var = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
6949 uint32_t ret_ref = 0;
6950 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6951 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6952 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6953 ret_ref = (uintptr_t)ret_var.inner;
6954 if (ret_var.is_owned) {
6960 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
6961 CHECK(owner->result_ok);
6962 return Shutdown_clone(&*owner->contents.result);
6964 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_ok"))) TS_CResult_ShutdownDecodeErrorZ_get_ok(uint32_t owner) {
6965 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
6966 LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
6967 uint32_t ret_ref = 0;
6968 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6969 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6970 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6971 ret_ref = (uintptr_t)ret_var.inner;
6972 if (ret_var.is_owned) {
6978 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
6979 CHECK(!owner->result_ok);
6980 return DecodeError_clone(&*owner->contents.err);
6982 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_err"))) TS_CResult_ShutdownDecodeErrorZ_get_err(uint32_t owner) {
6983 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
6984 LDKDecodeError ret_var = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
6985 uint32_t ret_ref = 0;
6986 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6987 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6988 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6989 ret_ref = (uintptr_t)ret_var.inner;
6990 if (ret_var.is_owned) {
6996 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
6997 CHECK(owner->result_ok);
6998 return UpdateFailHTLC_clone(&*owner->contents.result);
7000 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint32_t owner) {
7001 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
7002 LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
7003 uint32_t ret_ref = 0;
7004 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7005 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7006 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7007 ret_ref = (uintptr_t)ret_var.inner;
7008 if (ret_var.is_owned) {
7014 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
7015 CHECK(!owner->result_ok);
7016 return DecodeError_clone(&*owner->contents.err);
7018 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err(uint32_t owner) {
7019 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
7020 LDKDecodeError ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
7021 uint32_t ret_ref = 0;
7022 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7023 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7024 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7025 ret_ref = (uintptr_t)ret_var.inner;
7026 if (ret_var.is_owned) {
7032 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
7033 CHECK(owner->result_ok);
7034 return UpdateFailMalformedHTLC_clone(&*owner->contents.result);
7036 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint32_t owner) {
7037 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
7038 LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
7039 uint32_t ret_ref = 0;
7040 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7041 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7042 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7043 ret_ref = (uintptr_t)ret_var.inner;
7044 if (ret_var.is_owned) {
7050 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
7051 CHECK(!owner->result_ok);
7052 return DecodeError_clone(&*owner->contents.err);
7054 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint32_t owner) {
7055 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
7056 LDKDecodeError ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
7057 uint32_t ret_ref = 0;
7058 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7059 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7060 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7061 ret_ref = (uintptr_t)ret_var.inner;
7062 if (ret_var.is_owned) {
7068 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
7069 CHECK(owner->result_ok);
7070 return UpdateFee_clone(&*owner->contents.result);
7072 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_get_ok(uint32_t owner) {
7073 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
7074 LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
7075 uint32_t ret_ref = 0;
7076 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7077 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7078 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7079 ret_ref = (uintptr_t)ret_var.inner;
7080 if (ret_var.is_owned) {
7086 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
7087 CHECK(!owner->result_ok);
7088 return DecodeError_clone(&*owner->contents.err);
7090 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_err"))) TS_CResult_UpdateFeeDecodeErrorZ_get_err(uint32_t owner) {
7091 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
7092 LDKDecodeError ret_var = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
7093 uint32_t ret_ref = 0;
7094 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7095 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7096 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7097 ret_ref = (uintptr_t)ret_var.inner;
7098 if (ret_var.is_owned) {
7104 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
7105 CHECK(owner->result_ok);
7106 return UpdateFulfillHTLC_clone(&*owner->contents.result);
7108 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint32_t owner) {
7109 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
7110 LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
7111 uint32_t ret_ref = 0;
7112 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7113 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7114 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7115 ret_ref = (uintptr_t)ret_var.inner;
7116 if (ret_var.is_owned) {
7122 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
7123 CHECK(!owner->result_ok);
7124 return DecodeError_clone(&*owner->contents.err);
7126 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint32_t owner) {
7127 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
7128 LDKDecodeError ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
7129 uint32_t ret_ref = 0;
7130 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7131 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7132 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7133 ret_ref = (uintptr_t)ret_var.inner;
7134 if (ret_var.is_owned) {
7140 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
7141 CHECK(owner->result_ok);
7142 return UpdateAddHTLC_clone(&*owner->contents.result);
7144 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint32_t owner) {
7145 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
7146 LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
7147 uint32_t ret_ref = 0;
7148 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7149 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7150 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7151 ret_ref = (uintptr_t)ret_var.inner;
7152 if (ret_var.is_owned) {
7158 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
7159 CHECK(!owner->result_ok);
7160 return DecodeError_clone(&*owner->contents.err);
7162 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err(uint32_t owner) {
7163 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
7164 LDKDecodeError ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
7165 uint32_t ret_ref = 0;
7166 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7167 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7168 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7169 ret_ref = (uintptr_t)ret_var.inner;
7170 if (ret_var.is_owned) {
7176 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
7177 CHECK(owner->result_ok);
7178 return Ping_clone(&*owner->contents.result);
7180 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_ok"))) TS_CResult_PingDecodeErrorZ_get_ok(uint32_t owner) {
7181 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
7182 LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
7183 uint32_t ret_ref = 0;
7184 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7185 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7186 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7187 ret_ref = (uintptr_t)ret_var.inner;
7188 if (ret_var.is_owned) {
7194 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
7195 CHECK(!owner->result_ok);
7196 return DecodeError_clone(&*owner->contents.err);
7198 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_err"))) TS_CResult_PingDecodeErrorZ_get_err(uint32_t owner) {
7199 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
7200 LDKDecodeError ret_var = CResult_PingDecodeErrorZ_get_err(owner_conv);
7201 uint32_t ret_ref = 0;
7202 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7203 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7204 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7205 ret_ref = (uintptr_t)ret_var.inner;
7206 if (ret_var.is_owned) {
7212 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
7213 CHECK(owner->result_ok);
7214 return Pong_clone(&*owner->contents.result);
7216 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_ok"))) TS_CResult_PongDecodeErrorZ_get_ok(uint32_t owner) {
7217 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
7218 LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
7219 uint32_t ret_ref = 0;
7220 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7221 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7222 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7223 ret_ref = (uintptr_t)ret_var.inner;
7224 if (ret_var.is_owned) {
7230 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
7231 CHECK(!owner->result_ok);
7232 return DecodeError_clone(&*owner->contents.err);
7234 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_err"))) TS_CResult_PongDecodeErrorZ_get_err(uint32_t owner) {
7235 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
7236 LDKDecodeError ret_var = CResult_PongDecodeErrorZ_get_err(owner_conv);
7237 uint32_t ret_ref = 0;
7238 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7239 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7240 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7241 ret_ref = (uintptr_t)ret_var.inner;
7242 if (ret_var.is_owned) {
7248 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7249 CHECK(owner->result_ok);
7250 return UnsignedChannelAnnouncement_clone(&*owner->contents.result);
7252 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
7253 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
7254 LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
7255 uint32_t ret_ref = 0;
7256 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7257 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7258 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7259 ret_ref = (uintptr_t)ret_var.inner;
7260 if (ret_var.is_owned) {
7266 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7267 CHECK(!owner->result_ok);
7268 return DecodeError_clone(&*owner->contents.err);
7270 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
7271 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
7272 LDKDecodeError ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
7273 uint32_t ret_ref = 0;
7274 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7275 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7276 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7277 ret_ref = (uintptr_t)ret_var.inner;
7278 if (ret_var.is_owned) {
7284 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7285 CHECK(owner->result_ok);
7286 return ChannelAnnouncement_clone(&*owner->contents.result);
7288 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
7289 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
7290 LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
7291 uint32_t ret_ref = 0;
7292 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7293 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7294 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7295 ret_ref = (uintptr_t)ret_var.inner;
7296 if (ret_var.is_owned) {
7302 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7303 CHECK(!owner->result_ok);
7304 return DecodeError_clone(&*owner->contents.err);
7306 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
7307 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
7308 LDKDecodeError ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
7309 uint32_t ret_ref = 0;
7310 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7311 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7312 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7313 ret_ref = (uintptr_t)ret_var.inner;
7314 if (ret_var.is_owned) {
7320 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7321 CHECK(owner->result_ok);
7322 return UnsignedChannelUpdate_clone(&*owner->contents.result);
7324 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint32_t owner) {
7325 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
7326 LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
7327 uint32_t ret_ref = 0;
7328 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7329 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7330 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7331 ret_ref = (uintptr_t)ret_var.inner;
7332 if (ret_var.is_owned) {
7338 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7339 CHECK(!owner->result_ok);
7340 return DecodeError_clone(&*owner->contents.err);
7342 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint32_t owner) {
7343 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
7344 LDKDecodeError ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
7345 uint32_t ret_ref = 0;
7346 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7347 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7348 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7349 ret_ref = (uintptr_t)ret_var.inner;
7350 if (ret_var.is_owned) {
7356 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7357 CHECK(owner->result_ok);
7358 return ChannelUpdate_clone(&*owner->contents.result);
7360 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_ok(uint32_t owner) {
7361 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
7362 LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
7363 uint32_t ret_ref = 0;
7364 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7365 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7366 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7367 ret_ref = (uintptr_t)ret_var.inner;
7368 if (ret_var.is_owned) {
7374 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7375 CHECK(!owner->result_ok);
7376 return DecodeError_clone(&*owner->contents.err);
7378 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_err(uint32_t owner) {
7379 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
7380 LDKDecodeError ret_var = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
7381 uint32_t ret_ref = 0;
7382 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7383 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7384 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7385 ret_ref = (uintptr_t)ret_var.inner;
7386 if (ret_var.is_owned) {
7392 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
7393 CHECK(owner->result_ok);
7394 return ErrorMessage_clone(&*owner->contents.result);
7396 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_get_ok(uint32_t owner) {
7397 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
7398 LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
7399 uint32_t ret_ref = 0;
7400 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7401 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7402 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7403 ret_ref = (uintptr_t)ret_var.inner;
7404 if (ret_var.is_owned) {
7410 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
7411 CHECK(!owner->result_ok);
7412 return DecodeError_clone(&*owner->contents.err);
7414 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_err"))) TS_CResult_ErrorMessageDecodeErrorZ_get_err(uint32_t owner) {
7415 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
7416 LDKDecodeError ret_var = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
7417 uint32_t ret_ref = 0;
7418 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7419 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7420 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7421 ret_ref = (uintptr_t)ret_var.inner;
7422 if (ret_var.is_owned) {
7428 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
7429 CHECK(owner->result_ok);
7430 return WarningMessage_clone(&*owner->contents.result);
7432 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_ok"))) TS_CResult_WarningMessageDecodeErrorZ_get_ok(uint32_t owner) {
7433 LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(owner & ~1);
7434 LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
7435 uint32_t ret_ref = 0;
7436 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7437 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7438 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7439 ret_ref = (uintptr_t)ret_var.inner;
7440 if (ret_var.is_owned) {
7446 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
7447 CHECK(!owner->result_ok);
7448 return DecodeError_clone(&*owner->contents.err);
7450 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_err"))) TS_CResult_WarningMessageDecodeErrorZ_get_err(uint32_t owner) {
7451 LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(owner & ~1);
7452 LDKDecodeError ret_var = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
7453 uint32_t ret_ref = 0;
7454 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7455 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7456 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7457 ret_ref = (uintptr_t)ret_var.inner;
7458 if (ret_var.is_owned) {
7464 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7465 CHECK(owner->result_ok);
7466 return UnsignedNodeAnnouncement_clone(&*owner->contents.result);
7468 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
7469 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
7470 LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
7471 uint32_t ret_ref = 0;
7472 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7473 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7474 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7475 ret_ref = (uintptr_t)ret_var.inner;
7476 if (ret_var.is_owned) {
7482 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7483 CHECK(!owner->result_ok);
7484 return DecodeError_clone(&*owner->contents.err);
7486 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
7487 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
7488 LDKDecodeError ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
7489 uint32_t ret_ref = 0;
7490 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7491 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7492 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7493 ret_ref = (uintptr_t)ret_var.inner;
7494 if (ret_var.is_owned) {
7500 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7501 CHECK(owner->result_ok);
7502 return NodeAnnouncement_clone(&*owner->contents.result);
7504 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
7505 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
7506 LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
7507 uint32_t ret_ref = 0;
7508 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7509 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7510 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7511 ret_ref = (uintptr_t)ret_var.inner;
7512 if (ret_var.is_owned) {
7518 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7519 CHECK(!owner->result_ok);
7520 return DecodeError_clone(&*owner->contents.err);
7522 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
7523 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
7524 LDKDecodeError ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
7525 uint32_t ret_ref = 0;
7526 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7527 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7528 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7529 ret_ref = (uintptr_t)ret_var.inner;
7530 if (ret_var.is_owned) {
7536 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
7537 CHECK(owner->result_ok);
7538 return QueryShortChannelIds_clone(&*owner->contents.result);
7540 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint32_t owner) {
7541 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
7542 LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
7543 uint32_t ret_ref = 0;
7544 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7545 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7546 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7547 ret_ref = (uintptr_t)ret_var.inner;
7548 if (ret_var.is_owned) {
7554 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
7555 CHECK(!owner->result_ok);
7556 return DecodeError_clone(&*owner->contents.err);
7558 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint32_t owner) {
7559 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
7560 LDKDecodeError ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
7561 uint32_t ret_ref = 0;
7562 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7563 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7564 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7565 ret_ref = (uintptr_t)ret_var.inner;
7566 if (ret_var.is_owned) {
7572 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
7573 CHECK(owner->result_ok);
7574 return ReplyShortChannelIdsEnd_clone(&*owner->contents.result);
7576 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint32_t owner) {
7577 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
7578 LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
7579 uint32_t ret_ref = 0;
7580 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7581 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7582 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7583 ret_ref = (uintptr_t)ret_var.inner;
7584 if (ret_var.is_owned) {
7590 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
7591 CHECK(!owner->result_ok);
7592 return DecodeError_clone(&*owner->contents.err);
7594 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint32_t owner) {
7595 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
7596 LDKDecodeError ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
7597 uint32_t ret_ref = 0;
7598 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7599 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7600 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7601 ret_ref = (uintptr_t)ret_var.inner;
7602 if (ret_var.is_owned) {
7608 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7609 CHECK(owner->result_ok);
7610 return QueryChannelRange_clone(&*owner->contents.result);
7612 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok(uint32_t owner) {
7613 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
7614 LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
7615 uint32_t ret_ref = 0;
7616 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7617 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7618 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7619 ret_ref = (uintptr_t)ret_var.inner;
7620 if (ret_var.is_owned) {
7626 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7627 CHECK(!owner->result_ok);
7628 return DecodeError_clone(&*owner->contents.err);
7630 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_err(uint32_t owner) {
7631 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
7632 LDKDecodeError ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
7633 uint32_t ret_ref = 0;
7634 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7635 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7636 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7637 ret_ref = (uintptr_t)ret_var.inner;
7638 if (ret_var.is_owned) {
7644 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7645 CHECK(owner->result_ok);
7646 return ReplyChannelRange_clone(&*owner->contents.result);
7648 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint32_t owner) {
7649 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
7650 LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
7651 uint32_t ret_ref = 0;
7652 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7653 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7654 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7655 ret_ref = (uintptr_t)ret_var.inner;
7656 if (ret_var.is_owned) {
7662 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7663 CHECK(!owner->result_ok);
7664 return DecodeError_clone(&*owner->contents.err);
7666 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err(uint32_t owner) {
7667 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
7668 LDKDecodeError ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
7669 uint32_t ret_ref = 0;
7670 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7671 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7672 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7673 ret_ref = (uintptr_t)ret_var.inner;
7674 if (ret_var.is_owned) {
7680 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
7681 CHECK(owner->result_ok);
7682 return GossipTimestampFilter_clone(&*owner->contents.result);
7684 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint32_t owner) {
7685 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
7686 LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
7687 uint32_t ret_ref = 0;
7688 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7689 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7690 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7691 ret_ref = (uintptr_t)ret_var.inner;
7692 if (ret_var.is_owned) {
7698 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
7699 CHECK(!owner->result_ok);
7700 return DecodeError_clone(&*owner->contents.err);
7702 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err(uint32_t owner) {
7703 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
7704 LDKDecodeError ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
7705 uint32_t ret_ref = 0;
7706 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7707 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7708 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7709 ret_ref = (uintptr_t)ret_var.inner;
7710 if (ret_var.is_owned) {
7716 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_ty_from_ptr"))) TS_LDKSignOrCreationError_ty_from_ptr(uint32_t ptr) {
7717 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
7719 case LDKSignOrCreationError_SignError: return 0;
7720 case LDKSignOrCreationError_CreationError: return 1;
7724 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_CreationError_get_creation_error"))) TS_LDKSignOrCreationError_CreationError_get_creation_error(uint32_t ptr) {
7725 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
7726 assert(obj->tag == LDKSignOrCreationError_CreationError);
7727 uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
7728 return creation_error_conv;
7730 static inline struct LDKInvoice CResult_InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
7731 CHECK(owner->result_ok);
7732 return Invoice_clone(&*owner->contents.result);
7734 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_ok(uint32_t owner) {
7735 LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(owner & ~1);
7736 LDKInvoice ret_var = CResult_InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
7737 uint32_t ret_ref = 0;
7738 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7739 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7740 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7741 ret_ref = (uintptr_t)ret_var.inner;
7742 if (ret_var.is_owned) {
7748 static inline struct LDKSignOrCreationError CResult_InvoiceSignOrCreationErrorZ_get_err(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
7749 CHECK(!owner->result_ok);
7750 return SignOrCreationError_clone(&*owner->contents.err);
7752 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_err(uint32_t owner) {
7753 LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(owner & ~1);
7754 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
7755 *ret_copy = CResult_InvoiceSignOrCreationErrorZ_get_err(owner_conv);
7756 uint32_t ret_ref = (uintptr_t)ret_copy;
7760 typedef struct LDKFilter_JCalls {
7761 atomic_size_t refcnt;
7762 uint32_t instance_ptr;
7764 static void LDKFilter_JCalls_free(void* this_arg) {
7765 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7766 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7770 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
7771 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7772 int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
7773 memcpy(txid_arr->elems, *txid, 32);
7774 LDKu8slice script_pubkey_var = script_pubkey;
7775 int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__);
7776 memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
7777 js_invoke_function_2(j_calls->instance_ptr, 32, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr);
7779 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
7780 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7781 LDKWatchedOutput output_var = output;
7782 uint32_t output_ref = 0;
7783 CHECK((((uintptr_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7784 CHECK((((uintptr_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7785 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
7786 output_ref = (uintptr_t)output_var.inner;
7787 if (output_var.is_owned) {
7790 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 33, (uint32_t)output_ref);
7791 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
7792 CHECK_ACCESS(ret_ptr);
7793 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(ret_ptr);
7797 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
7798 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
7799 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7801 static inline LDKFilter LDKFilter_init (JSValue o) {
7802 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
7803 atomic_init(&calls->refcnt, 1);
7804 calls->instance_ptr = o;
7807 .this_arg = (void*) calls,
7808 .register_tx = register_tx_LDKFilter_jcall,
7809 .register_output = register_output_LDKFilter_jcall,
7810 .free = LDKFilter_JCalls_free,
7814 long __attribute__((export_name("TS_LDKFilter_new"))) TS_LDKFilter_new(JSValue o) {
7815 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
7816 *res_ptr = LDKFilter_init(o);
7817 return (long)res_ptr;
7819 void __attribute__((export_name("TS_Filter_register_tx"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
7820 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7821 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7822 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
7823 unsigned char txid_arr[32];
7824 CHECK(txid->arr_len == 32);
7825 memcpy(txid_arr, txid->elems, 32); FREE(txid);
7826 unsigned char (*txid_ref)[32] = &txid_arr;
7827 LDKu8slice script_pubkey_ref;
7828 script_pubkey_ref.datalen = script_pubkey->arr_len;
7829 script_pubkey_ref.data = script_pubkey->elems /* XXX script_pubkey leaks */;
7830 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
7833 uint32_t __attribute__((export_name("TS_Filter_register_output"))) TS_Filter_register_output(uint32_t this_arg, uint32_t output) {
7834 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7835 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7836 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
7837 LDKWatchedOutput output_conv;
7838 output_conv.inner = (void*)(output & (~1));
7839 output_conv.is_owned = (output & 1) || (output == 0);
7840 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
7841 output_conv = WatchedOutput_clone(&output_conv);
7842 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
7843 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
7844 uint32_t ret_ref = (uintptr_t)ret_copy;
7848 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_ty_from_ptr"))) TS_LDKCOption_FilterZ_ty_from_ptr(uint32_t ptr) {
7849 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
7851 case LDKCOption_FilterZ_Some: return 0;
7852 case LDKCOption_FilterZ_None: return 1;
7856 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_Some_get_some"))) TS_LDKCOption_FilterZ_Some_get_some(uint32_t ptr) {
7857 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
7858 assert(obj->tag == LDKCOption_FilterZ_Some);
7859 LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
7860 *some_ret = obj->some;
7861 // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
7862 return (uint32_t)some_ret;
7864 static inline struct LDKLockedChannelMonitor *CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
7865 CHECK(owner->result_ok);
7866 return &*owner->contents.result;
7868 uint32_t __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_ok"))) TS_CResult_LockedChannelMonitorNoneZ_get_ok(uint32_t owner) {
7869 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
7870 LDKLockedChannelMonitor ret_var = *CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
7871 uint32_t ret_ref = 0;
7872 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7873 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7874 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7875 ret_ref = (uintptr_t)ret_var.inner & ~1;
7879 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
7880 CHECK(!owner->result_ok);
7881 return *owner->contents.err;
7883 void __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_err"))) TS_CResult_LockedChannelMonitorNoneZ_get_err(uint32_t owner) {
7884 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
7885 CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
7888 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
7889 LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
7890 for (size_t i = 0; i < ret.datalen; i++) {
7891 ret.data[i] = OutPoint_clone(&orig->data[i]);
7895 typedef struct LDKMessageSendEventsProvider_JCalls {
7896 atomic_size_t refcnt;
7897 uint32_t instance_ptr;
7898 } LDKMessageSendEventsProvider_JCalls;
7899 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
7900 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
7901 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7905 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
7906 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
7907 uint32_tArray ret = (uint32_tArray)js_invoke_function_0(j_calls->instance_ptr, 34);
7908 LDKCVec_MessageSendEventZ ret_constr;
7909 ret_constr.datalen = ret->arr_len;
7910 if (ret_constr.datalen > 0)
7911 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
7913 ret_constr.data = NULL;
7914 uint32_t* ret_vals = ret->elems /* XXX ret leaks */;
7915 for (size_t s = 0; s < ret_constr.datalen; s++) {
7916 uint32_t ret_conv_18 = ret_vals[s];
7917 void* ret_conv_18_ptr = (void*)(((uintptr_t)ret_conv_18) & ~1);
7918 CHECK_ACCESS(ret_conv_18_ptr);
7919 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
7920 FREE((void*)ret_conv_18);
7921 ret_constr.data[s] = ret_conv_18_conv;
7925 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
7926 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
7927 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7929 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JSValue o) {
7930 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
7931 atomic_init(&calls->refcnt, 1);
7932 calls->instance_ptr = o;
7934 LDKMessageSendEventsProvider ret = {
7935 .this_arg = (void*) calls,
7936 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
7937 .free = LDKMessageSendEventsProvider_JCalls_free,
7941 long __attribute__((export_name("TS_LDKMessageSendEventsProvider_new"))) TS_LDKMessageSendEventsProvider_new(JSValue o) {
7942 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
7943 *res_ptr = LDKMessageSendEventsProvider_init(o);
7944 return (long)res_ptr;
7946 uint32_tArray __attribute__((export_name("TS_MessageSendEventsProvider_get_and_clear_pending_msg_events"))) TS_MessageSendEventsProvider_get_and_clear_pending_msg_events(uint32_t this_arg) {
7947 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7948 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7949 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
7950 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
7951 uint32_tArray ret_arr = NULL;
7952 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
7953 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
7954 for (size_t s = 0; s < ret_var.datalen; s++) {
7955 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
7956 *ret_conv_18_copy = ret_var.data[s];
7957 uint32_t ret_conv_18_ref = (uintptr_t)ret_conv_18_copy;
7958 ret_arr_ptr[s] = ret_conv_18_ref;
7965 typedef struct LDKEventHandler_JCalls {
7966 atomic_size_t refcnt;
7967 uint32_t instance_ptr;
7968 } LDKEventHandler_JCalls;
7969 static void LDKEventHandler_JCalls_free(void* this_arg) {
7970 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
7971 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7975 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
7976 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
7977 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
7978 *ret_event = Event_clone(event);
7979 js_invoke_function_1(j_calls->instance_ptr, 35, (uint32_t)(uint32_t)ret_event);
7981 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
7982 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
7983 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7985 static inline LDKEventHandler LDKEventHandler_init (JSValue o) {
7986 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
7987 atomic_init(&calls->refcnt, 1);
7988 calls->instance_ptr = o;
7990 LDKEventHandler ret = {
7991 .this_arg = (void*) calls,
7992 .handle_event = handle_event_LDKEventHandler_jcall,
7993 .free = LDKEventHandler_JCalls_free,
7997 long __attribute__((export_name("TS_LDKEventHandler_new"))) TS_LDKEventHandler_new(JSValue o) {
7998 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
7999 *res_ptr = LDKEventHandler_init(o);
8000 return (long)res_ptr;
8002 void __attribute__((export_name("TS_EventHandler_handle_event"))) TS_EventHandler_handle_event(uint32_t this_arg, uint32_t event) {
8003 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8004 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8005 LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
8006 LDKEvent* event_conv = (LDKEvent*)event;
8007 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
8010 typedef struct LDKEventsProvider_JCalls {
8011 atomic_size_t refcnt;
8012 uint32_t instance_ptr;
8013 } LDKEventsProvider_JCalls;
8014 static void LDKEventsProvider_JCalls_free(void* this_arg) {
8015 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
8016 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8020 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
8021 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
8022 LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
8023 *handler_ret = handler;
8024 js_invoke_function_1(j_calls->instance_ptr, 36, (uint32_t)(uint32_t)handler_ret);
8026 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
8027 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
8028 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8030 static inline LDKEventsProvider LDKEventsProvider_init (JSValue o) {
8031 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
8032 atomic_init(&calls->refcnt, 1);
8033 calls->instance_ptr = o;
8035 LDKEventsProvider ret = {
8036 .this_arg = (void*) calls,
8037 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
8038 .free = LDKEventsProvider_JCalls_free,
8042 long __attribute__((export_name("TS_LDKEventsProvider_new"))) TS_LDKEventsProvider_new(JSValue o) {
8043 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
8044 *res_ptr = LDKEventsProvider_init(o);
8045 return (long)res_ptr;
8047 void __attribute__((export_name("TS_EventsProvider_process_pending_events"))) TS_EventsProvider_process_pending_events(uint32_t this_arg, uint32_t handler) {
8048 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8049 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8050 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
8051 void* handler_ptr = (void*)(((uintptr_t)handler) & ~1);
8052 CHECK_ACCESS(handler_ptr);
8053 LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
8054 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
8057 typedef struct LDKListen_JCalls {
8058 atomic_size_t refcnt;
8059 uint32_t instance_ptr;
8061 static void LDKListen_JCalls_free(void* this_arg) {
8062 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8063 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8067 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
8068 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8069 LDKu8slice block_var = block;
8070 int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__);
8071 memcpy(block_arr->elems, block_var.data, block_var.datalen);
8072 js_invoke_function_2(j_calls->instance_ptr, 37, (uint32_t)block_arr, (uint32_t)height);
8074 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
8075 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8076 int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8077 memcpy(header_arr->elems, *header, 80);
8078 js_invoke_function_2(j_calls->instance_ptr, 38, (uint32_t)header_arr, (uint32_t)height);
8080 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
8081 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
8082 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8084 static inline LDKListen LDKListen_init (JSValue o) {
8085 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
8086 atomic_init(&calls->refcnt, 1);
8087 calls->instance_ptr = o;
8090 .this_arg = (void*) calls,
8091 .block_connected = block_connected_LDKListen_jcall,
8092 .block_disconnected = block_disconnected_LDKListen_jcall,
8093 .free = LDKListen_JCalls_free,
8097 long __attribute__((export_name("TS_LDKListen_new"))) TS_LDKListen_new(JSValue o) {
8098 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
8099 *res_ptr = LDKListen_init(o);
8100 return (long)res_ptr;
8102 void __attribute__((export_name("TS_Listen_block_connected"))) TS_Listen_block_connected(uint32_t this_arg, int8_tArray block, int32_t height) {
8103 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8104 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8105 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8106 LDKu8slice block_ref;
8107 block_ref.datalen = block->arr_len;
8108 block_ref.data = block->elems /* XXX block leaks */;
8109 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
8112 void __attribute__((export_name("TS_Listen_block_disconnected"))) TS_Listen_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height) {
8113 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8114 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8115 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8116 unsigned char header_arr[80];
8117 CHECK(header->arr_len == 80);
8118 memcpy(header_arr, header->elems, 80); FREE(header);
8119 unsigned char (*header_ref)[80] = &header_arr;
8120 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
8123 typedef struct LDKConfirm_JCalls {
8124 atomic_size_t refcnt;
8125 uint32_t instance_ptr;
8126 } LDKConfirm_JCalls;
8127 static void LDKConfirm_JCalls_free(void* this_arg) {
8128 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8129 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8133 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
8134 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8135 int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8136 memcpy(header_arr->elems, *header, 80);
8137 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
8138 uint32_tArray txdata_arr = NULL;
8139 txdata_arr = init_uint32_tArray(txdata_var.datalen, __LINE__);
8140 uint32_t *txdata_arr_ptr = (uint32_t*)(((uint8_t*)txdata_arr) + 4);
8141 for (size_t c = 0; c < txdata_var.datalen; c++) {
8142 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
8143 *txdata_conv_28_conv = txdata_var.data[c];
8144 txdata_arr_ptr[c] = ((uint32_t)txdata_conv_28_conv);
8147 FREE(txdata_var.data);
8148 js_invoke_function_3(j_calls->instance_ptr, 39, (uint32_t)header_arr, (uint32_t)txdata_arr, (uint32_t)height);
8150 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
8151 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8152 int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
8153 memcpy(txid_arr->elems, *txid, 32);
8154 js_invoke_function_1(j_calls->instance_ptr, 40, (uint32_t)txid_arr);
8156 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
8157 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8158 int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8159 memcpy(header_arr->elems, *header, 80);
8160 js_invoke_function_2(j_calls->instance_ptr, 41, (uint32_t)header_arr, (uint32_t)height);
8162 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
8163 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8164 ptrArray ret = (ptrArray)js_invoke_function_0(j_calls->instance_ptr, 42);
8165 LDKCVec_TxidZ ret_constr;
8166 ret_constr.datalen = ret->arr_len;
8167 if (ret_constr.datalen > 0)
8168 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
8170 ret_constr.data = NULL;
8171 int8_tArray* ret_vals = (void*) ret->elems /* XXX ret leaks */;
8172 for (size_t m = 0; m < ret_constr.datalen; m++) {
8173 int8_tArray ret_conv_12 = ret_vals[m];
8174 LDKThirtyTwoBytes ret_conv_12_ref;
8175 CHECK(ret_conv_12->arr_len == 32);
8176 memcpy(ret_conv_12_ref.data, ret_conv_12->elems, 32); FREE(ret_conv_12);
8177 ret_constr.data[m] = ret_conv_12_ref;
8181 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
8182 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
8183 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8185 static inline LDKConfirm LDKConfirm_init (JSValue o) {
8186 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
8187 atomic_init(&calls->refcnt, 1);
8188 calls->instance_ptr = o;
8191 .this_arg = (void*) calls,
8192 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
8193 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
8194 .best_block_updated = best_block_updated_LDKConfirm_jcall,
8195 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
8196 .free = LDKConfirm_JCalls_free,
8200 long __attribute__((export_name("TS_LDKConfirm_new"))) TS_LDKConfirm_new(JSValue o) {
8201 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
8202 *res_ptr = LDKConfirm_init(o);
8203 return (long)res_ptr;
8205 void __attribute__((export_name("TS_Confirm_transactions_confirmed"))) TS_Confirm_transactions_confirmed(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
8206 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8207 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8208 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8209 unsigned char header_arr[80];
8210 CHECK(header->arr_len == 80);
8211 memcpy(header_arr, header->elems, 80); FREE(header);
8212 unsigned char (*header_ref)[80] = &header_arr;
8213 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
8214 txdata_constr.datalen = txdata->arr_len;
8215 if (txdata_constr.datalen > 0)
8216 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8218 txdata_constr.data = NULL;
8219 uint32_t* txdata_vals = txdata->elems /* XXX txdata leaks */;
8220 for (size_t c = 0; c < txdata_constr.datalen; c++) {
8221 uint32_t txdata_conv_28 = txdata_vals[c];
8222 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
8223 CHECK_ACCESS(txdata_conv_28_ptr);
8224 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
8225 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
8226 txdata_constr.data[c] = txdata_conv_28_conv;
8228 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
8231 void __attribute__((export_name("TS_Confirm_transaction_unconfirmed"))) TS_Confirm_transaction_unconfirmed(uint32_t this_arg, int8_tArray txid) {
8232 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8233 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8234 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8235 unsigned char txid_arr[32];
8236 CHECK(txid->arr_len == 32);
8237 memcpy(txid_arr, txid->elems, 32); FREE(txid);
8238 unsigned char (*txid_ref)[32] = &txid_arr;
8239 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
8242 void __attribute__((export_name("TS_Confirm_best_block_updated"))) TS_Confirm_best_block_updated(uint32_t this_arg, int8_tArray header, int32_t height) {
8243 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8244 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8245 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8246 unsigned char header_arr[80];
8247 CHECK(header->arr_len == 80);
8248 memcpy(header_arr, header->elems, 80); FREE(header);
8249 unsigned char (*header_ref)[80] = &header_arr;
8250 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
8253 ptrArray __attribute__((export_name("TS_Confirm_get_relevant_txids"))) TS_Confirm_get_relevant_txids(uint32_t this_arg) {
8254 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8255 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8256 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8257 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
8258 ptrArray ret_arr = NULL;
8259 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
8260 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
8261 for (size_t m = 0; m < ret_var.datalen; m++) {
8262 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
8263 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
8264 ret_arr_ptr[m] = ret_conv_12_arr;
8271 typedef struct LDKPersist_JCalls {
8272 atomic_size_t refcnt;
8273 uint32_t instance_ptr;
8274 } LDKPersist_JCalls;
8275 static void LDKPersist_JCalls_free(void* this_arg) {
8276 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8277 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8281 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
8282 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8283 LDKOutPoint channel_id_var = channel_id;
8284 uint32_t channel_id_ref = 0;
8285 CHECK((((uintptr_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8286 CHECK((((uintptr_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8287 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
8288 channel_id_ref = (uintptr_t)channel_id_var.inner;
8289 if (channel_id_var.is_owned) {
8290 channel_id_ref |= 1;
8292 LDKChannelMonitor data_var = *data;
8293 uint32_t data_ref = 0;
8294 data_var = ChannelMonitor_clone(&data_var);
8295 CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8296 CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8297 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
8298 data_ref = (uintptr_t)data_var.inner;
8299 if (data_var.is_owned) {
8302 LDKMonitorUpdateId update_id_var = update_id;
8303 uint32_t update_id_ref = 0;
8304 CHECK((((uintptr_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8305 CHECK((((uintptr_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8306 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
8307 update_id_ref = (uintptr_t)update_id_var.inner;
8308 if (update_id_var.is_owned) {
8311 uint32_t ret = js_invoke_function_3(j_calls->instance_ptr, 43, (uint32_t)channel_id_ref, (uint32_t)data_ref, (uint32_t)update_id_ref);
8312 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
8313 CHECK_ACCESS(ret_ptr);
8314 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
8318 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
8319 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8320 LDKOutPoint channel_id_var = channel_id;
8321 uint32_t channel_id_ref = 0;
8322 CHECK((((uintptr_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8323 CHECK((((uintptr_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8324 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
8325 channel_id_ref = (uintptr_t)channel_id_var.inner;
8326 if (channel_id_var.is_owned) {
8327 channel_id_ref |= 1;
8329 LDKChannelMonitorUpdate update_var = *update;
8330 uint32_t update_ref = 0;
8331 if ((uintptr_t)update_var.inner > 4096) {
8332 update_var = ChannelMonitorUpdate_clone(&update_var);
8333 CHECK((((uintptr_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8334 CHECK((((uintptr_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8335 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
8336 update_ref = (uintptr_t)update_var.inner;
8337 if (update_var.is_owned) {
8341 LDKChannelMonitor data_var = *data;
8342 uint32_t data_ref = 0;
8343 data_var = ChannelMonitor_clone(&data_var);
8344 CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8345 CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8346 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
8347 data_ref = (uintptr_t)data_var.inner;
8348 if (data_var.is_owned) {
8351 LDKMonitorUpdateId update_id_var = update_id;
8352 uint32_t update_id_ref = 0;
8353 CHECK((((uintptr_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8354 CHECK((((uintptr_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8355 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
8356 update_id_ref = (uintptr_t)update_id_var.inner;
8357 if (update_id_var.is_owned) {
8360 uint32_t ret = js_invoke_function_4(j_calls->instance_ptr, 44, (uint32_t)channel_id_ref, (uint32_t)update_ref, (uint32_t)data_ref, (uint32_t)update_id_ref);
8361 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
8362 CHECK_ACCESS(ret_ptr);
8363 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
8367 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
8368 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
8369 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8371 static inline LDKPersist LDKPersist_init (JSValue o) {
8372 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
8373 atomic_init(&calls->refcnt, 1);
8374 calls->instance_ptr = o;
8377 .this_arg = (void*) calls,
8378 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
8379 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
8380 .free = LDKPersist_JCalls_free,
8384 long __attribute__((export_name("TS_LDKPersist_new"))) TS_LDKPersist_new(JSValue o) {
8385 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
8386 *res_ptr = LDKPersist_init(o);
8387 return (long)res_ptr;
8389 uint32_t __attribute__((export_name("TS_Persist_persist_new_channel"))) TS_Persist_persist_new_channel(uint32_t this_arg, uint32_t channel_id, uint32_t data, uint32_t update_id) {
8390 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8391 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8392 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
8393 LDKOutPoint channel_id_conv;
8394 channel_id_conv.inner = (void*)(channel_id & (~1));
8395 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
8396 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
8397 channel_id_conv = OutPoint_clone(&channel_id_conv);
8398 LDKChannelMonitor data_conv;
8399 data_conv.inner = (void*)(data & (~1));
8400 data_conv.is_owned = false;
8401 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
8402 LDKMonitorUpdateId update_id_conv;
8403 update_id_conv.inner = (void*)(update_id & (~1));
8404 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
8405 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
8406 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
8407 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
8408 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv);
8409 return (uint32_t)ret_conv;
8412 uint32_t __attribute__((export_name("TS_Persist_update_persisted_channel"))) TS_Persist_update_persisted_channel(uint32_t this_arg, uint32_t channel_id, uint32_t update, uint32_t data, uint32_t update_id) {
8413 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8414 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8415 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
8416 LDKOutPoint channel_id_conv;
8417 channel_id_conv.inner = (void*)(channel_id & (~1));
8418 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
8419 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
8420 channel_id_conv = OutPoint_clone(&channel_id_conv);
8421 LDKChannelMonitorUpdate update_conv;
8422 update_conv.inner = (void*)(update & (~1));
8423 update_conv.is_owned = false;
8424 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
8425 LDKChannelMonitor data_conv;
8426 data_conv.inner = (void*)(data & (~1));
8427 data_conv.is_owned = false;
8428 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
8429 LDKMonitorUpdateId update_id_conv;
8430 update_id_conv.inner = (void*)(update_id & (~1));
8431 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
8432 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
8433 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
8434 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
8435 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv);
8436 return (uint32_t)ret_conv;
8439 typedef struct LDKChannelMessageHandler_JCalls {
8440 atomic_size_t refcnt;
8441 uint32_t instance_ptr;
8442 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
8443 } LDKChannelMessageHandler_JCalls;
8444 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
8445 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8446 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8450 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
8451 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8452 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8453 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8454 LDKInitFeatures their_features_var = their_features;
8455 uint32_t their_features_ref = 0;
8456 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8457 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8458 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
8459 their_features_ref = (uintptr_t)their_features_var.inner;
8460 if (their_features_var.is_owned) {
8461 their_features_ref |= 1;
8463 LDKOpenChannel msg_var = *msg;
8464 uint32_t msg_ref = 0;
8465 msg_var = OpenChannel_clone(&msg_var);
8466 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8467 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8468 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8469 msg_ref = (uintptr_t)msg_var.inner;
8470 if (msg_var.is_owned) {
8473 js_invoke_function_3(j_calls->instance_ptr, 45, (uint32_t)their_node_id_arr, (uint32_t)their_features_ref, (uint32_t)msg_ref);
8475 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
8476 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8477 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8478 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8479 LDKInitFeatures their_features_var = their_features;
8480 uint32_t their_features_ref = 0;
8481 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8482 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8483 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
8484 their_features_ref = (uintptr_t)their_features_var.inner;
8485 if (their_features_var.is_owned) {
8486 their_features_ref |= 1;
8488 LDKAcceptChannel msg_var = *msg;
8489 uint32_t msg_ref = 0;
8490 msg_var = AcceptChannel_clone(&msg_var);
8491 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8492 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8493 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8494 msg_ref = (uintptr_t)msg_var.inner;
8495 if (msg_var.is_owned) {
8498 js_invoke_function_3(j_calls->instance_ptr, 46, (uint32_t)their_node_id_arr, (uint32_t)their_features_ref, (uint32_t)msg_ref);
8500 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
8501 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8502 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8503 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8504 LDKFundingCreated msg_var = *msg;
8505 uint32_t msg_ref = 0;
8506 msg_var = FundingCreated_clone(&msg_var);
8507 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8508 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8509 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8510 msg_ref = (uintptr_t)msg_var.inner;
8511 if (msg_var.is_owned) {
8514 js_invoke_function_2(j_calls->instance_ptr, 47, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8516 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
8517 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8518 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8519 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8520 LDKFundingSigned msg_var = *msg;
8521 uint32_t msg_ref = 0;
8522 msg_var = FundingSigned_clone(&msg_var);
8523 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8524 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8525 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8526 msg_ref = (uintptr_t)msg_var.inner;
8527 if (msg_var.is_owned) {
8530 js_invoke_function_2(j_calls->instance_ptr, 48, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8532 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
8533 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8534 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8535 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8536 LDKFundingLocked msg_var = *msg;
8537 uint32_t msg_ref = 0;
8538 msg_var = FundingLocked_clone(&msg_var);
8539 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8540 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8541 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8542 msg_ref = (uintptr_t)msg_var.inner;
8543 if (msg_var.is_owned) {
8546 js_invoke_function_2(j_calls->instance_ptr, 49, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8548 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
8549 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8550 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8551 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8552 LDKInitFeatures their_features_var = *their_features;
8553 uint32_t their_features_ref = 0;
8554 their_features_var = InitFeatures_clone(&their_features_var);
8555 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8556 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8557 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
8558 their_features_ref = (uintptr_t)their_features_var.inner;
8559 if (their_features_var.is_owned) {
8560 their_features_ref |= 1;
8562 LDKShutdown msg_var = *msg;
8563 uint32_t msg_ref = 0;
8564 msg_var = Shutdown_clone(&msg_var);
8565 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8566 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8567 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8568 msg_ref = (uintptr_t)msg_var.inner;
8569 if (msg_var.is_owned) {
8572 js_invoke_function_3(j_calls->instance_ptr, 50, (uint32_t)their_node_id_arr, (uint32_t)their_features_ref, (uint32_t)msg_ref);
8574 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
8575 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8576 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8577 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8578 LDKClosingSigned msg_var = *msg;
8579 uint32_t msg_ref = 0;
8580 msg_var = ClosingSigned_clone(&msg_var);
8581 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8582 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8583 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8584 msg_ref = (uintptr_t)msg_var.inner;
8585 if (msg_var.is_owned) {
8588 js_invoke_function_2(j_calls->instance_ptr, 51, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8590 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
8591 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8592 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8593 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8594 LDKUpdateAddHTLC msg_var = *msg;
8595 uint32_t msg_ref = 0;
8596 msg_var = UpdateAddHTLC_clone(&msg_var);
8597 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8598 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8599 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8600 msg_ref = (uintptr_t)msg_var.inner;
8601 if (msg_var.is_owned) {
8604 js_invoke_function_2(j_calls->instance_ptr, 52, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8606 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
8607 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8608 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8609 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8610 LDKUpdateFulfillHTLC msg_var = *msg;
8611 uint32_t msg_ref = 0;
8612 msg_var = UpdateFulfillHTLC_clone(&msg_var);
8613 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8614 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8615 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8616 msg_ref = (uintptr_t)msg_var.inner;
8617 if (msg_var.is_owned) {
8620 js_invoke_function_2(j_calls->instance_ptr, 53, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8622 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
8623 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8624 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8625 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8626 LDKUpdateFailHTLC msg_var = *msg;
8627 uint32_t msg_ref = 0;
8628 msg_var = UpdateFailHTLC_clone(&msg_var);
8629 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8630 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8631 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8632 msg_ref = (uintptr_t)msg_var.inner;
8633 if (msg_var.is_owned) {
8636 js_invoke_function_2(j_calls->instance_ptr, 54, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8638 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
8639 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8640 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8641 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8642 LDKUpdateFailMalformedHTLC msg_var = *msg;
8643 uint32_t msg_ref = 0;
8644 msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
8645 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8646 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8647 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8648 msg_ref = (uintptr_t)msg_var.inner;
8649 if (msg_var.is_owned) {
8652 js_invoke_function_2(j_calls->instance_ptr, 55, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8654 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
8655 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8656 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8657 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8658 LDKCommitmentSigned msg_var = *msg;
8659 uint32_t msg_ref = 0;
8660 msg_var = CommitmentSigned_clone(&msg_var);
8661 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8662 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8663 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8664 msg_ref = (uintptr_t)msg_var.inner;
8665 if (msg_var.is_owned) {
8668 js_invoke_function_2(j_calls->instance_ptr, 56, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8670 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
8671 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8672 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8673 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8674 LDKRevokeAndACK msg_var = *msg;
8675 uint32_t msg_ref = 0;
8676 msg_var = RevokeAndACK_clone(&msg_var);
8677 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8678 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8679 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8680 msg_ref = (uintptr_t)msg_var.inner;
8681 if (msg_var.is_owned) {
8684 js_invoke_function_2(j_calls->instance_ptr, 57, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8686 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
8687 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8688 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8689 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8690 LDKUpdateFee msg_var = *msg;
8691 uint32_t msg_ref = 0;
8692 msg_var = UpdateFee_clone(&msg_var);
8693 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8694 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8695 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8696 msg_ref = (uintptr_t)msg_var.inner;
8697 if (msg_var.is_owned) {
8700 js_invoke_function_2(j_calls->instance_ptr, 58, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8702 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
8703 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8704 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8705 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8706 LDKAnnouncementSignatures msg_var = *msg;
8707 uint32_t msg_ref = 0;
8708 msg_var = AnnouncementSignatures_clone(&msg_var);
8709 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8710 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8711 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8712 msg_ref = (uintptr_t)msg_var.inner;
8713 if (msg_var.is_owned) {
8716 js_invoke_function_2(j_calls->instance_ptr, 59, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8718 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
8719 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8720 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8721 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8722 js_invoke_function_2(j_calls->instance_ptr, 60, (uint32_t)their_node_id_arr, (uint32_t)no_connection_possible);
8724 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
8725 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8726 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8727 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8728 LDKInit msg_var = *msg;
8729 uint32_t msg_ref = 0;
8730 msg_var = Init_clone(&msg_var);
8731 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8732 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8733 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8734 msg_ref = (uintptr_t)msg_var.inner;
8735 if (msg_var.is_owned) {
8738 js_invoke_function_2(j_calls->instance_ptr, 61, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8740 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
8741 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8742 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8743 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8744 LDKChannelReestablish msg_var = *msg;
8745 uint32_t msg_ref = 0;
8746 msg_var = ChannelReestablish_clone(&msg_var);
8747 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8748 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8749 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8750 msg_ref = (uintptr_t)msg_var.inner;
8751 if (msg_var.is_owned) {
8754 js_invoke_function_2(j_calls->instance_ptr, 62, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8756 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
8757 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8758 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8759 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8760 LDKChannelUpdate msg_var = *msg;
8761 uint32_t msg_ref = 0;
8762 msg_var = ChannelUpdate_clone(&msg_var);
8763 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8764 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8765 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8766 msg_ref = (uintptr_t)msg_var.inner;
8767 if (msg_var.is_owned) {
8770 js_invoke_function_2(j_calls->instance_ptr, 63, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8772 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
8773 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8774 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8775 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8776 LDKErrorMessage msg_var = *msg;
8777 uint32_t msg_ref = 0;
8778 msg_var = ErrorMessage_clone(&msg_var);
8779 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8780 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8781 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8782 msg_ref = (uintptr_t)msg_var.inner;
8783 if (msg_var.is_owned) {
8786 js_invoke_function_2(j_calls->instance_ptr, 64, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8788 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
8789 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
8790 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8791 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
8793 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
8794 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
8795 atomic_init(&calls->refcnt, 1);
8796 calls->instance_ptr = o;
8798 LDKChannelMessageHandler ret = {
8799 .this_arg = (void*) calls,
8800 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
8801 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
8802 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
8803 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
8804 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
8805 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
8806 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
8807 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
8808 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
8809 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
8810 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
8811 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
8812 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
8813 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
8814 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
8815 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
8816 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
8817 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
8818 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
8819 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
8820 .free = LDKChannelMessageHandler_JCalls_free,
8821 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
8823 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
8826 long __attribute__((export_name("TS_LDKChannelMessageHandler_new"))) TS_LDKChannelMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
8827 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
8828 *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
8829 return (long)res_ptr;
8831 void __attribute__((export_name("TS_ChannelMessageHandler_handle_open_channel"))) TS_ChannelMessageHandler_handle_open_channel(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
8832 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8833 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8834 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8835 LDKPublicKey their_node_id_ref;
8836 CHECK(their_node_id->arr_len == 33);
8837 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8838 LDKInitFeatures their_features_conv;
8839 their_features_conv.inner = (void*)(their_features & (~1));
8840 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
8841 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
8842 their_features_conv = InitFeatures_clone(&their_features_conv);
8843 LDKOpenChannel msg_conv;
8844 msg_conv.inner = (void*)(msg & (~1));
8845 msg_conv.is_owned = false;
8846 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8847 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
8850 void __attribute__((export_name("TS_ChannelMessageHandler_handle_accept_channel"))) TS_ChannelMessageHandler_handle_accept_channel(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
8851 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8852 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8853 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8854 LDKPublicKey their_node_id_ref;
8855 CHECK(their_node_id->arr_len == 33);
8856 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8857 LDKInitFeatures their_features_conv;
8858 their_features_conv.inner = (void*)(their_features & (~1));
8859 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
8860 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
8861 their_features_conv = InitFeatures_clone(&their_features_conv);
8862 LDKAcceptChannel msg_conv;
8863 msg_conv.inner = (void*)(msg & (~1));
8864 msg_conv.is_owned = false;
8865 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8866 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
8869 void __attribute__((export_name("TS_ChannelMessageHandler_handle_funding_created"))) TS_ChannelMessageHandler_handle_funding_created(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
8870 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8871 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8872 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8873 LDKPublicKey their_node_id_ref;
8874 CHECK(their_node_id->arr_len == 33);
8875 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8876 LDKFundingCreated msg_conv;
8877 msg_conv.inner = (void*)(msg & (~1));
8878 msg_conv.is_owned = false;
8879 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8880 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8883 void __attribute__((export_name("TS_ChannelMessageHandler_handle_funding_signed"))) TS_ChannelMessageHandler_handle_funding_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
8884 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8885 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8886 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8887 LDKPublicKey their_node_id_ref;
8888 CHECK(their_node_id->arr_len == 33);
8889 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8890 LDKFundingSigned msg_conv;
8891 msg_conv.inner = (void*)(msg & (~1));
8892 msg_conv.is_owned = false;
8893 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8894 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8897 void __attribute__((export_name("TS_ChannelMessageHandler_handle_funding_locked"))) TS_ChannelMessageHandler_handle_funding_locked(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
8898 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8899 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8900 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8901 LDKPublicKey their_node_id_ref;
8902 CHECK(their_node_id->arr_len == 33);
8903 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8904 LDKFundingLocked msg_conv;
8905 msg_conv.inner = (void*)(msg & (~1));
8906 msg_conv.is_owned = false;
8907 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8908 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8911 void __attribute__((export_name("TS_ChannelMessageHandler_handle_shutdown"))) TS_ChannelMessageHandler_handle_shutdown(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
8912 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8913 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8914 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8915 LDKPublicKey their_node_id_ref;
8916 CHECK(their_node_id->arr_len == 33);
8917 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8918 LDKInitFeatures their_features_conv;
8919 their_features_conv.inner = (void*)(their_features & (~1));
8920 their_features_conv.is_owned = false;
8921 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
8922 LDKShutdown msg_conv;
8923 msg_conv.inner = (void*)(msg & (~1));
8924 msg_conv.is_owned = false;
8925 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8926 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
8929 void __attribute__((export_name("TS_ChannelMessageHandler_handle_closing_signed"))) TS_ChannelMessageHandler_handle_closing_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
8930 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8931 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8932 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8933 LDKPublicKey their_node_id_ref;
8934 CHECK(their_node_id->arr_len == 33);
8935 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8936 LDKClosingSigned msg_conv;
8937 msg_conv.inner = (void*)(msg & (~1));
8938 msg_conv.is_owned = false;
8939 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8940 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8943 void __attribute__((export_name("TS_ChannelMessageHandler_handle_update_add_htlc"))) TS_ChannelMessageHandler_handle_update_add_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
8944 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8945 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8946 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8947 LDKPublicKey their_node_id_ref;
8948 CHECK(their_node_id->arr_len == 33);
8949 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8950 LDKUpdateAddHTLC msg_conv;
8951 msg_conv.inner = (void*)(msg & (~1));
8952 msg_conv.is_owned = false;
8953 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8954 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8957 void __attribute__((export_name("TS_ChannelMessageHandler_handle_update_fulfill_htlc"))) TS_ChannelMessageHandler_handle_update_fulfill_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
8958 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8959 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8960 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8961 LDKPublicKey their_node_id_ref;
8962 CHECK(their_node_id->arr_len == 33);
8963 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8964 LDKUpdateFulfillHTLC msg_conv;
8965 msg_conv.inner = (void*)(msg & (~1));
8966 msg_conv.is_owned = false;
8967 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8968 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8971 void __attribute__((export_name("TS_ChannelMessageHandler_handle_update_fail_htlc"))) TS_ChannelMessageHandler_handle_update_fail_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
8972 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8973 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8974 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8975 LDKPublicKey their_node_id_ref;
8976 CHECK(their_node_id->arr_len == 33);
8977 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8978 LDKUpdateFailHTLC msg_conv;
8979 msg_conv.inner = (void*)(msg & (~1));
8980 msg_conv.is_owned = false;
8981 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8982 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8985 void __attribute__((export_name("TS_ChannelMessageHandler_handle_update_fail_malformed_htlc"))) TS_ChannelMessageHandler_handle_update_fail_malformed_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
8986 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8987 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8988 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8989 LDKPublicKey their_node_id_ref;
8990 CHECK(their_node_id->arr_len == 33);
8991 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8992 LDKUpdateFailMalformedHTLC msg_conv;
8993 msg_conv.inner = (void*)(msg & (~1));
8994 msg_conv.is_owned = false;
8995 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8996 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8999 void __attribute__((export_name("TS_ChannelMessageHandler_handle_commitment_signed"))) TS_ChannelMessageHandler_handle_commitment_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
9000 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9001 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9002 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9003 LDKPublicKey their_node_id_ref;
9004 CHECK(their_node_id->arr_len == 33);
9005 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9006 LDKCommitmentSigned msg_conv;
9007 msg_conv.inner = (void*)(msg & (~1));
9008 msg_conv.is_owned = false;
9009 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9010 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9013 void __attribute__((export_name("TS_ChannelMessageHandler_handle_revoke_and_ack"))) TS_ChannelMessageHandler_handle_revoke_and_ack(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
9014 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9015 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9016 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9017 LDKPublicKey their_node_id_ref;
9018 CHECK(their_node_id->arr_len == 33);
9019 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9020 LDKRevokeAndACK msg_conv;
9021 msg_conv.inner = (void*)(msg & (~1));
9022 msg_conv.is_owned = false;
9023 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9024 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9027 void __attribute__((export_name("TS_ChannelMessageHandler_handle_update_fee"))) TS_ChannelMessageHandler_handle_update_fee(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
9028 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9029 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9030 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9031 LDKPublicKey their_node_id_ref;
9032 CHECK(their_node_id->arr_len == 33);
9033 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9034 LDKUpdateFee msg_conv;
9035 msg_conv.inner = (void*)(msg & (~1));
9036 msg_conv.is_owned = false;
9037 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9038 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9041 void __attribute__((export_name("TS_ChannelMessageHandler_handle_announcement_signatures"))) TS_ChannelMessageHandler_handle_announcement_signatures(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
9042 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9043 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9044 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9045 LDKPublicKey their_node_id_ref;
9046 CHECK(their_node_id->arr_len == 33);
9047 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9048 LDKAnnouncementSignatures msg_conv;
9049 msg_conv.inner = (void*)(msg & (~1));
9050 msg_conv.is_owned = false;
9051 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9052 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9055 void __attribute__((export_name("TS_ChannelMessageHandler_peer_disconnected"))) TS_ChannelMessageHandler_peer_disconnected(uint32_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
9056 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9057 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9058 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9059 LDKPublicKey their_node_id_ref;
9060 CHECK(their_node_id->arr_len == 33);
9061 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9062 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
9065 void __attribute__((export_name("TS_ChannelMessageHandler_peer_connected"))) TS_ChannelMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
9066 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9067 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9068 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9069 LDKPublicKey their_node_id_ref;
9070 CHECK(their_node_id->arr_len == 33);
9071 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9073 msg_conv.inner = (void*)(msg & (~1));
9074 msg_conv.is_owned = false;
9075 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9076 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9079 void __attribute__((export_name("TS_ChannelMessageHandler_handle_channel_reestablish"))) TS_ChannelMessageHandler_handle_channel_reestablish(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
9080 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9081 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9082 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9083 LDKPublicKey their_node_id_ref;
9084 CHECK(their_node_id->arr_len == 33);
9085 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9086 LDKChannelReestablish msg_conv;
9087 msg_conv.inner = (void*)(msg & (~1));
9088 msg_conv.is_owned = false;
9089 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9090 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9093 void __attribute__((export_name("TS_ChannelMessageHandler_handle_channel_update"))) TS_ChannelMessageHandler_handle_channel_update(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
9094 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9095 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9096 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9097 LDKPublicKey their_node_id_ref;
9098 CHECK(their_node_id->arr_len == 33);
9099 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9100 LDKChannelUpdate msg_conv;
9101 msg_conv.inner = (void*)(msg & (~1));
9102 msg_conv.is_owned = false;
9103 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9104 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9107 void __attribute__((export_name("TS_ChannelMessageHandler_handle_error"))) TS_ChannelMessageHandler_handle_error(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
9108 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9109 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9110 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9111 LDKPublicKey their_node_id_ref;
9112 CHECK(their_node_id->arr_len == 33);
9113 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9114 LDKErrorMessage msg_conv;
9115 msg_conv.inner = (void*)(msg & (~1));
9116 msg_conv.is_owned = false;
9117 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9118 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9121 typedef struct LDKRoutingMessageHandler_JCalls {
9122 atomic_size_t refcnt;
9123 uint32_t instance_ptr;
9124 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
9125 } LDKRoutingMessageHandler_JCalls;
9126 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
9127 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9128 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9132 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
9133 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9134 LDKNodeAnnouncement msg_var = *msg;
9135 uint32_t msg_ref = 0;
9136 msg_var = NodeAnnouncement_clone(&msg_var);
9137 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9138 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9139 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9140 msg_ref = (uintptr_t)msg_var.inner;
9141 if (msg_var.is_owned) {
9144 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 65, (uint32_t)msg_ref);
9145 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9146 CHECK_ACCESS(ret_ptr);
9147 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9151 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
9152 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9153 LDKChannelAnnouncement msg_var = *msg;
9154 uint32_t msg_ref = 0;
9155 msg_var = ChannelAnnouncement_clone(&msg_var);
9156 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9157 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9158 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9159 msg_ref = (uintptr_t)msg_var.inner;
9160 if (msg_var.is_owned) {
9163 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 66, (uint32_t)msg_ref);
9164 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9165 CHECK_ACCESS(ret_ptr);
9166 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9170 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
9171 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9172 LDKChannelUpdate msg_var = *msg;
9173 uint32_t msg_ref = 0;
9174 msg_var = ChannelUpdate_clone(&msg_var);
9175 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9176 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9177 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9178 msg_ref = (uintptr_t)msg_var.inner;
9179 if (msg_var.is_owned) {
9182 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 67, (uint32_t)msg_ref);
9183 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9184 CHECK_ACCESS(ret_ptr);
9185 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9189 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
9190 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9191 uint32_tArray ret = (uint32_tArray)js_invoke_function_2(j_calls->instance_ptr, 68, (uint32_t)starting_point, (uint32_t)batch_amount);
9192 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
9193 ret_constr.datalen = ret->arr_len;
9194 if (ret_constr.datalen > 0)
9195 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
9197 ret_constr.data = NULL;
9198 uint32_t* ret_vals = ret->elems /* XXX ret leaks */;
9199 for (size_t h = 0; h < ret_constr.datalen; h++) {
9200 uint32_t ret_conv_59 = ret_vals[h];
9201 void* ret_conv_59_ptr = (void*)(((uintptr_t)ret_conv_59) & ~1);
9202 CHECK_ACCESS(ret_conv_59_ptr);
9203 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ret_conv_59_ptr);
9204 FREE((void*)ret_conv_59);
9205 ret_constr.data[h] = ret_conv_59_conv;
9209 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
9210 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9211 int8_tArray starting_point_arr = init_int8_tArray(33, __LINE__);
9212 memcpy(starting_point_arr->elems, starting_point.compressed_form, 33);
9213 uint32_tArray ret = (uint32_tArray)js_invoke_function_2(j_calls->instance_ptr, 69, (uint32_t)starting_point_arr, (uint32_t)batch_amount);
9214 LDKCVec_NodeAnnouncementZ ret_constr;
9215 ret_constr.datalen = ret->arr_len;
9216 if (ret_constr.datalen > 0)
9217 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
9219 ret_constr.data = NULL;
9220 uint32_t* ret_vals = ret->elems /* XXX ret leaks */;
9221 for (size_t s = 0; s < ret_constr.datalen; s++) {
9222 uint32_t ret_conv_18 = ret_vals[s];
9223 LDKNodeAnnouncement ret_conv_18_conv;
9224 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
9225 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
9226 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_conv);
9227 ret_constr.data[s] = ret_conv_18_conv;
9231 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
9232 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9233 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9234 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9235 LDKInit init_var = *init;
9236 uint32_t init_ref = 0;
9237 init_var = Init_clone(&init_var);
9238 CHECK((((uintptr_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9239 CHECK((((uintptr_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9240 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
9241 init_ref = (uintptr_t)init_var.inner;
9242 if (init_var.is_owned) {
9245 js_invoke_function_2(j_calls->instance_ptr, 70, (uint32_t)their_node_id_arr, (uint32_t)init_ref);
9247 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
9248 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9249 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9250 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9251 LDKReplyChannelRange msg_var = msg;
9252 uint32_t msg_ref = 0;
9253 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9254 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9255 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9256 msg_ref = (uintptr_t)msg_var.inner;
9257 if (msg_var.is_owned) {
9260 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 71, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9261 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9262 CHECK_ACCESS(ret_ptr);
9263 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9267 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
9268 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9269 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9270 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9271 LDKReplyShortChannelIdsEnd msg_var = msg;
9272 uint32_t msg_ref = 0;
9273 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9274 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9275 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9276 msg_ref = (uintptr_t)msg_var.inner;
9277 if (msg_var.is_owned) {
9280 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 72, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9281 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9282 CHECK_ACCESS(ret_ptr);
9283 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9287 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
9288 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9289 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9290 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9291 LDKQueryChannelRange msg_var = msg;
9292 uint32_t msg_ref = 0;
9293 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9294 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9295 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9296 msg_ref = (uintptr_t)msg_var.inner;
9297 if (msg_var.is_owned) {
9300 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 73, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9301 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9302 CHECK_ACCESS(ret_ptr);
9303 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9307 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
9308 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9309 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9310 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9311 LDKQueryShortChannelIds msg_var = msg;
9312 uint32_t msg_ref = 0;
9313 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9314 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9315 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9316 msg_ref = (uintptr_t)msg_var.inner;
9317 if (msg_var.is_owned) {
9320 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 74, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9321 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9322 CHECK_ACCESS(ret_ptr);
9323 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9327 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
9328 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
9329 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9330 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
9332 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
9333 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
9334 atomic_init(&calls->refcnt, 1);
9335 calls->instance_ptr = o;
9337 LDKRoutingMessageHandler ret = {
9338 .this_arg = (void*) calls,
9339 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
9340 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
9341 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
9342 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
9343 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
9344 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
9345 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
9346 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
9347 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
9348 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
9349 .free = LDKRoutingMessageHandler_JCalls_free,
9350 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
9352 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
9355 long __attribute__((export_name("TS_LDKRoutingMessageHandler_new"))) TS_LDKRoutingMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
9356 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
9357 *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
9358 return (long)res_ptr;
9360 uint32_t __attribute__((export_name("TS_RoutingMessageHandler_handle_node_announcement"))) TS_RoutingMessageHandler_handle_node_announcement(uint32_t this_arg, uint32_t msg) {
9361 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9362 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9363 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9364 LDKNodeAnnouncement msg_conv;
9365 msg_conv.inner = (void*)(msg & (~1));
9366 msg_conv.is_owned = false;
9367 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9368 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9369 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
9370 return (uint32_t)ret_conv;
9373 uint32_t __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_announcement"))) TS_RoutingMessageHandler_handle_channel_announcement(uint32_t this_arg, uint32_t msg) {
9374 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9375 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9376 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9377 LDKChannelAnnouncement msg_conv;
9378 msg_conv.inner = (void*)(msg & (~1));
9379 msg_conv.is_owned = false;
9380 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9381 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9382 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
9383 return (uint32_t)ret_conv;
9386 uint32_t __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_update"))) TS_RoutingMessageHandler_handle_channel_update(uint32_t this_arg, uint32_t msg) {
9387 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9388 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9389 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9390 LDKChannelUpdate msg_conv;
9391 msg_conv.inner = (void*)(msg & (~1));
9392 msg_conv.is_owned = false;
9393 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9394 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9395 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
9396 return (uint32_t)ret_conv;
9399 uint32_tArray __attribute__((export_name("TS_RoutingMessageHandler_get_next_channel_announcements"))) TS_RoutingMessageHandler_get_next_channel_announcements(uint32_t this_arg, int64_t starting_point, int8_t batch_amount) {
9400 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9401 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9402 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9403 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
9404 uint32_tArray ret_arr = NULL;
9405 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
9406 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
9407 for (size_t h = 0; h < ret_var.datalen; h++) {
9408 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
9409 *ret_conv_59_conv = ret_var.data[h];
9410 ret_arr_ptr[h] = ((uint32_t)ret_conv_59_conv);
9417 uint32_tArray __attribute__((export_name("TS_RoutingMessageHandler_get_next_node_announcements"))) TS_RoutingMessageHandler_get_next_node_announcements(uint32_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
9418 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9419 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9420 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9421 LDKPublicKey starting_point_ref;
9422 CHECK(starting_point->arr_len == 33);
9423 memcpy(starting_point_ref.compressed_form, starting_point->elems, 33); FREE(starting_point);
9424 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
9425 uint32_tArray ret_arr = NULL;
9426 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
9427 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
9428 for (size_t s = 0; s < ret_var.datalen; s++) {
9429 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
9430 uint32_t ret_conv_18_ref = 0;
9431 CHECK((((uintptr_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9432 CHECK((((uintptr_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9433 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_var);
9434 ret_conv_18_ref = (uintptr_t)ret_conv_18_var.inner;
9435 if (ret_conv_18_var.is_owned) {
9436 ret_conv_18_ref |= 1;
9438 ret_arr_ptr[s] = ret_conv_18_ref;
9445 void __attribute__((export_name("TS_RoutingMessageHandler_sync_routing_table"))) TS_RoutingMessageHandler_sync_routing_table(uint32_t this_arg, int8_tArray their_node_id, uint32_t init) {
9446 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9447 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9448 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9449 LDKPublicKey their_node_id_ref;
9450 CHECK(their_node_id->arr_len == 33);
9451 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9453 init_conv.inner = (void*)(init & (~1));
9454 init_conv.is_owned = false;
9455 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
9456 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
9459 uint32_t __attribute__((export_name("TS_RoutingMessageHandler_handle_reply_channel_range"))) TS_RoutingMessageHandler_handle_reply_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
9460 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9461 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9462 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9463 LDKPublicKey their_node_id_ref;
9464 CHECK(their_node_id->arr_len == 33);
9465 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9466 LDKReplyChannelRange msg_conv;
9467 msg_conv.inner = (void*)(msg & (~1));
9468 msg_conv.is_owned = (msg & 1) || (msg == 0);
9469 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9470 msg_conv = ReplyChannelRange_clone(&msg_conv);
9471 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9472 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9473 return (uint32_t)ret_conv;
9476 uint32_t __attribute__((export_name("TS_RoutingMessageHandler_handle_reply_short_channel_ids_end"))) TS_RoutingMessageHandler_handle_reply_short_channel_ids_end(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
9477 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9478 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9479 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9480 LDKPublicKey their_node_id_ref;
9481 CHECK(their_node_id->arr_len == 33);
9482 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9483 LDKReplyShortChannelIdsEnd msg_conv;
9484 msg_conv.inner = (void*)(msg & (~1));
9485 msg_conv.is_owned = (msg & 1) || (msg == 0);
9486 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9487 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
9488 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9489 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9490 return (uint32_t)ret_conv;
9493 uint32_t __attribute__((export_name("TS_RoutingMessageHandler_handle_query_channel_range"))) TS_RoutingMessageHandler_handle_query_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
9494 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9495 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9496 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9497 LDKPublicKey their_node_id_ref;
9498 CHECK(their_node_id->arr_len == 33);
9499 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9500 LDKQueryChannelRange msg_conv;
9501 msg_conv.inner = (void*)(msg & (~1));
9502 msg_conv.is_owned = (msg & 1) || (msg == 0);
9503 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9504 msg_conv = QueryChannelRange_clone(&msg_conv);
9505 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9506 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9507 return (uint32_t)ret_conv;
9510 uint32_t __attribute__((export_name("TS_RoutingMessageHandler_handle_query_short_channel_ids"))) TS_RoutingMessageHandler_handle_query_short_channel_ids(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
9511 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9512 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9513 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9514 LDKPublicKey their_node_id_ref;
9515 CHECK(their_node_id->arr_len == 33);
9516 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9517 LDKQueryShortChannelIds msg_conv;
9518 msg_conv.inner = (void*)(msg & (~1));
9519 msg_conv.is_owned = (msg & 1) || (msg == 0);
9520 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9521 msg_conv = QueryShortChannelIds_clone(&msg_conv);
9522 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9523 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9524 return (uint32_t)ret_conv;
9527 typedef struct LDKCustomMessageReader_JCalls {
9528 atomic_size_t refcnt;
9529 uint32_t instance_ptr;
9530 } LDKCustomMessageReader_JCalls;
9531 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
9532 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
9533 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9537 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
9538 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
9539 LDKu8slice buffer_var = buffer;
9540 int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
9541 memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
9542 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 75, (uint32_t)message_type, (uint32_t)buffer_arr);
9543 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9544 CHECK_ACCESS(ret_ptr);
9545 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
9549 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
9550 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
9551 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9553 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JSValue o) {
9554 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
9555 atomic_init(&calls->refcnt, 1);
9556 calls->instance_ptr = o;
9558 LDKCustomMessageReader ret = {
9559 .this_arg = (void*) calls,
9560 .read = read_LDKCustomMessageReader_jcall,
9561 .free = LDKCustomMessageReader_JCalls_free,
9565 long __attribute__((export_name("TS_LDKCustomMessageReader_new"))) TS_LDKCustomMessageReader_new(JSValue o) {
9566 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
9567 *res_ptr = LDKCustomMessageReader_init(o);
9568 return (long)res_ptr;
9570 uint32_t __attribute__((export_name("TS_CustomMessageReader_read"))) TS_CustomMessageReader_read(uint32_t this_arg, int16_t message_type, int8_tArray buffer) {
9571 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9572 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9573 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
9574 LDKu8slice buffer_ref;
9575 buffer_ref.datalen = buffer->arr_len;
9576 buffer_ref.data = buffer->elems /* XXX buffer leaks */;
9577 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9578 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
9579 return (uint32_t)ret_conv;
9582 typedef struct LDKCustomMessageHandler_JCalls {
9583 atomic_size_t refcnt;
9584 uint32_t instance_ptr;
9585 LDKCustomMessageReader_JCalls* CustomMessageReader;
9586 } LDKCustomMessageHandler_JCalls;
9587 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
9588 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
9589 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9593 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
9594 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
9595 LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
9597 int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__);
9598 memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
9599 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 76, (uint32_t)(uint32_t)msg_ret, (uint32_t)sender_node_id_arr);
9600 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9601 CHECK_ACCESS(ret_ptr);
9602 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9606 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
9607 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
9608 uint32_tArray ret = (uint32_tArray)js_invoke_function_0(j_calls->instance_ptr, 77);
9609 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
9610 ret_constr.datalen = ret->arr_len;
9611 if (ret_constr.datalen > 0)
9612 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
9614 ret_constr.data = NULL;
9615 uint32_t* ret_vals = ret->elems /* XXX ret leaks */;
9616 for (size_t z = 0; z < ret_constr.datalen; z++) {
9617 uint32_t ret_conv_25 = ret_vals[z];
9618 void* ret_conv_25_ptr = (void*)(((uintptr_t)ret_conv_25) & ~1);
9619 CHECK_ACCESS(ret_conv_25_ptr);
9620 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
9621 FREE((void*)ret_conv_25);
9622 ret_constr.data[z] = ret_conv_25_conv;
9626 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
9627 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
9628 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9629 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
9631 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JSValue o, JSValue CustomMessageReader) {
9632 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
9633 atomic_init(&calls->refcnt, 1);
9634 calls->instance_ptr = o;
9636 LDKCustomMessageHandler ret = {
9637 .this_arg = (void*) calls,
9638 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
9639 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
9640 .free = LDKCustomMessageHandler_JCalls_free,
9641 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
9643 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
9646 long __attribute__((export_name("TS_LDKCustomMessageHandler_new"))) TS_LDKCustomMessageHandler_new(JSValue o, JSValue CustomMessageReader) {
9647 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
9648 *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
9649 return (long)res_ptr;
9651 uint32_t __attribute__((export_name("TS_CustomMessageHandler_handle_custom_message"))) TS_CustomMessageHandler_handle_custom_message(uint32_t this_arg, uint32_t msg, int8_tArray sender_node_id) {
9652 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9653 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9654 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
9655 void* msg_ptr = (void*)(((uintptr_t)msg) & ~1);
9656 CHECK_ACCESS(msg_ptr);
9657 LDKType msg_conv = *(LDKType*)(msg_ptr);
9658 LDKPublicKey sender_node_id_ref;
9659 CHECK(sender_node_id->arr_len == 33);
9660 memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33); FREE(sender_node_id);
9661 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9662 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
9663 return (uint32_t)ret_conv;
9666 uint32_tArray __attribute__((export_name("TS_CustomMessageHandler_get_and_clear_pending_msg"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint32_t this_arg) {
9667 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9668 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9669 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
9670 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
9671 uint32_tArray ret_arr = NULL;
9672 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
9673 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
9674 for (size_t z = 0; z < ret_var.datalen; z++) {
9675 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
9676 *ret_conv_25_conv = ret_var.data[z];
9677 ret_arr_ptr[z] = ((uint32_t)ret_conv_25_conv);
9684 typedef struct LDKSocketDescriptor_JCalls {
9685 atomic_size_t refcnt;
9686 uint32_t instance_ptr;
9687 } LDKSocketDescriptor_JCalls;
9688 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
9689 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9690 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9694 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
9695 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9696 LDKu8slice data_var = data;
9697 int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__);
9698 memcpy(data_arr->elems, data_var.data, data_var.datalen);
9699 return js_invoke_function_2(j_calls->instance_ptr, 78, (uint32_t)data_arr, (uint32_t)resume_read);
9701 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
9702 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9703 js_invoke_function_0(j_calls->instance_ptr, 79);
9705 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
9706 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9707 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
9708 *other_arg_clone = SocketDescriptor_clone(other_arg);
9709 return js_invoke_function_1(j_calls->instance_ptr, 80, (uint32_t)(uint32_t)other_arg_clone);
9711 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
9712 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9713 return js_invoke_function_0(j_calls->instance_ptr, 81);
9715 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
9716 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
9717 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9719 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JSValue o) {
9720 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
9721 atomic_init(&calls->refcnt, 1);
9722 calls->instance_ptr = o;
9724 LDKSocketDescriptor ret = {
9725 .this_arg = (void*) calls,
9726 .send_data = send_data_LDKSocketDescriptor_jcall,
9727 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
9728 .eq = eq_LDKSocketDescriptor_jcall,
9729 .hash = hash_LDKSocketDescriptor_jcall,
9730 .cloned = LDKSocketDescriptor_JCalls_cloned,
9731 .free = LDKSocketDescriptor_JCalls_free,
9735 long __attribute__((export_name("TS_LDKSocketDescriptor_new"))) TS_LDKSocketDescriptor_new(JSValue o) {
9736 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
9737 *res_ptr = LDKSocketDescriptor_init(o);
9738 return (long)res_ptr;
9740 uint32_t __attribute__((export_name("TS_SocketDescriptor_send_data"))) TS_SocketDescriptor_send_data(uint32_t this_arg, int8_tArray data, jboolean resume_read) {
9741 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9742 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9743 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
9744 LDKu8slice data_ref;
9745 data_ref.datalen = data->arr_len;
9746 data_ref.data = data->elems /* XXX data leaks */;
9747 uint32_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
9751 void __attribute__((export_name("TS_SocketDescriptor_disconnect_socket"))) TS_SocketDescriptor_disconnect_socket(uint32_t this_arg) {
9752 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9753 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9754 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
9755 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
9758 int64_t __attribute__((export_name("TS_SocketDescriptor_hash"))) TS_SocketDescriptor_hash(uint32_t this_arg) {
9759 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9760 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9761 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
9762 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
9766 uint32_t __attribute__((export_name("TS_LDKEffectiveCapacity_ty_from_ptr"))) TS_LDKEffectiveCapacity_ty_from_ptr(uint32_t ptr) {
9767 LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1);
9769 case LDKEffectiveCapacity_ExactLiquidity: return 0;
9770 case LDKEffectiveCapacity_MaximumHTLC: return 1;
9771 case LDKEffectiveCapacity_Total: return 2;
9772 case LDKEffectiveCapacity_Infinite: return 3;
9773 case LDKEffectiveCapacity_Unknown: return 4;
9777 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat"))) TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(uint32_t ptr) {
9778 LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1);
9779 assert(obj->tag == LDKEffectiveCapacity_ExactLiquidity);
9780 return obj->exact_liquidity.liquidity_msat;
9782 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat(uint32_t ptr) {
9783 LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1);
9784 assert(obj->tag == LDKEffectiveCapacity_MaximumHTLC);
9785 return obj->maximum_htlc.amount_msat;
9787 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_capacity_msat"))) TS_LDKEffectiveCapacity_Total_get_capacity_msat(uint32_t ptr) {
9788 LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1);
9789 assert(obj->tag == LDKEffectiveCapacity_Total);
9790 return obj->total.capacity_msat;
9792 typedef struct LDKScore_JCalls {
9793 atomic_size_t refcnt;
9794 uint32_t instance_ptr;
9796 static void LDKScore_JCalls_free(void* this_arg) {
9797 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9798 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9802 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, uint64_t send_amt_msat, uint64_t capacity_msat, const LDKNodeId * source, const LDKNodeId * target) {
9803 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9804 LDKNodeId source_var = *source;
9805 uint32_t source_ref = 0;
9806 source_var = NodeId_clone(&source_var);
9807 CHECK((((uintptr_t)source_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9808 CHECK((((uintptr_t)&source_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9809 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
9810 source_ref = (uintptr_t)source_var.inner;
9811 if (source_var.is_owned) {
9814 LDKNodeId target_var = *target;
9815 uint32_t target_ref = 0;
9816 target_var = NodeId_clone(&target_var);
9817 CHECK((((uintptr_t)target_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9818 CHECK((((uintptr_t)&target_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9819 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
9820 target_ref = (uintptr_t)target_var.inner;
9821 if (target_var.is_owned) {
9824 return js_invoke_function_5(j_calls->instance_ptr, 82, (uint32_t)short_channel_id, (uint32_t)send_amt_msat, (uint32_t)capacity_msat, (uint32_t)source_ref, (uint32_t)target_ref);
9826 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
9827 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9828 LDKCVec_RouteHopZ path_var = path;
9829 uint32_tArray path_arr = NULL;
9830 path_arr = init_uint32_tArray(path_var.datalen, __LINE__);
9831 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
9832 for (size_t k = 0; k < path_var.datalen; k++) {
9833 LDKRouteHop path_conv_10_var = path_var.data[k];
9834 uint32_t path_conv_10_ref = 0;
9835 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9836 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9837 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
9838 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
9839 if (path_conv_10_var.is_owned) {
9840 path_conv_10_ref |= 1;
9842 path_arr_ptr[k] = path_conv_10_ref;
9845 FREE(path_var.data);
9846 js_invoke_function_2(j_calls->instance_ptr, 83, (uint32_t)path_arr, (uint32_t)short_channel_id);
9848 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
9849 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9850 LDKCVec_RouteHopZ path_var = path;
9851 uint32_tArray path_arr = NULL;
9852 path_arr = init_uint32_tArray(path_var.datalen, __LINE__);
9853 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
9854 for (size_t k = 0; k < path_var.datalen; k++) {
9855 LDKRouteHop path_conv_10_var = path_var.data[k];
9856 uint32_t path_conv_10_ref = 0;
9857 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9858 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9859 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
9860 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
9861 if (path_conv_10_var.is_owned) {
9862 path_conv_10_ref |= 1;
9864 path_arr_ptr[k] = path_conv_10_ref;
9867 FREE(path_var.data);
9868 js_invoke_function_1(j_calls->instance_ptr, 84, (uint32_t)path_arr);
9870 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
9871 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9872 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 85);
9873 LDKCVec_u8Z ret_ref;
9874 ret_ref.datalen = ret->arr_len;
9875 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
9876 memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
9879 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
9880 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
9881 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9883 static inline LDKScore LDKScore_init (JSValue o) {
9884 LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
9885 atomic_init(&calls->refcnt, 1);
9886 calls->instance_ptr = o;
9889 .this_arg = (void*) calls,
9890 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
9891 .payment_path_failed = payment_path_failed_LDKScore_jcall,
9892 .payment_path_successful = payment_path_successful_LDKScore_jcall,
9893 .write = write_LDKScore_jcall,
9894 .free = LDKScore_JCalls_free,
9898 long __attribute__((export_name("TS_LDKScore_new"))) TS_LDKScore_new(JSValue o) {
9899 LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
9900 *res_ptr = LDKScore_init(o);
9901 return (long)res_ptr;
9903 int64_t __attribute__((export_name("TS_Score_channel_penalty_msat"))) TS_Score_channel_penalty_msat(uint32_t this_arg, int64_t short_channel_id, int64_t send_amt_msat, int64_t capacity_msat, uint32_t source, uint32_t target) {
9904 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9905 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9906 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9907 LDKNodeId source_conv;
9908 source_conv.inner = (void*)(source & (~1));
9909 source_conv.is_owned = false;
9910 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
9911 LDKNodeId target_conv;
9912 target_conv.inner = (void*)(target & (~1));
9913 target_conv.is_owned = false;
9914 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
9915 int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, send_amt_msat, capacity_msat, &source_conv, &target_conv);
9919 void __attribute__((export_name("TS_Score_payment_path_failed"))) TS_Score_payment_path_failed(uint32_t this_arg, uint32_tArray path, int64_t short_channel_id) {
9920 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9921 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9922 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9923 LDKCVec_RouteHopZ path_constr;
9924 path_constr.datalen = path->arr_len;
9925 if (path_constr.datalen > 0)
9926 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9928 path_constr.data = NULL;
9929 uint32_t* path_vals = path->elems /* XXX path leaks */;
9930 for (size_t k = 0; k < path_constr.datalen; k++) {
9931 uint32_t path_conv_10 = path_vals[k];
9932 LDKRouteHop path_conv_10_conv;
9933 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
9934 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
9935 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
9936 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
9937 path_constr.data[k] = path_conv_10_conv;
9939 (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
9942 void __attribute__((export_name("TS_Score_payment_path_successful"))) TS_Score_payment_path_successful(uint32_t this_arg, uint32_tArray path) {
9943 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9944 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9945 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9946 LDKCVec_RouteHopZ path_constr;
9947 path_constr.datalen = path->arr_len;
9948 if (path_constr.datalen > 0)
9949 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9951 path_constr.data = NULL;
9952 uint32_t* path_vals = path->elems /* XXX path leaks */;
9953 for (size_t k = 0; k < path_constr.datalen; k++) {
9954 uint32_t path_conv_10 = path_vals[k];
9955 LDKRouteHop path_conv_10_conv;
9956 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
9957 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
9958 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
9959 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
9960 path_constr.data[k] = path_conv_10_conv;
9962 (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
9965 int8_tArray __attribute__((export_name("TS_Score_write"))) TS_Score_write(uint32_t this_arg) {
9966 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9967 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9968 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9969 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
9970 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
9971 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
9972 CVec_u8Z_free(ret_var);
9976 typedef struct LDKLockableScore_JCalls {
9977 atomic_size_t refcnt;
9978 uint32_t instance_ptr;
9979 } LDKLockableScore_JCalls;
9980 static void LDKLockableScore_JCalls_free(void* this_arg) {
9981 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
9982 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9986 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
9987 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
9988 uint32_t ret = js_invoke_function_0(j_calls->instance_ptr, 86);
9989 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9990 CHECK_ACCESS(ret_ptr);
9991 LDKScore ret_conv = *(LDKScore*)(ret_ptr);// WARNING: we may need a move here but no clone is available for LDKScore
9995 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
9996 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
9997 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9999 static inline LDKLockableScore LDKLockableScore_init (JSValue o) {
10000 LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
10001 atomic_init(&calls->refcnt, 1);
10002 calls->instance_ptr = o;
10004 LDKLockableScore ret = {
10005 .this_arg = (void*) calls,
10006 .lock = lock_LDKLockableScore_jcall,
10007 .free = LDKLockableScore_JCalls_free,
10011 long __attribute__((export_name("TS_LDKLockableScore_new"))) TS_LDKLockableScore_new(JSValue o) {
10012 LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
10013 *res_ptr = LDKLockableScore_init(o);
10014 return (long)res_ptr;
10016 uint32_t __attribute__((export_name("TS_LockableScore_lock"))) TS_LockableScore_lock(uint32_t this_arg) {
10017 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10018 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10019 LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
10020 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
10021 *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
10022 return (uint32_t)ret_ret;
10025 uint32_t __attribute__((export_name("TS_LDKFallback_ty_from_ptr"))) TS_LDKFallback_ty_from_ptr(uint32_t ptr) {
10026 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
10028 case LDKFallback_SegWitProgram: return 0;
10029 case LDKFallback_PubKeyHash: return 1;
10030 case LDKFallback_ScriptHash: return 2;
10034 int8_t __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_version"))) TS_LDKFallback_SegWitProgram_get_version(uint32_t ptr) {
10035 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
10036 assert(obj->tag == LDKFallback_SegWitProgram);
10037 uint8_t version_val = obj->seg_wit_program.version._0;
10038 return version_val;
10040 int8_tArray __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_program"))) TS_LDKFallback_SegWitProgram_get_program(uint32_t ptr) {
10041 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
10042 assert(obj->tag == LDKFallback_SegWitProgram);
10043 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
10044 int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__);
10045 memcpy(program_arr->elems, program_var.data, program_var.datalen);
10046 return program_arr;
10048 int8_tArray __attribute__((export_name("TS_LDKFallback_PubKeyHash_get_pub_key_hash"))) TS_LDKFallback_PubKeyHash_get_pub_key_hash(uint32_t ptr) {
10049 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
10050 assert(obj->tag == LDKFallback_PubKeyHash);
10051 int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__);
10052 memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20);
10053 return pub_key_hash_arr;
10055 int8_tArray __attribute__((export_name("TS_LDKFallback_ScriptHash_get_script_hash"))) TS_LDKFallback_ScriptHash_get_script_hash(uint32_t ptr) {
10056 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
10057 assert(obj->tag == LDKFallback_ScriptHash);
10058 int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__);
10059 memcpy(script_hash_arr->elems, obj->script_hash.data, 20);
10060 return script_hash_arr;
10062 typedef struct LDKPayer_JCalls {
10063 atomic_size_t refcnt;
10064 uint32_t instance_ptr;
10066 static void LDKPayer_JCalls_free(void* this_arg) {
10067 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10068 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10072 LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) {
10073 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10074 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 87);
10075 LDKPublicKey ret_ref;
10076 CHECK(ret->arr_len == 33);
10077 memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
10080 LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) {
10081 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10082 uint32_tArray ret = (uint32_tArray)js_invoke_function_0(j_calls->instance_ptr, 88);
10083 LDKCVec_ChannelDetailsZ ret_constr;
10084 ret_constr.datalen = ret->arr_len;
10085 if (ret_constr.datalen > 0)
10086 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
10088 ret_constr.data = NULL;
10089 uint32_t* ret_vals = ret->elems /* XXX ret leaks */;
10090 for (size_t q = 0; q < ret_constr.datalen; q++) {
10091 uint32_t ret_conv_16 = ret_vals[q];
10092 LDKChannelDetails ret_conv_16_conv;
10093 ret_conv_16_conv.inner = (void*)(ret_conv_16 & (~1));
10094 ret_conv_16_conv.is_owned = (ret_conv_16 & 1) || (ret_conv_16 == 0);
10095 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv);
10096 ret_constr.data[q] = ret_conv_16_conv;
10100 LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret) {
10101 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10102 LDKRoute route_var = *route;
10103 uint32_t route_ref = 0;
10104 route_var = Route_clone(&route_var);
10105 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10106 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10107 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
10108 route_ref = (uintptr_t)route_var.inner;
10109 if (route_var.is_owned) {
10112 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10113 memcpy(payment_hash_arr->elems, payment_hash.data, 32);
10114 int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
10115 memcpy(payment_secret_arr->elems, payment_secret.data, 32);
10116 uint32_t ret = js_invoke_function_3(j_calls->instance_ptr, 89, (uint32_t)route_ref, (uint32_t)payment_hash_arr, (uint32_t)payment_secret_arr);
10117 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10118 CHECK_ACCESS(ret_ptr);
10119 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
10123 LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage) {
10124 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10125 LDKRoute route_var = *route;
10126 uint32_t route_ref = 0;
10127 route_var = Route_clone(&route_var);
10128 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10129 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10130 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
10131 route_ref = (uintptr_t)route_var.inner;
10132 if (route_var.is_owned) {
10135 int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
10136 memcpy(payment_preimage_arr->elems, payment_preimage.data, 32);
10137 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 90, (uint32_t)route_ref, (uint32_t)payment_preimage_arr);
10138 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10139 CHECK_ACCESS(ret_ptr);
10140 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
10144 LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) {
10145 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10146 LDKRoute route_var = *route;
10147 uint32_t route_ref = 0;
10148 route_var = Route_clone(&route_var);
10149 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10150 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10151 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
10152 route_ref = (uintptr_t)route_var.inner;
10153 if (route_var.is_owned) {
10156 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
10157 memcpy(payment_id_arr->elems, payment_id.data, 32);
10158 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 91, (uint32_t)route_ref, (uint32_t)payment_id_arr);
10159 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10160 CHECK_ACCESS(ret_ptr);
10161 LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
10165 void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) {
10166 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10167 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
10168 memcpy(payment_id_arr->elems, payment_id.data, 32);
10169 js_invoke_function_1(j_calls->instance_ptr, 92, (uint32_t)payment_id_arr);
10171 static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) {
10172 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg;
10173 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10175 static inline LDKPayer LDKPayer_init (JSValue o) {
10176 LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls");
10177 atomic_init(&calls->refcnt, 1);
10178 calls->instance_ptr = o;
10181 .this_arg = (void*) calls,
10182 .node_id = node_id_LDKPayer_jcall,
10183 .first_hops = first_hops_LDKPayer_jcall,
10184 .send_payment = send_payment_LDKPayer_jcall,
10185 .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall,
10186 .retry_payment = retry_payment_LDKPayer_jcall,
10187 .abandon_payment = abandon_payment_LDKPayer_jcall,
10188 .free = LDKPayer_JCalls_free,
10192 long __attribute__((export_name("TS_LDKPayer_new"))) TS_LDKPayer_new(JSValue o) {
10193 LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer");
10194 *res_ptr = LDKPayer_init(o);
10195 return (long)res_ptr;
10197 int8_tArray __attribute__((export_name("TS_Payer_node_id"))) TS_Payer_node_id(uint32_t this_arg) {
10198 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10199 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10200 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10201 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
10202 memcpy(ret_arr->elems, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form, 33);
10206 uint32_tArray __attribute__((export_name("TS_Payer_first_hops"))) TS_Payer_first_hops(uint32_t this_arg) {
10207 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10208 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10209 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10210 LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg);
10211 uint32_tArray ret_arr = NULL;
10212 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
10213 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
10214 for (size_t q = 0; q < ret_var.datalen; q++) {
10215 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
10216 uint32_t ret_conv_16_ref = 0;
10217 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10218 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10219 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
10220 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
10221 if (ret_conv_16_var.is_owned) {
10222 ret_conv_16_ref |= 1;
10224 ret_arr_ptr[q] = ret_conv_16_ref;
10227 FREE(ret_var.data);
10231 uint32_t __attribute__((export_name("TS_Payer_send_payment"))) TS_Payer_send_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
10232 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10233 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10234 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10235 LDKRoute route_conv;
10236 route_conv.inner = (void*)(route & (~1));
10237 route_conv.is_owned = false;
10238 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
10239 LDKThirtyTwoBytes payment_hash_ref;
10240 CHECK(payment_hash->arr_len == 32);
10241 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
10242 LDKThirtyTwoBytes payment_secret_ref;
10243 CHECK(payment_secret->arr_len == 32);
10244 memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
10245 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
10246 *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref);
10247 return (uint32_t)ret_conv;
10250 uint32_t __attribute__((export_name("TS_Payer_send_spontaneous_payment"))) TS_Payer_send_spontaneous_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_preimage) {
10251 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10252 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10253 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10254 LDKRoute route_conv;
10255 route_conv.inner = (void*)(route & (~1));
10256 route_conv.is_owned = false;
10257 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
10258 LDKThirtyTwoBytes payment_preimage_ref;
10259 CHECK(payment_preimage->arr_len == 32);
10260 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
10261 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
10262 *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref);
10263 return (uint32_t)ret_conv;
10266 uint32_t __attribute__((export_name("TS_Payer_retry_payment"))) TS_Payer_retry_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_id) {
10267 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10268 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10269 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10270 LDKRoute route_conv;
10271 route_conv.inner = (void*)(route & (~1));
10272 route_conv.is_owned = false;
10273 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
10274 LDKThirtyTwoBytes payment_id_ref;
10275 CHECK(payment_id->arr_len == 32);
10276 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
10277 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10278 *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref);
10279 return (uint32_t)ret_conv;
10282 void __attribute__((export_name("TS_Payer_abandon_payment"))) TS_Payer_abandon_payment(uint32_t this_arg, int8_tArray payment_id) {
10283 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10284 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10285 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10286 LDKThirtyTwoBytes payment_id_ref;
10287 CHECK(payment_id->arr_len == 32);
10288 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
10289 (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref);
10292 typedef struct LDKRouter_JCalls {
10293 atomic_size_t refcnt;
10294 uint32_t instance_ptr;
10295 } LDKRouter_JCalls;
10296 static void LDKRouter_JCalls_free(void* this_arg) {
10297 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10298 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10302 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, const uint8_t (* payment_hash)[32], LDKCVec_ChannelDetailsZ * first_hops, const LDKScore * scorer) {
10303 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10304 int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
10305 memcpy(payer_arr->elems, payer.compressed_form, 33);
10306 LDKRouteParameters route_params_var = *route_params;
10307 uint32_t route_params_ref = 0;
10308 route_params_var = RouteParameters_clone(&route_params_var);
10309 CHECK((((uintptr_t)route_params_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10310 CHECK((((uintptr_t)&route_params_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10311 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
10312 route_params_ref = (uintptr_t)route_params_var.inner;
10313 if (route_params_var.is_owned) {
10314 route_params_ref |= 1;
10316 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10317 memcpy(payment_hash_arr->elems, *payment_hash, 32);
10318 LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
10319 uint32_tArray first_hops_arr = NULL;
10320 if (first_hops != NULL) {
10321 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
10322 first_hops_arr = init_uint32_tArray(first_hops_var.datalen, __LINE__);
10323 uint32_t *first_hops_arr_ptr = (uint32_t*)(((uint8_t*)first_hops_arr) + 4);
10324 for (size_t q = 0; q < first_hops_var.datalen; q++) {
10325 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
10326 uint32_t first_hops_conv_16_ref = 0;
10327 CHECK((((uintptr_t)first_hops_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10328 CHECK((((uintptr_t)&first_hops_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10329 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
10330 first_hops_conv_16_ref = (uintptr_t)first_hops_conv_16_var.inner;
10331 if (first_hops_conv_16_var.is_owned) {
10332 first_hops_conv_16_ref |= 1;
10334 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
10338 // WARNING: This object doesn't live past this scope, needs clone!
10339 uint32_t ret_scorer = ((uintptr_t)scorer) | 1;
10340 uint32_t ret = js_invoke_function_5(j_calls->instance_ptr, 93, (uint32_t)payer_arr, (uint32_t)route_params_ref, (uint32_t)payment_hash_arr, (uint32_t)first_hops_arr, (uint32_t)ret_scorer);
10341 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10342 CHECK_ACCESS(ret_ptr);
10343 LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
10347 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
10348 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
10349 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10351 static inline LDKRouter LDKRouter_init (JSValue o) {
10352 LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
10353 atomic_init(&calls->refcnt, 1);
10354 calls->instance_ptr = o;
10357 .this_arg = (void*) calls,
10358 .find_route = find_route_LDKRouter_jcall,
10359 .free = LDKRouter_JCalls_free,
10363 long __attribute__((export_name("TS_LDKRouter_new"))) TS_LDKRouter_new(JSValue o) {
10364 LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
10365 *res_ptr = LDKRouter_init(o);
10366 return (long)res_ptr;
10368 uint32_t __attribute__((export_name("TS_Router_find_route"))) TS_Router_find_route(uint32_t this_arg, int8_tArray payer, uint32_t route_params, int8_tArray payment_hash, uint32_tArray first_hops, uint32_t scorer) {
10369 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10370 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10371 LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
10372 LDKPublicKey payer_ref;
10373 CHECK(payer->arr_len == 33);
10374 memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
10375 LDKRouteParameters route_params_conv;
10376 route_params_conv.inner = (void*)(route_params & (~1));
10377 route_params_conv.is_owned = false;
10378 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
10379 unsigned char payment_hash_arr[32];
10380 CHECK(payment_hash->arr_len == 32);
10381 memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
10382 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
10383 LDKCVec_ChannelDetailsZ first_hops_constr;
10384 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
10385 if (first_hops != 0) {
10386 first_hops_constr.datalen = first_hops->arr_len;
10387 if (first_hops_constr.datalen > 0)
10388 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
10390 first_hops_constr.data = NULL;
10391 uint32_t* first_hops_vals = first_hops->elems /* XXX first_hops leaks */;
10392 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
10393 uint32_t first_hops_conv_16 = first_hops_vals[q];
10394 LDKChannelDetails first_hops_conv_16_conv;
10395 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
10396 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
10397 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
10398 first_hops_constr.data[q] = first_hops_conv_16_conv;
10400 first_hops_ptr = &first_hops_constr;
10402 void* scorer_ptr = (void*)(((uintptr_t)scorer) & ~1);
10403 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
10404 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
10405 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
10406 *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, payment_hash_ref, first_hops_ptr, scorer_conv);
10407 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
10408 return (uint32_t)ret_conv;
10411 jstring __attribute__((export_name("TS__ldk_get_compiled_version"))) TS__ldk_get_compiled_version() {
10412 LDKStr ret_str = _ldk_get_compiled_version();
10413 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
10418 jstring __attribute__((export_name("TS__ldk_c_bindings_get_compiled_version"))) TS__ldk_c_bindings_get_compiled_version() {
10419 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
10420 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
10425 void __attribute__((export_name("TS_Transaction_free"))) TS_Transaction_free(int8_tArray _res) {
10426 LDKTransaction _res_ref;
10427 _res_ref.datalen = _res->arr_len;
10428 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
10429 memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
10430 _res_ref.data_is_owned = true;
10431 Transaction_free(_res_ref);
10434 uint32_t __attribute__((export_name("TS_TxOut_new"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
10435 LDKCVec_u8Z script_pubkey_ref;
10436 script_pubkey_ref.datalen = script_pubkey->arr_len;
10437 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
10438 memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen); FREE(script_pubkey);
10439 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
10440 *ret_ref = TxOut_new(script_pubkey_ref, value);
10441 return (uint32_t)ret_ref;
10444 void __attribute__((export_name("TS_TxOut_free"))) TS_TxOut_free(uint32_t _res) {
10445 if ((_res & 1) != 0) return;
10446 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
10447 CHECK_ACCESS(_res_ptr);
10448 LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
10450 TxOut_free(_res_conv);
10453 static inline uintptr_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
10454 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
10455 *ret_ref = TxOut_clone(arg);
10456 return (uint32_t)ret_ref;
10458 uint32_t __attribute__((export_name("TS_TxOut_clone_ptr"))) TS_TxOut_clone_ptr(uint32_t arg) {
10459 LDKTxOut* arg_conv = (LDKTxOut*)(arg & ~1);
10460 uint32_t ret_val = TxOut_clone_ptr(arg_conv);
10464 uint32_t __attribute__((export_name("TS_TxOut_clone"))) TS_TxOut_clone(uint32_t orig) {
10465 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
10466 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
10467 *ret_ref = TxOut_clone(orig_conv);
10468 return (uint32_t)ret_ref;
10471 void __attribute__((export_name("TS_Str_free"))) TS_Str_free(jstring _res) {
10472 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
10476 uint32_t __attribute__((export_name("TS_CResult_NoneNoneZ_ok"))) TS_CResult_NoneNoneZ_ok() {
10477 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10478 *ret_conv = CResult_NoneNoneZ_ok();
10479 return (uint32_t)ret_conv;
10482 uint32_t __attribute__((export_name("TS_CResult_NoneNoneZ_err"))) TS_CResult_NoneNoneZ_err() {
10483 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10484 *ret_conv = CResult_NoneNoneZ_err();
10485 return (uint32_t)ret_conv;
10488 jboolean __attribute__((export_name("TS_CResult_NoneNoneZ_is_ok"))) TS_CResult_NoneNoneZ_is_ok(uint32_t o) {
10489 LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)(o & ~1);
10490 jboolean ret_val = CResult_NoneNoneZ_is_ok(o_conv);
10494 void __attribute__((export_name("TS_CResult_NoneNoneZ_free"))) TS_CResult_NoneNoneZ_free(uint32_t _res) {
10495 if ((_res & 1) != 0) return;
10496 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
10497 CHECK_ACCESS(_res_ptr);
10498 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
10500 CResult_NoneNoneZ_free(_res_conv);
10503 static inline uintptr_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
10504 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10505 *ret_conv = CResult_NoneNoneZ_clone(arg);
10506 return (uint32_t)ret_conv;
10508 uint32_t __attribute__((export_name("TS_CResult_NoneNoneZ_clone_ptr"))) TS_CResult_NoneNoneZ_clone_ptr(uint32_t arg) {
10509 LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)(arg & ~1);
10510 uint32_t ret_val = CResult_NoneNoneZ_clone_ptr(arg_conv);
10514 uint32_t __attribute__((export_name("TS_CResult_NoneNoneZ_clone"))) TS_CResult_NoneNoneZ_clone(uint32_t orig) {
10515 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
10516 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10517 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
10518 return (uint32_t)ret_conv;
10521 uint32_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(uint32_t o) {
10522 LDKCounterpartyCommitmentSecrets o_conv;
10523 o_conv.inner = (void*)(o & (~1));
10524 o_conv.is_owned = (o & 1) || (o == 0);
10525 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10526 o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
10527 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
10528 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
10529 return (uint32_t)ret_conv;
10532 uint32_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(uint32_t e) {
10533 LDKDecodeError e_conv;
10534 e_conv.inner = (void*)(e & (~1));
10535 e_conv.is_owned = (e & 1) || (e == 0);
10536 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10537 e_conv = DecodeError_clone(&e_conv);
10538 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
10539 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
10540 return (uint32_t)ret_conv;
10543 jboolean __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(uint32_t o) {
10544 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(o & ~1);
10545 jboolean ret_val = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
10549 void __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(uint32_t _res) {
10550 if ((_res & 1) != 0) return;
10551 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
10552 CHECK_ACCESS(_res_ptr);
10553 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
10555 CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
10558 static inline uintptr_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
10559 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
10560 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
10561 return (uint32_t)ret_conv;
10563 uint32_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(uint32_t arg) {
10564 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(arg & ~1);
10565 uint32_t ret_val = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
10569 uint32_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(uint32_t orig) {
10570 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(orig & ~1);
10571 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
10572 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
10573 return (uint32_t)ret_conv;
10576 uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_ok"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
10577 LDKSecretKey o_ref;
10578 CHECK(o->arr_len == 32);
10579 memcpy(o_ref.bytes, o->elems, 32); FREE(o);
10580 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
10581 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
10582 return (uint32_t)ret_conv;
10585 uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_err"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
10586 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
10587 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
10588 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
10589 return (uint32_t)ret_conv;
10592 jboolean __attribute__((export_name("TS_CResult_SecretKeyErrorZ_is_ok"))) TS_CResult_SecretKeyErrorZ_is_ok(uint32_t o) {
10593 LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)(o & ~1);
10594 jboolean ret_val = CResult_SecretKeyErrorZ_is_ok(o_conv);
10598 void __attribute__((export_name("TS_CResult_SecretKeyErrorZ_free"))) TS_CResult_SecretKeyErrorZ_free(uint32_t _res) {
10599 if ((_res & 1) != 0) return;
10600 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
10601 CHECK_ACCESS(_res_ptr);
10602 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
10604 CResult_SecretKeyErrorZ_free(_res_conv);
10607 static inline uintptr_t CResult_SecretKeyErrorZ_clone_ptr(LDKCResult_SecretKeyErrorZ *NONNULL_PTR arg) {
10608 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
10609 *ret_conv = CResult_SecretKeyErrorZ_clone(arg);
10610 return (uint32_t)ret_conv;
10612 uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_clone_ptr"))) TS_CResult_SecretKeyErrorZ_clone_ptr(uint32_t arg) {
10613 LDKCResult_SecretKeyErrorZ* arg_conv = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
10614 uint32_t ret_val = CResult_SecretKeyErrorZ_clone_ptr(arg_conv);
10618 uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_clone"))) TS_CResult_SecretKeyErrorZ_clone(uint32_t orig) {
10619 LDKCResult_SecretKeyErrorZ* orig_conv = (LDKCResult_SecretKeyErrorZ*)(orig & ~1);
10620 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
10621 *ret_conv = CResult_SecretKeyErrorZ_clone(orig_conv);
10622 return (uint32_t)ret_conv;
10625 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_ok"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
10626 LDKPublicKey o_ref;
10627 CHECK(o->arr_len == 33);
10628 memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
10629 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
10630 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
10631 return (uint32_t)ret_conv;
10634 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_err"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
10635 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
10636 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
10637 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
10638 return (uint32_t)ret_conv;
10641 jboolean __attribute__((export_name("TS_CResult_PublicKeyErrorZ_is_ok"))) TS_CResult_PublicKeyErrorZ_is_ok(uint32_t o) {
10642 LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)(o & ~1);
10643 jboolean ret_val = CResult_PublicKeyErrorZ_is_ok(o_conv);
10647 void __attribute__((export_name("TS_CResult_PublicKeyErrorZ_free"))) TS_CResult_PublicKeyErrorZ_free(uint32_t _res) {
10648 if ((_res & 1) != 0) return;
10649 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
10650 CHECK_ACCESS(_res_ptr);
10651 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
10653 CResult_PublicKeyErrorZ_free(_res_conv);
10656 static inline uintptr_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
10657 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
10658 *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
10659 return (uint32_t)ret_conv;
10661 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone_ptr"))) TS_CResult_PublicKeyErrorZ_clone_ptr(uint32_t arg) {
10662 LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
10663 uint32_t ret_val = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
10667 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone"))) TS_CResult_PublicKeyErrorZ_clone(uint32_t orig) {
10668 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
10669 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
10670 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
10671 return (uint32_t)ret_conv;
10674 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint32_t o) {
10675 LDKTxCreationKeys o_conv;
10676 o_conv.inner = (void*)(o & (~1));
10677 o_conv.is_owned = (o & 1) || (o == 0);
10678 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10679 o_conv = TxCreationKeys_clone(&o_conv);
10680 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
10681 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
10682 return (uint32_t)ret_conv;
10685 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint32_t e) {
10686 LDKDecodeError e_conv;
10687 e_conv.inner = (void*)(e & (~1));
10688 e_conv.is_owned = (e & 1) || (e == 0);
10689 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10690 e_conv = DecodeError_clone(&e_conv);
10691 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
10692 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
10693 return (uint32_t)ret_conv;
10696 jboolean __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_is_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint32_t o) {
10697 LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(o & ~1);
10698 jboolean ret_val = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
10702 void __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_free"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint32_t _res) {
10703 if ((_res & 1) != 0) return;
10704 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
10705 CHECK_ACCESS(_res_ptr);
10706 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
10708 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
10711 static inline uintptr_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
10712 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
10713 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
10714 return (uint32_t)ret_conv;
10716 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint32_t arg) {
10717 LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
10718 uint32_t ret_val = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
10722 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint32_t orig) {
10723 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
10724 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
10725 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
10726 return (uint32_t)ret_conv;
10729 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint32_t o) {
10730 LDKChannelPublicKeys o_conv;
10731 o_conv.inner = (void*)(o & (~1));
10732 o_conv.is_owned = (o & 1) || (o == 0);
10733 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10734 o_conv = ChannelPublicKeys_clone(&o_conv);
10735 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
10736 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
10737 return (uint32_t)ret_conv;
10740 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint32_t e) {
10741 LDKDecodeError e_conv;
10742 e_conv.inner = (void*)(e & (~1));
10743 e_conv.is_owned = (e & 1) || (e == 0);
10744 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10745 e_conv = DecodeError_clone(&e_conv);
10746 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
10747 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
10748 return (uint32_t)ret_conv;
10751 jboolean __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint32_t o) {
10752 LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(o & ~1);
10753 jboolean ret_val = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
10757 void __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_free"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint32_t _res) {
10758 if ((_res & 1) != 0) return;
10759 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
10760 CHECK_ACCESS(_res_ptr);
10761 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
10763 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
10766 static inline uintptr_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
10767 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
10768 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
10769 return (uint32_t)ret_conv;
10771 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint32_t arg) {
10772 LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
10773 uint32_t ret_val = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
10777 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint32_t orig) {
10778 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
10779 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
10780 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
10781 return (uint32_t)ret_conv;
10784 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_ok"))) TS_CResult_TxCreationKeysErrorZ_ok(uint32_t o) {
10785 LDKTxCreationKeys o_conv;
10786 o_conv.inner = (void*)(o & (~1));
10787 o_conv.is_owned = (o & 1) || (o == 0);
10788 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10789 o_conv = TxCreationKeys_clone(&o_conv);
10790 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
10791 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
10792 return (uint32_t)ret_conv;
10795 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_err"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
10796 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
10797 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
10798 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
10799 return (uint32_t)ret_conv;
10802 jboolean __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_is_ok"))) TS_CResult_TxCreationKeysErrorZ_is_ok(uint32_t o) {
10803 LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)(o & ~1);
10804 jboolean ret_val = CResult_TxCreationKeysErrorZ_is_ok(o_conv);
10808 void __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_free"))) TS_CResult_TxCreationKeysErrorZ_free(uint32_t _res) {
10809 if ((_res & 1) != 0) return;
10810 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
10811 CHECK_ACCESS(_res_ptr);
10812 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
10814 CResult_TxCreationKeysErrorZ_free(_res_conv);
10817 static inline uintptr_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) {
10818 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
10819 *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg);
10820 return (uint32_t)ret_conv;
10822 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysErrorZ_clone_ptr(uint32_t arg) {
10823 LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
10824 uint32_t ret_val = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv);
10828 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_clone"))) TS_CResult_TxCreationKeysErrorZ_clone(uint32_t orig) {
10829 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
10830 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
10831 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
10832 return (uint32_t)ret_conv;
10835 uint32_t __attribute__((export_name("TS_COption_u32Z_some"))) TS_COption_u32Z_some(int32_t o) {
10836 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
10837 *ret_copy = COption_u32Z_some(o);
10838 uint32_t ret_ref = (uintptr_t)ret_copy;
10842 uint32_t __attribute__((export_name("TS_COption_u32Z_none"))) TS_COption_u32Z_none() {
10843 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
10844 *ret_copy = COption_u32Z_none();
10845 uint32_t ret_ref = (uintptr_t)ret_copy;
10849 void __attribute__((export_name("TS_COption_u32Z_free"))) TS_COption_u32Z_free(uint32_t _res) {
10850 if ((_res & 1) != 0) return;
10851 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
10852 CHECK_ACCESS(_res_ptr);
10853 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
10855 COption_u32Z_free(_res_conv);
10858 static inline uintptr_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
10859 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
10860 *ret_copy = COption_u32Z_clone(arg);
10861 uint32_t ret_ref = (uintptr_t)ret_copy;
10864 uint32_t __attribute__((export_name("TS_COption_u32Z_clone_ptr"))) TS_COption_u32Z_clone_ptr(uint32_t arg) {
10865 LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)arg;
10866 uint32_t ret_val = COption_u32Z_clone_ptr(arg_conv);
10870 uint32_t __attribute__((export_name("TS_COption_u32Z_clone"))) TS_COption_u32Z_clone(uint32_t orig) {
10871 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
10872 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
10873 *ret_copy = COption_u32Z_clone(orig_conv);
10874 uint32_t ret_ref = (uintptr_t)ret_copy;
10878 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint32_t o) {
10879 LDKHTLCOutputInCommitment o_conv;
10880 o_conv.inner = (void*)(o & (~1));
10881 o_conv.is_owned = (o & 1) || (o == 0);
10882 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10883 o_conv = HTLCOutputInCommitment_clone(&o_conv);
10884 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
10885 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
10886 return (uint32_t)ret_conv;
10889 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint32_t e) {
10890 LDKDecodeError e_conv;
10891 e_conv.inner = (void*)(e & (~1));
10892 e_conv.is_owned = (e & 1) || (e == 0);
10893 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10894 e_conv = DecodeError_clone(&e_conv);
10895 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
10896 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
10897 return (uint32_t)ret_conv;
10900 jboolean __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint32_t o) {
10901 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(o & ~1);
10902 jboolean ret_val = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
10906 void __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint32_t _res) {
10907 if ((_res & 1) != 0) return;
10908 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
10909 CHECK_ACCESS(_res_ptr);
10910 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
10912 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
10915 static inline uintptr_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
10916 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
10917 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
10918 return (uint32_t)ret_conv;
10920 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint32_t arg) {
10921 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
10922 uint32_t ret_val = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
10926 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint32_t orig) {
10927 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
10928 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
10929 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
10930 return (uint32_t)ret_conv;
10933 uint32_t __attribute__((export_name("TS_COption_NoneZ_some"))) TS_COption_NoneZ_some() {
10934 uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
10938 uint32_t __attribute__((export_name("TS_COption_NoneZ_none"))) TS_COption_NoneZ_none() {
10939 uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
10943 void __attribute__((export_name("TS_COption_NoneZ_free"))) TS_COption_NoneZ_free(uint32_t _res) {
10944 LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
10945 COption_NoneZ_free(_res_conv);
10948 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
10949 LDKCounterpartyChannelTransactionParameters o_conv;
10950 o_conv.inner = (void*)(o & (~1));
10951 o_conv.is_owned = (o & 1) || (o == 0);
10952 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10953 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
10954 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
10955 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
10956 return (uint32_t)ret_conv;
10959 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
10960 LDKDecodeError e_conv;
10961 e_conv.inner = (void*)(e & (~1));
10962 e_conv.is_owned = (e & 1) || (e == 0);
10963 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10964 e_conv = DecodeError_clone(&e_conv);
10965 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
10966 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
10967 return (uint32_t)ret_conv;
10970 jboolean __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint32_t o) {
10971 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(o & ~1);
10972 jboolean ret_val = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
10976 void __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
10977 if ((_res & 1) != 0) return;
10978 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
10979 CHECK_ACCESS(_res_ptr);
10980 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
10982 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
10985 static inline uintptr_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
10986 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
10987 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
10988 return (uint32_t)ret_conv;
10990 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
10991 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
10992 uint32_t ret_val = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
10996 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
10997 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
10998 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
10999 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
11000 return (uint32_t)ret_conv;
11003 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
11004 LDKChannelTransactionParameters o_conv;
11005 o_conv.inner = (void*)(o & (~1));
11006 o_conv.is_owned = (o & 1) || (o == 0);
11007 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11008 o_conv = ChannelTransactionParameters_clone(&o_conv);
11009 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11010 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
11011 return (uint32_t)ret_conv;
11014 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
11015 LDKDecodeError e_conv;
11016 e_conv.inner = (void*)(e & (~1));
11017 e_conv.is_owned = (e & 1) || (e == 0);
11018 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11019 e_conv = DecodeError_clone(&e_conv);
11020 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11021 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
11022 return (uint32_t)ret_conv;
11025 jboolean __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint32_t o) {
11026 LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(o & ~1);
11027 jboolean ret_val = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
11031 void __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
11032 if ((_res & 1) != 0) return;
11033 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11034 CHECK_ACCESS(_res_ptr);
11035 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
11037 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
11040 static inline uintptr_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
11041 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11042 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
11043 return (uint32_t)ret_conv;
11045 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
11046 LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
11047 uint32_t ret_val = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
11051 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
11052 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
11053 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11054 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
11055 return (uint32_t)ret_conv;
11058 void __attribute__((export_name("TS_CVec_SignatureZ_free"))) TS_CVec_SignatureZ_free(ptrArray _res) {
11059 LDKCVec_SignatureZ _res_constr;
11060 _res_constr.datalen = _res->arr_len;
11061 if (_res_constr.datalen > 0)
11062 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
11064 _res_constr.data = NULL;
11065 int8_tArray* _res_vals = (void*) _res->elems /* XXX _res leaks */;
11066 for (size_t m = 0; m < _res_constr.datalen; m++) {
11067 int8_tArray _res_conv_12 = _res_vals[m];
11068 LDKSignature _res_conv_12_ref;
11069 CHECK(_res_conv_12->arr_len == 64);
11070 memcpy(_res_conv_12_ref.compact_form, _res_conv_12->elems, 64); FREE(_res_conv_12);
11071 _res_constr.data[m] = _res_conv_12_ref;
11073 CVec_SignatureZ_free(_res_constr);
11076 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
11077 LDKHolderCommitmentTransaction o_conv;
11078 o_conv.inner = (void*)(o & (~1));
11079 o_conv.is_owned = (o & 1) || (o == 0);
11080 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11081 o_conv = HolderCommitmentTransaction_clone(&o_conv);
11082 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11083 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
11084 return (uint32_t)ret_conv;
11087 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
11088 LDKDecodeError e_conv;
11089 e_conv.inner = (void*)(e & (~1));
11090 e_conv.is_owned = (e & 1) || (e == 0);
11091 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11092 e_conv = DecodeError_clone(&e_conv);
11093 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11094 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
11095 return (uint32_t)ret_conv;
11098 jboolean __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
11099 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(o & ~1);
11100 jboolean ret_val = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
11104 void __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
11105 if ((_res & 1) != 0) return;
11106 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11107 CHECK_ACCESS(_res_ptr);
11108 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
11110 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
11113 static inline uintptr_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
11114 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11115 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
11116 return (uint32_t)ret_conv;
11118 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
11119 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
11120 uint32_t ret_val = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
11124 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
11125 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
11126 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11127 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
11128 return (uint32_t)ret_conv;
11131 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
11132 LDKBuiltCommitmentTransaction o_conv;
11133 o_conv.inner = (void*)(o & (~1));
11134 o_conv.is_owned = (o & 1) || (o == 0);
11135 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11136 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
11137 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
11138 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
11139 return (uint32_t)ret_conv;
11142 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
11143 LDKDecodeError e_conv;
11144 e_conv.inner = (void*)(e & (~1));
11145 e_conv.is_owned = (e & 1) || (e == 0);
11146 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11147 e_conv = DecodeError_clone(&e_conv);
11148 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
11149 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
11150 return (uint32_t)ret_conv;
11153 jboolean __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
11154 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(o & ~1);
11155 jboolean ret_val = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
11159 void __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
11160 if ((_res & 1) != 0) return;
11161 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11162 CHECK_ACCESS(_res_ptr);
11163 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
11165 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
11168 static inline uintptr_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
11169 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
11170 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
11171 return (uint32_t)ret_conv;
11173 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
11174 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
11175 uint32_t ret_val = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
11179 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
11180 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
11181 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
11182 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
11183 return (uint32_t)ret_conv;
11186 uint32_t __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint32_t o) {
11187 LDKTrustedClosingTransaction o_conv;
11188 o_conv.inner = (void*)(o & (~1));
11189 o_conv.is_owned = (o & 1) || (o == 0);
11190 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11191 // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
11192 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
11193 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
11194 return (uint32_t)ret_conv;
11197 uint32_t __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_err"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
11198 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
11199 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
11200 return (uint32_t)ret_conv;
11203 jboolean __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_is_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint32_t o) {
11204 LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(o & ~1);
11205 jboolean ret_val = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
11209 void __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_free"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint32_t _res) {
11210 if ((_res & 1) != 0) return;
11211 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11212 CHECK_ACCESS(_res_ptr);
11213 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
11215 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
11218 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
11219 LDKCommitmentTransaction o_conv;
11220 o_conv.inner = (void*)(o & (~1));
11221 o_conv.is_owned = (o & 1) || (o == 0);
11222 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11223 o_conv = CommitmentTransaction_clone(&o_conv);
11224 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
11225 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
11226 return (uint32_t)ret_conv;
11229 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint32_t e) {
11230 LDKDecodeError e_conv;
11231 e_conv.inner = (void*)(e & (~1));
11232 e_conv.is_owned = (e & 1) || (e == 0);
11233 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11234 e_conv = DecodeError_clone(&e_conv);
11235 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
11236 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
11237 return (uint32_t)ret_conv;
11240 jboolean __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
11241 LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(o & ~1);
11242 jboolean ret_val = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
11246 void __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_free"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
11247 if ((_res & 1) != 0) return;
11248 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11249 CHECK_ACCESS(_res_ptr);
11250 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
11252 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
11255 static inline uintptr_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
11256 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
11257 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
11258 return (uint32_t)ret_conv;
11260 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
11261 LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
11262 uint32_t ret_val = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
11266 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
11267 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
11268 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
11269 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
11270 return (uint32_t)ret_conv;
11273 uint32_t __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint32_t o) {
11274 LDKTrustedCommitmentTransaction o_conv;
11275 o_conv.inner = (void*)(o & (~1));
11276 o_conv.is_owned = (o & 1) || (o == 0);
11277 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11278 // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
11279 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
11280 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
11281 return (uint32_t)ret_conv;
11284 uint32_t __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
11285 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
11286 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
11287 return (uint32_t)ret_conv;
11290 jboolean __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint32_t o) {
11291 LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(o & ~1);
11292 jboolean ret_val = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
11296 void __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_free"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint32_t _res) {
11297 if ((_res & 1) != 0) return;
11298 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11299 CHECK_ACCESS(_res_ptr);
11300 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
11302 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
11305 uint32_t __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_ok"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
11306 LDKCVec_SignatureZ o_constr;
11307 o_constr.datalen = o->arr_len;
11308 if (o_constr.datalen > 0)
11309 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
11311 o_constr.data = NULL;
11312 int8_tArray* o_vals = (void*) o->elems /* XXX o leaks */;
11313 for (size_t m = 0; m < o_constr.datalen; m++) {
11314 int8_tArray o_conv_12 = o_vals[m];
11315 LDKSignature o_conv_12_ref;
11316 CHECK(o_conv_12->arr_len == 64);
11317 memcpy(o_conv_12_ref.compact_form, o_conv_12->elems, 64); FREE(o_conv_12);
11318 o_constr.data[m] = o_conv_12_ref;
11320 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
11321 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
11322 return (uint32_t)ret_conv;
11325 uint32_t __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_err"))) TS_CResult_CVec_SignatureZNoneZ_err() {
11326 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
11327 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
11328 return (uint32_t)ret_conv;
11331 jboolean __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_is_ok"))) TS_CResult_CVec_SignatureZNoneZ_is_ok(uint32_t o) {
11332 LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)(o & ~1);
11333 jboolean ret_val = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
11337 void __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_free"))) TS_CResult_CVec_SignatureZNoneZ_free(uint32_t _res) {
11338 if ((_res & 1) != 0) return;
11339 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11340 CHECK_ACCESS(_res_ptr);
11341 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
11343 CResult_CVec_SignatureZNoneZ_free(_res_conv);
11346 static inline uintptr_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
11347 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
11348 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
11349 return (uint32_t)ret_conv;
11351 uint32_t __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone_ptr"))) TS_CResult_CVec_SignatureZNoneZ_clone_ptr(uint32_t arg) {
11352 LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
11353 uint32_t ret_val = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
11357 uint32_t __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint32_t orig) {
11358 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
11359 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
11360 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
11361 return (uint32_t)ret_conv;
11364 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint32_t o) {
11365 LDKShutdownScript o_conv;
11366 o_conv.inner = (void*)(o & (~1));
11367 o_conv.is_owned = (o & 1) || (o == 0);
11368 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11369 o_conv = ShutdownScript_clone(&o_conv);
11370 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
11371 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
11372 return (uint32_t)ret_conv;
11375 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint32_t e) {
11376 LDKDecodeError e_conv;
11377 e_conv.inner = (void*)(e & (~1));
11378 e_conv.is_owned = (e & 1) || (e == 0);
11379 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11380 e_conv = DecodeError_clone(&e_conv);
11381 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
11382 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
11383 return (uint32_t)ret_conv;
11386 jboolean __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_is_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint32_t o) {
11387 LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(o & ~1);
11388 jboolean ret_val = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
11392 void __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_free"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint32_t _res) {
11393 if ((_res & 1) != 0) return;
11394 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11395 CHECK_ACCESS(_res_ptr);
11396 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
11398 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
11401 static inline uintptr_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
11402 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
11403 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
11404 return (uint32_t)ret_conv;
11406 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint32_t arg) {
11407 LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
11408 uint32_t ret_val = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
11412 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint32_t orig) {
11413 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
11414 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
11415 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
11416 return (uint32_t)ret_conv;
11419 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint32_t o) {
11420 LDKShutdownScript o_conv;
11421 o_conv.inner = (void*)(o & (~1));
11422 o_conv.is_owned = (o & 1) || (o == 0);
11423 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11424 o_conv = ShutdownScript_clone(&o_conv);
11425 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
11426 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
11427 return (uint32_t)ret_conv;
11430 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint32_t e) {
11431 LDKInvalidShutdownScript e_conv;
11432 e_conv.inner = (void*)(e & (~1));
11433 e_conv.is_owned = (e & 1) || (e == 0);
11434 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11435 e_conv = InvalidShutdownScript_clone(&e_conv);
11436 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
11437 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
11438 return (uint32_t)ret_conv;
11441 jboolean __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint32_t o) {
11442 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(o & ~1);
11443 jboolean ret_val = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
11447 void __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint32_t _res) {
11448 if ((_res & 1) != 0) return;
11449 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11450 CHECK_ACCESS(_res_ptr);
11451 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
11453 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
11456 static inline uintptr_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
11457 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
11458 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
11459 return (uint32_t)ret_conv;
11461 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint32_t arg) {
11462 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
11463 uint32_t ret_val = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
11467 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint32_t orig) {
11468 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(orig & ~1);
11469 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
11470 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
11471 return (uint32_t)ret_conv;
11474 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_ok"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint32_t o) {
11475 LDKRouteHop o_conv;
11476 o_conv.inner = (void*)(o & (~1));
11477 o_conv.is_owned = (o & 1) || (o == 0);
11478 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11479 o_conv = RouteHop_clone(&o_conv);
11480 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
11481 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
11482 return (uint32_t)ret_conv;
11485 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_err"))) TS_CResult_RouteHopDecodeErrorZ_err(uint32_t e) {
11486 LDKDecodeError e_conv;
11487 e_conv.inner = (void*)(e & (~1));
11488 e_conv.is_owned = (e & 1) || (e == 0);
11489 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11490 e_conv = DecodeError_clone(&e_conv);
11491 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
11492 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
11493 return (uint32_t)ret_conv;
11496 jboolean __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint32_t o) {
11497 LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)(o & ~1);
11498 jboolean ret_val = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
11502 void __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_free"))) TS_CResult_RouteHopDecodeErrorZ_free(uint32_t _res) {
11503 if ((_res & 1) != 0) return;
11504 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11505 CHECK_ACCESS(_res_ptr);
11506 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
11508 CResult_RouteHopDecodeErrorZ_free(_res_conv);
11511 static inline uintptr_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
11512 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
11513 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
11514 return (uint32_t)ret_conv;
11516 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint32_t arg) {
11517 LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
11518 uint32_t ret_val = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
11522 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint32_t orig) {
11523 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
11524 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
11525 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
11526 return (uint32_t)ret_conv;
11529 void __attribute__((export_name("TS_CVec_RouteHopZ_free"))) TS_CVec_RouteHopZ_free(uint32_tArray _res) {
11530 LDKCVec_RouteHopZ _res_constr;
11531 _res_constr.datalen = _res->arr_len;
11532 if (_res_constr.datalen > 0)
11533 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11535 _res_constr.data = NULL;
11536 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
11537 for (size_t k = 0; k < _res_constr.datalen; k++) {
11538 uint32_t _res_conv_10 = _res_vals[k];
11539 LDKRouteHop _res_conv_10_conv;
11540 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
11541 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
11542 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
11543 _res_constr.data[k] = _res_conv_10_conv;
11545 CVec_RouteHopZ_free(_res_constr);
11548 void __attribute__((export_name("TS_CVec_CVec_RouteHopZZ_free"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
11549 LDKCVec_CVec_RouteHopZZ _res_constr;
11550 _res_constr.datalen = _res->arr_len;
11551 if (_res_constr.datalen > 0)
11552 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
11554 _res_constr.data = NULL;
11555 uint32_tArray* _res_vals = (void*) _res->elems /* XXX _res leaks */;
11556 for (size_t m = 0; m < _res_constr.datalen; m++) {
11557 uint32_tArray _res_conv_12 = _res_vals[m];
11558 LDKCVec_RouteHopZ _res_conv_12_constr;
11559 _res_conv_12_constr.datalen = _res_conv_12->arr_len;
11560 if (_res_conv_12_constr.datalen > 0)
11561 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11563 _res_conv_12_constr.data = NULL;
11564 uint32_t* _res_conv_12_vals = _res_conv_12->elems /* XXX _res_conv_12 leaks */;
11565 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
11566 uint32_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
11567 LDKRouteHop _res_conv_12_conv_10_conv;
11568 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
11569 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
11570 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
11571 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
11573 _res_constr.data[m] = _res_conv_12_constr;
11575 CVec_CVec_RouteHopZZ_free(_res_constr);
11578 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_ok"))) TS_CResult_RouteDecodeErrorZ_ok(uint32_t o) {
11580 o_conv.inner = (void*)(o & (~1));
11581 o_conv.is_owned = (o & 1) || (o == 0);
11582 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11583 o_conv = Route_clone(&o_conv);
11584 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
11585 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
11586 return (uint32_t)ret_conv;
11589 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_err"))) TS_CResult_RouteDecodeErrorZ_err(uint32_t e) {
11590 LDKDecodeError e_conv;
11591 e_conv.inner = (void*)(e & (~1));
11592 e_conv.is_owned = (e & 1) || (e == 0);
11593 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11594 e_conv = DecodeError_clone(&e_conv);
11595 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
11596 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
11597 return (uint32_t)ret_conv;
11600 jboolean __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_is_ok"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint32_t o) {
11601 LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)(o & ~1);
11602 jboolean ret_val = CResult_RouteDecodeErrorZ_is_ok(o_conv);
11606 void __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_free"))) TS_CResult_RouteDecodeErrorZ_free(uint32_t _res) {
11607 if ((_res & 1) != 0) return;
11608 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11609 CHECK_ACCESS(_res_ptr);
11610 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
11612 CResult_RouteDecodeErrorZ_free(_res_conv);
11615 static inline uintptr_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
11616 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
11617 *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
11618 return (uint32_t)ret_conv;
11620 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone_ptr"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint32_t arg) {
11621 LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
11622 uint32_t ret_val = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
11626 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone"))) TS_CResult_RouteDecodeErrorZ_clone(uint32_t orig) {
11627 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
11628 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
11629 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
11630 return (uint32_t)ret_conv;
11633 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_ok"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint32_t o) {
11634 LDKRouteParameters o_conv;
11635 o_conv.inner = (void*)(o & (~1));
11636 o_conv.is_owned = (o & 1) || (o == 0);
11637 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11638 o_conv = RouteParameters_clone(&o_conv);
11639 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
11640 *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
11641 return (uint32_t)ret_conv;
11644 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_err"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint32_t e) {
11645 LDKDecodeError e_conv;
11646 e_conv.inner = (void*)(e & (~1));
11647 e_conv.is_owned = (e & 1) || (e == 0);
11648 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11649 e_conv = DecodeError_clone(&e_conv);
11650 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
11651 *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
11652 return (uint32_t)ret_conv;
11655 jboolean __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_is_ok"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint32_t o) {
11656 LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(o & ~1);
11657 jboolean ret_val = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
11661 void __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_free"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint32_t _res) {
11662 if ((_res & 1) != 0) return;
11663 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11664 CHECK_ACCESS(_res_ptr);
11665 LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
11667 CResult_RouteParametersDecodeErrorZ_free(_res_conv);
11670 static inline uintptr_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
11671 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
11672 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
11673 return (uint32_t)ret_conv;
11675 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone_ptr"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
11676 LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
11677 uint32_t ret_val = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
11681 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint32_t orig) {
11682 LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(orig & ~1);
11683 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
11684 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
11685 return (uint32_t)ret_conv;
11688 void __attribute__((export_name("TS_CVec_RouteHintZ_free"))) TS_CVec_RouteHintZ_free(uint32_tArray _res) {
11689 LDKCVec_RouteHintZ _res_constr;
11690 _res_constr.datalen = _res->arr_len;
11691 if (_res_constr.datalen > 0)
11692 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
11694 _res_constr.data = NULL;
11695 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
11696 for (size_t l = 0; l < _res_constr.datalen; l++) {
11697 uint32_t _res_conv_11 = _res_vals[l];
11698 LDKRouteHint _res_conv_11_conv;
11699 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
11700 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
11701 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
11702 _res_constr.data[l] = _res_conv_11_conv;
11704 CVec_RouteHintZ_free(_res_constr);
11707 uint32_t __attribute__((export_name("TS_COption_u64Z_some"))) TS_COption_u64Z_some(int64_t o) {
11708 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11709 *ret_copy = COption_u64Z_some(o);
11710 uint32_t ret_ref = (uintptr_t)ret_copy;
11714 uint32_t __attribute__((export_name("TS_COption_u64Z_none"))) TS_COption_u64Z_none() {
11715 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11716 *ret_copy = COption_u64Z_none();
11717 uint32_t ret_ref = (uintptr_t)ret_copy;
11721 void __attribute__((export_name("TS_COption_u64Z_free"))) TS_COption_u64Z_free(uint32_t _res) {
11722 if ((_res & 1) != 0) return;
11723 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11724 CHECK_ACCESS(_res_ptr);
11725 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
11727 COption_u64Z_free(_res_conv);
11730 static inline uintptr_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
11731 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11732 *ret_copy = COption_u64Z_clone(arg);
11733 uint32_t ret_ref = (uintptr_t)ret_copy;
11736 uint32_t __attribute__((export_name("TS_COption_u64Z_clone_ptr"))) TS_COption_u64Z_clone_ptr(uint32_t arg) {
11737 LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)arg;
11738 uint32_t ret_val = COption_u64Z_clone_ptr(arg_conv);
11742 uint32_t __attribute__((export_name("TS_COption_u64Z_clone"))) TS_COption_u64Z_clone(uint32_t orig) {
11743 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
11744 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11745 *ret_copy = COption_u64Z_clone(orig_conv);
11746 uint32_t ret_ref = (uintptr_t)ret_copy;
11750 uint32_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_ok(uint32_t o) {
11751 LDKPaymentParameters o_conv;
11752 o_conv.inner = (void*)(o & (~1));
11753 o_conv.is_owned = (o & 1) || (o == 0);
11754 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11755 o_conv = PaymentParameters_clone(&o_conv);
11756 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
11757 *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
11758 return (uint32_t)ret_conv;
11761 uint32_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_err"))) TS_CResult_PaymentParametersDecodeErrorZ_err(uint32_t e) {
11762 LDKDecodeError e_conv;
11763 e_conv.inner = (void*)(e & (~1));
11764 e_conv.is_owned = (e & 1) || (e == 0);
11765 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11766 e_conv = DecodeError_clone(&e_conv);
11767 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
11768 *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
11769 return (uint32_t)ret_conv;
11772 jboolean __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_is_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_is_ok(uint32_t o) {
11773 LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(o & ~1);
11774 jboolean ret_val = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
11778 void __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_free"))) TS_CResult_PaymentParametersDecodeErrorZ_free(uint32_t _res) {
11779 if ((_res & 1) != 0) return;
11780 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11781 CHECK_ACCESS(_res_ptr);
11782 LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
11784 CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
11787 static inline uintptr_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
11788 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
11789 *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
11790 return (uint32_t)ret_conv;
11792 uint32_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
11793 LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(arg & ~1);
11794 uint32_t ret_val = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
11798 uint32_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone"))) TS_CResult_PaymentParametersDecodeErrorZ_clone(uint32_t orig) {
11799 LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(orig & ~1);
11800 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
11801 *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
11802 return (uint32_t)ret_conv;
11805 void __attribute__((export_name("TS_CVec_RouteHintHopZ_free"))) TS_CVec_RouteHintHopZ_free(uint32_tArray _res) {
11806 LDKCVec_RouteHintHopZ _res_constr;
11807 _res_constr.datalen = _res->arr_len;
11808 if (_res_constr.datalen > 0)
11809 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
11811 _res_constr.data = NULL;
11812 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
11813 for (size_t o = 0; o < _res_constr.datalen; o++) {
11814 uint32_t _res_conv_14 = _res_vals[o];
11815 LDKRouteHintHop _res_conv_14_conv;
11816 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
11817 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
11818 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
11819 _res_constr.data[o] = _res_conv_14_conv;
11821 CVec_RouteHintHopZ_free(_res_constr);
11824 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_ok"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint32_t o) {
11825 LDKRouteHint o_conv;
11826 o_conv.inner = (void*)(o & (~1));
11827 o_conv.is_owned = (o & 1) || (o == 0);
11828 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11829 o_conv = RouteHint_clone(&o_conv);
11830 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
11831 *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
11832 return (uint32_t)ret_conv;
11835 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_err"))) TS_CResult_RouteHintDecodeErrorZ_err(uint32_t e) {
11836 LDKDecodeError e_conv;
11837 e_conv.inner = (void*)(e & (~1));
11838 e_conv.is_owned = (e & 1) || (e == 0);
11839 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11840 e_conv = DecodeError_clone(&e_conv);
11841 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
11842 *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
11843 return (uint32_t)ret_conv;
11846 jboolean __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_is_ok"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint32_t o) {
11847 LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)(o & ~1);
11848 jboolean ret_val = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
11852 void __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_free"))) TS_CResult_RouteHintDecodeErrorZ_free(uint32_t _res) {
11853 if ((_res & 1) != 0) return;
11854 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11855 CHECK_ACCESS(_res_ptr);
11856 LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
11858 CResult_RouteHintDecodeErrorZ_free(_res_conv);
11861 static inline uintptr_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
11862 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
11863 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
11864 return (uint32_t)ret_conv;
11866 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint32_t arg) {
11867 LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
11868 uint32_t ret_val = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
11872 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint32_t orig) {
11873 LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)(orig & ~1);
11874 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
11875 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
11876 return (uint32_t)ret_conv;
11879 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint32_t o) {
11880 LDKRouteHintHop o_conv;
11881 o_conv.inner = (void*)(o & (~1));
11882 o_conv.is_owned = (o & 1) || (o == 0);
11883 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11884 o_conv = RouteHintHop_clone(&o_conv);
11885 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
11886 *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
11887 return (uint32_t)ret_conv;
11890 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_err"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint32_t e) {
11891 LDKDecodeError e_conv;
11892 e_conv.inner = (void*)(e & (~1));
11893 e_conv.is_owned = (e & 1) || (e == 0);
11894 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11895 e_conv = DecodeError_clone(&e_conv);
11896 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
11897 *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
11898 return (uint32_t)ret_conv;
11901 jboolean __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint32_t o) {
11902 LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(o & ~1);
11903 jboolean ret_val = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
11907 void __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_free"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint32_t _res) {
11908 if ((_res & 1) != 0) return;
11909 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11910 CHECK_ACCESS(_res_ptr);
11911 LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
11913 CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
11916 static inline uintptr_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
11917 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
11918 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
11919 return (uint32_t)ret_conv;
11921 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint32_t arg) {
11922 LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
11923 uint32_t ret_val = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
11927 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint32_t orig) {
11928 LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(orig & ~1);
11929 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
11930 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
11931 return (uint32_t)ret_conv;
11934 void __attribute__((export_name("TS_CVec_ChannelDetailsZ_free"))) TS_CVec_ChannelDetailsZ_free(uint32_tArray _res) {
11935 LDKCVec_ChannelDetailsZ _res_constr;
11936 _res_constr.datalen = _res->arr_len;
11937 if (_res_constr.datalen > 0)
11938 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
11940 _res_constr.data = NULL;
11941 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
11942 for (size_t q = 0; q < _res_constr.datalen; q++) {
11943 uint32_t _res_conv_16 = _res_vals[q];
11944 LDKChannelDetails _res_conv_16_conv;
11945 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
11946 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
11947 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
11948 _res_constr.data[q] = _res_conv_16_conv;
11950 CVec_ChannelDetailsZ_free(_res_constr);
11953 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_ok"))) TS_CResult_RouteLightningErrorZ_ok(uint32_t o) {
11955 o_conv.inner = (void*)(o & (~1));
11956 o_conv.is_owned = (o & 1) || (o == 0);
11957 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11958 o_conv = Route_clone(&o_conv);
11959 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11960 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
11961 return (uint32_t)ret_conv;
11964 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_err"))) TS_CResult_RouteLightningErrorZ_err(uint32_t e) {
11965 LDKLightningError e_conv;
11966 e_conv.inner = (void*)(e & (~1));
11967 e_conv.is_owned = (e & 1) || (e == 0);
11968 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11969 e_conv = LightningError_clone(&e_conv);
11970 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11971 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
11972 return (uint32_t)ret_conv;
11975 jboolean __attribute__((export_name("TS_CResult_RouteLightningErrorZ_is_ok"))) TS_CResult_RouteLightningErrorZ_is_ok(uint32_t o) {
11976 LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)(o & ~1);
11977 jboolean ret_val = CResult_RouteLightningErrorZ_is_ok(o_conv);
11981 void __attribute__((export_name("TS_CResult_RouteLightningErrorZ_free"))) TS_CResult_RouteLightningErrorZ_free(uint32_t _res) {
11982 if ((_res & 1) != 0) return;
11983 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11984 CHECK_ACCESS(_res_ptr);
11985 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
11987 CResult_RouteLightningErrorZ_free(_res_conv);
11990 static inline uintptr_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
11991 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11992 *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
11993 return (uint32_t)ret_conv;
11995 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone_ptr"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint32_t arg) {
11996 LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
11997 uint32_t ret_val = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
12001 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone"))) TS_CResult_RouteLightningErrorZ_clone(uint32_t orig) {
12002 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
12003 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12004 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
12005 return (uint32_t)ret_conv;
12008 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_ok"))) TS_CResult_TxOutAccessErrorZ_ok(uint32_t o) {
12009 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12010 CHECK_ACCESS(o_ptr);
12011 LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
12012 o_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)o) & ~1));
12013 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
12014 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
12015 return (uint32_t)ret_conv;
12018 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_err"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
12019 LDKAccessError e_conv = LDKAccessError_from_js(e);
12020 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
12021 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
12022 return (uint32_t)ret_conv;
12025 jboolean __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_is_ok"))) TS_CResult_TxOutAccessErrorZ_is_ok(uint32_t o) {
12026 LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)(o & ~1);
12027 jboolean ret_val = CResult_TxOutAccessErrorZ_is_ok(o_conv);
12031 void __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_free"))) TS_CResult_TxOutAccessErrorZ_free(uint32_t _res) {
12032 if ((_res & 1) != 0) return;
12033 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12034 CHECK_ACCESS(_res_ptr);
12035 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
12037 CResult_TxOutAccessErrorZ_free(_res_conv);
12040 static inline uintptr_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
12041 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
12042 *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
12043 return (uint32_t)ret_conv;
12045 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone_ptr"))) TS_CResult_TxOutAccessErrorZ_clone_ptr(uint32_t arg) {
12046 LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
12047 uint32_t ret_val = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
12051 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone"))) TS_CResult_TxOutAccessErrorZ_clone(uint32_t orig) {
12052 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
12053 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
12054 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
12055 return (uint32_t)ret_conv;
12058 static inline uintptr_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
12059 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
12060 *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
12061 return ((uint32_t)ret_conv);
12063 uint32_t __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone_ptr"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint32_t arg) {
12064 LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)(arg & ~1);
12065 uint32_t ret_val = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
12069 uint32_t __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone"))) TS_C2Tuple_usizeTransactionZ_clone(uint32_t orig) {
12070 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
12071 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
12072 *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
12073 return ((uint32_t)ret_conv);
12076 uint32_t __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_new"))) TS_C2Tuple_usizeTransactionZ_new(uint32_t a, int8_tArray b) {
12077 LDKTransaction b_ref;
12078 b_ref.datalen = b->arr_len;
12079 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
12080 memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
12081 b_ref.data_is_owned = true;
12082 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
12083 *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
12084 return ((uint32_t)ret_conv);
12087 void __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_free"))) TS_C2Tuple_usizeTransactionZ_free(uint32_t _res) {
12088 if ((_res & 1) != 0) return;
12089 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12090 CHECK_ACCESS(_res_ptr);
12091 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
12093 C2Tuple_usizeTransactionZ_free(_res_conv);
12096 void __attribute__((export_name("TS_CVec_C2Tuple_usizeTransactionZZ_free"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint32_tArray _res) {
12097 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
12098 _res_constr.datalen = _res->arr_len;
12099 if (_res_constr.datalen > 0)
12100 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
12102 _res_constr.data = NULL;
12103 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
12104 for (size_t c = 0; c < _res_constr.datalen; c++) {
12105 uint32_t _res_conv_28 = _res_vals[c];
12106 void* _res_conv_28_ptr = (void*)(((uintptr_t)_res_conv_28) & ~1);
12107 CHECK_ACCESS(_res_conv_28_ptr);
12108 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
12109 FREE((void*)_res_conv_28);
12110 _res_constr.data[c] = _res_conv_28_conv;
12112 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
12115 void __attribute__((export_name("TS_CVec_TxidZ_free"))) TS_CVec_TxidZ_free(ptrArray _res) {
12116 LDKCVec_TxidZ _res_constr;
12117 _res_constr.datalen = _res->arr_len;
12118 if (_res_constr.datalen > 0)
12119 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
12121 _res_constr.data = NULL;
12122 int8_tArray* _res_vals = (void*) _res->elems /* XXX _res leaks */;
12123 for (size_t m = 0; m < _res_constr.datalen; m++) {
12124 int8_tArray _res_conv_12 = _res_vals[m];
12125 LDKThirtyTwoBytes _res_conv_12_ref;
12126 CHECK(_res_conv_12->arr_len == 32);
12127 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
12128 _res_constr.data[m] = _res_conv_12_ref;
12130 CVec_TxidZ_free(_res_constr);
12133 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
12134 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
12135 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
12136 return (uint32_t)ret_conv;
12139 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_err"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
12140 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
12141 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
12142 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
12143 return (uint32_t)ret_conv;
12146 jboolean __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_is_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_is_ok(uint32_t o) {
12147 LDKCResult_NoneChannelMonitorUpdateErrZ* o_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(o & ~1);
12148 jboolean ret_val = CResult_NoneChannelMonitorUpdateErrZ_is_ok(o_conv);
12152 void __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_free"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint32_t _res) {
12153 if ((_res & 1) != 0) return;
12154 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12155 CHECK_ACCESS(_res_ptr);
12156 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
12158 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
12161 static inline uintptr_t CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR arg) {
12162 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
12163 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(arg);
12164 return (uint32_t)ret_conv;
12166 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_clone_ptr"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(uint32_t arg) {
12167 LDKCResult_NoneChannelMonitorUpdateErrZ* arg_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
12168 uint32_t ret_val = CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(arg_conv);
12172 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_clone"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint32_t orig) {
12173 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
12174 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
12175 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
12176 return (uint32_t)ret_conv;
12179 void __attribute__((export_name("TS_CVec_MonitorEventZ_free"))) TS_CVec_MonitorEventZ_free(uint32_tArray _res) {
12180 LDKCVec_MonitorEventZ _res_constr;
12181 _res_constr.datalen = _res->arr_len;
12182 if (_res_constr.datalen > 0)
12183 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
12185 _res_constr.data = NULL;
12186 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
12187 for (size_t o = 0; o < _res_constr.datalen; o++) {
12188 uint32_t _res_conv_14 = _res_vals[o];
12189 void* _res_conv_14_ptr = (void*)(((uintptr_t)_res_conv_14) & ~1);
12190 CHECK_ACCESS(_res_conv_14_ptr);
12191 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
12192 FREE((void*)_res_conv_14);
12193 _res_constr.data[o] = _res_conv_14_conv;
12195 CVec_MonitorEventZ_free(_res_constr);
12198 uint32_t __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_some"))) TS_COption_C2Tuple_usizeTransactionZZ_some(uint32_t o) {
12199 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12200 CHECK_ACCESS(o_ptr);
12201 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(o_ptr);
12202 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)o) & ~1));
12203 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
12204 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
12205 uint32_t ret_ref = (uintptr_t)ret_copy;
12209 uint32_t __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_none"))) TS_COption_C2Tuple_usizeTransactionZZ_none() {
12210 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
12211 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
12212 uint32_t ret_ref = (uintptr_t)ret_copy;
12216 void __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_free"))) TS_COption_C2Tuple_usizeTransactionZZ_free(uint32_t _res) {
12217 if ((_res & 1) != 0) return;
12218 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12219 CHECK_ACCESS(_res_ptr);
12220 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(_res_ptr);
12222 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
12225 static inline uintptr_t COption_C2Tuple_usizeTransactionZZ_clone_ptr(LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR arg) {
12226 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
12227 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(arg);
12228 uint32_t ret_ref = (uintptr_t)ret_copy;
12231 uint32_t __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_clone_ptr"))) TS_COption_C2Tuple_usizeTransactionZZ_clone_ptr(uint32_t arg) {
12232 LDKCOption_C2Tuple_usizeTransactionZZ* arg_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)arg;
12233 uint32_t ret_val = COption_C2Tuple_usizeTransactionZZ_clone_ptr(arg_conv);
12237 uint32_t __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_clone"))) TS_COption_C2Tuple_usizeTransactionZZ_clone(uint32_t orig) {
12238 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
12239 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
12240 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
12241 uint32_t ret_ref = (uintptr_t)ret_copy;
12245 uint32_t __attribute__((export_name("TS_COption_ClosureReasonZ_some"))) TS_COption_ClosureReasonZ_some(uint32_t o) {
12246 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12247 CHECK_ACCESS(o_ptr);
12248 LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
12249 o_conv = ClosureReason_clone((LDKClosureReason*)(((uintptr_t)o) & ~1));
12250 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12251 *ret_copy = COption_ClosureReasonZ_some(o_conv);
12252 uint32_t ret_ref = (uintptr_t)ret_copy;
12256 uint32_t __attribute__((export_name("TS_COption_ClosureReasonZ_none"))) TS_COption_ClosureReasonZ_none() {
12257 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12258 *ret_copy = COption_ClosureReasonZ_none();
12259 uint32_t ret_ref = (uintptr_t)ret_copy;
12263 void __attribute__((export_name("TS_COption_ClosureReasonZ_free"))) TS_COption_ClosureReasonZ_free(uint32_t _res) {
12264 if ((_res & 1) != 0) return;
12265 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12266 CHECK_ACCESS(_res_ptr);
12267 LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
12269 COption_ClosureReasonZ_free(_res_conv);
12272 static inline uintptr_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
12273 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12274 *ret_copy = COption_ClosureReasonZ_clone(arg);
12275 uint32_t ret_ref = (uintptr_t)ret_copy;
12278 uint32_t __attribute__((export_name("TS_COption_ClosureReasonZ_clone_ptr"))) TS_COption_ClosureReasonZ_clone_ptr(uint32_t arg) {
12279 LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)arg;
12280 uint32_t ret_val = COption_ClosureReasonZ_clone_ptr(arg_conv);
12284 uint32_t __attribute__((export_name("TS_COption_ClosureReasonZ_clone"))) TS_COption_ClosureReasonZ_clone(uint32_t orig) {
12285 LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)orig;
12286 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12287 *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
12288 uint32_t ret_ref = (uintptr_t)ret_copy;
12292 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint32_t o) {
12293 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12294 CHECK_ACCESS(o_ptr);
12295 LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
12296 o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)(((uintptr_t)o) & ~1));
12297 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12298 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
12299 return (uint32_t)ret_conv;
12302 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint32_t e) {
12303 LDKDecodeError e_conv;
12304 e_conv.inner = (void*)(e & (~1));
12305 e_conv.is_owned = (e & 1) || (e == 0);
12306 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12307 e_conv = DecodeError_clone(&e_conv);
12308 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12309 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
12310 return (uint32_t)ret_conv;
12313 jboolean __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint32_t o) {
12314 LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(o & ~1);
12315 jboolean ret_val = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
12319 void __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_free"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint32_t _res) {
12320 if ((_res & 1) != 0) return;
12321 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12322 CHECK_ACCESS(_res_ptr);
12323 LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
12325 CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
12328 static inline uintptr_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
12329 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12330 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
12331 return (uint32_t)ret_conv;
12333 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint32_t arg) {
12334 LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(arg & ~1);
12335 uint32_t ret_val = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
12339 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint32_t orig) {
12340 LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(orig & ~1);
12341 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12342 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
12343 return (uint32_t)ret_conv;
12346 uint32_t __attribute__((export_name("TS_COption_NetworkUpdateZ_some"))) TS_COption_NetworkUpdateZ_some(uint32_t o) {
12347 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12348 CHECK_ACCESS(o_ptr);
12349 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
12350 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uintptr_t)o) & ~1));
12351 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12352 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
12353 uint32_t ret_ref = (uintptr_t)ret_copy;
12357 uint32_t __attribute__((export_name("TS_COption_NetworkUpdateZ_none"))) TS_COption_NetworkUpdateZ_none() {
12358 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12359 *ret_copy = COption_NetworkUpdateZ_none();
12360 uint32_t ret_ref = (uintptr_t)ret_copy;
12364 void __attribute__((export_name("TS_COption_NetworkUpdateZ_free"))) TS_COption_NetworkUpdateZ_free(uint32_t _res) {
12365 if ((_res & 1) != 0) return;
12366 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12367 CHECK_ACCESS(_res_ptr);
12368 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
12370 COption_NetworkUpdateZ_free(_res_conv);
12373 static inline uintptr_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
12374 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12375 *ret_copy = COption_NetworkUpdateZ_clone(arg);
12376 uint32_t ret_ref = (uintptr_t)ret_copy;
12379 uint32_t __attribute__((export_name("TS_COption_NetworkUpdateZ_clone_ptr"))) TS_COption_NetworkUpdateZ_clone_ptr(uint32_t arg) {
12380 LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)arg;
12381 uint32_t ret_val = COption_NetworkUpdateZ_clone_ptr(arg_conv);
12385 uint32_t __attribute__((export_name("TS_COption_NetworkUpdateZ_clone"))) TS_COption_NetworkUpdateZ_clone(uint32_t orig) {
12386 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
12387 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12388 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
12389 uint32_t ret_ref = (uintptr_t)ret_copy;
12393 void __attribute__((export_name("TS_CVec_SpendableOutputDescriptorZ_free"))) TS_CVec_SpendableOutputDescriptorZ_free(uint32_tArray _res) {
12394 LDKCVec_SpendableOutputDescriptorZ _res_constr;
12395 _res_constr.datalen = _res->arr_len;
12396 if (_res_constr.datalen > 0)
12397 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
12399 _res_constr.data = NULL;
12400 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
12401 for (size_t b = 0; b < _res_constr.datalen; b++) {
12402 uint32_t _res_conv_27 = _res_vals[b];
12403 void* _res_conv_27_ptr = (void*)(((uintptr_t)_res_conv_27) & ~1);
12404 CHECK_ACCESS(_res_conv_27_ptr);
12405 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
12406 FREE((void*)_res_conv_27);
12407 _res_constr.data[b] = _res_conv_27_conv;
12409 CVec_SpendableOutputDescriptorZ_free(_res_constr);
12412 uint32_t __attribute__((export_name("TS_COption_EventZ_some"))) TS_COption_EventZ_some(uint32_t o) {
12413 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12414 CHECK_ACCESS(o_ptr);
12415 LDKEvent o_conv = *(LDKEvent*)(o_ptr);
12416 o_conv = Event_clone((LDKEvent*)(((uintptr_t)o) & ~1));
12417 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12418 *ret_copy = COption_EventZ_some(o_conv);
12419 uint32_t ret_ref = (uintptr_t)ret_copy;
12423 uint32_t __attribute__((export_name("TS_COption_EventZ_none"))) TS_COption_EventZ_none() {
12424 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12425 *ret_copy = COption_EventZ_none();
12426 uint32_t ret_ref = (uintptr_t)ret_copy;
12430 void __attribute__((export_name("TS_COption_EventZ_free"))) TS_COption_EventZ_free(uint32_t _res) {
12431 if ((_res & 1) != 0) return;
12432 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12433 CHECK_ACCESS(_res_ptr);
12434 LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
12436 COption_EventZ_free(_res_conv);
12439 static inline uintptr_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
12440 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12441 *ret_copy = COption_EventZ_clone(arg);
12442 uint32_t ret_ref = (uintptr_t)ret_copy;
12445 uint32_t __attribute__((export_name("TS_COption_EventZ_clone_ptr"))) TS_COption_EventZ_clone_ptr(uint32_t arg) {
12446 LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)arg;
12447 uint32_t ret_val = COption_EventZ_clone_ptr(arg_conv);
12451 uint32_t __attribute__((export_name("TS_COption_EventZ_clone"))) TS_COption_EventZ_clone(uint32_t orig) {
12452 LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)orig;
12453 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12454 *ret_copy = COption_EventZ_clone(orig_conv);
12455 uint32_t ret_ref = (uintptr_t)ret_copy;
12459 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_ok"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint32_t o) {
12460 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12461 CHECK_ACCESS(o_ptr);
12462 LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
12463 o_conv = COption_EventZ_clone((LDKCOption_EventZ*)(((uintptr_t)o) & ~1));
12464 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12465 *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
12466 return (uint32_t)ret_conv;
12469 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_err"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint32_t e) {
12470 LDKDecodeError e_conv;
12471 e_conv.inner = (void*)(e & (~1));
12472 e_conv.is_owned = (e & 1) || (e == 0);
12473 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12474 e_conv = DecodeError_clone(&e_conv);
12475 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12476 *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
12477 return (uint32_t)ret_conv;
12480 jboolean __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_is_ok"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint32_t o) {
12481 LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(o & ~1);
12482 jboolean ret_val = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
12486 void __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_free"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint32_t _res) {
12487 if ((_res & 1) != 0) return;
12488 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12489 CHECK_ACCESS(_res_ptr);
12490 LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
12492 CResult_COption_EventZDecodeErrorZ_free(_res_conv);
12495 static inline uintptr_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
12496 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12497 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
12498 return (uint32_t)ret_conv;
12500 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint32_t arg) {
12501 LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(arg & ~1);
12502 uint32_t ret_val = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
12506 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint32_t orig) {
12507 LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(orig & ~1);
12508 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12509 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
12510 return (uint32_t)ret_conv;
12513 void __attribute__((export_name("TS_CVec_MessageSendEventZ_free"))) TS_CVec_MessageSendEventZ_free(uint32_tArray _res) {
12514 LDKCVec_MessageSendEventZ _res_constr;
12515 _res_constr.datalen = _res->arr_len;
12516 if (_res_constr.datalen > 0)
12517 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
12519 _res_constr.data = NULL;
12520 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
12521 for (size_t s = 0; s < _res_constr.datalen; s++) {
12522 uint32_t _res_conv_18 = _res_vals[s];
12523 void* _res_conv_18_ptr = (void*)(((uintptr_t)_res_conv_18) & ~1);
12524 CHECK_ACCESS(_res_conv_18_ptr);
12525 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
12526 FREE((void*)_res_conv_18);
12527 _res_constr.data[s] = _res_conv_18_conv;
12529 CVec_MessageSendEventZ_free(_res_constr);
12532 uint32_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok(uint32_t o) {
12533 LDKFixedPenaltyScorer o_conv;
12534 o_conv.inner = (void*)(o & (~1));
12535 o_conv.is_owned = (o & 1) || (o == 0);
12536 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12537 o_conv = FixedPenaltyScorer_clone(&o_conv);
12538 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
12539 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
12540 return (uint32_t)ret_conv;
12543 uint32_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_err(uint32_t e) {
12544 LDKDecodeError e_conv;
12545 e_conv.inner = (void*)(e & (~1));
12546 e_conv.is_owned = (e & 1) || (e == 0);
12547 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12548 e_conv = DecodeError_clone(&e_conv);
12549 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
12550 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
12551 return (uint32_t)ret_conv;
12554 jboolean __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(uint32_t o) {
12555 LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(o & ~1);
12556 jboolean ret_val = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
12560 void __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_free"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_free(uint32_t _res) {
12561 if ((_res & 1) != 0) return;
12562 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12563 CHECK_ACCESS(_res_ptr);
12564 LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
12566 CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
12569 static inline uintptr_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
12570 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
12571 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
12572 return (uint32_t)ret_conv;
12574 uint32_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(uint32_t arg) {
12575 LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(arg & ~1);
12576 uint32_t ret_val = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
12580 uint32_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone(uint32_t orig) {
12581 LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(orig & ~1);
12582 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
12583 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
12584 return (uint32_t)ret_conv;
12587 uint32_t __attribute__((export_name("TS_CResult_ScoringParametersDecodeErrorZ_ok"))) TS_CResult_ScoringParametersDecodeErrorZ_ok(uint32_t o) {
12588 LDKScoringParameters o_conv;
12589 o_conv.inner = (void*)(o & (~1));
12590 o_conv.is_owned = (o & 1) || (o == 0);
12591 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12592 o_conv = ScoringParameters_clone(&o_conv);
12593 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
12594 *ret_conv = CResult_ScoringParametersDecodeErrorZ_ok(o_conv);
12595 return (uint32_t)ret_conv;
12598 uint32_t __attribute__((export_name("TS_CResult_ScoringParametersDecodeErrorZ_err"))) TS_CResult_ScoringParametersDecodeErrorZ_err(uint32_t e) {
12599 LDKDecodeError e_conv;
12600 e_conv.inner = (void*)(e & (~1));
12601 e_conv.is_owned = (e & 1) || (e == 0);
12602 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12603 e_conv = DecodeError_clone(&e_conv);
12604 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
12605 *ret_conv = CResult_ScoringParametersDecodeErrorZ_err(e_conv);
12606 return (uint32_t)ret_conv;
12609 jboolean __attribute__((export_name("TS_CResult_ScoringParametersDecodeErrorZ_is_ok"))) TS_CResult_ScoringParametersDecodeErrorZ_is_ok(uint32_t o) {
12610 LDKCResult_ScoringParametersDecodeErrorZ* o_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(o & ~1);
12611 jboolean ret_val = CResult_ScoringParametersDecodeErrorZ_is_ok(o_conv);
12615 void __attribute__((export_name("TS_CResult_ScoringParametersDecodeErrorZ_free"))) TS_CResult_ScoringParametersDecodeErrorZ_free(uint32_t _res) {
12616 if ((_res & 1) != 0) return;
12617 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12618 CHECK_ACCESS(_res_ptr);
12619 LDKCResult_ScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ScoringParametersDecodeErrorZ*)(_res_ptr);
12621 CResult_ScoringParametersDecodeErrorZ_free(_res_conv);
12624 static inline uintptr_t CResult_ScoringParametersDecodeErrorZ_clone_ptr(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR arg) {
12625 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
12626 *ret_conv = CResult_ScoringParametersDecodeErrorZ_clone(arg);
12627 return (uint32_t)ret_conv;
12629 uint32_t __attribute__((export_name("TS_CResult_ScoringParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ScoringParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
12630 LDKCResult_ScoringParametersDecodeErrorZ* arg_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1);
12631 uint32_t ret_val = CResult_ScoringParametersDecodeErrorZ_clone_ptr(arg_conv);
12635 uint32_t __attribute__((export_name("TS_CResult_ScoringParametersDecodeErrorZ_clone"))) TS_CResult_ScoringParametersDecodeErrorZ_clone(uint32_t orig) {
12636 LDKCResult_ScoringParametersDecodeErrorZ* orig_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(orig & ~1);
12637 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
12638 *ret_conv = CResult_ScoringParametersDecodeErrorZ_clone(orig_conv);
12639 return (uint32_t)ret_conv;
12642 uint32_t __attribute__((export_name("TS_CResult_ScorerDecodeErrorZ_ok"))) TS_CResult_ScorerDecodeErrorZ_ok(uint32_t o) {
12644 o_conv.inner = (void*)(o & (~1));
12645 o_conv.is_owned = (o & 1) || (o == 0);
12646 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12647 // WARNING: we need a move here but no clone is available for LDKScorer
12648 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
12649 *ret_conv = CResult_ScorerDecodeErrorZ_ok(o_conv);
12650 return (uint32_t)ret_conv;
12653 uint32_t __attribute__((export_name("TS_CResult_ScorerDecodeErrorZ_err"))) TS_CResult_ScorerDecodeErrorZ_err(uint32_t e) {
12654 LDKDecodeError e_conv;
12655 e_conv.inner = (void*)(e & (~1));
12656 e_conv.is_owned = (e & 1) || (e == 0);
12657 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12658 e_conv = DecodeError_clone(&e_conv);
12659 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
12660 *ret_conv = CResult_ScorerDecodeErrorZ_err(e_conv);
12661 return (uint32_t)ret_conv;
12664 jboolean __attribute__((export_name("TS_CResult_ScorerDecodeErrorZ_is_ok"))) TS_CResult_ScorerDecodeErrorZ_is_ok(uint32_t o) {
12665 LDKCResult_ScorerDecodeErrorZ* o_conv = (LDKCResult_ScorerDecodeErrorZ*)(o & ~1);
12666 jboolean ret_val = CResult_ScorerDecodeErrorZ_is_ok(o_conv);
12670 void __attribute__((export_name("TS_CResult_ScorerDecodeErrorZ_free"))) TS_CResult_ScorerDecodeErrorZ_free(uint32_t _res) {
12671 if ((_res & 1) != 0) return;
12672 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12673 CHECK_ACCESS(_res_ptr);
12674 LDKCResult_ScorerDecodeErrorZ _res_conv = *(LDKCResult_ScorerDecodeErrorZ*)(_res_ptr);
12676 CResult_ScorerDecodeErrorZ_free(_res_conv);
12679 uint32_t __attribute__((export_name("TS_CResult_ProbabilisticScoringParametersDecodeErrorZ_ok"))) TS_CResult_ProbabilisticScoringParametersDecodeErrorZ_ok(uint32_t o) {
12680 LDKProbabilisticScoringParameters o_conv;
12681 o_conv.inner = (void*)(o & (~1));
12682 o_conv.is_owned = (o & 1) || (o == 0);
12683 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12684 o_conv = ProbabilisticScoringParameters_clone(&o_conv);
12685 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ");
12686 *ret_conv = CResult_ProbabilisticScoringParametersDecodeErrorZ_ok(o_conv);
12687 return (uint32_t)ret_conv;
12690 uint32_t __attribute__((export_name("TS_CResult_ProbabilisticScoringParametersDecodeErrorZ_err"))) TS_CResult_ProbabilisticScoringParametersDecodeErrorZ_err(uint32_t e) {
12691 LDKDecodeError e_conv;
12692 e_conv.inner = (void*)(e & (~1));
12693 e_conv.is_owned = (e & 1) || (e == 0);
12694 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12695 e_conv = DecodeError_clone(&e_conv);
12696 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ");
12697 *ret_conv = CResult_ProbabilisticScoringParametersDecodeErrorZ_err(e_conv);
12698 return (uint32_t)ret_conv;
12701 jboolean __attribute__((export_name("TS_CResult_ProbabilisticScoringParametersDecodeErrorZ_is_ok"))) TS_CResult_ProbabilisticScoringParametersDecodeErrorZ_is_ok(uint32_t o) {
12702 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(o & ~1);
12703 jboolean ret_val = CResult_ProbabilisticScoringParametersDecodeErrorZ_is_ok(o_conv);
12707 void __attribute__((export_name("TS_CResult_ProbabilisticScoringParametersDecodeErrorZ_free"))) TS_CResult_ProbabilisticScoringParametersDecodeErrorZ_free(uint32_t _res) {
12708 if ((_res & 1) != 0) return;
12709 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12710 CHECK_ACCESS(_res_ptr);
12711 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(_res_ptr);
12713 CResult_ProbabilisticScoringParametersDecodeErrorZ_free(_res_conv);
12716 static inline uintptr_t CResult_ProbabilisticScoringParametersDecodeErrorZ_clone_ptr(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR arg) {
12717 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ");
12718 *ret_conv = CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(arg);
12719 return (uint32_t)ret_conv;
12721 uint32_t __attribute__((export_name("TS_CResult_ProbabilisticScoringParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ProbabilisticScoringParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
12722 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* arg_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(arg & ~1);
12723 uint32_t ret_val = CResult_ProbabilisticScoringParametersDecodeErrorZ_clone_ptr(arg_conv);
12727 uint32_t __attribute__((export_name("TS_CResult_ProbabilisticScoringParametersDecodeErrorZ_clone"))) TS_CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(uint32_t orig) {
12728 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* orig_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(orig & ~1);
12729 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ");
12730 *ret_conv = CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(orig_conv);
12731 return (uint32_t)ret_conv;
12734 static inline uintptr_t C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone_ptr(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ *NONNULL_PTR arg) {
12735 LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ), "LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ");
12736 *ret_conv = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone(arg);
12737 return ((uint32_t)ret_conv);
12739 uint32_t __attribute__((export_name("TS_C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone_ptr"))) TS_C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone_ptr(uint32_t arg) {
12740 LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* arg_conv = (LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(arg & ~1);
12741 uint32_t ret_val = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone_ptr(arg_conv);
12745 uint32_t __attribute__((export_name("TS_C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone"))) TS_C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone(uint32_t orig) {
12746 LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* orig_conv = (LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(orig & ~1);
12747 LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ), "LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ");
12748 *ret_conv = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone(orig_conv);
12749 return ((uint32_t)ret_conv);
12752 uint32_t __attribute__((export_name("TS_C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_new"))) TS_C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_new(uint32_t a, uint32_t b) {
12753 LDKProbabilisticScoringParameters a_conv;
12754 a_conv.inner = (void*)(a & (~1));
12755 a_conv.is_owned = (a & 1) || (a == 0);
12756 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
12757 a_conv = ProbabilisticScoringParameters_clone(&a_conv);
12758 LDKNetworkGraph b_conv;
12759 b_conv.inner = (void*)(b & (~1));
12760 b_conv.is_owned = false;
12761 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
12762 LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ), "LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ");
12763 *ret_conv = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_new(a_conv, &b_conv);
12764 return ((uint32_t)ret_conv);
12767 void __attribute__((export_name("TS_C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_free"))) TS_C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_free(uint32_t _res) {
12768 if ((_res & 1) != 0) return;
12769 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12770 CHECK_ACCESS(_res_ptr);
12771 LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ _res_conv = *(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(_res_ptr);
12773 C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_free(_res_conv);
12776 uint32_t __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_ok(uint32_t o) {
12777 LDKProbabilisticScorer o_conv;
12778 o_conv.inner = (void*)(o & (~1));
12779 o_conv.is_owned = (o & 1) || (o == 0);
12780 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12781 // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
12782 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
12783 *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
12784 return (uint32_t)ret_conv;
12787 uint32_t __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_err(uint32_t e) {
12788 LDKDecodeError e_conv;
12789 e_conv.inner = (void*)(e & (~1));
12790 e_conv.is_owned = (e & 1) || (e == 0);
12791 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12792 e_conv = DecodeError_clone(&e_conv);
12793 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
12794 *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
12795 return (uint32_t)ret_conv;
12798 jboolean __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok(uint32_t o) {
12799 LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(o & ~1);
12800 jboolean ret_val = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
12804 void __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_free"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_free(uint32_t _res) {
12805 if ((_res & 1) != 0) return;
12806 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12807 CHECK_ACCESS(_res_ptr);
12808 LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
12810 CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
12813 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) {
12814 LDKInitFeatures o_conv;
12815 o_conv.inner = (void*)(o & (~1));
12816 o_conv.is_owned = (o & 1) || (o == 0);
12817 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12818 o_conv = InitFeatures_clone(&o_conv);
12819 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
12820 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
12821 return (uint32_t)ret_conv;
12824 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_err"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) {
12825 LDKDecodeError e_conv;
12826 e_conv.inner = (void*)(e & (~1));
12827 e_conv.is_owned = (e & 1) || (e == 0);
12828 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12829 e_conv = DecodeError_clone(&e_conv);
12830 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
12831 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
12832 return (uint32_t)ret_conv;
12835 jboolean __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint32_t o) {
12836 LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(o & ~1);
12837 jboolean ret_val = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
12841 void __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_free"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) {
12842 if ((_res & 1) != 0) return;
12843 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12844 CHECK_ACCESS(_res_ptr);
12845 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
12847 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
12850 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint32_t o) {
12851 LDKChannelFeatures o_conv;
12852 o_conv.inner = (void*)(o & (~1));
12853 o_conv.is_owned = (o & 1) || (o == 0);
12854 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12855 o_conv = ChannelFeatures_clone(&o_conv);
12856 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
12857 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
12858 return (uint32_t)ret_conv;
12861 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint32_t e) {
12862 LDKDecodeError e_conv;
12863 e_conv.inner = (void*)(e & (~1));
12864 e_conv.is_owned = (e & 1) || (e == 0);
12865 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12866 e_conv = DecodeError_clone(&e_conv);
12867 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
12868 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
12869 return (uint32_t)ret_conv;
12872 jboolean __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint32_t o) {
12873 LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(o & ~1);
12874 jboolean ret_val = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
12878 void __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint32_t _res) {
12879 if ((_res & 1) != 0) return;
12880 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12881 CHECK_ACCESS(_res_ptr);
12882 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
12884 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
12887 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) {
12888 LDKNodeFeatures o_conv;
12889 o_conv.inner = (void*)(o & (~1));
12890 o_conv.is_owned = (o & 1) || (o == 0);
12891 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12892 o_conv = NodeFeatures_clone(&o_conv);
12893 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
12894 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
12895 return (uint32_t)ret_conv;
12898 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) {
12899 LDKDecodeError e_conv;
12900 e_conv.inner = (void*)(e & (~1));
12901 e_conv.is_owned = (e & 1) || (e == 0);
12902 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12903 e_conv = DecodeError_clone(&e_conv);
12904 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
12905 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
12906 return (uint32_t)ret_conv;
12909 jboolean __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint32_t o) {
12910 LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(o & ~1);
12911 jboolean ret_val = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
12915 void __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_free"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) {
12916 if ((_res & 1) != 0) return;
12917 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12918 CHECK_ACCESS(_res_ptr);
12919 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
12921 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
12924 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint32_t o) {
12925 LDKInvoiceFeatures o_conv;
12926 o_conv.inner = (void*)(o & (~1));
12927 o_conv.is_owned = (o & 1) || (o == 0);
12928 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12929 o_conv = InvoiceFeatures_clone(&o_conv);
12930 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
12931 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
12932 return (uint32_t)ret_conv;
12935 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint32_t e) {
12936 LDKDecodeError e_conv;
12937 e_conv.inner = (void*)(e & (~1));
12938 e_conv.is_owned = (e & 1) || (e == 0);
12939 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12940 e_conv = DecodeError_clone(&e_conv);
12941 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
12942 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
12943 return (uint32_t)ret_conv;
12946 jboolean __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok(uint32_t o) {
12947 LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(o & ~1);
12948 jboolean ret_val = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
12952 void __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint32_t _res) {
12953 if ((_res & 1) != 0) return;
12954 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12955 CHECK_ACCESS(_res_ptr);
12956 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
12958 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
12961 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint32_t o) {
12962 LDKChannelTypeFeatures o_conv;
12963 o_conv.inner = (void*)(o & (~1));
12964 o_conv.is_owned = (o & 1) || (o == 0);
12965 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12966 o_conv = ChannelTypeFeatures_clone(&o_conv);
12967 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
12968 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
12969 return (uint32_t)ret_conv;
12972 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint32_t e) {
12973 LDKDecodeError e_conv;
12974 e_conv.inner = (void*)(e & (~1));
12975 e_conv.is_owned = (e & 1) || (e == 0);
12976 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12977 e_conv = DecodeError_clone(&e_conv);
12978 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
12979 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
12980 return (uint32_t)ret_conv;
12983 jboolean __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint32_t o) {
12984 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(o & ~1);
12985 jboolean ret_val = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
12989 void __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint32_t _res) {
12990 if ((_res & 1) != 0) return;
12991 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12992 CHECK_ACCESS(_res_ptr);
12993 LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
12995 CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
12998 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
12999 LDKDelayedPaymentOutputDescriptor o_conv;
13000 o_conv.inner = (void*)(o & (~1));
13001 o_conv.is_owned = (o & 1) || (o == 0);
13002 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13003 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
13004 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
13005 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
13006 return (uint32_t)ret_conv;
13009 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
13010 LDKDecodeError e_conv;
13011 e_conv.inner = (void*)(e & (~1));
13012 e_conv.is_owned = (e & 1) || (e == 0);
13013 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13014 e_conv = DecodeError_clone(&e_conv);
13015 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
13016 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
13017 return (uint32_t)ret_conv;
13020 jboolean __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
13021 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
13022 jboolean ret_val = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
13026 void __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
13027 if ((_res & 1) != 0) return;
13028 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13029 CHECK_ACCESS(_res_ptr);
13030 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
13032 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
13035 static inline uintptr_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
13036 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
13037 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
13038 return (uint32_t)ret_conv;
13040 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
13041 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
13042 uint32_t ret_val = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
13046 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
13047 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
13048 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
13049 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
13050 return (uint32_t)ret_conv;
13053 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
13054 LDKStaticPaymentOutputDescriptor o_conv;
13055 o_conv.inner = (void*)(o & (~1));
13056 o_conv.is_owned = (o & 1) || (o == 0);
13057 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13058 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
13059 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
13060 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
13061 return (uint32_t)ret_conv;
13064 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
13065 LDKDecodeError e_conv;
13066 e_conv.inner = (void*)(e & (~1));
13067 e_conv.is_owned = (e & 1) || (e == 0);
13068 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13069 e_conv = DecodeError_clone(&e_conv);
13070 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
13071 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
13072 return (uint32_t)ret_conv;
13075 jboolean __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
13076 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
13077 jboolean ret_val = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
13081 void __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
13082 if ((_res & 1) != 0) return;
13083 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13084 CHECK_ACCESS(_res_ptr);
13085 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
13087 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
13090 static inline uintptr_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
13091 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
13092 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
13093 return (uint32_t)ret_conv;
13095 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
13096 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
13097 uint32_t ret_val = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
13101 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
13102 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
13103 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
13104 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
13105 return (uint32_t)ret_conv;
13108 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
13109 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
13110 CHECK_ACCESS(o_ptr);
13111 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
13112 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)o) & ~1));
13113 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
13114 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
13115 return (uint32_t)ret_conv;
13118 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint32_t e) {
13119 LDKDecodeError e_conv;
13120 e_conv.inner = (void*)(e & (~1));
13121 e_conv.is_owned = (e & 1) || (e == 0);
13122 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13123 e_conv = DecodeError_clone(&e_conv);
13124 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
13125 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
13126 return (uint32_t)ret_conv;
13129 jboolean __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
13130 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(o & ~1);
13131 jboolean ret_val = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
13135 void __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
13136 if ((_res & 1) != 0) return;
13137 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13138 CHECK_ACCESS(_res_ptr);
13139 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
13141 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
13144 static inline uintptr_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
13145 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
13146 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
13147 return (uint32_t)ret_conv;
13149 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
13150 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
13151 uint32_t ret_val = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
13155 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
13156 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
13157 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
13158 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
13159 return (uint32_t)ret_conv;
13162 void __attribute__((export_name("TS_CVec_PaymentPreimageZ_free"))) TS_CVec_PaymentPreimageZ_free(ptrArray _res) {
13163 LDKCVec_PaymentPreimageZ _res_constr;
13164 _res_constr.datalen = _res->arr_len;
13165 if (_res_constr.datalen > 0)
13166 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
13168 _res_constr.data = NULL;
13169 int8_tArray* _res_vals = (void*) _res->elems /* XXX _res leaks */;
13170 for (size_t m = 0; m < _res_constr.datalen; m++) {
13171 int8_tArray _res_conv_12 = _res_vals[m];
13172 LDKThirtyTwoBytes _res_conv_12_ref;
13173 CHECK(_res_conv_12->arr_len == 32);
13174 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
13175 _res_constr.data[m] = _res_conv_12_ref;
13177 CVec_PaymentPreimageZ_free(_res_constr);
13180 static inline uintptr_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
13181 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
13182 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
13183 return ((uint32_t)ret_conv);
13185 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(uint32_t arg) {
13186 LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(arg & ~1);
13187 uint32_t ret_val = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
13191 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint32_t orig) {
13192 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
13193 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
13194 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
13195 return ((uint32_t)ret_conv);
13198 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_new"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
13199 LDKSignature a_ref;
13200 CHECK(a->arr_len == 64);
13201 memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
13202 LDKCVec_SignatureZ b_constr;
13203 b_constr.datalen = b->arr_len;
13204 if (b_constr.datalen > 0)
13205 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
13207 b_constr.data = NULL;
13208 int8_tArray* b_vals = (void*) b->elems /* XXX b leaks */;
13209 for (size_t m = 0; m < b_constr.datalen; m++) {
13210 int8_tArray b_conv_12 = b_vals[m];
13211 LDKSignature b_conv_12_ref;
13212 CHECK(b_conv_12->arr_len == 64);
13213 memcpy(b_conv_12_ref.compact_form, b_conv_12->elems, 64); FREE(b_conv_12);
13214 b_constr.data[m] = b_conv_12_ref;
13216 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
13217 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
13218 return ((uint32_t)ret_conv);
13221 void __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_free"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint32_t _res) {
13222 if ((_res & 1) != 0) return;
13223 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13224 CHECK_ACCESS(_res_ptr);
13225 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
13227 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
13230 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint32_t o) {
13231 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
13232 CHECK_ACCESS(o_ptr);
13233 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
13234 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uintptr_t)o) & ~1));
13235 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
13236 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
13237 return (uint32_t)ret_conv;
13240 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
13241 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
13242 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
13243 return (uint32_t)ret_conv;
13246 jboolean __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(uint32_t o) {
13247 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(o & ~1);
13248 jboolean ret_val = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
13252 void __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint32_t _res) {
13253 if ((_res & 1) != 0) return;
13254 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13255 CHECK_ACCESS(_res_ptr);
13256 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
13258 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
13261 static inline uintptr_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
13262 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
13263 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
13264 return (uint32_t)ret_conv;
13266 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(uint32_t arg) {
13267 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
13268 uint32_t ret_val = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
13272 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint32_t orig) {
13273 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
13274 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
13275 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
13276 return (uint32_t)ret_conv;
13279 uint32_t __attribute__((export_name("TS_CResult_SignatureNoneZ_ok"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
13280 LDKSignature o_ref;
13281 CHECK(o->arr_len == 64);
13282 memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
13283 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
13284 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
13285 return (uint32_t)ret_conv;
13288 uint32_t __attribute__((export_name("TS_CResult_SignatureNoneZ_err"))) TS_CResult_SignatureNoneZ_err() {
13289 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
13290 *ret_conv = CResult_SignatureNoneZ_err();
13291 return (uint32_t)ret_conv;
13294 jboolean __attribute__((export_name("TS_CResult_SignatureNoneZ_is_ok"))) TS_CResult_SignatureNoneZ_is_ok(uint32_t o) {
13295 LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)(o & ~1);
13296 jboolean ret_val = CResult_SignatureNoneZ_is_ok(o_conv);
13300 void __attribute__((export_name("TS_CResult_SignatureNoneZ_free"))) TS_CResult_SignatureNoneZ_free(uint32_t _res) {
13301 if ((_res & 1) != 0) return;
13302 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13303 CHECK_ACCESS(_res_ptr);
13304 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
13306 CResult_SignatureNoneZ_free(_res_conv);
13309 static inline uintptr_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
13310 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
13311 *ret_conv = CResult_SignatureNoneZ_clone(arg);
13312 return (uint32_t)ret_conv;
13314 uint32_t __attribute__((export_name("TS_CResult_SignatureNoneZ_clone_ptr"))) TS_CResult_SignatureNoneZ_clone_ptr(uint32_t arg) {
13315 LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)(arg & ~1);
13316 uint32_t ret_val = CResult_SignatureNoneZ_clone_ptr(arg_conv);
13320 uint32_t __attribute__((export_name("TS_CResult_SignatureNoneZ_clone"))) TS_CResult_SignatureNoneZ_clone(uint32_t orig) {
13321 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
13322 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
13323 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
13324 return (uint32_t)ret_conv;
13327 static inline uintptr_t C2Tuple_SignatureSignatureZ_clone_ptr(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR arg) {
13328 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
13329 *ret_conv = C2Tuple_SignatureSignatureZ_clone(arg);
13330 return ((uint32_t)ret_conv);
13332 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_clone_ptr"))) TS_C2Tuple_SignatureSignatureZ_clone_ptr(uint32_t arg) {
13333 LDKC2Tuple_SignatureSignatureZ* arg_conv = (LDKC2Tuple_SignatureSignatureZ*)(arg & ~1);
13334 uint32_t ret_val = C2Tuple_SignatureSignatureZ_clone_ptr(arg_conv);
13338 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_clone"))) TS_C2Tuple_SignatureSignatureZ_clone(uint32_t orig) {
13339 LDKC2Tuple_SignatureSignatureZ* orig_conv = (LDKC2Tuple_SignatureSignatureZ*)(orig & ~1);
13340 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
13341 *ret_conv = C2Tuple_SignatureSignatureZ_clone(orig_conv);
13342 return ((uint32_t)ret_conv);
13345 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_new"))) TS_C2Tuple_SignatureSignatureZ_new(int8_tArray a, int8_tArray b) {
13346 LDKSignature a_ref;
13347 CHECK(a->arr_len == 64);
13348 memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
13349 LDKSignature b_ref;
13350 CHECK(b->arr_len == 64);
13351 memcpy(b_ref.compact_form, b->elems, 64); FREE(b);
13352 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
13353 *ret_conv = C2Tuple_SignatureSignatureZ_new(a_ref, b_ref);
13354 return ((uint32_t)ret_conv);
13357 void __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_free"))) TS_C2Tuple_SignatureSignatureZ_free(uint32_t _res) {
13358 if ((_res & 1) != 0) return;
13359 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13360 CHECK_ACCESS(_res_ptr);
13361 LDKC2Tuple_SignatureSignatureZ _res_conv = *(LDKC2Tuple_SignatureSignatureZ*)(_res_ptr);
13363 C2Tuple_SignatureSignatureZ_free(_res_conv);
13366 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_ok(uint32_t o) {
13367 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
13368 CHECK_ACCESS(o_ptr);
13369 LDKC2Tuple_SignatureSignatureZ o_conv = *(LDKC2Tuple_SignatureSignatureZ*)(o_ptr);
13370 o_conv = C2Tuple_SignatureSignatureZ_clone((LDKC2Tuple_SignatureSignatureZ*)(((uintptr_t)o) & ~1));
13371 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
13372 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o_conv);
13373 return (uint32_t)ret_conv;
13376 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_err"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_err() {
13377 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
13378 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_err();
13379 return (uint32_t)ret_conv;
13382 jboolean __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(uint32_t o) {
13383 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(o & ~1);
13384 jboolean ret_val = CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o_conv);
13388 void __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_free"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_free(uint32_t _res) {
13389 if ((_res & 1) != 0) return;
13390 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13391 CHECK_ACCESS(_res_ptr);
13392 LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(_res_ptr);
13394 CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res_conv);
13397 static inline uintptr_t CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR arg) {
13398 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
13399 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(arg);
13400 return (uint32_t)ret_conv;
13402 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(uint32_t arg) {
13403 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(arg & ~1);
13404 uint32_t ret_val = CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(arg_conv);
13408 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone(uint32_t orig) {
13409 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(orig & ~1);
13410 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
13411 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig_conv);
13412 return (uint32_t)ret_conv;
13415 uint32_t __attribute__((export_name("TS_CResult_SecretKeyNoneZ_ok"))) TS_CResult_SecretKeyNoneZ_ok(int8_tArray o) {
13416 LDKSecretKey o_ref;
13417 CHECK(o->arr_len == 32);
13418 memcpy(o_ref.bytes, o->elems, 32); FREE(o);
13419 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
13420 *ret_conv = CResult_SecretKeyNoneZ_ok(o_ref);
13421 return (uint32_t)ret_conv;
13424 uint32_t __attribute__((export_name("TS_CResult_SecretKeyNoneZ_err"))) TS_CResult_SecretKeyNoneZ_err() {
13425 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
13426 *ret_conv = CResult_SecretKeyNoneZ_err();
13427 return (uint32_t)ret_conv;
13430 jboolean __attribute__((export_name("TS_CResult_SecretKeyNoneZ_is_ok"))) TS_CResult_SecretKeyNoneZ_is_ok(uint32_t o) {
13431 LDKCResult_SecretKeyNoneZ* o_conv = (LDKCResult_SecretKeyNoneZ*)(o & ~1);
13432 jboolean ret_val = CResult_SecretKeyNoneZ_is_ok(o_conv);
13436 void __attribute__((export_name("TS_CResult_SecretKeyNoneZ_free"))) TS_CResult_SecretKeyNoneZ_free(uint32_t _res) {
13437 if ((_res & 1) != 0) return;
13438 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13439 CHECK_ACCESS(_res_ptr);
13440 LDKCResult_SecretKeyNoneZ _res_conv = *(LDKCResult_SecretKeyNoneZ*)(_res_ptr);
13442 CResult_SecretKeyNoneZ_free(_res_conv);
13445 static inline uintptr_t CResult_SecretKeyNoneZ_clone_ptr(LDKCResult_SecretKeyNoneZ *NONNULL_PTR arg) {
13446 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
13447 *ret_conv = CResult_SecretKeyNoneZ_clone(arg);
13448 return (uint32_t)ret_conv;
13450 uint32_t __attribute__((export_name("TS_CResult_SecretKeyNoneZ_clone_ptr"))) TS_CResult_SecretKeyNoneZ_clone_ptr(uint32_t arg) {
13451 LDKCResult_SecretKeyNoneZ* arg_conv = (LDKCResult_SecretKeyNoneZ*)(arg & ~1);
13452 uint32_t ret_val = CResult_SecretKeyNoneZ_clone_ptr(arg_conv);
13456 uint32_t __attribute__((export_name("TS_CResult_SecretKeyNoneZ_clone"))) TS_CResult_SecretKeyNoneZ_clone(uint32_t orig) {
13457 LDKCResult_SecretKeyNoneZ* orig_conv = (LDKCResult_SecretKeyNoneZ*)(orig & ~1);
13458 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
13459 *ret_conv = CResult_SecretKeyNoneZ_clone(orig_conv);
13460 return (uint32_t)ret_conv;
13463 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_ok"))) TS_CResult_SignDecodeErrorZ_ok(uint32_t o) {
13464 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
13465 CHECK_ACCESS(o_ptr);
13466 LDKSign o_conv = *(LDKSign*)(o_ptr);
13467 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
13468 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
13469 return (uint32_t)ret_conv;
13472 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_err"))) TS_CResult_SignDecodeErrorZ_err(uint32_t e) {
13473 LDKDecodeError e_conv;
13474 e_conv.inner = (void*)(e & (~1));
13475 e_conv.is_owned = (e & 1) || (e == 0);
13476 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13477 e_conv = DecodeError_clone(&e_conv);
13478 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
13479 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
13480 return (uint32_t)ret_conv;
13483 jboolean __attribute__((export_name("TS_CResult_SignDecodeErrorZ_is_ok"))) TS_CResult_SignDecodeErrorZ_is_ok(uint32_t o) {
13484 LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)(o & ~1);
13485 jboolean ret_val = CResult_SignDecodeErrorZ_is_ok(o_conv);
13489 void __attribute__((export_name("TS_CResult_SignDecodeErrorZ_free"))) TS_CResult_SignDecodeErrorZ_free(uint32_t _res) {
13490 if ((_res & 1) != 0) return;
13491 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13492 CHECK_ACCESS(_res_ptr);
13493 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
13495 CResult_SignDecodeErrorZ_free(_res_conv);
13498 static inline uintptr_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
13499 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
13500 *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
13501 return (uint32_t)ret_conv;
13503 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone_ptr"))) TS_CResult_SignDecodeErrorZ_clone_ptr(uint32_t arg) {
13504 LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
13505 uint32_t ret_val = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
13509 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone"))) TS_CResult_SignDecodeErrorZ_clone(uint32_t orig) {
13510 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
13511 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
13512 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
13513 return (uint32_t)ret_conv;
13516 void __attribute__((export_name("TS_CVec_u5Z_free"))) TS_CVec_u5Z_free(ptrArray _res) {
13517 LDKCVec_u5Z _res_constr;
13518 _res_constr.datalen = _res->arr_len;
13519 if (_res_constr.datalen > 0)
13520 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
13522 _res_constr.data = NULL;
13523 int8_t* _res_vals = (void*) _res->elems /* XXX _res leaks */;
13524 for (size_t h = 0; h < _res_constr.datalen; h++) {
13525 int8_t _res_conv_7 = _res_vals[h];
13527 _res_constr.data[h] = (LDKu5){ ._0 = _res_conv_7 };
13529 CVec_u5Z_free(_res_constr);
13532 uint32_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
13533 LDKRecoverableSignature o_ref;
13534 CHECK(o->arr_len == 68);
13535 memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
13536 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
13537 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
13538 return (uint32_t)ret_conv;
13541 uint32_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_err"))) TS_CResult_RecoverableSignatureNoneZ_err() {
13542 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
13543 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
13544 return (uint32_t)ret_conv;
13547 jboolean __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_is_ok"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint32_t o) {
13548 LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)(o & ~1);
13549 jboolean ret_val = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
13553 void __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_free"))) TS_CResult_RecoverableSignatureNoneZ_free(uint32_t _res) {
13554 if ((_res & 1) != 0) return;
13555 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13556 CHECK_ACCESS(_res_ptr);
13557 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
13559 CResult_RecoverableSignatureNoneZ_free(_res_conv);
13562 static inline uintptr_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
13563 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
13564 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
13565 return (uint32_t)ret_conv;
13567 uint32_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone_ptr"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint32_t arg) {
13568 LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
13569 uint32_t ret_val = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
13573 uint32_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint32_t orig) {
13574 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
13575 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
13576 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
13577 return (uint32_t)ret_conv;
13580 void __attribute__((export_name("TS_CVec_u8Z_free"))) TS_CVec_u8Z_free(int8_tArray _res) {
13581 LDKCVec_u8Z _res_ref;
13582 _res_ref.datalen = _res->arr_len;
13583 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
13584 memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
13585 CVec_u8Z_free(_res_ref);
13588 void __attribute__((export_name("TS_CVec_CVec_u8ZZ_free"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
13589 LDKCVec_CVec_u8ZZ _res_constr;
13590 _res_constr.datalen = _res->arr_len;
13591 if (_res_constr.datalen > 0)
13592 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
13594 _res_constr.data = NULL;
13595 int8_tArray* _res_vals = (void*) _res->elems /* XXX _res leaks */;
13596 for (size_t m = 0; m < _res_constr.datalen; m++) {
13597 int8_tArray _res_conv_12 = _res_vals[m];
13598 LDKCVec_u8Z _res_conv_12_ref;
13599 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
13600 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
13601 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
13602 _res_constr.data[m] = _res_conv_12_ref;
13604 CVec_CVec_u8ZZ_free(_res_constr);
13607 uint32_t __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
13608 LDKCVec_CVec_u8ZZ o_constr;
13609 o_constr.datalen = o->arr_len;
13610 if (o_constr.datalen > 0)
13611 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
13613 o_constr.data = NULL;
13614 int8_tArray* o_vals = (void*) o->elems /* XXX o leaks */;
13615 for (size_t m = 0; m < o_constr.datalen; m++) {
13616 int8_tArray o_conv_12 = o_vals[m];
13617 LDKCVec_u8Z o_conv_12_ref;
13618 o_conv_12_ref.datalen = o_conv_12->arr_len;
13619 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
13620 memcpy(o_conv_12_ref.data, o_conv_12->elems, o_conv_12_ref.datalen); FREE(o_conv_12);
13621 o_constr.data[m] = o_conv_12_ref;
13623 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
13624 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
13625 return (uint32_t)ret_conv;
13628 uint32_t __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
13629 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
13630 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
13631 return (uint32_t)ret_conv;
13634 jboolean __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok(uint32_t o) {
13635 LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(o & ~1);
13636 jboolean ret_val = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
13640 void __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_free"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint32_t _res) {
13641 if ((_res & 1) != 0) return;
13642 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13643 CHECK_ACCESS(_res_ptr);
13644 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
13646 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
13649 static inline uintptr_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
13650 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
13651 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
13652 return (uint32_t)ret_conv;
13654 uint32_t __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(uint32_t arg) {
13655 LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
13656 uint32_t ret_val = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
13660 uint32_t __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint32_t orig) {
13661 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
13662 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
13663 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
13664 return (uint32_t)ret_conv;
13667 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint32_t o) {
13668 LDKInMemorySigner o_conv;
13669 o_conv.inner = (void*)(o & (~1));
13670 o_conv.is_owned = (o & 1) || (o == 0);
13671 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13672 o_conv = InMemorySigner_clone(&o_conv);
13673 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
13674 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
13675 return (uint32_t)ret_conv;
13678 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_err"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint32_t e) {
13679 LDKDecodeError e_conv;
13680 e_conv.inner = (void*)(e & (~1));
13681 e_conv.is_owned = (e & 1) || (e == 0);
13682 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13683 e_conv = DecodeError_clone(&e_conv);
13684 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
13685 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
13686 return (uint32_t)ret_conv;
13689 jboolean __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_is_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint32_t o) {
13690 LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(o & ~1);
13691 jboolean ret_val = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
13695 void __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_free"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint32_t _res) {
13696 if ((_res & 1) != 0) return;
13697 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13698 CHECK_ACCESS(_res_ptr);
13699 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
13701 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
13704 static inline uintptr_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
13705 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
13706 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
13707 return (uint32_t)ret_conv;
13709 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint32_t arg) {
13710 LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
13711 uint32_t ret_val = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
13715 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint32_t orig) {
13716 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
13717 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
13718 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
13719 return (uint32_t)ret_conv;
13722 void __attribute__((export_name("TS_CVec_TxOutZ_free"))) TS_CVec_TxOutZ_free(uint32_tArray _res) {
13723 LDKCVec_TxOutZ _res_constr;
13724 _res_constr.datalen = _res->arr_len;
13725 if (_res_constr.datalen > 0)
13726 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
13728 _res_constr.data = NULL;
13729 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
13730 for (size_t h = 0; h < _res_constr.datalen; h++) {
13731 uint32_t _res_conv_7 = _res_vals[h];
13732 void* _res_conv_7_ptr = (void*)(((uintptr_t)_res_conv_7) & ~1);
13733 CHECK_ACCESS(_res_conv_7_ptr);
13734 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
13735 FREE((void*)_res_conv_7);
13736 _res_constr.data[h] = _res_conv_7_conv;
13738 CVec_TxOutZ_free(_res_constr);
13741 uint32_t __attribute__((export_name("TS_CResult_TransactionNoneZ_ok"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
13742 LDKTransaction o_ref;
13743 o_ref.datalen = o->arr_len;
13744 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
13745 memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
13746 o_ref.data_is_owned = true;
13747 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
13748 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
13749 return (uint32_t)ret_conv;
13752 uint32_t __attribute__((export_name("TS_CResult_TransactionNoneZ_err"))) TS_CResult_TransactionNoneZ_err() {
13753 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
13754 *ret_conv = CResult_TransactionNoneZ_err();
13755 return (uint32_t)ret_conv;
13758 jboolean __attribute__((export_name("TS_CResult_TransactionNoneZ_is_ok"))) TS_CResult_TransactionNoneZ_is_ok(uint32_t o) {
13759 LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)(o & ~1);
13760 jboolean ret_val = CResult_TransactionNoneZ_is_ok(o_conv);
13764 void __attribute__((export_name("TS_CResult_TransactionNoneZ_free"))) TS_CResult_TransactionNoneZ_free(uint32_t _res) {
13765 if ((_res & 1) != 0) return;
13766 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13767 CHECK_ACCESS(_res_ptr);
13768 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
13770 CResult_TransactionNoneZ_free(_res_conv);
13773 static inline uintptr_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
13774 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
13775 *ret_conv = CResult_TransactionNoneZ_clone(arg);
13776 return (uint32_t)ret_conv;
13778 uint32_t __attribute__((export_name("TS_CResult_TransactionNoneZ_clone_ptr"))) TS_CResult_TransactionNoneZ_clone_ptr(uint32_t arg) {
13779 LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)(arg & ~1);
13780 uint32_t ret_val = CResult_TransactionNoneZ_clone_ptr(arg_conv);
13784 uint32_t __attribute__((export_name("TS_CResult_TransactionNoneZ_clone"))) TS_CResult_TransactionNoneZ_clone(uint32_t orig) {
13785 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
13786 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
13787 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
13788 return (uint32_t)ret_conv;
13791 uint32_t __attribute__((export_name("TS_COption_u16Z_some"))) TS_COption_u16Z_some(int16_t o) {
13792 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
13793 *ret_copy = COption_u16Z_some(o);
13794 uint32_t ret_ref = (uintptr_t)ret_copy;
13798 uint32_t __attribute__((export_name("TS_COption_u16Z_none"))) TS_COption_u16Z_none() {
13799 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
13800 *ret_copy = COption_u16Z_none();
13801 uint32_t ret_ref = (uintptr_t)ret_copy;
13805 void __attribute__((export_name("TS_COption_u16Z_free"))) TS_COption_u16Z_free(uint32_t _res) {
13806 if ((_res & 1) != 0) return;
13807 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13808 CHECK_ACCESS(_res_ptr);
13809 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
13811 COption_u16Z_free(_res_conv);
13814 static inline uintptr_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
13815 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
13816 *ret_copy = COption_u16Z_clone(arg);
13817 uint32_t ret_ref = (uintptr_t)ret_copy;
13820 uint32_t __attribute__((export_name("TS_COption_u16Z_clone_ptr"))) TS_COption_u16Z_clone_ptr(uint32_t arg) {
13821 LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)arg;
13822 uint32_t ret_val = COption_u16Z_clone_ptr(arg_conv);
13826 uint32_t __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_clone(uint32_t orig) {
13827 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
13828 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
13829 *ret_copy = COption_u16Z_clone(orig_conv);
13830 uint32_t ret_ref = (uintptr_t)ret_copy;
13834 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_ok"))) TS_CResult_NoneAPIErrorZ_ok() {
13835 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
13836 *ret_conv = CResult_NoneAPIErrorZ_ok();
13837 return (uint32_t)ret_conv;
13840 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_err"))) TS_CResult_NoneAPIErrorZ_err(uint32_t e) {
13841 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
13842 CHECK_ACCESS(e_ptr);
13843 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
13844 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
13845 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
13846 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
13847 return (uint32_t)ret_conv;
13850 jboolean __attribute__((export_name("TS_CResult_NoneAPIErrorZ_is_ok"))) TS_CResult_NoneAPIErrorZ_is_ok(uint32_t o) {
13851 LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)(o & ~1);
13852 jboolean ret_val = CResult_NoneAPIErrorZ_is_ok(o_conv);
13856 void __attribute__((export_name("TS_CResult_NoneAPIErrorZ_free"))) TS_CResult_NoneAPIErrorZ_free(uint32_t _res) {
13857 if ((_res & 1) != 0) return;
13858 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13859 CHECK_ACCESS(_res_ptr);
13860 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
13862 CResult_NoneAPIErrorZ_free(_res_conv);
13865 static inline uintptr_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
13866 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
13867 *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
13868 return (uint32_t)ret_conv;
13870 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone_ptr"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint32_t arg) {
13871 LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
13872 uint32_t ret_val = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
13876 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone"))) TS_CResult_NoneAPIErrorZ_clone(uint32_t orig) {
13877 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
13878 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
13879 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
13880 return (uint32_t)ret_conv;
13883 void __attribute__((export_name("TS_CVec_CResult_NoneAPIErrorZZ_free"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint32_tArray _res) {
13884 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
13885 _res_constr.datalen = _res->arr_len;
13886 if (_res_constr.datalen > 0)
13887 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
13889 _res_constr.data = NULL;
13890 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
13891 for (size_t w = 0; w < _res_constr.datalen; w++) {
13892 uint32_t _res_conv_22 = _res_vals[w];
13893 void* _res_conv_22_ptr = (void*)(((uintptr_t)_res_conv_22) & ~1);
13894 CHECK_ACCESS(_res_conv_22_ptr);
13895 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
13896 FREE((void*)_res_conv_22);
13897 _res_constr.data[w] = _res_conv_22_conv;
13899 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
13902 void __attribute__((export_name("TS_CVec_APIErrorZ_free"))) TS_CVec_APIErrorZ_free(uint32_tArray _res) {
13903 LDKCVec_APIErrorZ _res_constr;
13904 _res_constr.datalen = _res->arr_len;
13905 if (_res_constr.datalen > 0)
13906 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
13908 _res_constr.data = NULL;
13909 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
13910 for (size_t k = 0; k < _res_constr.datalen; k++) {
13911 uint32_t _res_conv_10 = _res_vals[k];
13912 void* _res_conv_10_ptr = (void*)(((uintptr_t)_res_conv_10) & ~1);
13913 CHECK_ACCESS(_res_conv_10_ptr);
13914 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
13915 FREE((void*)_res_conv_10);
13916 _res_constr.data[k] = _res_conv_10_conv;
13918 CVec_APIErrorZ_free(_res_constr);
13921 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_ok"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) {
13922 LDKThirtyTwoBytes o_ref;
13923 CHECK(o->arr_len == 32);
13924 memcpy(o_ref.data, o->elems, 32); FREE(o);
13925 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
13926 *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
13927 return (uint32_t)ret_conv;
13930 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_err"))) TS_CResult__u832APIErrorZ_err(uint32_t e) {
13931 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
13932 CHECK_ACCESS(e_ptr);
13933 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
13934 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
13935 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
13936 *ret_conv = CResult__u832APIErrorZ_err(e_conv);
13937 return (uint32_t)ret_conv;
13940 jboolean __attribute__((export_name("TS_CResult__u832APIErrorZ_is_ok"))) TS_CResult__u832APIErrorZ_is_ok(uint32_t o) {
13941 LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)(o & ~1);
13942 jboolean ret_val = CResult__u832APIErrorZ_is_ok(o_conv);
13946 void __attribute__((export_name("TS_CResult__u832APIErrorZ_free"))) TS_CResult__u832APIErrorZ_free(uint32_t _res) {
13947 if ((_res & 1) != 0) return;
13948 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13949 CHECK_ACCESS(_res_ptr);
13950 LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
13952 CResult__u832APIErrorZ_free(_res_conv);
13955 static inline uintptr_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
13956 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
13957 *ret_conv = CResult__u832APIErrorZ_clone(arg);
13958 return (uint32_t)ret_conv;
13960 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_clone_ptr"))) TS_CResult__u832APIErrorZ_clone_ptr(uint32_t arg) {
13961 LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)(arg & ~1);
13962 uint32_t ret_val = CResult__u832APIErrorZ_clone_ptr(arg_conv);
13966 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_clone"))) TS_CResult__u832APIErrorZ_clone(uint32_t orig) {
13967 LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1);
13968 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
13969 *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
13970 return (uint32_t)ret_conv;
13973 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_ok(int8_tArray o) {
13974 LDKThirtyTwoBytes o_ref;
13975 CHECK(o->arr_len == 32);
13976 memcpy(o_ref.data, o->elems, 32); FREE(o);
13977 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
13978 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
13979 return (uint32_t)ret_conv;
13982 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_err"))) TS_CResult_PaymentIdPaymentSendFailureZ_err(uint32_t e) {
13983 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
13984 CHECK_ACCESS(e_ptr);
13985 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
13986 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
13987 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
13988 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
13989 return (uint32_t)ret_conv;
13992 jboolean __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_is_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_is_ok(uint32_t o) {
13993 LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(o & ~1);
13994 jboolean ret_val = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv);
13998 void __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_free"))) TS_CResult_PaymentIdPaymentSendFailureZ_free(uint32_t _res) {
13999 if ((_res & 1) != 0) return;
14000 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14001 CHECK_ACCESS(_res_ptr);
14002 LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
14004 CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
14007 static inline uintptr_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) {
14008 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
14009 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg);
14010 return (uint32_t)ret_conv;
14012 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr(uint32_t arg) {
14013 LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
14014 uint32_t ret_val = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv);
14018 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_clone"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone(uint32_t orig) {
14019 LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1);
14020 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
14021 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
14022 return (uint32_t)ret_conv;
14025 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() {
14026 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
14027 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
14028 return (uint32_t)ret_conv;
14031 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint32_t e) {
14032 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
14033 CHECK_ACCESS(e_ptr);
14034 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
14035 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
14036 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
14037 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
14038 return (uint32_t)ret_conv;
14041 jboolean __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint32_t o) {
14042 LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)(o & ~1);
14043 jboolean ret_val = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
14047 void __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint32_t _res) {
14048 if ((_res & 1) != 0) return;
14049 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14050 CHECK_ACCESS(_res_ptr);
14051 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
14053 CResult_NonePaymentSendFailureZ_free(_res_conv);
14056 static inline uintptr_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
14057 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
14058 *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
14059 return (uint32_t)ret_conv;
14061 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint32_t arg) {
14062 LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
14063 uint32_t ret_val = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
14067 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint32_t orig) {
14068 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
14069 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
14070 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
14071 return (uint32_t)ret_conv;
14074 static inline uintptr_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
14075 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
14076 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
14077 return ((uint32_t)ret_conv);
14079 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr(uint32_t arg) {
14080 LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(arg & ~1);
14081 uint32_t ret_val = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
14085 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint32_t orig) {
14086 LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1);
14087 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
14088 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
14089 return ((uint32_t)ret_conv);
14092 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_new"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, int8_tArray b) {
14093 LDKThirtyTwoBytes a_ref;
14094 CHECK(a->arr_len == 32);
14095 memcpy(a_ref.data, a->elems, 32); FREE(a);
14096 LDKThirtyTwoBytes b_ref;
14097 CHECK(b->arr_len == 32);
14098 memcpy(b_ref.data, b->elems, 32); FREE(b);
14099 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
14100 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
14101 return ((uint32_t)ret_conv);
14104 void __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_free"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint32_t _res) {
14105 if ((_res & 1) != 0) return;
14106 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14107 CHECK_ACCESS(_res_ptr);
14108 LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
14110 C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
14113 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint32_t o) {
14114 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14115 CHECK_ACCESS(o_ptr);
14116 LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
14117 o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uintptr_t)o) & ~1));
14118 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
14119 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
14120 return (uint32_t)ret_conv;
14123 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint32_t e) {
14124 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
14125 CHECK_ACCESS(e_ptr);
14126 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
14127 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
14128 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
14129 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
14130 return (uint32_t)ret_conv;
14133 jboolean __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(uint32_t o) {
14134 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(o & ~1);
14135 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
14139 void __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint32_t _res) {
14140 if ((_res & 1) != 0) return;
14141 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14142 CHECK_ACCESS(_res_ptr);
14143 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
14145 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
14148 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
14149 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
14150 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
14151 return (uint32_t)ret_conv;
14153 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(uint32_t arg) {
14154 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
14155 uint32_t ret_val = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
14159 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint32_t orig) {
14160 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1);
14161 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
14162 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
14163 return (uint32_t)ret_conv;
14166 void __attribute__((export_name("TS_CVec_NetAddressZ_free"))) TS_CVec_NetAddressZ_free(uint32_tArray _res) {
14167 LDKCVec_NetAddressZ _res_constr;
14168 _res_constr.datalen = _res->arr_len;
14169 if (_res_constr.datalen > 0)
14170 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14172 _res_constr.data = NULL;
14173 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
14174 for (size_t m = 0; m < _res_constr.datalen; m++) {
14175 uint32_t _res_conv_12 = _res_vals[m];
14176 void* _res_conv_12_ptr = (void*)(((uintptr_t)_res_conv_12) & ~1);
14177 CHECK_ACCESS(_res_conv_12_ptr);
14178 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
14179 FREE((void*)_res_conv_12);
14180 _res_constr.data[m] = _res_conv_12_conv;
14182 CVec_NetAddressZ_free(_res_constr);
14185 static inline uintptr_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
14186 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
14187 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
14188 return ((uint32_t)ret_conv);
14190 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(uint32_t arg) {
14191 LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(arg & ~1);
14192 uint32_t ret_val = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
14196 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint32_t orig) {
14197 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
14198 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
14199 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
14200 return ((uint32_t)ret_conv);
14203 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_new"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
14204 LDKThirtyTwoBytes a_ref;
14205 CHECK(a->arr_len == 32);
14206 memcpy(a_ref.data, a->elems, 32); FREE(a);
14207 LDKThirtyTwoBytes b_ref;
14208 CHECK(b->arr_len == 32);
14209 memcpy(b_ref.data, b->elems, 32); FREE(b);
14210 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
14211 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
14212 return ((uint32_t)ret_conv);
14215 void __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_free"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint32_t _res) {
14216 if ((_res & 1) != 0) return;
14217 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14218 CHECK_ACCESS(_res_ptr);
14219 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
14221 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
14224 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(uint32_t o) {
14225 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14226 CHECK_ACCESS(o_ptr);
14227 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
14228 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uintptr_t)o) & ~1));
14229 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
14230 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
14231 return (uint32_t)ret_conv;
14234 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() {
14235 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
14236 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
14237 return (uint32_t)ret_conv;
14240 jboolean __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(uint32_t o) {
14241 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(o & ~1);
14242 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
14246 void __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(uint32_t _res) {
14247 if ((_res & 1) != 0) return;
14248 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14249 CHECK_ACCESS(_res_ptr);
14250 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
14252 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
14255 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
14256 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
14257 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
14258 return (uint32_t)ret_conv;
14260 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(uint32_t arg) {
14261 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1);
14262 uint32_t ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
14266 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(uint32_t orig) {
14267 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(orig & ~1);
14268 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
14269 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
14270 return (uint32_t)ret_conv;
14273 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(uint32_t o) {
14274 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14275 CHECK_ACCESS(o_ptr);
14276 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
14277 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uintptr_t)o) & ~1));
14278 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
14279 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
14280 return (uint32_t)ret_conv;
14283 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(uint32_t e) {
14284 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
14285 CHECK_ACCESS(e_ptr);
14286 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
14287 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
14288 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
14289 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
14290 return (uint32_t)ret_conv;
14293 jboolean __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(uint32_t o) {
14294 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(o & ~1);
14295 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
14299 void __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(uint32_t _res) {
14300 if ((_res & 1) != 0) return;
14301 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14302 CHECK_ACCESS(_res_ptr);
14303 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
14305 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
14308 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
14309 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
14310 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
14311 return (uint32_t)ret_conv;
14313 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(uint32_t arg) {
14314 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1);
14315 uint32_t ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
14319 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(uint32_t orig) {
14320 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(orig & ~1);
14321 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
14322 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
14323 return (uint32_t)ret_conv;
14326 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_ok"))) TS_CResult_PaymentSecretNoneZ_ok(int8_tArray o) {
14327 LDKThirtyTwoBytes o_ref;
14328 CHECK(o->arr_len == 32);
14329 memcpy(o_ref.data, o->elems, 32); FREE(o);
14330 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
14331 *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
14332 return (uint32_t)ret_conv;
14335 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_err"))) TS_CResult_PaymentSecretNoneZ_err() {
14336 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
14337 *ret_conv = CResult_PaymentSecretNoneZ_err();
14338 return (uint32_t)ret_conv;
14341 jboolean __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_is_ok"))) TS_CResult_PaymentSecretNoneZ_is_ok(uint32_t o) {
14342 LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)(o & ~1);
14343 jboolean ret_val = CResult_PaymentSecretNoneZ_is_ok(o_conv);
14347 void __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_free"))) TS_CResult_PaymentSecretNoneZ_free(uint32_t _res) {
14348 if ((_res & 1) != 0) return;
14349 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14350 CHECK_ACCESS(_res_ptr);
14351 LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
14353 CResult_PaymentSecretNoneZ_free(_res_conv);
14356 static inline uintptr_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
14357 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
14358 *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
14359 return (uint32_t)ret_conv;
14361 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone_ptr"))) TS_CResult_PaymentSecretNoneZ_clone_ptr(uint32_t arg) {
14362 LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1);
14363 uint32_t ret_val = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
14367 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone"))) TS_CResult_PaymentSecretNoneZ_clone(uint32_t orig) {
14368 LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)(orig & ~1);
14369 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
14370 *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
14371 return (uint32_t)ret_conv;
14374 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_ok"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
14375 LDKThirtyTwoBytes o_ref;
14376 CHECK(o->arr_len == 32);
14377 memcpy(o_ref.data, o->elems, 32); FREE(o);
14378 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
14379 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
14380 return (uint32_t)ret_conv;
14383 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_err"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint32_t e) {
14384 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
14385 CHECK_ACCESS(e_ptr);
14386 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
14387 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
14388 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
14389 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
14390 return (uint32_t)ret_conv;
14393 jboolean __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_is_ok"))) TS_CResult_PaymentSecretAPIErrorZ_is_ok(uint32_t o) {
14394 LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(o & ~1);
14395 jboolean ret_val = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
14399 void __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_free"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint32_t _res) {
14400 if ((_res & 1) != 0) return;
14401 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14402 CHECK_ACCESS(_res_ptr);
14403 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
14405 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
14408 static inline uintptr_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
14409 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
14410 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
14411 return (uint32_t)ret_conv;
14413 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone_ptr"))) TS_CResult_PaymentSecretAPIErrorZ_clone_ptr(uint32_t arg) {
14414 LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
14415 uint32_t ret_val = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
14419 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint32_t orig) {
14420 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
14421 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
14422 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
14423 return (uint32_t)ret_conv;
14426 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_ok(int8_tArray o) {
14427 LDKThirtyTwoBytes o_ref;
14428 CHECK(o->arr_len == 32);
14429 memcpy(o_ref.data, o->elems, 32); FREE(o);
14430 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
14431 *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
14432 return (uint32_t)ret_conv;
14435 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_err"))) TS_CResult_PaymentPreimageAPIErrorZ_err(uint32_t e) {
14436 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
14437 CHECK_ACCESS(e_ptr);
14438 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
14439 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
14440 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
14441 *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
14442 return (uint32_t)ret_conv;
14445 jboolean __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_is_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_is_ok(uint32_t o) {
14446 LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(o & ~1);
14447 jboolean ret_val = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
14451 void __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_free"))) TS_CResult_PaymentPreimageAPIErrorZ_free(uint32_t _res) {
14452 if ((_res & 1) != 0) return;
14453 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14454 CHECK_ACCESS(_res_ptr);
14455 LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
14457 CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
14460 static inline uintptr_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
14461 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
14462 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
14463 return (uint32_t)ret_conv;
14465 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr"))) TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr(uint32_t arg) {
14466 LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1);
14467 uint32_t ret_val = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
14471 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone"))) TS_CResult_PaymentPreimageAPIErrorZ_clone(uint32_t orig) {
14472 LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(orig & ~1);
14473 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
14474 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
14475 return (uint32_t)ret_conv;
14478 uint32_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(uint32_t o) {
14479 LDKCounterpartyForwardingInfo o_conv;
14480 o_conv.inner = (void*)(o & (~1));
14481 o_conv.is_owned = (o & 1) || (o == 0);
14482 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14483 o_conv = CounterpartyForwardingInfo_clone(&o_conv);
14484 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
14485 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
14486 return (uint32_t)ret_conv;
14489 uint32_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(uint32_t e) {
14490 LDKDecodeError e_conv;
14491 e_conv.inner = (void*)(e & (~1));
14492 e_conv.is_owned = (e & 1) || (e == 0);
14493 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14494 e_conv = DecodeError_clone(&e_conv);
14495 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
14496 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
14497 return (uint32_t)ret_conv;
14500 jboolean __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(uint32_t o) {
14501 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(o & ~1);
14502 jboolean ret_val = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
14506 void __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(uint32_t _res) {
14507 if ((_res & 1) != 0) return;
14508 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14509 CHECK_ACCESS(_res_ptr);
14510 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
14512 CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
14515 static inline uintptr_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
14516 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
14517 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
14518 return (uint32_t)ret_conv;
14520 uint32_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
14521 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(arg & ~1);
14522 uint32_t ret_val = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
14526 uint32_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(uint32_t orig) {
14527 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(orig & ~1);
14528 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
14529 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
14530 return (uint32_t)ret_conv;
14533 uint32_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_ok(uint32_t o) {
14534 LDKChannelCounterparty o_conv;
14535 o_conv.inner = (void*)(o & (~1));
14536 o_conv.is_owned = (o & 1) || (o == 0);
14537 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14538 o_conv = ChannelCounterparty_clone(&o_conv);
14539 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
14540 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
14541 return (uint32_t)ret_conv;
14544 uint32_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_err(uint32_t e) {
14545 LDKDecodeError e_conv;
14546 e_conv.inner = (void*)(e & (~1));
14547 e_conv.is_owned = (e & 1) || (e == 0);
14548 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14549 e_conv = DecodeError_clone(&e_conv);
14550 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
14551 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
14552 return (uint32_t)ret_conv;
14555 jboolean __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(uint32_t o) {
14556 LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(o & ~1);
14557 jboolean ret_val = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
14561 void __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_free"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_free(uint32_t _res) {
14562 if ((_res & 1) != 0) return;
14563 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14564 CHECK_ACCESS(_res_ptr);
14565 LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
14567 CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
14570 static inline uintptr_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
14571 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
14572 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
14573 return (uint32_t)ret_conv;
14575 uint32_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(uint32_t arg) {
14576 LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(arg & ~1);
14577 uint32_t ret_val = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
14581 uint32_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone(uint32_t orig) {
14582 LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(orig & ~1);
14583 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
14584 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
14585 return (uint32_t)ret_conv;
14588 uint32_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_ok(uint32_t o) {
14589 LDKChannelDetails o_conv;
14590 o_conv.inner = (void*)(o & (~1));
14591 o_conv.is_owned = (o & 1) || (o == 0);
14592 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14593 o_conv = ChannelDetails_clone(&o_conv);
14594 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
14595 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
14596 return (uint32_t)ret_conv;
14599 uint32_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_err(uint32_t e) {
14600 LDKDecodeError e_conv;
14601 e_conv.inner = (void*)(e & (~1));
14602 e_conv.is_owned = (e & 1) || (e == 0);
14603 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14604 e_conv = DecodeError_clone(&e_conv);
14605 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
14606 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
14607 return (uint32_t)ret_conv;
14610 jboolean __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_is_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_is_ok(uint32_t o) {
14611 LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(o & ~1);
14612 jboolean ret_val = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
14616 void __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_free"))) TS_CResult_ChannelDetailsDecodeErrorZ_free(uint32_t _res) {
14617 if ((_res & 1) != 0) return;
14618 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14619 CHECK_ACCESS(_res_ptr);
14620 LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
14622 CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
14625 static inline uintptr_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
14626 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
14627 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
14628 return (uint32_t)ret_conv;
14630 uint32_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(uint32_t arg) {
14631 LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(arg & ~1);
14632 uint32_t ret_val = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
14636 uint32_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone(uint32_t orig) {
14637 LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(orig & ~1);
14638 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
14639 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
14640 return (uint32_t)ret_conv;
14643 uint32_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_ok(uint32_t o) {
14644 LDKPhantomRouteHints o_conv;
14645 o_conv.inner = (void*)(o & (~1));
14646 o_conv.is_owned = (o & 1) || (o == 0);
14647 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14648 o_conv = PhantomRouteHints_clone(&o_conv);
14649 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
14650 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
14651 return (uint32_t)ret_conv;
14654 uint32_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_err(uint32_t e) {
14655 LDKDecodeError e_conv;
14656 e_conv.inner = (void*)(e & (~1));
14657 e_conv.is_owned = (e & 1) || (e == 0);
14658 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14659 e_conv = DecodeError_clone(&e_conv);
14660 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
14661 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
14662 return (uint32_t)ret_conv;
14665 jboolean __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(uint32_t o) {
14666 LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(o & ~1);
14667 jboolean ret_val = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
14671 void __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_free"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_free(uint32_t _res) {
14672 if ((_res & 1) != 0) return;
14673 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14674 CHECK_ACCESS(_res_ptr);
14675 LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
14677 CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
14680 static inline uintptr_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
14681 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
14682 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
14683 return (uint32_t)ret_conv;
14685 uint32_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(uint32_t arg) {
14686 LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(arg & ~1);
14687 uint32_t ret_val = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
14691 uint32_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone(uint32_t orig) {
14692 LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(orig & ~1);
14693 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
14694 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
14695 return (uint32_t)ret_conv;
14698 void __attribute__((export_name("TS_CVec_ChannelMonitorZ_free"))) TS_CVec_ChannelMonitorZ_free(uint32_tArray _res) {
14699 LDKCVec_ChannelMonitorZ _res_constr;
14700 _res_constr.datalen = _res->arr_len;
14701 if (_res_constr.datalen > 0)
14702 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
14704 _res_constr.data = NULL;
14705 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
14706 for (size_t q = 0; q < _res_constr.datalen; q++) {
14707 uint32_t _res_conv_16 = _res_vals[q];
14708 LDKChannelMonitor _res_conv_16_conv;
14709 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
14710 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
14711 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
14712 _res_constr.data[q] = _res_conv_16_conv;
14714 CVec_ChannelMonitorZ_free(_res_constr);
14717 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_new"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
14718 LDKThirtyTwoBytes a_ref;
14719 CHECK(a->arr_len == 32);
14720 memcpy(a_ref.data, a->elems, 32); FREE(a);
14721 LDKChannelManager b_conv;
14722 b_conv.inner = (void*)(b & (~1));
14723 b_conv.is_owned = (b & 1) || (b == 0);
14724 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
14725 // WARNING: we need a move here but no clone is available for LDKChannelManager
14726 LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
14727 *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
14728 return ((uint32_t)ret_conv);
14731 void __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_free"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint32_t _res) {
14732 if ((_res & 1) != 0) return;
14733 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14734 CHECK_ACCESS(_res_ptr);
14735 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
14737 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
14740 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint32_t o) {
14741 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14742 CHECK_ACCESS(o_ptr);
14743 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
14744 // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
14745 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
14746 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
14747 return (uint32_t)ret_conv;
14750 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint32_t e) {
14751 LDKDecodeError e_conv;
14752 e_conv.inner = (void*)(e & (~1));
14753 e_conv.is_owned = (e & 1) || (e == 0);
14754 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14755 e_conv = DecodeError_clone(&e_conv);
14756 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
14757 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
14758 return (uint32_t)ret_conv;
14761 jboolean __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(uint32_t o) {
14762 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(o & ~1);
14763 jboolean ret_val = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
14767 void __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint32_t _res) {
14768 if ((_res & 1) != 0) return;
14769 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14770 CHECK_ACCESS(_res_ptr);
14771 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
14773 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
14776 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint32_t o) {
14777 LDKChannelConfig o_conv;
14778 o_conv.inner = (void*)(o & (~1));
14779 o_conv.is_owned = (o & 1) || (o == 0);
14780 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14781 o_conv = ChannelConfig_clone(&o_conv);
14782 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
14783 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
14784 return (uint32_t)ret_conv;
14787 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_err"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint32_t e) {
14788 LDKDecodeError e_conv;
14789 e_conv.inner = (void*)(e & (~1));
14790 e_conv.is_owned = (e & 1) || (e == 0);
14791 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14792 e_conv = DecodeError_clone(&e_conv);
14793 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
14794 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
14795 return (uint32_t)ret_conv;
14798 jboolean __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_is_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint32_t o) {
14799 LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(o & ~1);
14800 jboolean ret_val = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
14804 void __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_free"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint32_t _res) {
14805 if ((_res & 1) != 0) return;
14806 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14807 CHECK_ACCESS(_res_ptr);
14808 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
14810 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
14813 static inline uintptr_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
14814 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
14815 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
14816 return (uint32_t)ret_conv;
14818 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint32_t arg) {
14819 LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
14820 uint32_t ret_val = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
14824 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint32_t orig) {
14825 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
14826 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
14827 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
14828 return (uint32_t)ret_conv;
14831 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint32_t o) {
14832 LDKOutPoint o_conv;
14833 o_conv.inner = (void*)(o & (~1));
14834 o_conv.is_owned = (o & 1) || (o == 0);
14835 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14836 o_conv = OutPoint_clone(&o_conv);
14837 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
14838 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
14839 return (uint32_t)ret_conv;
14842 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_err"))) TS_CResult_OutPointDecodeErrorZ_err(uint32_t e) {
14843 LDKDecodeError e_conv;
14844 e_conv.inner = (void*)(e & (~1));
14845 e_conv.is_owned = (e & 1) || (e == 0);
14846 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14847 e_conv = DecodeError_clone(&e_conv);
14848 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
14849 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
14850 return (uint32_t)ret_conv;
14853 jboolean __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_is_ok"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint32_t o) {
14854 LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)(o & ~1);
14855 jboolean ret_val = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
14859 void __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_free"))) TS_CResult_OutPointDecodeErrorZ_free(uint32_t _res) {
14860 if ((_res & 1) != 0) return;
14861 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14862 CHECK_ACCESS(_res_ptr);
14863 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
14865 CResult_OutPointDecodeErrorZ_free(_res_conv);
14868 static inline uintptr_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
14869 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
14870 *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
14871 return (uint32_t)ret_conv;
14873 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone_ptr"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint32_t arg) {
14874 LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
14875 uint32_t ret_val = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
14879 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone"))) TS_CResult_OutPointDecodeErrorZ_clone(uint32_t orig) {
14880 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
14881 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
14882 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
14883 return (uint32_t)ret_conv;
14886 uint32_t __attribute__((export_name("TS_COption_TypeZ_some"))) TS_COption_TypeZ_some(uint32_t o) {
14887 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14888 CHECK_ACCESS(o_ptr);
14889 LDKType o_conv = *(LDKType*)(o_ptr);
14890 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
14891 *ret_copy = COption_TypeZ_some(o_conv);
14892 uint32_t ret_ref = (uintptr_t)ret_copy;
14896 uint32_t __attribute__((export_name("TS_COption_TypeZ_none"))) TS_COption_TypeZ_none() {
14897 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
14898 *ret_copy = COption_TypeZ_none();
14899 uint32_t ret_ref = (uintptr_t)ret_copy;
14903 void __attribute__((export_name("TS_COption_TypeZ_free"))) TS_COption_TypeZ_free(uint32_t _res) {
14904 if ((_res & 1) != 0) return;
14905 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14906 CHECK_ACCESS(_res_ptr);
14907 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
14909 COption_TypeZ_free(_res_conv);
14912 static inline uintptr_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
14913 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
14914 *ret_copy = COption_TypeZ_clone(arg);
14915 uint32_t ret_ref = (uintptr_t)ret_copy;
14918 uint32_t __attribute__((export_name("TS_COption_TypeZ_clone_ptr"))) TS_COption_TypeZ_clone_ptr(uint32_t arg) {
14919 LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)arg;
14920 uint32_t ret_val = COption_TypeZ_clone_ptr(arg_conv);
14924 uint32_t __attribute__((export_name("TS_COption_TypeZ_clone"))) TS_COption_TypeZ_clone(uint32_t orig) {
14925 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
14926 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
14927 *ret_copy = COption_TypeZ_clone(orig_conv);
14928 uint32_t ret_ref = (uintptr_t)ret_copy;
14932 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint32_t o) {
14933 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14934 CHECK_ACCESS(o_ptr);
14935 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
14936 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uintptr_t)o) & ~1));
14937 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
14938 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
14939 return (uint32_t)ret_conv;
14942 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_err"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint32_t e) {
14943 LDKDecodeError e_conv;
14944 e_conv.inner = (void*)(e & (~1));
14945 e_conv.is_owned = (e & 1) || (e == 0);
14946 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14947 e_conv = DecodeError_clone(&e_conv);
14948 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
14949 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
14950 return (uint32_t)ret_conv;
14953 jboolean __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_is_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint32_t o) {
14954 LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(o & ~1);
14955 jboolean ret_val = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
14959 void __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_free"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint32_t _res) {
14960 if ((_res & 1) != 0) return;
14961 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14962 CHECK_ACCESS(_res_ptr);
14963 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
14965 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
14968 static inline uintptr_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
14969 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
14970 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
14971 return (uint32_t)ret_conv;
14973 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint32_t arg) {
14974 LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
14975 uint32_t ret_val = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
14979 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint32_t orig) {
14980 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
14981 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
14982 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
14983 return (uint32_t)ret_conv;
14986 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_ok"))) TS_CResult_PaymentIdPaymentErrorZ_ok(int8_tArray o) {
14987 LDKThirtyTwoBytes o_ref;
14988 CHECK(o->arr_len == 32);
14989 memcpy(o_ref.data, o->elems, 32); FREE(o);
14990 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
14991 *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
14992 return (uint32_t)ret_conv;
14995 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_err"))) TS_CResult_PaymentIdPaymentErrorZ_err(uint32_t e) {
14996 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
14997 CHECK_ACCESS(e_ptr);
14998 LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
14999 e_conv = PaymentError_clone((LDKPaymentError*)(((uintptr_t)e) & ~1));
15000 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
15001 *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
15002 return (uint32_t)ret_conv;
15005 jboolean __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_is_ok"))) TS_CResult_PaymentIdPaymentErrorZ_is_ok(uint32_t o) {
15006 LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(o & ~1);
15007 jboolean ret_val = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
15011 void __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_free"))) TS_CResult_PaymentIdPaymentErrorZ_free(uint32_t _res) {
15012 if ((_res & 1) != 0) return;
15013 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15014 CHECK_ACCESS(_res_ptr);
15015 LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
15017 CResult_PaymentIdPaymentErrorZ_free(_res_conv);
15020 static inline uintptr_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
15021 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
15022 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
15023 return (uint32_t)ret_conv;
15025 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone_ptr"))) TS_CResult_PaymentIdPaymentErrorZ_clone_ptr(uint32_t arg) {
15026 LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(arg & ~1);
15027 uint32_t ret_val = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
15031 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone"))) TS_CResult_PaymentIdPaymentErrorZ_clone(uint32_t orig) {
15032 LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(orig & ~1);
15033 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
15034 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
15035 return (uint32_t)ret_conv;
15038 uint32_t __attribute__((export_name("TS_CResult_SiPrefixNoneZ_ok"))) TS_CResult_SiPrefixNoneZ_ok(uint32_t o) {
15039 LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
15040 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
15041 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
15042 return (uint32_t)ret_conv;
15045 uint32_t __attribute__((export_name("TS_CResult_SiPrefixNoneZ_err"))) TS_CResult_SiPrefixNoneZ_err() {
15046 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
15047 *ret_conv = CResult_SiPrefixNoneZ_err();
15048 return (uint32_t)ret_conv;
15051 jboolean __attribute__((export_name("TS_CResult_SiPrefixNoneZ_is_ok"))) TS_CResult_SiPrefixNoneZ_is_ok(uint32_t o) {
15052 LDKCResult_SiPrefixNoneZ* o_conv = (LDKCResult_SiPrefixNoneZ*)(o & ~1);
15053 jboolean ret_val = CResult_SiPrefixNoneZ_is_ok(o_conv);
15057 void __attribute__((export_name("TS_CResult_SiPrefixNoneZ_free"))) TS_CResult_SiPrefixNoneZ_free(uint32_t _res) {
15058 if ((_res & 1) != 0) return;
15059 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15060 CHECK_ACCESS(_res_ptr);
15061 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(_res_ptr);
15063 CResult_SiPrefixNoneZ_free(_res_conv);
15066 static inline uintptr_t CResult_SiPrefixNoneZ_clone_ptr(LDKCResult_SiPrefixNoneZ *NONNULL_PTR arg) {
15067 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
15068 *ret_conv = CResult_SiPrefixNoneZ_clone(arg);
15069 return (uint32_t)ret_conv;
15071 uint32_t __attribute__((export_name("TS_CResult_SiPrefixNoneZ_clone_ptr"))) TS_CResult_SiPrefixNoneZ_clone_ptr(uint32_t arg) {
15072 LDKCResult_SiPrefixNoneZ* arg_conv = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
15073 uint32_t ret_val = CResult_SiPrefixNoneZ_clone_ptr(arg_conv);
15077 uint32_t __attribute__((export_name("TS_CResult_SiPrefixNoneZ_clone"))) TS_CResult_SiPrefixNoneZ_clone(uint32_t orig) {
15078 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
15079 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
15080 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
15081 return (uint32_t)ret_conv;
15084 uint32_t __attribute__((export_name("TS_CResult_InvoiceNoneZ_ok"))) TS_CResult_InvoiceNoneZ_ok(uint32_t o) {
15086 o_conv.inner = (void*)(o & (~1));
15087 o_conv.is_owned = (o & 1) || (o == 0);
15088 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15089 o_conv = Invoice_clone(&o_conv);
15090 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
15091 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
15092 return (uint32_t)ret_conv;
15095 uint32_t __attribute__((export_name("TS_CResult_InvoiceNoneZ_err"))) TS_CResult_InvoiceNoneZ_err() {
15096 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
15097 *ret_conv = CResult_InvoiceNoneZ_err();
15098 return (uint32_t)ret_conv;
15101 jboolean __attribute__((export_name("TS_CResult_InvoiceNoneZ_is_ok"))) TS_CResult_InvoiceNoneZ_is_ok(uint32_t o) {
15102 LDKCResult_InvoiceNoneZ* o_conv = (LDKCResult_InvoiceNoneZ*)(o & ~1);
15103 jboolean ret_val = CResult_InvoiceNoneZ_is_ok(o_conv);
15107 void __attribute__((export_name("TS_CResult_InvoiceNoneZ_free"))) TS_CResult_InvoiceNoneZ_free(uint32_t _res) {
15108 if ((_res & 1) != 0) return;
15109 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15110 CHECK_ACCESS(_res_ptr);
15111 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(_res_ptr);
15113 CResult_InvoiceNoneZ_free(_res_conv);
15116 static inline uintptr_t CResult_InvoiceNoneZ_clone_ptr(LDKCResult_InvoiceNoneZ *NONNULL_PTR arg) {
15117 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
15118 *ret_conv = CResult_InvoiceNoneZ_clone(arg);
15119 return (uint32_t)ret_conv;
15121 uint32_t __attribute__((export_name("TS_CResult_InvoiceNoneZ_clone_ptr"))) TS_CResult_InvoiceNoneZ_clone_ptr(uint32_t arg) {
15122 LDKCResult_InvoiceNoneZ* arg_conv = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
15123 uint32_t ret_val = CResult_InvoiceNoneZ_clone_ptr(arg_conv);
15127 uint32_t __attribute__((export_name("TS_CResult_InvoiceNoneZ_clone"))) TS_CResult_InvoiceNoneZ_clone(uint32_t orig) {
15128 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
15129 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
15130 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
15131 return (uint32_t)ret_conv;
15134 uint32_t __attribute__((export_name("TS_CResult_SignedRawInvoiceNoneZ_ok"))) TS_CResult_SignedRawInvoiceNoneZ_ok(uint32_t o) {
15135 LDKSignedRawInvoice o_conv;
15136 o_conv.inner = (void*)(o & (~1));
15137 o_conv.is_owned = (o & 1) || (o == 0);
15138 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15139 o_conv = SignedRawInvoice_clone(&o_conv);
15140 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
15141 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
15142 return (uint32_t)ret_conv;
15145 uint32_t __attribute__((export_name("TS_CResult_SignedRawInvoiceNoneZ_err"))) TS_CResult_SignedRawInvoiceNoneZ_err() {
15146 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
15147 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
15148 return (uint32_t)ret_conv;
15151 jboolean __attribute__((export_name("TS_CResult_SignedRawInvoiceNoneZ_is_ok"))) TS_CResult_SignedRawInvoiceNoneZ_is_ok(uint32_t o) {
15152 LDKCResult_SignedRawInvoiceNoneZ* o_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(o & ~1);
15153 jboolean ret_val = CResult_SignedRawInvoiceNoneZ_is_ok(o_conv);
15157 void __attribute__((export_name("TS_CResult_SignedRawInvoiceNoneZ_free"))) TS_CResult_SignedRawInvoiceNoneZ_free(uint32_t _res) {
15158 if ((_res & 1) != 0) return;
15159 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15160 CHECK_ACCESS(_res_ptr);
15161 LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(_res_ptr);
15163 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
15166 static inline uintptr_t CResult_SignedRawInvoiceNoneZ_clone_ptr(LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR arg) {
15167 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
15168 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(arg);
15169 return (uint32_t)ret_conv;
15171 uint32_t __attribute__((export_name("TS_CResult_SignedRawInvoiceNoneZ_clone_ptr"))) TS_CResult_SignedRawInvoiceNoneZ_clone_ptr(uint32_t arg) {
15172 LDKCResult_SignedRawInvoiceNoneZ* arg_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
15173 uint32_t ret_val = CResult_SignedRawInvoiceNoneZ_clone_ptr(arg_conv);
15177 uint32_t __attribute__((export_name("TS_CResult_SignedRawInvoiceNoneZ_clone"))) TS_CResult_SignedRawInvoiceNoneZ_clone(uint32_t orig) {
15178 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
15179 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
15180 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
15181 return (uint32_t)ret_conv;
15184 static inline uintptr_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
15185 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
15186 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
15187 return ((uint32_t)ret_conv);
15189 uint32_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(uint32_t arg) {
15190 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(arg & ~1);
15191 uint32_t ret_val = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
15195 uint32_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint32_t orig) {
15196 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
15197 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
15198 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
15199 return ((uint32_t)ret_conv);
15202 uint32_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint32_t a, int8_tArray b, uint32_t c) {
15203 LDKRawInvoice a_conv;
15204 a_conv.inner = (void*)(a & (~1));
15205 a_conv.is_owned = (a & 1) || (a == 0);
15206 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
15207 a_conv = RawInvoice_clone(&a_conv);
15208 LDKThirtyTwoBytes b_ref;
15209 CHECK(b->arr_len == 32);
15210 memcpy(b_ref.data, b->elems, 32); FREE(b);
15211 LDKInvoiceSignature c_conv;
15212 c_conv.inner = (void*)(c & (~1));
15213 c_conv.is_owned = (c & 1) || (c == 0);
15214 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
15215 c_conv = InvoiceSignature_clone(&c_conv);
15216 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
15217 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
15218 return ((uint32_t)ret_conv);
15221 void __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint32_t _res) {
15222 if ((_res & 1) != 0) return;
15223 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15224 CHECK_ACCESS(_res_ptr);
15225 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
15227 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
15230 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_ok"))) TS_CResult_PayeePubKeyErrorZ_ok(uint32_t o) {
15231 LDKPayeePubKey o_conv;
15232 o_conv.inner = (void*)(o & (~1));
15233 o_conv.is_owned = (o & 1) || (o == 0);
15234 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15235 o_conv = PayeePubKey_clone(&o_conv);
15236 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
15237 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
15238 return (uint32_t)ret_conv;
15241 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_err"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
15242 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
15243 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
15244 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
15245 return (uint32_t)ret_conv;
15248 jboolean __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_is_ok"))) TS_CResult_PayeePubKeyErrorZ_is_ok(uint32_t o) {
15249 LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)(o & ~1);
15250 jboolean ret_val = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
15254 void __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_free"))) TS_CResult_PayeePubKeyErrorZ_free(uint32_t _res) {
15255 if ((_res & 1) != 0) return;
15256 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15257 CHECK_ACCESS(_res_ptr);
15258 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
15260 CResult_PayeePubKeyErrorZ_free(_res_conv);
15263 static inline uintptr_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
15264 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
15265 *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
15266 return (uint32_t)ret_conv;
15268 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone_ptr"))) TS_CResult_PayeePubKeyErrorZ_clone_ptr(uint32_t arg) {
15269 LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
15270 uint32_t ret_val = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
15274 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone"))) TS_CResult_PayeePubKeyErrorZ_clone(uint32_t orig) {
15275 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
15276 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
15277 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
15278 return (uint32_t)ret_conv;
15281 void __attribute__((export_name("TS_CVec_PrivateRouteZ_free"))) TS_CVec_PrivateRouteZ_free(uint32_tArray _res) {
15282 LDKCVec_PrivateRouteZ _res_constr;
15283 _res_constr.datalen = _res->arr_len;
15284 if (_res_constr.datalen > 0)
15285 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
15287 _res_constr.data = NULL;
15288 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
15289 for (size_t o = 0; o < _res_constr.datalen; o++) {
15290 uint32_t _res_conv_14 = _res_vals[o];
15291 LDKPrivateRoute _res_conv_14_conv;
15292 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
15293 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
15294 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
15295 _res_constr.data[o] = _res_conv_14_conv;
15297 CVec_PrivateRouteZ_free(_res_constr);
15300 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint32_t o) {
15301 LDKPositiveTimestamp o_conv;
15302 o_conv.inner = (void*)(o & (~1));
15303 o_conv.is_owned = (o & 1) || (o == 0);
15304 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15305 o_conv = PositiveTimestamp_clone(&o_conv);
15306 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
15307 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
15308 return (uint32_t)ret_conv;
15311 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_err"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
15312 LDKCreationError e_conv = LDKCreationError_from_js(e);
15313 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
15314 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
15315 return (uint32_t)ret_conv;
15318 jboolean __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_is_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint32_t o) {
15319 LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(o & ~1);
15320 jboolean ret_val = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
15324 void __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_free"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint32_t _res) {
15325 if ((_res & 1) != 0) return;
15326 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15327 CHECK_ACCESS(_res_ptr);
15328 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
15330 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
15333 static inline uintptr_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
15334 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
15335 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
15336 return (uint32_t)ret_conv;
15338 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint32_t arg) {
15339 LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
15340 uint32_t ret_val = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
15344 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint32_t orig) {
15345 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
15346 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
15347 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
15348 return (uint32_t)ret_conv;
15351 uint32_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_ok"))) TS_CResult_NoneSemanticErrorZ_ok() {
15352 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
15353 *ret_conv = CResult_NoneSemanticErrorZ_ok();
15354 return (uint32_t)ret_conv;
15357 uint32_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_err"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) {
15358 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
15359 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
15360 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
15361 return (uint32_t)ret_conv;
15364 jboolean __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_is_ok"))) TS_CResult_NoneSemanticErrorZ_is_ok(uint32_t o) {
15365 LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)(o & ~1);
15366 jboolean ret_val = CResult_NoneSemanticErrorZ_is_ok(o_conv);
15370 void __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_free"))) TS_CResult_NoneSemanticErrorZ_free(uint32_t _res) {
15371 if ((_res & 1) != 0) return;
15372 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15373 CHECK_ACCESS(_res_ptr);
15374 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
15376 CResult_NoneSemanticErrorZ_free(_res_conv);
15379 static inline uintptr_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
15380 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
15381 *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
15382 return (uint32_t)ret_conv;
15384 uint32_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone_ptr"))) TS_CResult_NoneSemanticErrorZ_clone_ptr(uint32_t arg) {
15385 LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
15386 uint32_t ret_val = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
15390 uint32_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone"))) TS_CResult_NoneSemanticErrorZ_clone(uint32_t orig) {
15391 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
15392 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
15393 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
15394 return (uint32_t)ret_conv;
15397 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_ok"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint32_t o) {
15399 o_conv.inner = (void*)(o & (~1));
15400 o_conv.is_owned = (o & 1) || (o == 0);
15401 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15402 o_conv = Invoice_clone(&o_conv);
15403 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
15404 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
15405 return (uint32_t)ret_conv;
15408 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_err"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) {
15409 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
15410 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
15411 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
15412 return (uint32_t)ret_conv;
15415 jboolean __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_is_ok"))) TS_CResult_InvoiceSemanticErrorZ_is_ok(uint32_t o) {
15416 LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)(o & ~1);
15417 jboolean ret_val = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
15421 void __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_free"))) TS_CResult_InvoiceSemanticErrorZ_free(uint32_t _res) {
15422 if ((_res & 1) != 0) return;
15423 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15424 CHECK_ACCESS(_res_ptr);
15425 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
15427 CResult_InvoiceSemanticErrorZ_free(_res_conv);
15430 static inline uintptr_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
15431 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
15432 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
15433 return (uint32_t)ret_conv;
15435 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceSemanticErrorZ_clone_ptr(uint32_t arg) {
15436 LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
15437 uint32_t ret_val = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
15441 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint32_t orig) {
15442 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
15443 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
15444 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
15445 return (uint32_t)ret_conv;
15448 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_ok"))) TS_CResult_DescriptionCreationErrorZ_ok(uint32_t o) {
15449 LDKDescription o_conv;
15450 o_conv.inner = (void*)(o & (~1));
15451 o_conv.is_owned = (o & 1) || (o == 0);
15452 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15453 o_conv = Description_clone(&o_conv);
15454 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
15455 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
15456 return (uint32_t)ret_conv;
15459 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_err"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
15460 LDKCreationError e_conv = LDKCreationError_from_js(e);
15461 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
15462 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
15463 return (uint32_t)ret_conv;
15466 jboolean __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_is_ok"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint32_t o) {
15467 LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)(o & ~1);
15468 jboolean ret_val = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
15472 void __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_free"))) TS_CResult_DescriptionCreationErrorZ_free(uint32_t _res) {
15473 if ((_res & 1) != 0) return;
15474 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15475 CHECK_ACCESS(_res_ptr);
15476 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
15478 CResult_DescriptionCreationErrorZ_free(_res_conv);
15481 static inline uintptr_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
15482 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
15483 *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
15484 return (uint32_t)ret_conv;
15486 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone_ptr"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint32_t arg) {
15487 LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
15488 uint32_t ret_val = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
15492 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone"))) TS_CResult_DescriptionCreationErrorZ_clone(uint32_t orig) {
15493 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
15494 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
15495 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
15496 return (uint32_t)ret_conv;
15499 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_ok"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint32_t o) {
15500 LDKPrivateRoute o_conv;
15501 o_conv.inner = (void*)(o & (~1));
15502 o_conv.is_owned = (o & 1) || (o == 0);
15503 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15504 o_conv = PrivateRoute_clone(&o_conv);
15505 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
15506 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
15507 return (uint32_t)ret_conv;
15510 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_err"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
15511 LDKCreationError e_conv = LDKCreationError_from_js(e);
15512 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
15513 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
15514 return (uint32_t)ret_conv;
15517 jboolean __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_is_ok"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint32_t o) {
15518 LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(o & ~1);
15519 jboolean ret_val = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
15523 void __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_free"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint32_t _res) {
15524 if ((_res & 1) != 0) return;
15525 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15526 CHECK_ACCESS(_res_ptr);
15527 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
15529 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
15532 static inline uintptr_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
15533 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
15534 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
15535 return (uint32_t)ret_conv;
15537 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone_ptr"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint32_t arg) {
15538 LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
15539 uint32_t ret_val = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
15543 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint32_t orig) {
15544 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
15545 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
15546 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
15547 return (uint32_t)ret_conv;
15550 uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_ok"))) TS_CResult_StringErrorZ_ok(jstring o) {
15551 LDKStr o_conv = str_ref_to_owned_c(o);
15552 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
15553 *ret_conv = CResult_StringErrorZ_ok(o_conv);
15554 return (uint32_t)ret_conv;
15557 uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_err"))) TS_CResult_StringErrorZ_err(uint32_t e) {
15558 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
15559 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
15560 *ret_conv = CResult_StringErrorZ_err(e_conv);
15561 return (uint32_t)ret_conv;
15564 jboolean __attribute__((export_name("TS_CResult_StringErrorZ_is_ok"))) TS_CResult_StringErrorZ_is_ok(uint32_t o) {
15565 LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)(o & ~1);
15566 jboolean ret_val = CResult_StringErrorZ_is_ok(o_conv);
15570 void __attribute__((export_name("TS_CResult_StringErrorZ_free"))) TS_CResult_StringErrorZ_free(uint32_t _res) {
15571 if ((_res & 1) != 0) return;
15572 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15573 CHECK_ACCESS(_res_ptr);
15574 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
15576 CResult_StringErrorZ_free(_res_conv);
15579 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint32_t o) {
15580 LDKChannelMonitorUpdate o_conv;
15581 o_conv.inner = (void*)(o & (~1));
15582 o_conv.is_owned = (o & 1) || (o == 0);
15583 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15584 o_conv = ChannelMonitorUpdate_clone(&o_conv);
15585 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
15586 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
15587 return (uint32_t)ret_conv;
15590 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint32_t e) {
15591 LDKDecodeError e_conv;
15592 e_conv.inner = (void*)(e & (~1));
15593 e_conv.is_owned = (e & 1) || (e == 0);
15594 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15595 e_conv = DecodeError_clone(&e_conv);
15596 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
15597 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
15598 return (uint32_t)ret_conv;
15601 jboolean __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint32_t o) {
15602 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(o & ~1);
15603 jboolean ret_val = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
15607 void __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint32_t _res) {
15608 if ((_res & 1) != 0) return;
15609 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15610 CHECK_ACCESS(_res_ptr);
15611 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
15613 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
15616 static inline uintptr_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
15617 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
15618 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
15619 return (uint32_t)ret_conv;
15621 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
15622 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
15623 uint32_t ret_val = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
15627 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint32_t orig) {
15628 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
15629 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
15630 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
15631 return (uint32_t)ret_conv;
15634 uint32_t __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint32_t o) {
15635 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15636 CHECK_ACCESS(o_ptr);
15637 LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
15638 o_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uintptr_t)o) & ~1));
15639 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
15640 *ret_copy = COption_MonitorEventZ_some(o_conv);
15641 uint32_t ret_ref = (uintptr_t)ret_copy;
15645 uint32_t __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() {
15646 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
15647 *ret_copy = COption_MonitorEventZ_none();
15648 uint32_t ret_ref = (uintptr_t)ret_copy;
15652 void __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint32_t _res) {
15653 if ((_res & 1) != 0) return;
15654 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15655 CHECK_ACCESS(_res_ptr);
15656 LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
15658 COption_MonitorEventZ_free(_res_conv);
15661 static inline uintptr_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
15662 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
15663 *ret_copy = COption_MonitorEventZ_clone(arg);
15664 uint32_t ret_ref = (uintptr_t)ret_copy;
15667 uint32_t __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint32_t arg) {
15668 LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)arg;
15669 uint32_t ret_val = COption_MonitorEventZ_clone_ptr(arg_conv);
15673 uint32_t __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint32_t orig) {
15674 LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)orig;
15675 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
15676 *ret_copy = COption_MonitorEventZ_clone(orig_conv);
15677 uint32_t ret_ref = (uintptr_t)ret_copy;
15681 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint32_t o) {
15682 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15683 CHECK_ACCESS(o_ptr);
15684 LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
15685 o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)(((uintptr_t)o) & ~1));
15686 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
15687 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
15688 return (uint32_t)ret_conv;
15691 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint32_t e) {
15692 LDKDecodeError e_conv;
15693 e_conv.inner = (void*)(e & (~1));
15694 e_conv.is_owned = (e & 1) || (e == 0);
15695 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15696 e_conv = DecodeError_clone(&e_conv);
15697 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
15698 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
15699 return (uint32_t)ret_conv;
15702 jboolean __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint32_t o) {
15703 LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(o & ~1);
15704 jboolean ret_val = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
15708 void __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint32_t _res) {
15709 if ((_res & 1) != 0) return;
15710 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15711 CHECK_ACCESS(_res_ptr);
15712 LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
15714 CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
15717 static inline uintptr_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
15718 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
15719 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
15720 return (uint32_t)ret_conv;
15722 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint32_t arg) {
15723 LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(arg & ~1);
15724 uint32_t ret_val = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
15728 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint32_t orig) {
15729 LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(orig & ~1);
15730 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
15731 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
15732 return (uint32_t)ret_conv;
15735 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint32_t o) {
15736 LDKHTLCUpdate o_conv;
15737 o_conv.inner = (void*)(o & (~1));
15738 o_conv.is_owned = (o & 1) || (o == 0);
15739 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15740 o_conv = HTLCUpdate_clone(&o_conv);
15741 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
15742 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
15743 return (uint32_t)ret_conv;
15746 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint32_t e) {
15747 LDKDecodeError e_conv;
15748 e_conv.inner = (void*)(e & (~1));
15749 e_conv.is_owned = (e & 1) || (e == 0);
15750 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15751 e_conv = DecodeError_clone(&e_conv);
15752 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
15753 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
15754 return (uint32_t)ret_conv;
15757 jboolean __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_is_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint32_t o) {
15758 LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(o & ~1);
15759 jboolean ret_val = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
15763 void __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_free"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint32_t _res) {
15764 if ((_res & 1) != 0) return;
15765 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15766 CHECK_ACCESS(_res_ptr);
15767 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
15769 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
15772 static inline uintptr_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
15773 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
15774 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
15775 return (uint32_t)ret_conv;
15777 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
15778 LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
15779 uint32_t ret_val = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
15783 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint32_t orig) {
15784 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
15785 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
15786 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
15787 return (uint32_t)ret_conv;
15790 static inline uintptr_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
15791 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
15792 *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
15793 return ((uint32_t)ret_conv);
15795 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone_ptr"))) TS_C2Tuple_OutPointScriptZ_clone_ptr(uint32_t arg) {
15796 LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)(arg & ~1);
15797 uint32_t ret_val = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
15801 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone"))) TS_C2Tuple_OutPointScriptZ_clone(uint32_t orig) {
15802 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
15803 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
15804 *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
15805 return ((uint32_t)ret_conv);
15808 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_new"))) TS_C2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
15809 LDKOutPoint a_conv;
15810 a_conv.inner = (void*)(a & (~1));
15811 a_conv.is_owned = (a & 1) || (a == 0);
15812 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
15813 a_conv = OutPoint_clone(&a_conv);
15815 b_ref.datalen = b->arr_len;
15816 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
15817 memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
15818 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
15819 *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
15820 return ((uint32_t)ret_conv);
15823 void __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_free"))) TS_C2Tuple_OutPointScriptZ_free(uint32_t _res) {
15824 if ((_res & 1) != 0) return;
15825 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15826 CHECK_ACCESS(_res_ptr);
15827 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
15829 C2Tuple_OutPointScriptZ_free(_res_conv);
15832 static inline uintptr_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
15833 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
15834 *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
15835 return ((uint32_t)ret_conv);
15837 uint32_t __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone_ptr"))) TS_C2Tuple_u32ScriptZ_clone_ptr(uint32_t arg) {
15838 LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)(arg & ~1);
15839 uint32_t ret_val = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
15843 uint32_t __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone"))) TS_C2Tuple_u32ScriptZ_clone(uint32_t orig) {
15844 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
15845 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
15846 *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
15847 return ((uint32_t)ret_conv);
15850 uint32_t __attribute__((export_name("TS_C2Tuple_u32ScriptZ_new"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
15852 b_ref.datalen = b->arr_len;
15853 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
15854 memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
15855 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
15856 *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
15857 return ((uint32_t)ret_conv);
15860 void __attribute__((export_name("TS_C2Tuple_u32ScriptZ_free"))) TS_C2Tuple_u32ScriptZ_free(uint32_t _res) {
15861 if ((_res & 1) != 0) return;
15862 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15863 CHECK_ACCESS(_res_ptr);
15864 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
15866 C2Tuple_u32ScriptZ_free(_res_conv);
15869 void __attribute__((export_name("TS_CVec_C2Tuple_u32ScriptZZ_free"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint32_tArray _res) {
15870 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
15871 _res_constr.datalen = _res->arr_len;
15872 if (_res_constr.datalen > 0)
15873 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
15875 _res_constr.data = NULL;
15876 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
15877 for (size_t v = 0; v < _res_constr.datalen; v++) {
15878 uint32_t _res_conv_21 = _res_vals[v];
15879 void* _res_conv_21_ptr = (void*)(((uintptr_t)_res_conv_21) & ~1);
15880 CHECK_ACCESS(_res_conv_21_ptr);
15881 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
15882 FREE((void*)_res_conv_21);
15883 _res_constr.data[v] = _res_conv_21_conv;
15885 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
15888 static inline uintptr_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
15889 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
15890 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
15891 return ((uint32_t)ret_conv);
15893 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(uint32_t arg) {
15894 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(arg & ~1);
15895 uint32_t ret_val = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
15899 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint32_t orig) {
15900 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
15901 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
15902 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
15903 return ((uint32_t)ret_conv);
15906 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
15907 LDKThirtyTwoBytes a_ref;
15908 CHECK(a->arr_len == 32);
15909 memcpy(a_ref.data, a->elems, 32); FREE(a);
15910 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
15911 b_constr.datalen = b->arr_len;
15912 if (b_constr.datalen > 0)
15913 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
15915 b_constr.data = NULL;
15916 uint32_t* b_vals = b->elems /* XXX b leaks */;
15917 for (size_t v = 0; v < b_constr.datalen; v++) {
15918 uint32_t b_conv_21 = b_vals[v];
15919 void* b_conv_21_ptr = (void*)(((uintptr_t)b_conv_21) & ~1);
15920 CHECK_ACCESS(b_conv_21_ptr);
15921 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
15922 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uintptr_t)b_conv_21) & ~1));
15923 b_constr.data[v] = b_conv_21_conv;
15925 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
15926 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
15927 return ((uint32_t)ret_conv);
15930 void __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint32_t _res) {
15931 if ((_res & 1) != 0) return;
15932 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15933 CHECK_ACCESS(_res_ptr);
15934 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
15936 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
15939 void __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint32_tArray _res) {
15940 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
15941 _res_constr.datalen = _res->arr_len;
15942 if (_res_constr.datalen > 0)
15943 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
15945 _res_constr.data = NULL;
15946 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
15947 for (size_t o = 0; o < _res_constr.datalen; o++) {
15948 uint32_t _res_conv_40 = _res_vals[o];
15949 void* _res_conv_40_ptr = (void*)(((uintptr_t)_res_conv_40) & ~1);
15950 CHECK_ACCESS(_res_conv_40_ptr);
15951 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
15952 FREE((void*)_res_conv_40);
15953 _res_constr.data[o] = _res_conv_40_conv;
15955 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
15958 void __attribute__((export_name("TS_CVec_EventZ_free"))) TS_CVec_EventZ_free(uint32_tArray _res) {
15959 LDKCVec_EventZ _res_constr;
15960 _res_constr.datalen = _res->arr_len;
15961 if (_res_constr.datalen > 0)
15962 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
15964 _res_constr.data = NULL;
15965 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
15966 for (size_t h = 0; h < _res_constr.datalen; h++) {
15967 uint32_t _res_conv_7 = _res_vals[h];
15968 void* _res_conv_7_ptr = (void*)(((uintptr_t)_res_conv_7) & ~1);
15969 CHECK_ACCESS(_res_conv_7_ptr);
15970 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
15971 FREE((void*)_res_conv_7);
15972 _res_constr.data[h] = _res_conv_7_conv;
15974 CVec_EventZ_free(_res_constr);
15977 void __attribute__((export_name("TS_CVec_TransactionZ_free"))) TS_CVec_TransactionZ_free(ptrArray _res) {
15978 LDKCVec_TransactionZ _res_constr;
15979 _res_constr.datalen = _res->arr_len;
15980 if (_res_constr.datalen > 0)
15981 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
15983 _res_constr.data = NULL;
15984 int8_tArray* _res_vals = (void*) _res->elems /* XXX _res leaks */;
15985 for (size_t m = 0; m < _res_constr.datalen; m++) {
15986 int8_tArray _res_conv_12 = _res_vals[m];
15987 LDKTransaction _res_conv_12_ref;
15988 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
15989 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
15990 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
15991 _res_conv_12_ref.data_is_owned = true;
15992 _res_constr.data[m] = _res_conv_12_ref;
15994 CVec_TransactionZ_free(_res_constr);
15997 static inline uintptr_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
15998 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
15999 *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
16000 return ((uint32_t)ret_conv);
16002 uint32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone_ptr"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint32_t arg) {
16003 LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)(arg & ~1);
16004 uint32_t ret_val = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
16008 uint32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone"))) TS_C2Tuple_u32TxOutZ_clone(uint32_t orig) {
16009 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
16010 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
16011 *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
16012 return ((uint32_t)ret_conv);
16015 uint32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_new"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
16016 void* b_ptr = (void*)(((uintptr_t)b) & ~1);
16017 CHECK_ACCESS(b_ptr);
16018 LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
16019 b_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)b) & ~1));
16020 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
16021 *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
16022 return ((uint32_t)ret_conv);
16025 void __attribute__((export_name("TS_C2Tuple_u32TxOutZ_free"))) TS_C2Tuple_u32TxOutZ_free(uint32_t _res) {
16026 if ((_res & 1) != 0) return;
16027 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16028 CHECK_ACCESS(_res_ptr);
16029 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
16031 C2Tuple_u32TxOutZ_free(_res_conv);
16034 void __attribute__((export_name("TS_CVec_C2Tuple_u32TxOutZZ_free"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint32_tArray _res) {
16035 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
16036 _res_constr.datalen = _res->arr_len;
16037 if (_res_constr.datalen > 0)
16038 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
16040 _res_constr.data = NULL;
16041 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
16042 for (size_t u = 0; u < _res_constr.datalen; u++) {
16043 uint32_t _res_conv_20 = _res_vals[u];
16044 void* _res_conv_20_ptr = (void*)(((uintptr_t)_res_conv_20) & ~1);
16045 CHECK_ACCESS(_res_conv_20_ptr);
16046 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
16047 FREE((void*)_res_conv_20);
16048 _res_constr.data[u] = _res_conv_20_conv;
16050 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
16053 static inline uintptr_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
16054 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
16055 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
16056 return ((uint32_t)ret_conv);
16058 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint32_t arg) {
16059 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(arg & ~1);
16060 uint32_t ret_val = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
16064 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint32_t orig) {
16065 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
16066 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
16067 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
16068 return ((uint32_t)ret_conv);
16071 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
16072 LDKThirtyTwoBytes a_ref;
16073 CHECK(a->arr_len == 32);
16074 memcpy(a_ref.data, a->elems, 32); FREE(a);
16075 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
16076 b_constr.datalen = b->arr_len;
16077 if (b_constr.datalen > 0)
16078 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
16080 b_constr.data = NULL;
16081 uint32_t* b_vals = b->elems /* XXX b leaks */;
16082 for (size_t u = 0; u < b_constr.datalen; u++) {
16083 uint32_t b_conv_20 = b_vals[u];
16084 void* b_conv_20_ptr = (void*)(((uintptr_t)b_conv_20) & ~1);
16085 CHECK_ACCESS(b_conv_20_ptr);
16086 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
16087 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uintptr_t)b_conv_20) & ~1));
16088 b_constr.data[u] = b_conv_20_conv;
16090 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
16091 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
16092 return ((uint32_t)ret_conv);
16095 void __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint32_t _res) {
16096 if ((_res & 1) != 0) return;
16097 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16098 CHECK_ACCESS(_res_ptr);
16099 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
16101 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
16104 void __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint32_tArray _res) {
16105 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
16106 _res_constr.datalen = _res->arr_len;
16107 if (_res_constr.datalen > 0)
16108 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
16110 _res_constr.data = NULL;
16111 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
16112 for (size_t n = 0; n < _res_constr.datalen; n++) {
16113 uint32_t _res_conv_39 = _res_vals[n];
16114 void* _res_conv_39_ptr = (void*)(((uintptr_t)_res_conv_39) & ~1);
16115 CHECK_ACCESS(_res_conv_39_ptr);
16116 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
16117 FREE((void*)_res_conv_39);
16118 _res_constr.data[n] = _res_conv_39_conv;
16120 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
16123 void __attribute__((export_name("TS_CVec_BalanceZ_free"))) TS_CVec_BalanceZ_free(uint32_tArray _res) {
16124 LDKCVec_BalanceZ _res_constr;
16125 _res_constr.datalen = _res->arr_len;
16126 if (_res_constr.datalen > 0)
16127 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
16129 _res_constr.data = NULL;
16130 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
16131 for (size_t j = 0; j < _res_constr.datalen; j++) {
16132 uint32_t _res_conv_9 = _res_vals[j];
16133 void* _res_conv_9_ptr = (void*)(((uintptr_t)_res_conv_9) & ~1);
16134 CHECK_ACCESS(_res_conv_9_ptr);
16135 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
16136 FREE((void*)_res_conv_9);
16137 _res_constr.data[j] = _res_conv_9_conv;
16139 CVec_BalanceZ_free(_res_constr);
16142 static inline uintptr_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
16143 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
16144 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
16145 return ((uint32_t)ret_conv);
16147 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr(uint32_t arg) {
16148 LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(arg & ~1);
16149 uint32_t ret_val = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
16153 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint32_t orig) {
16154 LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(orig & ~1);
16155 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
16156 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
16157 return ((uint32_t)ret_conv);
16160 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_new"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
16161 LDKThirtyTwoBytes a_ref;
16162 CHECK(a->arr_len == 32);
16163 memcpy(a_ref.data, a->elems, 32); FREE(a);
16164 LDKChannelMonitor b_conv;
16165 b_conv.inner = (void*)(b & (~1));
16166 b_conv.is_owned = (b & 1) || (b == 0);
16167 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
16168 b_conv = ChannelMonitor_clone(&b_conv);
16169 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
16170 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
16171 return ((uint32_t)ret_conv);
16174 void __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_free"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint32_t _res) {
16175 if ((_res & 1) != 0) return;
16176 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16177 CHECK_ACCESS(_res_ptr);
16178 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
16180 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
16183 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint32_t o) {
16184 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16185 CHECK_ACCESS(o_ptr);
16186 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
16187 o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uintptr_t)o) & ~1));
16188 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
16189 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
16190 return (uint32_t)ret_conv;
16193 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint32_t e) {
16194 LDKDecodeError e_conv;
16195 e_conv.inner = (void*)(e & (~1));
16196 e_conv.is_owned = (e & 1) || (e == 0);
16197 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16198 e_conv = DecodeError_clone(&e_conv);
16199 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
16200 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
16201 return (uint32_t)ret_conv;
16204 jboolean __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(uint32_t o) {
16205 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(o & ~1);
16206 jboolean ret_val = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
16210 void __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint32_t _res) {
16211 if ((_res & 1) != 0) return;
16212 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16213 CHECK_ACCESS(_res_ptr);
16214 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
16216 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
16219 static inline uintptr_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
16220 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
16221 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
16222 return (uint32_t)ret_conv;
16224 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(uint32_t arg) {
16225 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
16226 uint32_t ret_val = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
16230 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint32_t orig) {
16231 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(orig & ~1);
16232 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
16233 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
16234 return (uint32_t)ret_conv;
16237 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_ok"))) TS_CResult_NoneLightningErrorZ_ok() {
16238 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16239 *ret_conv = CResult_NoneLightningErrorZ_ok();
16240 return (uint32_t)ret_conv;
16243 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_err"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
16244 LDKLightningError e_conv;
16245 e_conv.inner = (void*)(e & (~1));
16246 e_conv.is_owned = (e & 1) || (e == 0);
16247 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16248 e_conv = LightningError_clone(&e_conv);
16249 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16250 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
16251 return (uint32_t)ret_conv;
16254 jboolean __attribute__((export_name("TS_CResult_NoneLightningErrorZ_is_ok"))) TS_CResult_NoneLightningErrorZ_is_ok(uint32_t o) {
16255 LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)(o & ~1);
16256 jboolean ret_val = CResult_NoneLightningErrorZ_is_ok(o_conv);
16260 void __attribute__((export_name("TS_CResult_NoneLightningErrorZ_free"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
16261 if ((_res & 1) != 0) return;
16262 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16263 CHECK_ACCESS(_res_ptr);
16264 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
16266 CResult_NoneLightningErrorZ_free(_res_conv);
16269 static inline uintptr_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
16270 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16271 *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
16272 return (uint32_t)ret_conv;
16274 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone_ptr"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint32_t arg) {
16275 LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
16276 uint32_t ret_val = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
16280 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
16281 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
16282 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16283 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
16284 return (uint32_t)ret_conv;
16287 static inline uintptr_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
16288 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
16289 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
16290 return ((uint32_t)ret_conv);
16292 uint32_t __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone_ptr"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint32_t arg) {
16293 LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)(arg & ~1);
16294 uint32_t ret_val = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
16298 uint32_t __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint32_t orig) {
16299 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
16300 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
16301 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
16302 return ((uint32_t)ret_conv);
16305 uint32_t __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_new"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint32_t b) {
16306 LDKPublicKey a_ref;
16307 CHECK(a->arr_len == 33);
16308 memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
16309 void* b_ptr = (void*)(((uintptr_t)b) & ~1);
16310 CHECK_ACCESS(b_ptr);
16311 LDKType b_conv = *(LDKType*)(b_ptr);
16312 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
16313 *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
16314 return ((uint32_t)ret_conv);
16317 void __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_free"))) TS_C2Tuple_PublicKeyTypeZ_free(uint32_t _res) {
16318 if ((_res & 1) != 0) return;
16319 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16320 CHECK_ACCESS(_res_ptr);
16321 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
16323 C2Tuple_PublicKeyTypeZ_free(_res_conv);
16326 void __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyTypeZZ_free"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint32_tArray _res) {
16327 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
16328 _res_constr.datalen = _res->arr_len;
16329 if (_res_constr.datalen > 0)
16330 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
16332 _res_constr.data = NULL;
16333 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
16334 for (size_t z = 0; z < _res_constr.datalen; z++) {
16335 uint32_t _res_conv_25 = _res_vals[z];
16336 void* _res_conv_25_ptr = (void*)(((uintptr_t)_res_conv_25) & ~1);
16337 CHECK_ACCESS(_res_conv_25_ptr);
16338 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
16339 FREE((void*)_res_conv_25);
16340 _res_constr.data[z] = _res_conv_25_conv;
16342 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
16345 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_ok"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
16346 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16347 *ret_conv = CResult_boolLightningErrorZ_ok(o);
16348 return (uint32_t)ret_conv;
16351 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_err"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
16352 LDKLightningError e_conv;
16353 e_conv.inner = (void*)(e & (~1));
16354 e_conv.is_owned = (e & 1) || (e == 0);
16355 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16356 e_conv = LightningError_clone(&e_conv);
16357 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16358 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
16359 return (uint32_t)ret_conv;
16362 jboolean __attribute__((export_name("TS_CResult_boolLightningErrorZ_is_ok"))) TS_CResult_boolLightningErrorZ_is_ok(uint32_t o) {
16363 LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)(o & ~1);
16364 jboolean ret_val = CResult_boolLightningErrorZ_is_ok(o_conv);
16368 void __attribute__((export_name("TS_CResult_boolLightningErrorZ_free"))) TS_CResult_boolLightningErrorZ_free(uint32_t _res) {
16369 if ((_res & 1) != 0) return;
16370 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16371 CHECK_ACCESS(_res_ptr);
16372 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
16374 CResult_boolLightningErrorZ_free(_res_conv);
16377 static inline uintptr_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
16378 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16379 *ret_conv = CResult_boolLightningErrorZ_clone(arg);
16380 return (uint32_t)ret_conv;
16382 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone_ptr"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint32_t arg) {
16383 LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
16384 uint32_t ret_val = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
16388 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
16389 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
16390 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16391 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
16392 return (uint32_t)ret_conv;
16395 static inline uintptr_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
16396 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
16397 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
16398 return ((uint32_t)ret_conv);
16400 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint32_t arg) {
16401 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(arg & ~1);
16402 uint32_t ret_val = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
16406 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
16407 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
16408 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
16409 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
16410 return ((uint32_t)ret_conv);
16413 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
16414 LDKChannelAnnouncement a_conv;
16415 a_conv.inner = (void*)(a & (~1));
16416 a_conv.is_owned = (a & 1) || (a == 0);
16417 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
16418 a_conv = ChannelAnnouncement_clone(&a_conv);
16419 LDKChannelUpdate b_conv;
16420 b_conv.inner = (void*)(b & (~1));
16421 b_conv.is_owned = (b & 1) || (b == 0);
16422 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
16423 b_conv = ChannelUpdate_clone(&b_conv);
16424 LDKChannelUpdate c_conv;
16425 c_conv.inner = (void*)(c & (~1));
16426 c_conv.is_owned = (c & 1) || (c == 0);
16427 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
16428 c_conv = ChannelUpdate_clone(&c_conv);
16429 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
16430 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
16431 return ((uint32_t)ret_conv);
16434 void __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint32_t _res) {
16435 if ((_res & 1) != 0) return;
16436 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16437 CHECK_ACCESS(_res_ptr);
16438 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
16440 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
16443 void __attribute__((export_name("TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free"))) TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint32_tArray _res) {
16444 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
16445 _res_constr.datalen = _res->arr_len;
16446 if (_res_constr.datalen > 0)
16447 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
16449 _res_constr.data = NULL;
16450 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
16451 for (size_t h = 0; h < _res_constr.datalen; h++) {
16452 uint32_t _res_conv_59 = _res_vals[h];
16453 void* _res_conv_59_ptr = (void*)(((uintptr_t)_res_conv_59) & ~1);
16454 CHECK_ACCESS(_res_conv_59_ptr);
16455 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_conv_59_ptr);
16456 FREE((void*)_res_conv_59);
16457 _res_constr.data[h] = _res_conv_59_conv;
16459 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
16462 void __attribute__((export_name("TS_CVec_NodeAnnouncementZ_free"))) TS_CVec_NodeAnnouncementZ_free(uint32_tArray _res) {
16463 LDKCVec_NodeAnnouncementZ _res_constr;
16464 _res_constr.datalen = _res->arr_len;
16465 if (_res_constr.datalen > 0)
16466 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
16468 _res_constr.data = NULL;
16469 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
16470 for (size_t s = 0; s < _res_constr.datalen; s++) {
16471 uint32_t _res_conv_18 = _res_vals[s];
16472 LDKNodeAnnouncement _res_conv_18_conv;
16473 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
16474 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
16475 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_18_conv);
16476 _res_constr.data[s] = _res_conv_18_conv;
16478 CVec_NodeAnnouncementZ_free(_res_constr);
16481 void __attribute__((export_name("TS_CVec_PublicKeyZ_free"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
16482 LDKCVec_PublicKeyZ _res_constr;
16483 _res_constr.datalen = _res->arr_len;
16484 if (_res_constr.datalen > 0)
16485 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
16487 _res_constr.data = NULL;
16488 int8_tArray* _res_vals = (void*) _res->elems /* XXX _res leaks */;
16489 for (size_t m = 0; m < _res_constr.datalen; m++) {
16490 int8_tArray _res_conv_12 = _res_vals[m];
16491 LDKPublicKey _res_conv_12_ref;
16492 CHECK(_res_conv_12->arr_len == 33);
16493 memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33); FREE(_res_conv_12);
16494 _res_constr.data[m] = _res_conv_12_ref;
16496 CVec_PublicKeyZ_free(_res_constr);
16499 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
16501 o_ref.datalen = o->arr_len;
16502 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
16503 memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
16504 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
16505 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
16506 return (uint32_t)ret_conv;
16509 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint32_t e) {
16510 LDKPeerHandleError e_conv;
16511 e_conv.inner = (void*)(e & (~1));
16512 e_conv.is_owned = (e & 1) || (e == 0);
16513 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16514 e_conv = PeerHandleError_clone(&e_conv);
16515 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
16516 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
16517 return (uint32_t)ret_conv;
16520 jboolean __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint32_t o) {
16521 LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(o & ~1);
16522 jboolean ret_val = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
16526 void __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint32_t _res) {
16527 if ((_res & 1) != 0) return;
16528 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16529 CHECK_ACCESS(_res_ptr);
16530 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
16532 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
16535 static inline uintptr_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
16536 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
16537 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
16538 return (uint32_t)ret_conv;
16540 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint32_t arg) {
16541 LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
16542 uint32_t ret_val = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
16546 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint32_t orig) {
16547 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
16548 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
16549 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
16550 return (uint32_t)ret_conv;
16553 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() {
16554 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
16555 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
16556 return (uint32_t)ret_conv;
16559 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint32_t e) {
16560 LDKPeerHandleError e_conv;
16561 e_conv.inner = (void*)(e & (~1));
16562 e_conv.is_owned = (e & 1) || (e == 0);
16563 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16564 e_conv = PeerHandleError_clone(&e_conv);
16565 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
16566 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
16567 return (uint32_t)ret_conv;
16570 jboolean __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint32_t o) {
16571 LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)(o & ~1);
16572 jboolean ret_val = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
16576 void __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint32_t _res) {
16577 if ((_res & 1) != 0) return;
16578 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16579 CHECK_ACCESS(_res_ptr);
16580 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
16582 CResult_NonePeerHandleErrorZ_free(_res_conv);
16585 static inline uintptr_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
16586 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
16587 *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
16588 return (uint32_t)ret_conv;
16590 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint32_t arg) {
16591 LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
16592 uint32_t ret_val = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
16596 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint32_t orig) {
16597 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
16598 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
16599 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
16600 return (uint32_t)ret_conv;
16603 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
16604 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
16605 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
16606 return (uint32_t)ret_conv;
16609 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint32_t e) {
16610 LDKPeerHandleError e_conv;
16611 e_conv.inner = (void*)(e & (~1));
16612 e_conv.is_owned = (e & 1) || (e == 0);
16613 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16614 e_conv = PeerHandleError_clone(&e_conv);
16615 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
16616 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
16617 return (uint32_t)ret_conv;
16620 jboolean __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint32_t o) {
16621 LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)(o & ~1);
16622 jboolean ret_val = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
16626 void __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint32_t _res) {
16627 if ((_res & 1) != 0) return;
16628 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16629 CHECK_ACCESS(_res_ptr);
16630 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
16632 CResult_boolPeerHandleErrorZ_free(_res_conv);
16635 static inline uintptr_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
16636 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
16637 *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
16638 return (uint32_t)ret_conv;
16640 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint32_t arg) {
16641 LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
16642 uint32_t ret_val = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
16646 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint32_t orig) {
16647 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
16648 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
16649 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
16650 return (uint32_t)ret_conv;
16653 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_ok"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint32_t o) {
16655 o_conv.inner = (void*)(o & (~1));
16656 o_conv.is_owned = (o & 1) || (o == 0);
16657 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16658 o_conv = NodeId_clone(&o_conv);
16659 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
16660 *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
16661 return (uint32_t)ret_conv;
16664 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_err"))) TS_CResult_NodeIdDecodeErrorZ_err(uint32_t e) {
16665 LDKDecodeError e_conv;
16666 e_conv.inner = (void*)(e & (~1));
16667 e_conv.is_owned = (e & 1) || (e == 0);
16668 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16669 e_conv = DecodeError_clone(&e_conv);
16670 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
16671 *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
16672 return (uint32_t)ret_conv;
16675 jboolean __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_is_ok"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint32_t o) {
16676 LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)(o & ~1);
16677 jboolean ret_val = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
16681 void __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_free"))) TS_CResult_NodeIdDecodeErrorZ_free(uint32_t _res) {
16682 if ((_res & 1) != 0) return;
16683 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16684 CHECK_ACCESS(_res_ptr);
16685 LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
16687 CResult_NodeIdDecodeErrorZ_free(_res_conv);
16690 static inline uintptr_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
16691 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
16692 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
16693 return (uint32_t)ret_conv;
16695 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone_ptr"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint32_t arg) {
16696 LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
16697 uint32_t ret_val = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
16701 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint32_t orig) {
16702 LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1);
16703 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
16704 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
16705 return (uint32_t)ret_conv;
16708 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint32_t o) {
16709 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16710 CHECK_ACCESS(o_ptr);
16711 LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
16712 o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uintptr_t)o) & ~1));
16713 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
16714 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
16715 return (uint32_t)ret_conv;
16718 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint32_t e) {
16719 LDKDecodeError e_conv;
16720 e_conv.inner = (void*)(e & (~1));
16721 e_conv.is_owned = (e & 1) || (e == 0);
16722 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16723 e_conv = DecodeError_clone(&e_conv);
16724 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
16725 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
16726 return (uint32_t)ret_conv;
16729 jboolean __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint32_t o) {
16730 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(o & ~1);
16731 jboolean ret_val = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
16735 void __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint32_t _res) {
16736 if ((_res & 1) != 0) return;
16737 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16738 CHECK_ACCESS(_res_ptr);
16739 LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
16741 CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
16744 static inline uintptr_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
16745 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
16746 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
16747 return (uint32_t)ret_conv;
16749 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint32_t arg) {
16750 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(arg & ~1);
16751 uint32_t ret_val = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
16755 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint32_t orig) {
16756 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(orig & ~1);
16757 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
16758 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
16759 return (uint32_t)ret_conv;
16762 uint32_t __attribute__((export_name("TS_COption_AccessZ_some"))) TS_COption_AccessZ_some(uint32_t o) {
16763 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16764 CHECK_ACCESS(o_ptr);
16765 LDKAccess o_conv = *(LDKAccess*)(o_ptr);
16766 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
16767 *ret_copy = COption_AccessZ_some(o_conv);
16768 uint32_t ret_ref = (uintptr_t)ret_copy;
16772 uint32_t __attribute__((export_name("TS_COption_AccessZ_none"))) TS_COption_AccessZ_none() {
16773 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
16774 *ret_copy = COption_AccessZ_none();
16775 uint32_t ret_ref = (uintptr_t)ret_copy;
16779 void __attribute__((export_name("TS_COption_AccessZ_free"))) TS_COption_AccessZ_free(uint32_t _res) {
16780 if ((_res & 1) != 0) return;
16781 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16782 CHECK_ACCESS(_res_ptr);
16783 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
16785 COption_AccessZ_free(_res_conv);
16788 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok(uint32_t o) {
16789 LDKChannelUpdateInfo o_conv;
16790 o_conv.inner = (void*)(o & (~1));
16791 o_conv.is_owned = (o & 1) || (o == 0);
16792 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16793 o_conv = ChannelUpdateInfo_clone(&o_conv);
16794 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
16795 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
16796 return (uint32_t)ret_conv;
16799 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_err(uint32_t e) {
16800 LDKDecodeError e_conv;
16801 e_conv.inner = (void*)(e & (~1));
16802 e_conv.is_owned = (e & 1) || (e == 0);
16803 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16804 e_conv = DecodeError_clone(&e_conv);
16805 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
16806 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
16807 return (uint32_t)ret_conv;
16810 jboolean __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(uint32_t o) {
16811 LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(o & ~1);
16812 jboolean ret_val = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
16816 void __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_free"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_free(uint32_t _res) {
16817 if ((_res & 1) != 0) return;
16818 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16819 CHECK_ACCESS(_res_ptr);
16820 LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
16822 CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
16825 static inline uintptr_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
16826 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
16827 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
16828 return (uint32_t)ret_conv;
16830 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
16831 LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(arg & ~1);
16832 uint32_t ret_val = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
16836 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone(uint32_t orig) {
16837 LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(orig & ~1);
16838 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
16839 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
16840 return (uint32_t)ret_conv;
16843 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint32_t o) {
16844 LDKChannelInfo o_conv;
16845 o_conv.inner = (void*)(o & (~1));
16846 o_conv.is_owned = (o & 1) || (o == 0);
16847 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16848 o_conv = ChannelInfo_clone(&o_conv);
16849 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
16850 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
16851 return (uint32_t)ret_conv;
16854 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_err"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint32_t e) {
16855 LDKDecodeError e_conv;
16856 e_conv.inner = (void*)(e & (~1));
16857 e_conv.is_owned = (e & 1) || (e == 0);
16858 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16859 e_conv = DecodeError_clone(&e_conv);
16860 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
16861 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
16862 return (uint32_t)ret_conv;
16865 jboolean __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint32_t o) {
16866 LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(o & ~1);
16867 jboolean ret_val = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
16871 void __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_free"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint32_t _res) {
16872 if ((_res & 1) != 0) return;
16873 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16874 CHECK_ACCESS(_res_ptr);
16875 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
16877 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
16880 static inline uintptr_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
16881 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
16882 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
16883 return (uint32_t)ret_conv;
16885 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
16886 LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
16887 uint32_t ret_val = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
16891 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint32_t orig) {
16892 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
16893 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
16894 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
16895 return (uint32_t)ret_conv;
16898 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint32_t o) {
16899 LDKRoutingFees o_conv;
16900 o_conv.inner = (void*)(o & (~1));
16901 o_conv.is_owned = (o & 1) || (o == 0);
16902 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16903 o_conv = RoutingFees_clone(&o_conv);
16904 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
16905 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
16906 return (uint32_t)ret_conv;
16909 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_err"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint32_t e) {
16910 LDKDecodeError e_conv;
16911 e_conv.inner = (void*)(e & (~1));
16912 e_conv.is_owned = (e & 1) || (e == 0);
16913 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16914 e_conv = DecodeError_clone(&e_conv);
16915 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
16916 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
16917 return (uint32_t)ret_conv;
16920 jboolean __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_is_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint32_t o) {
16921 LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(o & ~1);
16922 jboolean ret_val = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
16926 void __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_free"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint32_t _res) {
16927 if ((_res & 1) != 0) return;
16928 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16929 CHECK_ACCESS(_res_ptr);
16930 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
16932 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
16935 static inline uintptr_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
16936 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
16937 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
16938 return (uint32_t)ret_conv;
16940 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint32_t arg) {
16941 LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
16942 uint32_t ret_val = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
16946 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint32_t orig) {
16947 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
16948 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
16949 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
16950 return (uint32_t)ret_conv;
16953 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint32_t o) {
16954 LDKNodeAnnouncementInfo o_conv;
16955 o_conv.inner = (void*)(o & (~1));
16956 o_conv.is_owned = (o & 1) || (o == 0);
16957 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16958 o_conv = NodeAnnouncementInfo_clone(&o_conv);
16959 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
16960 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
16961 return (uint32_t)ret_conv;
16964 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint32_t e) {
16965 LDKDecodeError e_conv;
16966 e_conv.inner = (void*)(e & (~1));
16967 e_conv.is_owned = (e & 1) || (e == 0);
16968 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16969 e_conv = DecodeError_clone(&e_conv);
16970 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
16971 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
16972 return (uint32_t)ret_conv;
16975 jboolean __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint32_t o) {
16976 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(o & ~1);
16977 jboolean ret_val = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
16981 void __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint32_t _res) {
16982 if ((_res & 1) != 0) return;
16983 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16984 CHECK_ACCESS(_res_ptr);
16985 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
16987 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
16990 static inline uintptr_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
16991 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
16992 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
16993 return (uint32_t)ret_conv;
16995 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
16996 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
16997 uint32_t ret_val = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
17001 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint32_t orig) {
17002 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
17003 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
17004 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
17005 return (uint32_t)ret_conv;
17008 void __attribute__((export_name("TS_CVec_u64Z_free"))) TS_CVec_u64Z_free(int64_tArray _res) {
17009 LDKCVec_u64Z _res_constr;
17010 _res_constr.datalen = _res->arr_len;
17011 if (_res_constr.datalen > 0)
17012 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
17014 _res_constr.data = NULL;
17015 int64_t* _res_vals = _res->elems /* XXX _res leaks */;
17016 for (size_t i = 0; i < _res_constr.datalen; i++) {
17017 int64_t _res_conv_8 = _res_vals[i];
17018 _res_constr.data[i] = _res_conv_8;
17020 CVec_u64Z_free(_res_constr);
17023 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_ok"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint32_t o) {
17024 LDKNodeInfo o_conv;
17025 o_conv.inner = (void*)(o & (~1));
17026 o_conv.is_owned = (o & 1) || (o == 0);
17027 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17028 o_conv = NodeInfo_clone(&o_conv);
17029 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
17030 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
17031 return (uint32_t)ret_conv;
17034 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_err"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint32_t e) {
17035 LDKDecodeError e_conv;
17036 e_conv.inner = (void*)(e & (~1));
17037 e_conv.is_owned = (e & 1) || (e == 0);
17038 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17039 e_conv = DecodeError_clone(&e_conv);
17040 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
17041 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
17042 return (uint32_t)ret_conv;
17045 jboolean __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint32_t o) {
17046 LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(o & ~1);
17047 jboolean ret_val = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
17051 void __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_free"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint32_t _res) {
17052 if ((_res & 1) != 0) return;
17053 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17054 CHECK_ACCESS(_res_ptr);
17055 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
17057 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
17060 static inline uintptr_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
17061 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
17062 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
17063 return (uint32_t)ret_conv;
17065 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
17066 LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
17067 uint32_t ret_val = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
17071 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint32_t orig) {
17072 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
17073 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
17074 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
17075 return (uint32_t)ret_conv;
17078 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint32_t o) {
17079 LDKNetworkGraph o_conv;
17080 o_conv.inner = (void*)(o & (~1));
17081 o_conv.is_owned = (o & 1) || (o == 0);
17082 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17083 o_conv = NetworkGraph_clone(&o_conv);
17084 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
17085 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
17086 return (uint32_t)ret_conv;
17089 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_err"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint32_t e) {
17090 LDKDecodeError e_conv;
17091 e_conv.inner = (void*)(e & (~1));
17092 e_conv.is_owned = (e & 1) || (e == 0);
17093 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17094 e_conv = DecodeError_clone(&e_conv);
17095 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
17096 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
17097 return (uint32_t)ret_conv;
17100 jboolean __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_is_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint32_t o) {
17101 LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(o & ~1);
17102 jboolean ret_val = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
17106 void __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_free"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint32_t _res) {
17107 if ((_res & 1) != 0) return;
17108 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17109 CHECK_ACCESS(_res_ptr);
17110 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
17112 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
17115 static inline uintptr_t CResult_NetworkGraphDecodeErrorZ_clone_ptr(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR arg) {
17116 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
17117 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(arg);
17118 return (uint32_t)ret_conv;
17120 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_clone_ptr"))) TS_CResult_NetworkGraphDecodeErrorZ_clone_ptr(uint32_t arg) {
17121 LDKCResult_NetworkGraphDecodeErrorZ* arg_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
17122 uint32_t ret_val = CResult_NetworkGraphDecodeErrorZ_clone_ptr(arg_conv);
17126 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_clone"))) TS_CResult_NetworkGraphDecodeErrorZ_clone(uint32_t orig) {
17127 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
17128 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
17129 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
17130 return (uint32_t)ret_conv;
17133 uint32_t __attribute__((export_name("TS_COption_CVec_NetAddressZZ_some"))) TS_COption_CVec_NetAddressZZ_some(uint32_tArray o) {
17134 LDKCVec_NetAddressZ o_constr;
17135 o_constr.datalen = o->arr_len;
17136 if (o_constr.datalen > 0)
17137 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
17139 o_constr.data = NULL;
17140 uint32_t* o_vals = o->elems /* XXX o leaks */;
17141 for (size_t m = 0; m < o_constr.datalen; m++) {
17142 uint32_t o_conv_12 = o_vals[m];
17143 void* o_conv_12_ptr = (void*)(((uintptr_t)o_conv_12) & ~1);
17144 CHECK_ACCESS(o_conv_12_ptr);
17145 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
17146 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o_conv_12) & ~1));
17147 o_constr.data[m] = o_conv_12_conv;
17149 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
17150 *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
17151 uint32_t ret_ref = (uintptr_t)ret_copy;
17155 uint32_t __attribute__((export_name("TS_COption_CVec_NetAddressZZ_none"))) TS_COption_CVec_NetAddressZZ_none() {
17156 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
17157 *ret_copy = COption_CVec_NetAddressZZ_none();
17158 uint32_t ret_ref = (uintptr_t)ret_copy;
17162 void __attribute__((export_name("TS_COption_CVec_NetAddressZZ_free"))) TS_COption_CVec_NetAddressZZ_free(uint32_t _res) {
17163 if ((_res & 1) != 0) return;
17164 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17165 CHECK_ACCESS(_res_ptr);
17166 LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
17168 COption_CVec_NetAddressZZ_free(_res_conv);
17171 static inline uintptr_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
17172 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
17173 *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
17174 uint32_t ret_ref = (uintptr_t)ret_copy;
17177 uint32_t __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone_ptr"))) TS_COption_CVec_NetAddressZZ_clone_ptr(uint32_t arg) {
17178 LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)arg;
17179 uint32_t ret_val = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
17183 uint32_t __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone"))) TS_COption_CVec_NetAddressZZ_clone(uint32_t orig) {
17184 LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig;
17185 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
17186 *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
17187 uint32_t ret_ref = (uintptr_t)ret_copy;
17191 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_ok"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint32_t o) {
17192 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17193 CHECK_ACCESS(o_ptr);
17194 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
17195 o_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o) & ~1));
17196 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
17197 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
17198 return (uint32_t)ret_conv;
17201 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_err"))) TS_CResult_NetAddressDecodeErrorZ_err(uint32_t e) {
17202 LDKDecodeError e_conv;
17203 e_conv.inner = (void*)(e & (~1));
17204 e_conv.is_owned = (e & 1) || (e == 0);
17205 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17206 e_conv = DecodeError_clone(&e_conv);
17207 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
17208 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
17209 return (uint32_t)ret_conv;
17212 jboolean __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_is_ok"))) TS_CResult_NetAddressDecodeErrorZ_is_ok(uint32_t o) {
17213 LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)(o & ~1);
17214 jboolean ret_val = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
17218 void __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_free"))) TS_CResult_NetAddressDecodeErrorZ_free(uint32_t _res) {
17219 if ((_res & 1) != 0) return;
17220 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17221 CHECK_ACCESS(_res_ptr);
17222 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
17224 CResult_NetAddressDecodeErrorZ_free(_res_conv);
17227 static inline uintptr_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
17228 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
17229 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
17230 return (uint32_t)ret_conv;
17232 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone_ptr"))) TS_CResult_NetAddressDecodeErrorZ_clone_ptr(uint32_t arg) {
17233 LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
17234 uint32_t ret_val = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
17238 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint32_t orig) {
17239 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
17240 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
17241 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
17242 return (uint32_t)ret_conv;
17245 void __attribute__((export_name("TS_CVec_UpdateAddHTLCZ_free"))) TS_CVec_UpdateAddHTLCZ_free(uint32_tArray _res) {
17246 LDKCVec_UpdateAddHTLCZ _res_constr;
17247 _res_constr.datalen = _res->arr_len;
17248 if (_res_constr.datalen > 0)
17249 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
17251 _res_constr.data = NULL;
17252 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
17253 for (size_t p = 0; p < _res_constr.datalen; p++) {
17254 uint32_t _res_conv_15 = _res_vals[p];
17255 LDKUpdateAddHTLC _res_conv_15_conv;
17256 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
17257 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
17258 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
17259 _res_constr.data[p] = _res_conv_15_conv;
17261 CVec_UpdateAddHTLCZ_free(_res_constr);
17264 void __attribute__((export_name("TS_CVec_UpdateFulfillHTLCZ_free"))) TS_CVec_UpdateFulfillHTLCZ_free(uint32_tArray _res) {
17265 LDKCVec_UpdateFulfillHTLCZ _res_constr;
17266 _res_constr.datalen = _res->arr_len;
17267 if (_res_constr.datalen > 0)
17268 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
17270 _res_constr.data = NULL;
17271 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
17272 for (size_t t = 0; t < _res_constr.datalen; t++) {
17273 uint32_t _res_conv_19 = _res_vals[t];
17274 LDKUpdateFulfillHTLC _res_conv_19_conv;
17275 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
17276 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
17277 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
17278 _res_constr.data[t] = _res_conv_19_conv;
17280 CVec_UpdateFulfillHTLCZ_free(_res_constr);
17283 void __attribute__((export_name("TS_CVec_UpdateFailHTLCZ_free"))) TS_CVec_UpdateFailHTLCZ_free(uint32_tArray _res) {
17284 LDKCVec_UpdateFailHTLCZ _res_constr;
17285 _res_constr.datalen = _res->arr_len;
17286 if (_res_constr.datalen > 0)
17287 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
17289 _res_constr.data = NULL;
17290 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
17291 for (size_t q = 0; q < _res_constr.datalen; q++) {
17292 uint32_t _res_conv_16 = _res_vals[q];
17293 LDKUpdateFailHTLC _res_conv_16_conv;
17294 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
17295 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
17296 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
17297 _res_constr.data[q] = _res_conv_16_conv;
17299 CVec_UpdateFailHTLCZ_free(_res_constr);
17302 void __attribute__((export_name("TS_CVec_UpdateFailMalformedHTLCZ_free"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint32_tArray _res) {
17303 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
17304 _res_constr.datalen = _res->arr_len;
17305 if (_res_constr.datalen > 0)
17306 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
17308 _res_constr.data = NULL;
17309 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
17310 for (size_t z = 0; z < _res_constr.datalen; z++) {
17311 uint32_t _res_conv_25 = _res_vals[z];
17312 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
17313 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
17314 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
17315 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
17316 _res_constr.data[z] = _res_conv_25_conv;
17318 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
17321 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint32_t o) {
17322 LDKAcceptChannel o_conv;
17323 o_conv.inner = (void*)(o & (~1));
17324 o_conv.is_owned = (o & 1) || (o == 0);
17325 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17326 o_conv = AcceptChannel_clone(&o_conv);
17327 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
17328 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
17329 return (uint32_t)ret_conv;
17332 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_err"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint32_t e) {
17333 LDKDecodeError e_conv;
17334 e_conv.inner = (void*)(e & (~1));
17335 e_conv.is_owned = (e & 1) || (e == 0);
17336 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17337 e_conv = DecodeError_clone(&e_conv);
17338 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
17339 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
17340 return (uint32_t)ret_conv;
17343 jboolean __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint32_t o) {
17344 LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(o & ~1);
17345 jboolean ret_val = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
17349 void __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_free"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint32_t _res) {
17350 if ((_res & 1) != 0) return;
17351 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17352 CHECK_ACCESS(_res_ptr);
17353 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
17355 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
17358 static inline uintptr_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
17359 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
17360 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
17361 return (uint32_t)ret_conv;
17363 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint32_t arg) {
17364 LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
17365 uint32_t ret_val = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
17369 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint32_t orig) {
17370 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
17371 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
17372 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
17373 return (uint32_t)ret_conv;
17376 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint32_t o) {
17377 LDKAnnouncementSignatures o_conv;
17378 o_conv.inner = (void*)(o & (~1));
17379 o_conv.is_owned = (o & 1) || (o == 0);
17380 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17381 o_conv = AnnouncementSignatures_clone(&o_conv);
17382 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
17383 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
17384 return (uint32_t)ret_conv;
17387 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint32_t e) {
17388 LDKDecodeError e_conv;
17389 e_conv.inner = (void*)(e & (~1));
17390 e_conv.is_owned = (e & 1) || (e == 0);
17391 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17392 e_conv = DecodeError_clone(&e_conv);
17393 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
17394 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
17395 return (uint32_t)ret_conv;
17398 jboolean __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint32_t o) {
17399 LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(o & ~1);
17400 jboolean ret_val = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
17404 void __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_free"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint32_t _res) {
17405 if ((_res & 1) != 0) return;
17406 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17407 CHECK_ACCESS(_res_ptr);
17408 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
17410 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
17413 static inline uintptr_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
17414 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
17415 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
17416 return (uint32_t)ret_conv;
17418 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint32_t arg) {
17419 LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
17420 uint32_t ret_val = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
17424 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint32_t orig) {
17425 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
17426 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
17427 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
17428 return (uint32_t)ret_conv;
17431 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint32_t o) {
17432 LDKChannelReestablish o_conv;
17433 o_conv.inner = (void*)(o & (~1));
17434 o_conv.is_owned = (o & 1) || (o == 0);
17435 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17436 o_conv = ChannelReestablish_clone(&o_conv);
17437 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
17438 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
17439 return (uint32_t)ret_conv;
17442 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint32_t e) {
17443 LDKDecodeError e_conv;
17444 e_conv.inner = (void*)(e & (~1));
17445 e_conv.is_owned = (e & 1) || (e == 0);
17446 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17447 e_conv = DecodeError_clone(&e_conv);
17448 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
17449 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
17450 return (uint32_t)ret_conv;
17453 jboolean __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_is_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint32_t o) {
17454 LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(o & ~1);
17455 jboolean ret_val = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
17459 void __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_free"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint32_t _res) {
17460 if ((_res & 1) != 0) return;
17461 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17462 CHECK_ACCESS(_res_ptr);
17463 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
17465 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
17468 static inline uintptr_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
17469 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
17470 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
17471 return (uint32_t)ret_conv;
17473 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint32_t arg) {
17474 LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
17475 uint32_t ret_val = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
17479 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint32_t orig) {
17480 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
17481 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
17482 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
17483 return (uint32_t)ret_conv;
17486 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint32_t o) {
17487 LDKClosingSigned o_conv;
17488 o_conv.inner = (void*)(o & (~1));
17489 o_conv.is_owned = (o & 1) || (o == 0);
17490 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17491 o_conv = ClosingSigned_clone(&o_conv);
17492 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
17493 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
17494 return (uint32_t)ret_conv;
17497 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_err"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint32_t e) {
17498 LDKDecodeError e_conv;
17499 e_conv.inner = (void*)(e & (~1));
17500 e_conv.is_owned = (e & 1) || (e == 0);
17501 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17502 e_conv = DecodeError_clone(&e_conv);
17503 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
17504 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
17505 return (uint32_t)ret_conv;
17508 jboolean __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint32_t o) {
17509 LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(o & ~1);
17510 jboolean ret_val = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
17514 void __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_free"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint32_t _res) {
17515 if ((_res & 1) != 0) return;
17516 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17517 CHECK_ACCESS(_res_ptr);
17518 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
17520 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
17523 static inline uintptr_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
17524 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
17525 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
17526 return (uint32_t)ret_conv;
17528 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
17529 LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
17530 uint32_t ret_val = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
17534 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint32_t orig) {
17535 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
17536 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
17537 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
17538 return (uint32_t)ret_conv;
17541 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint32_t o) {
17542 LDKClosingSignedFeeRange o_conv;
17543 o_conv.inner = (void*)(o & (~1));
17544 o_conv.is_owned = (o & 1) || (o == 0);
17545 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17546 o_conv = ClosingSignedFeeRange_clone(&o_conv);
17547 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
17548 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
17549 return (uint32_t)ret_conv;
17552 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint32_t e) {
17553 LDKDecodeError e_conv;
17554 e_conv.inner = (void*)(e & (~1));
17555 e_conv.is_owned = (e & 1) || (e == 0);
17556 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17557 e_conv = DecodeError_clone(&e_conv);
17558 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
17559 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
17560 return (uint32_t)ret_conv;
17563 jboolean __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint32_t o) {
17564 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(o & ~1);
17565 jboolean ret_val = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
17569 void __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint32_t _res) {
17570 if ((_res & 1) != 0) return;
17571 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17572 CHECK_ACCESS(_res_ptr);
17573 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
17575 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
17578 static inline uintptr_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
17579 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
17580 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
17581 return (uint32_t)ret_conv;
17583 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
17584 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
17585 uint32_t ret_val = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
17589 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint32_t orig) {
17590 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
17591 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
17592 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
17593 return (uint32_t)ret_conv;
17596 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint32_t o) {
17597 LDKCommitmentSigned o_conv;
17598 o_conv.inner = (void*)(o & (~1));
17599 o_conv.is_owned = (o & 1) || (o == 0);
17600 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17601 o_conv = CommitmentSigned_clone(&o_conv);
17602 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
17603 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
17604 return (uint32_t)ret_conv;
17607 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint32_t e) {
17608 LDKDecodeError e_conv;
17609 e_conv.inner = (void*)(e & (~1));
17610 e_conv.is_owned = (e & 1) || (e == 0);
17611 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17612 e_conv = DecodeError_clone(&e_conv);
17613 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
17614 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
17615 return (uint32_t)ret_conv;
17618 jboolean __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_is_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint32_t o) {
17619 LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(o & ~1);
17620 jboolean ret_val = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
17624 void __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_free"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint32_t _res) {
17625 if ((_res & 1) != 0) return;
17626 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17627 CHECK_ACCESS(_res_ptr);
17628 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
17630 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
17633 static inline uintptr_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
17634 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
17635 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
17636 return (uint32_t)ret_conv;
17638 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
17639 LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
17640 uint32_t ret_val = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
17644 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint32_t orig) {
17645 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
17646 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
17647 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
17648 return (uint32_t)ret_conv;
17651 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint32_t o) {
17652 LDKFundingCreated o_conv;
17653 o_conv.inner = (void*)(o & (~1));
17654 o_conv.is_owned = (o & 1) || (o == 0);
17655 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17656 o_conv = FundingCreated_clone(&o_conv);
17657 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
17658 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
17659 return (uint32_t)ret_conv;
17662 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_err"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint32_t e) {
17663 LDKDecodeError e_conv;
17664 e_conv.inner = (void*)(e & (~1));
17665 e_conv.is_owned = (e & 1) || (e == 0);
17666 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17667 e_conv = DecodeError_clone(&e_conv);
17668 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
17669 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
17670 return (uint32_t)ret_conv;
17673 jboolean __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_is_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint32_t o) {
17674 LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(o & ~1);
17675 jboolean ret_val = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
17679 void __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_free"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint32_t _res) {
17680 if ((_res & 1) != 0) return;
17681 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17682 CHECK_ACCESS(_res_ptr);
17683 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
17685 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
17688 static inline uintptr_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
17689 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
17690 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
17691 return (uint32_t)ret_conv;
17693 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint32_t arg) {
17694 LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
17695 uint32_t ret_val = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
17699 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint32_t orig) {
17700 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
17701 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
17702 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
17703 return (uint32_t)ret_conv;
17706 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_ok"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint32_t o) {
17707 LDKFundingSigned o_conv;
17708 o_conv.inner = (void*)(o & (~1));
17709 o_conv.is_owned = (o & 1) || (o == 0);
17710 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17711 o_conv = FundingSigned_clone(&o_conv);
17712 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
17713 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
17714 return (uint32_t)ret_conv;
17717 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_err"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint32_t e) {
17718 LDKDecodeError e_conv;
17719 e_conv.inner = (void*)(e & (~1));
17720 e_conv.is_owned = (e & 1) || (e == 0);
17721 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17722 e_conv = DecodeError_clone(&e_conv);
17723 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
17724 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
17725 return (uint32_t)ret_conv;
17728 jboolean __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_is_ok"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint32_t o) {
17729 LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(o & ~1);
17730 jboolean ret_val = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
17734 void __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_free"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint32_t _res) {
17735 if ((_res & 1) != 0) return;
17736 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17737 CHECK_ACCESS(_res_ptr);
17738 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
17740 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
17743 static inline uintptr_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
17744 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
17745 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
17746 return (uint32_t)ret_conv;
17748 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
17749 LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
17750 uint32_t ret_val = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
17754 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint32_t orig) {
17755 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
17756 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
17757 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
17758 return (uint32_t)ret_conv;
17761 uint32_t __attribute__((export_name("TS_CResult_FundingLockedDecodeErrorZ_ok"))) TS_CResult_FundingLockedDecodeErrorZ_ok(uint32_t o) {
17762 LDKFundingLocked o_conv;
17763 o_conv.inner = (void*)(o & (~1));
17764 o_conv.is_owned = (o & 1) || (o == 0);
17765 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17766 o_conv = FundingLocked_clone(&o_conv);
17767 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
17768 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
17769 return (uint32_t)ret_conv;
17772 uint32_t __attribute__((export_name("TS_CResult_FundingLockedDecodeErrorZ_err"))) TS_CResult_FundingLockedDecodeErrorZ_err(uint32_t e) {
17773 LDKDecodeError e_conv;
17774 e_conv.inner = (void*)(e & (~1));
17775 e_conv.is_owned = (e & 1) || (e == 0);
17776 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17777 e_conv = DecodeError_clone(&e_conv);
17778 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
17779 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
17780 return (uint32_t)ret_conv;
17783 jboolean __attribute__((export_name("TS_CResult_FundingLockedDecodeErrorZ_is_ok"))) TS_CResult_FundingLockedDecodeErrorZ_is_ok(uint32_t o) {
17784 LDKCResult_FundingLockedDecodeErrorZ* o_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(o & ~1);
17785 jboolean ret_val = CResult_FundingLockedDecodeErrorZ_is_ok(o_conv);
17789 void __attribute__((export_name("TS_CResult_FundingLockedDecodeErrorZ_free"))) TS_CResult_FundingLockedDecodeErrorZ_free(uint32_t _res) {
17790 if ((_res & 1) != 0) return;
17791 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17792 CHECK_ACCESS(_res_ptr);
17793 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(_res_ptr);
17795 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
17798 static inline uintptr_t CResult_FundingLockedDecodeErrorZ_clone_ptr(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR arg) {
17799 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
17800 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(arg);
17801 return (uint32_t)ret_conv;
17803 uint32_t __attribute__((export_name("TS_CResult_FundingLockedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingLockedDecodeErrorZ_clone_ptr(uint32_t arg) {
17804 LDKCResult_FundingLockedDecodeErrorZ* arg_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
17805 uint32_t ret_val = CResult_FundingLockedDecodeErrorZ_clone_ptr(arg_conv);
17809 uint32_t __attribute__((export_name("TS_CResult_FundingLockedDecodeErrorZ_clone"))) TS_CResult_FundingLockedDecodeErrorZ_clone(uint32_t orig) {
17810 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
17811 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
17812 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
17813 return (uint32_t)ret_conv;
17816 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_ok"))) TS_CResult_InitDecodeErrorZ_ok(uint32_t o) {
17818 o_conv.inner = (void*)(o & (~1));
17819 o_conv.is_owned = (o & 1) || (o == 0);
17820 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17821 o_conv = Init_clone(&o_conv);
17822 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
17823 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
17824 return (uint32_t)ret_conv;
17827 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_err"))) TS_CResult_InitDecodeErrorZ_err(uint32_t e) {
17828 LDKDecodeError e_conv;
17829 e_conv.inner = (void*)(e & (~1));
17830 e_conv.is_owned = (e & 1) || (e == 0);
17831 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17832 e_conv = DecodeError_clone(&e_conv);
17833 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
17834 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
17835 return (uint32_t)ret_conv;
17838 jboolean __attribute__((export_name("TS_CResult_InitDecodeErrorZ_is_ok"))) TS_CResult_InitDecodeErrorZ_is_ok(uint32_t o) {
17839 LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)(o & ~1);
17840 jboolean ret_val = CResult_InitDecodeErrorZ_is_ok(o_conv);
17844 void __attribute__((export_name("TS_CResult_InitDecodeErrorZ_free"))) TS_CResult_InitDecodeErrorZ_free(uint32_t _res) {
17845 if ((_res & 1) != 0) return;
17846 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17847 CHECK_ACCESS(_res_ptr);
17848 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
17850 CResult_InitDecodeErrorZ_free(_res_conv);
17853 static inline uintptr_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
17854 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
17855 *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
17856 return (uint32_t)ret_conv;
17858 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone_ptr"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint32_t arg) {
17859 LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
17860 uint32_t ret_val = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
17864 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone"))) TS_CResult_InitDecodeErrorZ_clone(uint32_t orig) {
17865 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
17866 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
17867 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
17868 return (uint32_t)ret_conv;
17871 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_ok"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint32_t o) {
17872 LDKOpenChannel o_conv;
17873 o_conv.inner = (void*)(o & (~1));
17874 o_conv.is_owned = (o & 1) || (o == 0);
17875 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17876 o_conv = OpenChannel_clone(&o_conv);
17877 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
17878 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
17879 return (uint32_t)ret_conv;
17882 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_err"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint32_t e) {
17883 LDKDecodeError e_conv;
17884 e_conv.inner = (void*)(e & (~1));
17885 e_conv.is_owned = (e & 1) || (e == 0);
17886 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17887 e_conv = DecodeError_clone(&e_conv);
17888 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
17889 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
17890 return (uint32_t)ret_conv;
17893 jboolean __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_is_ok"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint32_t o) {
17894 LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(o & ~1);
17895 jboolean ret_val = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
17899 void __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_free"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint32_t _res) {
17900 if ((_res & 1) != 0) return;
17901 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17902 CHECK_ACCESS(_res_ptr);
17903 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
17905 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
17908 static inline uintptr_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
17909 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
17910 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
17911 return (uint32_t)ret_conv;
17913 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint32_t arg) {
17914 LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
17915 uint32_t ret_val = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
17919 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint32_t orig) {
17920 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
17921 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
17922 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
17923 return (uint32_t)ret_conv;
17926 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint32_t o) {
17927 LDKRevokeAndACK o_conv;
17928 o_conv.inner = (void*)(o & (~1));
17929 o_conv.is_owned = (o & 1) || (o == 0);
17930 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17931 o_conv = RevokeAndACK_clone(&o_conv);
17932 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
17933 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
17934 return (uint32_t)ret_conv;
17937 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint32_t e) {
17938 LDKDecodeError e_conv;
17939 e_conv.inner = (void*)(e & (~1));
17940 e_conv.is_owned = (e & 1) || (e == 0);
17941 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17942 e_conv = DecodeError_clone(&e_conv);
17943 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
17944 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
17945 return (uint32_t)ret_conv;
17948 jboolean __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_is_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint32_t o) {
17949 LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(o & ~1);
17950 jboolean ret_val = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
17954 void __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_free"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint32_t _res) {
17955 if ((_res & 1) != 0) return;
17956 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17957 CHECK_ACCESS(_res_ptr);
17958 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
17960 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
17963 static inline uintptr_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
17964 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
17965 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
17966 return (uint32_t)ret_conv;
17968 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint32_t arg) {
17969 LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
17970 uint32_t ret_val = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
17974 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint32_t orig) {
17975 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
17976 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
17977 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
17978 return (uint32_t)ret_conv;
17981 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_ok"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint32_t o) {
17982 LDKShutdown o_conv;
17983 o_conv.inner = (void*)(o & (~1));
17984 o_conv.is_owned = (o & 1) || (o == 0);
17985 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17986 o_conv = Shutdown_clone(&o_conv);
17987 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
17988 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
17989 return (uint32_t)ret_conv;
17992 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_err"))) TS_CResult_ShutdownDecodeErrorZ_err(uint32_t e) {
17993 LDKDecodeError e_conv;
17994 e_conv.inner = (void*)(e & (~1));
17995 e_conv.is_owned = (e & 1) || (e == 0);
17996 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17997 e_conv = DecodeError_clone(&e_conv);
17998 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
17999 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
18000 return (uint32_t)ret_conv;
18003 jboolean __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_is_ok"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint32_t o) {
18004 LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)(o & ~1);
18005 jboolean ret_val = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
18009 void __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_free"))) TS_CResult_ShutdownDecodeErrorZ_free(uint32_t _res) {
18010 if ((_res & 1) != 0) return;
18011 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18012 CHECK_ACCESS(_res_ptr);
18013 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
18015 CResult_ShutdownDecodeErrorZ_free(_res_conv);
18018 static inline uintptr_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
18019 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
18020 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
18021 return (uint32_t)ret_conv;
18023 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint32_t arg) {
18024 LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
18025 uint32_t ret_val = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
18029 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint32_t orig) {
18030 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
18031 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
18032 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
18033 return (uint32_t)ret_conv;
18036 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint32_t o) {
18037 LDKUpdateFailHTLC o_conv;
18038 o_conv.inner = (void*)(o & (~1));
18039 o_conv.is_owned = (o & 1) || (o == 0);
18040 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18041 o_conv = UpdateFailHTLC_clone(&o_conv);
18042 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
18043 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
18044 return (uint32_t)ret_conv;
18047 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint32_t e) {
18048 LDKDecodeError e_conv;
18049 e_conv.inner = (void*)(e & (~1));
18050 e_conv.is_owned = (e & 1) || (e == 0);
18051 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18052 e_conv = DecodeError_clone(&e_conv);
18053 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
18054 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
18055 return (uint32_t)ret_conv;
18058 jboolean __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint32_t o) {
18059 LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(o & ~1);
18060 jboolean ret_val = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
18064 void __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint32_t _res) {
18065 if ((_res & 1) != 0) return;
18066 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18067 CHECK_ACCESS(_res_ptr);
18068 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
18070 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
18073 static inline uintptr_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
18074 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
18075 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
18076 return (uint32_t)ret_conv;
18078 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
18079 LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
18080 uint32_t ret_val = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
18084 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint32_t orig) {
18085 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
18086 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
18087 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
18088 return (uint32_t)ret_conv;
18091 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint32_t o) {
18092 LDKUpdateFailMalformedHTLC o_conv;
18093 o_conv.inner = (void*)(o & (~1));
18094 o_conv.is_owned = (o & 1) || (o == 0);
18095 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18096 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
18097 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
18098 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
18099 return (uint32_t)ret_conv;
18102 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint32_t e) {
18103 LDKDecodeError e_conv;
18104 e_conv.inner = (void*)(e & (~1));
18105 e_conv.is_owned = (e & 1) || (e == 0);
18106 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18107 e_conv = DecodeError_clone(&e_conv);
18108 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
18109 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
18110 return (uint32_t)ret_conv;
18113 jboolean __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint32_t o) {
18114 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(o & ~1);
18115 jboolean ret_val = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
18119 void __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint32_t _res) {
18120 if ((_res & 1) != 0) return;
18121 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18122 CHECK_ACCESS(_res_ptr);
18123 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
18125 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
18128 static inline uintptr_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
18129 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
18130 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
18131 return (uint32_t)ret_conv;
18133 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
18134 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
18135 uint32_t ret_val = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
18139 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint32_t orig) {
18140 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
18141 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
18142 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
18143 return (uint32_t)ret_conv;
18146 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint32_t o) {
18147 LDKUpdateFee o_conv;
18148 o_conv.inner = (void*)(o & (~1));
18149 o_conv.is_owned = (o & 1) || (o == 0);
18150 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18151 o_conv = UpdateFee_clone(&o_conv);
18152 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18153 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
18154 return (uint32_t)ret_conv;
18157 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_err"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint32_t e) {
18158 LDKDecodeError e_conv;
18159 e_conv.inner = (void*)(e & (~1));
18160 e_conv.is_owned = (e & 1) || (e == 0);
18161 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18162 e_conv = DecodeError_clone(&e_conv);
18163 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18164 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
18165 return (uint32_t)ret_conv;
18168 jboolean __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_is_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint32_t o) {
18169 LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(o & ~1);
18170 jboolean ret_val = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
18174 void __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_free"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint32_t _res) {
18175 if ((_res & 1) != 0) return;
18176 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18177 CHECK_ACCESS(_res_ptr);
18178 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
18180 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
18183 static inline uintptr_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
18184 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18185 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
18186 return (uint32_t)ret_conv;
18188 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint32_t arg) {
18189 LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
18190 uint32_t ret_val = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
18194 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint32_t orig) {
18195 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
18196 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18197 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
18198 return (uint32_t)ret_conv;
18201 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint32_t o) {
18202 LDKUpdateFulfillHTLC o_conv;
18203 o_conv.inner = (void*)(o & (~1));
18204 o_conv.is_owned = (o & 1) || (o == 0);
18205 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18206 o_conv = UpdateFulfillHTLC_clone(&o_conv);
18207 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18208 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
18209 return (uint32_t)ret_conv;
18212 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint32_t e) {
18213 LDKDecodeError e_conv;
18214 e_conv.inner = (void*)(e & (~1));
18215 e_conv.is_owned = (e & 1) || (e == 0);
18216 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18217 e_conv = DecodeError_clone(&e_conv);
18218 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18219 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
18220 return (uint32_t)ret_conv;
18223 jboolean __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint32_t o) {
18224 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(o & ~1);
18225 jboolean ret_val = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
18229 void __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint32_t _res) {
18230 if ((_res & 1) != 0) return;
18231 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18232 CHECK_ACCESS(_res_ptr);
18233 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
18235 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
18238 static inline uintptr_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
18239 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18240 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
18241 return (uint32_t)ret_conv;
18243 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
18244 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
18245 uint32_t ret_val = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
18249 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint32_t orig) {
18250 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
18251 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18252 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
18253 return (uint32_t)ret_conv;
18256 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint32_t o) {
18257 LDKUpdateAddHTLC o_conv;
18258 o_conv.inner = (void*)(o & (~1));
18259 o_conv.is_owned = (o & 1) || (o == 0);
18260 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18261 o_conv = UpdateAddHTLC_clone(&o_conv);
18262 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
18263 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
18264 return (uint32_t)ret_conv;
18267 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint32_t e) {
18268 LDKDecodeError e_conv;
18269 e_conv.inner = (void*)(e & (~1));
18270 e_conv.is_owned = (e & 1) || (e == 0);
18271 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18272 e_conv = DecodeError_clone(&e_conv);
18273 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
18274 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
18275 return (uint32_t)ret_conv;
18278 jboolean __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint32_t o) {
18279 LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(o & ~1);
18280 jboolean ret_val = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
18284 void __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_free"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint32_t _res) {
18285 if ((_res & 1) != 0) return;
18286 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18287 CHECK_ACCESS(_res_ptr);
18288 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
18290 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
18293 static inline uintptr_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
18294 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
18295 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
18296 return (uint32_t)ret_conv;
18298 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
18299 LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
18300 uint32_t ret_val = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
18304 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint32_t orig) {
18305 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
18306 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
18307 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
18308 return (uint32_t)ret_conv;
18311 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_ok"))) TS_CResult_PingDecodeErrorZ_ok(uint32_t o) {
18313 o_conv.inner = (void*)(o & (~1));
18314 o_conv.is_owned = (o & 1) || (o == 0);
18315 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18316 o_conv = Ping_clone(&o_conv);
18317 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
18318 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
18319 return (uint32_t)ret_conv;
18322 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_err"))) TS_CResult_PingDecodeErrorZ_err(uint32_t e) {
18323 LDKDecodeError e_conv;
18324 e_conv.inner = (void*)(e & (~1));
18325 e_conv.is_owned = (e & 1) || (e == 0);
18326 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18327 e_conv = DecodeError_clone(&e_conv);
18328 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
18329 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
18330 return (uint32_t)ret_conv;
18333 jboolean __attribute__((export_name("TS_CResult_PingDecodeErrorZ_is_ok"))) TS_CResult_PingDecodeErrorZ_is_ok(uint32_t o) {
18334 LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)(o & ~1);
18335 jboolean ret_val = CResult_PingDecodeErrorZ_is_ok(o_conv);
18339 void __attribute__((export_name("TS_CResult_PingDecodeErrorZ_free"))) TS_CResult_PingDecodeErrorZ_free(uint32_t _res) {
18340 if ((_res & 1) != 0) return;
18341 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18342 CHECK_ACCESS(_res_ptr);
18343 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
18345 CResult_PingDecodeErrorZ_free(_res_conv);
18348 static inline uintptr_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
18349 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
18350 *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
18351 return (uint32_t)ret_conv;
18353 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone_ptr"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint32_t arg) {
18354 LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
18355 uint32_t ret_val = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
18359 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone"))) TS_CResult_PingDecodeErrorZ_clone(uint32_t orig) {
18360 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
18361 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
18362 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
18363 return (uint32_t)ret_conv;
18366 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_ok"))) TS_CResult_PongDecodeErrorZ_ok(uint32_t o) {
18368 o_conv.inner = (void*)(o & (~1));
18369 o_conv.is_owned = (o & 1) || (o == 0);
18370 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18371 o_conv = Pong_clone(&o_conv);
18372 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
18373 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
18374 return (uint32_t)ret_conv;
18377 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_err"))) TS_CResult_PongDecodeErrorZ_err(uint32_t e) {
18378 LDKDecodeError e_conv;
18379 e_conv.inner = (void*)(e & (~1));
18380 e_conv.is_owned = (e & 1) || (e == 0);
18381 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18382 e_conv = DecodeError_clone(&e_conv);
18383 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
18384 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
18385 return (uint32_t)ret_conv;
18388 jboolean __attribute__((export_name("TS_CResult_PongDecodeErrorZ_is_ok"))) TS_CResult_PongDecodeErrorZ_is_ok(uint32_t o) {
18389 LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)(o & ~1);
18390 jboolean ret_val = CResult_PongDecodeErrorZ_is_ok(o_conv);
18394 void __attribute__((export_name("TS_CResult_PongDecodeErrorZ_free"))) TS_CResult_PongDecodeErrorZ_free(uint32_t _res) {
18395 if ((_res & 1) != 0) return;
18396 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18397 CHECK_ACCESS(_res_ptr);
18398 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
18400 CResult_PongDecodeErrorZ_free(_res_conv);
18403 static inline uintptr_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
18404 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
18405 *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
18406 return (uint32_t)ret_conv;
18408 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone_ptr"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint32_t arg) {
18409 LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
18410 uint32_t ret_val = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
18414 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone"))) TS_CResult_PongDecodeErrorZ_clone(uint32_t orig) {
18415 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
18416 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
18417 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
18418 return (uint32_t)ret_conv;
18421 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
18422 LDKUnsignedChannelAnnouncement o_conv;
18423 o_conv.inner = (void*)(o & (~1));
18424 o_conv.is_owned = (o & 1) || (o == 0);
18425 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18426 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
18427 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
18428 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
18429 return (uint32_t)ret_conv;
18432 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
18433 LDKDecodeError e_conv;
18434 e_conv.inner = (void*)(e & (~1));
18435 e_conv.is_owned = (e & 1) || (e == 0);
18436 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18437 e_conv = DecodeError_clone(&e_conv);
18438 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
18439 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
18440 return (uint32_t)ret_conv;
18443 jboolean __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
18444 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(o & ~1);
18445 jboolean ret_val = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
18449 void __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
18450 if ((_res & 1) != 0) return;
18451 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18452 CHECK_ACCESS(_res_ptr);
18453 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
18455 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
18458 static inline uintptr_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
18459 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
18460 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
18461 return (uint32_t)ret_conv;
18463 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
18464 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
18465 uint32_t ret_val = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
18469 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
18470 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
18471 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
18472 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
18473 return (uint32_t)ret_conv;
18476 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
18477 LDKChannelAnnouncement o_conv;
18478 o_conv.inner = (void*)(o & (~1));
18479 o_conv.is_owned = (o & 1) || (o == 0);
18480 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18481 o_conv = ChannelAnnouncement_clone(&o_conv);
18482 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
18483 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
18484 return (uint32_t)ret_conv;
18487 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
18488 LDKDecodeError e_conv;
18489 e_conv.inner = (void*)(e & (~1));
18490 e_conv.is_owned = (e & 1) || (e == 0);
18491 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18492 e_conv = DecodeError_clone(&e_conv);
18493 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
18494 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
18495 return (uint32_t)ret_conv;
18498 jboolean __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
18499 LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(o & ~1);
18500 jboolean ret_val = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
18504 void __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
18505 if ((_res & 1) != 0) return;
18506 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18507 CHECK_ACCESS(_res_ptr);
18508 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
18510 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
18513 static inline uintptr_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
18514 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
18515 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
18516 return (uint32_t)ret_conv;
18518 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
18519 LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
18520 uint32_t ret_val = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
18524 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
18525 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
18526 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
18527 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
18528 return (uint32_t)ret_conv;
18531 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint32_t o) {
18532 LDKUnsignedChannelUpdate o_conv;
18533 o_conv.inner = (void*)(o & (~1));
18534 o_conv.is_owned = (o & 1) || (o == 0);
18535 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18536 o_conv = UnsignedChannelUpdate_clone(&o_conv);
18537 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
18538 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
18539 return (uint32_t)ret_conv;
18542 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint32_t e) {
18543 LDKDecodeError e_conv;
18544 e_conv.inner = (void*)(e & (~1));
18545 e_conv.is_owned = (e & 1) || (e == 0);
18546 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18547 e_conv = DecodeError_clone(&e_conv);
18548 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
18549 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
18550 return (uint32_t)ret_conv;
18553 jboolean __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint32_t o) {
18554 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(o & ~1);
18555 jboolean ret_val = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
18559 void __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint32_t _res) {
18560 if ((_res & 1) != 0) return;
18561 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18562 CHECK_ACCESS(_res_ptr);
18563 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
18565 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
18568 static inline uintptr_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
18569 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
18570 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
18571 return (uint32_t)ret_conv;
18573 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
18574 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
18575 uint32_t ret_val = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
18579 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
18580 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
18581 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
18582 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
18583 return (uint32_t)ret_conv;
18586 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint32_t o) {
18587 LDKChannelUpdate o_conv;
18588 o_conv.inner = (void*)(o & (~1));
18589 o_conv.is_owned = (o & 1) || (o == 0);
18590 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18591 o_conv = ChannelUpdate_clone(&o_conv);
18592 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
18593 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
18594 return (uint32_t)ret_conv;
18597 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint32_t e) {
18598 LDKDecodeError e_conv;
18599 e_conv.inner = (void*)(e & (~1));
18600 e_conv.is_owned = (e & 1) || (e == 0);
18601 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18602 e_conv = DecodeError_clone(&e_conv);
18603 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
18604 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
18605 return (uint32_t)ret_conv;
18608 jboolean __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint32_t o) {
18609 LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(o & ~1);
18610 jboolean ret_val = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
18614 void __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_free"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint32_t _res) {
18615 if ((_res & 1) != 0) return;
18616 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18617 CHECK_ACCESS(_res_ptr);
18618 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
18620 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
18623 static inline uintptr_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
18624 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
18625 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
18626 return (uint32_t)ret_conv;
18628 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
18629 LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
18630 uint32_t ret_val = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
18634 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
18635 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
18636 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
18637 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
18638 return (uint32_t)ret_conv;
18641 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint32_t o) {
18642 LDKErrorMessage o_conv;
18643 o_conv.inner = (void*)(o & (~1));
18644 o_conv.is_owned = (o & 1) || (o == 0);
18645 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18646 o_conv = ErrorMessage_clone(&o_conv);
18647 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
18648 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
18649 return (uint32_t)ret_conv;
18652 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_err"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint32_t e) {
18653 LDKDecodeError e_conv;
18654 e_conv.inner = (void*)(e & (~1));
18655 e_conv.is_owned = (e & 1) || (e == 0);
18656 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18657 e_conv = DecodeError_clone(&e_conv);
18658 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
18659 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
18660 return (uint32_t)ret_conv;
18663 jboolean __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_is_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint32_t o) {
18664 LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(o & ~1);
18665 jboolean ret_val = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
18669 void __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_free"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint32_t _res) {
18670 if ((_res & 1) != 0) return;
18671 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18672 CHECK_ACCESS(_res_ptr);
18673 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
18675 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
18678 static inline uintptr_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
18679 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
18680 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
18681 return (uint32_t)ret_conv;
18683 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint32_t arg) {
18684 LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
18685 uint32_t ret_val = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
18689 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint32_t orig) {
18690 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
18691 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
18692 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
18693 return (uint32_t)ret_conv;
18696 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_ok"))) TS_CResult_WarningMessageDecodeErrorZ_ok(uint32_t o) {
18697 LDKWarningMessage o_conv;
18698 o_conv.inner = (void*)(o & (~1));
18699 o_conv.is_owned = (o & 1) || (o == 0);
18700 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18701 o_conv = WarningMessage_clone(&o_conv);
18702 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
18703 *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
18704 return (uint32_t)ret_conv;
18707 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_err"))) TS_CResult_WarningMessageDecodeErrorZ_err(uint32_t e) {
18708 LDKDecodeError e_conv;
18709 e_conv.inner = (void*)(e & (~1));
18710 e_conv.is_owned = (e & 1) || (e == 0);
18711 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18712 e_conv = DecodeError_clone(&e_conv);
18713 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
18714 *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
18715 return (uint32_t)ret_conv;
18718 jboolean __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_is_ok"))) TS_CResult_WarningMessageDecodeErrorZ_is_ok(uint32_t o) {
18719 LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(o & ~1);
18720 jboolean ret_val = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
18724 void __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_free"))) TS_CResult_WarningMessageDecodeErrorZ_free(uint32_t _res) {
18725 if ((_res & 1) != 0) return;
18726 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18727 CHECK_ACCESS(_res_ptr);
18728 LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
18730 CResult_WarningMessageDecodeErrorZ_free(_res_conv);
18733 static inline uintptr_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
18734 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
18735 *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
18736 return (uint32_t)ret_conv;
18738 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone_ptr"))) TS_CResult_WarningMessageDecodeErrorZ_clone_ptr(uint32_t arg) {
18739 LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(arg & ~1);
18740 uint32_t ret_val = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
18744 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone"))) TS_CResult_WarningMessageDecodeErrorZ_clone(uint32_t orig) {
18745 LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(orig & ~1);
18746 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
18747 *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
18748 return (uint32_t)ret_conv;
18751 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
18752 LDKUnsignedNodeAnnouncement o_conv;
18753 o_conv.inner = (void*)(o & (~1));
18754 o_conv.is_owned = (o & 1) || (o == 0);
18755 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18756 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
18757 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
18758 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
18759 return (uint32_t)ret_conv;
18762 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint32_t e) {
18763 LDKDecodeError e_conv;
18764 e_conv.inner = (void*)(e & (~1));
18765 e_conv.is_owned = (e & 1) || (e == 0);
18766 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18767 e_conv = DecodeError_clone(&e_conv);
18768 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
18769 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
18770 return (uint32_t)ret_conv;
18773 jboolean __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
18774 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(o & ~1);
18775 jboolean ret_val = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
18779 void __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
18780 if ((_res & 1) != 0) return;
18781 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18782 CHECK_ACCESS(_res_ptr);
18783 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
18785 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
18788 static inline uintptr_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
18789 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
18790 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
18791 return (uint32_t)ret_conv;
18793 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
18794 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
18795 uint32_t ret_val = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
18799 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
18800 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
18801 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
18802 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
18803 return (uint32_t)ret_conv;
18806 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
18807 LDKNodeAnnouncement o_conv;
18808 o_conv.inner = (void*)(o & (~1));
18809 o_conv.is_owned = (o & 1) || (o == 0);
18810 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18811 o_conv = NodeAnnouncement_clone(&o_conv);
18812 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
18813 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
18814 return (uint32_t)ret_conv;
18817 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint32_t e) {
18818 LDKDecodeError e_conv;
18819 e_conv.inner = (void*)(e & (~1));
18820 e_conv.is_owned = (e & 1) || (e == 0);
18821 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18822 e_conv = DecodeError_clone(&e_conv);
18823 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
18824 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
18825 return (uint32_t)ret_conv;
18828 jboolean __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
18829 LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(o & ~1);
18830 jboolean ret_val = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
18834 void __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
18835 if ((_res & 1) != 0) return;
18836 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18837 CHECK_ACCESS(_res_ptr);
18838 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
18840 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
18843 static inline uintptr_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
18844 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
18845 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
18846 return (uint32_t)ret_conv;
18848 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
18849 LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
18850 uint32_t ret_val = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
18854 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
18855 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
18856 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
18857 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
18858 return (uint32_t)ret_conv;
18861 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint32_t o) {
18862 LDKQueryShortChannelIds o_conv;
18863 o_conv.inner = (void*)(o & (~1));
18864 o_conv.is_owned = (o & 1) || (o == 0);
18865 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18866 o_conv = QueryShortChannelIds_clone(&o_conv);
18867 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
18868 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
18869 return (uint32_t)ret_conv;
18872 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint32_t e) {
18873 LDKDecodeError e_conv;
18874 e_conv.inner = (void*)(e & (~1));
18875 e_conv.is_owned = (e & 1) || (e == 0);
18876 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18877 e_conv = DecodeError_clone(&e_conv);
18878 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
18879 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
18880 return (uint32_t)ret_conv;
18883 jboolean __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint32_t o) {
18884 LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(o & ~1);
18885 jboolean ret_val = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
18889 void __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_free"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint32_t _res) {
18890 if ((_res & 1) != 0) return;
18891 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18892 CHECK_ACCESS(_res_ptr);
18893 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
18895 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
18898 static inline uintptr_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
18899 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
18900 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
18901 return (uint32_t)ret_conv;
18903 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint32_t arg) {
18904 LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
18905 uint32_t ret_val = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
18909 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint32_t orig) {
18910 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
18911 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
18912 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
18913 return (uint32_t)ret_conv;
18916 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint32_t o) {
18917 LDKReplyShortChannelIdsEnd o_conv;
18918 o_conv.inner = (void*)(o & (~1));
18919 o_conv.is_owned = (o & 1) || (o == 0);
18920 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18921 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
18922 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
18923 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
18924 return (uint32_t)ret_conv;
18927 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint32_t e) {
18928 LDKDecodeError e_conv;
18929 e_conv.inner = (void*)(e & (~1));
18930 e_conv.is_owned = (e & 1) || (e == 0);
18931 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18932 e_conv = DecodeError_clone(&e_conv);
18933 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
18934 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
18935 return (uint32_t)ret_conv;
18938 jboolean __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint32_t o) {
18939 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(o & ~1);
18940 jboolean ret_val = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
18944 void __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint32_t _res) {
18945 if ((_res & 1) != 0) return;
18946 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18947 CHECK_ACCESS(_res_ptr);
18948 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
18950 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
18953 static inline uintptr_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
18954 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
18955 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
18956 return (uint32_t)ret_conv;
18958 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint32_t arg) {
18959 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
18960 uint32_t ret_val = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
18964 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint32_t orig) {
18965 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
18966 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
18967 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
18968 return (uint32_t)ret_conv;
18971 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint32_t o) {
18972 LDKQueryChannelRange o_conv;
18973 o_conv.inner = (void*)(o & (~1));
18974 o_conv.is_owned = (o & 1) || (o == 0);
18975 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18976 o_conv = QueryChannelRange_clone(&o_conv);
18977 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
18978 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
18979 return (uint32_t)ret_conv;
18982 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint32_t e) {
18983 LDKDecodeError e_conv;
18984 e_conv.inner = (void*)(e & (~1));
18985 e_conv.is_owned = (e & 1) || (e == 0);
18986 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18987 e_conv = DecodeError_clone(&e_conv);
18988 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
18989 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
18990 return (uint32_t)ret_conv;
18993 jboolean __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint32_t o) {
18994 LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(o & ~1);
18995 jboolean ret_val = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
18999 void __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_free"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint32_t _res) {
19000 if ((_res & 1) != 0) return;
19001 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19002 CHECK_ACCESS(_res_ptr);
19003 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
19005 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
19008 static inline uintptr_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
19009 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
19010 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
19011 return (uint32_t)ret_conv;
19013 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
19014 LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
19015 uint32_t ret_val = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
19019 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint32_t orig) {
19020 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
19021 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
19022 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
19023 return (uint32_t)ret_conv;
19026 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint32_t o) {
19027 LDKReplyChannelRange o_conv;
19028 o_conv.inner = (void*)(o & (~1));
19029 o_conv.is_owned = (o & 1) || (o == 0);
19030 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19031 o_conv = ReplyChannelRange_clone(&o_conv);
19032 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
19033 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
19034 return (uint32_t)ret_conv;
19037 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint32_t e) {
19038 LDKDecodeError e_conv;
19039 e_conv.inner = (void*)(e & (~1));
19040 e_conv.is_owned = (e & 1) || (e == 0);
19041 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19042 e_conv = DecodeError_clone(&e_conv);
19043 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
19044 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
19045 return (uint32_t)ret_conv;
19048 jboolean __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint32_t o) {
19049 LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(o & ~1);
19050 jboolean ret_val = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
19054 void __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_free"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint32_t _res) {
19055 if ((_res & 1) != 0) return;
19056 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19057 CHECK_ACCESS(_res_ptr);
19058 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
19060 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
19063 static inline uintptr_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
19064 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
19065 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
19066 return (uint32_t)ret_conv;
19068 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
19069 LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
19070 uint32_t ret_val = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
19074 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint32_t orig) {
19075 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
19076 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
19077 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
19078 return (uint32_t)ret_conv;
19081 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint32_t o) {
19082 LDKGossipTimestampFilter o_conv;
19083 o_conv.inner = (void*)(o & (~1));
19084 o_conv.is_owned = (o & 1) || (o == 0);
19085 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19086 o_conv = GossipTimestampFilter_clone(&o_conv);
19087 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
19088 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
19089 return (uint32_t)ret_conv;
19092 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint32_t e) {
19093 LDKDecodeError e_conv;
19094 e_conv.inner = (void*)(e & (~1));
19095 e_conv.is_owned = (e & 1) || (e == 0);
19096 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19097 e_conv = DecodeError_clone(&e_conv);
19098 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
19099 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
19100 return (uint32_t)ret_conv;
19103 jboolean __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint32_t o) {
19104 LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(o & ~1);
19105 jboolean ret_val = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
19109 void __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_free"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint32_t _res) {
19110 if ((_res & 1) != 0) return;
19111 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19112 CHECK_ACCESS(_res_ptr);
19113 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
19115 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
19118 static inline uintptr_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
19119 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
19120 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
19121 return (uint32_t)ret_conv;
19123 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint32_t arg) {
19124 LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
19125 uint32_t ret_val = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
19129 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint32_t orig) {
19130 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
19131 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
19132 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
19133 return (uint32_t)ret_conv;
19136 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint32_t o) {
19138 o_conv.inner = (void*)(o & (~1));
19139 o_conv.is_owned = (o & 1) || (o == 0);
19140 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19141 o_conv = Invoice_clone(&o_conv);
19142 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
19143 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
19144 return (uint32_t)ret_conv;
19147 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint32_t e) {
19148 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
19149 CHECK_ACCESS(e_ptr);
19150 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
19151 e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uintptr_t)e) & ~1));
19152 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
19153 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
19154 return (uint32_t)ret_conv;
19157 jboolean __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_is_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_is_ok(uint32_t o) {
19158 LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(o & ~1);
19159 jboolean ret_val = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
19163 void __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_free"))) TS_CResult_InvoiceSignOrCreationErrorZ_free(uint32_t _res) {
19164 if ((_res & 1) != 0) return;
19165 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19166 CHECK_ACCESS(_res_ptr);
19167 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
19169 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
19172 static inline uintptr_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
19173 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
19174 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
19175 return (uint32_t)ret_conv;
19177 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr(uint32_t arg) {
19178 LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
19179 uint32_t ret_val = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
19183 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone(uint32_t orig) {
19184 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
19185 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
19186 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
19187 return (uint32_t)ret_conv;
19190 uint32_t __attribute__((export_name("TS_COption_FilterZ_some"))) TS_COption_FilterZ_some(uint32_t o) {
19191 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
19192 CHECK_ACCESS(o_ptr);
19193 LDKFilter o_conv = *(LDKFilter*)(o_ptr);
19194 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
19195 *ret_copy = COption_FilterZ_some(o_conv);
19196 uint32_t ret_ref = (uintptr_t)ret_copy;
19200 uint32_t __attribute__((export_name("TS_COption_FilterZ_none"))) TS_COption_FilterZ_none() {
19201 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
19202 *ret_copy = COption_FilterZ_none();
19203 uint32_t ret_ref = (uintptr_t)ret_copy;
19207 void __attribute__((export_name("TS_COption_FilterZ_free"))) TS_COption_FilterZ_free(uint32_t _res) {
19208 if ((_res & 1) != 0) return;
19209 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19210 CHECK_ACCESS(_res_ptr);
19211 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
19213 COption_FilterZ_free(_res_conv);
19216 uint32_t __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_ok"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint32_t o) {
19217 LDKLockedChannelMonitor o_conv;
19218 o_conv.inner = (void*)(o & (~1));
19219 o_conv.is_owned = (o & 1) || (o == 0);
19220 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19221 // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
19222 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
19223 *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
19224 return (uint32_t)ret_conv;
19227 uint32_t __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_err"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
19228 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
19229 *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
19230 return (uint32_t)ret_conv;
19233 jboolean __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_is_ok"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint32_t o) {
19234 LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(o & ~1);
19235 jboolean ret_val = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
19239 void __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_free"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint32_t _res) {
19240 if ((_res & 1) != 0) return;
19241 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19242 CHECK_ACCESS(_res_ptr);
19243 LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
19245 CResult_LockedChannelMonitorNoneZ_free(_res_conv);
19248 void __attribute__((export_name("TS_CVec_OutPointZ_free"))) TS_CVec_OutPointZ_free(uint32_tArray _res) {
19249 LDKCVec_OutPointZ _res_constr;
19250 _res_constr.datalen = _res->arr_len;
19251 if (_res_constr.datalen > 0)
19252 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
19254 _res_constr.data = NULL;
19255 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
19256 for (size_t k = 0; k < _res_constr.datalen; k++) {
19257 uint32_t _res_conv_10 = _res_vals[k];
19258 LDKOutPoint _res_conv_10_conv;
19259 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
19260 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
19261 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
19262 _res_constr.data[k] = _res_conv_10_conv;
19264 CVec_OutPointZ_free(_res_constr);
19267 void __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint32_t this_ptr) {
19268 if ((this_ptr & 1) != 0) return;
19269 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
19270 CHECK_ACCESS(this_ptr_ptr);
19271 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
19272 FREE((void*)this_ptr);
19273 PaymentPurpose_free(this_ptr_conv);
19276 static inline uintptr_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
19277 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
19278 *ret_copy = PaymentPurpose_clone(arg);
19279 uint32_t ret_ref = (uintptr_t)ret_copy;
19282 uint32_t __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint32_t arg) {
19283 LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)arg;
19284 uint32_t ret_val = PaymentPurpose_clone_ptr(arg_conv);
19288 uint32_t __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint32_t orig) {
19289 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
19290 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
19291 *ret_copy = PaymentPurpose_clone(orig_conv);
19292 uint32_t ret_ref = (uintptr_t)ret_copy;
19296 uint32_t __attribute__((export_name("TS_PaymentPurpose_invoice_payment"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret) {
19297 LDKThirtyTwoBytes payment_preimage_ref;
19298 CHECK(payment_preimage->arr_len == 32);
19299 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
19300 LDKThirtyTwoBytes payment_secret_ref;
19301 CHECK(payment_secret->arr_len == 32);
19302 memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
19303 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
19304 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
19305 uint32_t ret_ref = (uintptr_t)ret_copy;
19309 uint32_t __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
19310 LDKThirtyTwoBytes a_ref;
19311 CHECK(a->arr_len == 32);
19312 memcpy(a_ref.data, a->elems, 32); FREE(a);
19313 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
19314 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
19315 uint32_t ret_ref = (uintptr_t)ret_copy;
19319 void __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint32_t this_ptr) {
19320 if ((this_ptr & 1) != 0) return;
19321 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
19322 CHECK_ACCESS(this_ptr_ptr);
19323 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
19324 FREE((void*)this_ptr);
19325 ClosureReason_free(this_ptr_conv);
19328 static inline uintptr_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
19329 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19330 *ret_copy = ClosureReason_clone(arg);
19331 uint32_t ret_ref = (uintptr_t)ret_copy;
19334 uint32_t __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint32_t arg) {
19335 LDKClosureReason* arg_conv = (LDKClosureReason*)arg;
19336 uint32_t ret_val = ClosureReason_clone_ptr(arg_conv);
19340 uint32_t __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint32_t orig) {
19341 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
19342 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19343 *ret_copy = ClosureReason_clone(orig_conv);
19344 uint32_t ret_ref = (uintptr_t)ret_copy;
19348 uint32_t __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(jstring peer_msg) {
19349 LDKStr peer_msg_conv = str_ref_to_owned_c(peer_msg);
19350 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19351 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
19352 uint32_t ret_ref = (uintptr_t)ret_copy;
19356 uint32_t __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
19357 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19358 *ret_copy = ClosureReason_holder_force_closed();
19359 uint32_t ret_ref = (uintptr_t)ret_copy;
19363 uint32_t __attribute__((export_name("TS_ClosureReason_cooperative_closure"))) TS_ClosureReason_cooperative_closure() {
19364 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19365 *ret_copy = ClosureReason_cooperative_closure();
19366 uint32_t ret_ref = (uintptr_t)ret_copy;
19370 uint32_t __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
19371 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19372 *ret_copy = ClosureReason_commitment_tx_confirmed();
19373 uint32_t ret_ref = (uintptr_t)ret_copy;
19377 uint32_t __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
19378 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19379 *ret_copy = ClosureReason_funding_timed_out();
19380 uint32_t ret_ref = (uintptr_t)ret_copy;
19384 uint32_t __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
19385 LDKStr err_conv = str_ref_to_owned_c(err);
19386 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19387 *ret_copy = ClosureReason_processing_error(err_conv);
19388 uint32_t ret_ref = (uintptr_t)ret_copy;
19392 uint32_t __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
19393 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19394 *ret_copy = ClosureReason_disconnected_peer();
19395 uint32_t ret_ref = (uintptr_t)ret_copy;
19399 uint32_t __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
19400 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19401 *ret_copy = ClosureReason_outdated_channel_manager();
19402 uint32_t ret_ref = (uintptr_t)ret_copy;
19406 int8_tArray __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint32_t obj) {
19407 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
19408 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
19409 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
19410 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
19411 CVec_u8Z_free(ret_var);
19415 uint32_t __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
19416 LDKu8slice ser_ref;
19417 ser_ref.datalen = ser->arr_len;
19418 ser_ref.data = ser->elems /* XXX ser leaks */;
19419 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
19420 *ret_conv = ClosureReason_read(ser_ref);
19421 return (uint32_t)ret_conv;
19424 void __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint32_t this_ptr) {
19425 if ((this_ptr & 1) != 0) return;
19426 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
19427 CHECK_ACCESS(this_ptr_ptr);
19428 LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
19429 FREE((void*)this_ptr);
19430 Event_free(this_ptr_conv);
19433 static inline uintptr_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
19434 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19435 *ret_copy = Event_clone(arg);
19436 uint32_t ret_ref = (uintptr_t)ret_copy;
19439 uint32_t __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint32_t arg) {
19440 LDKEvent* arg_conv = (LDKEvent*)arg;
19441 uint32_t ret_val = Event_clone_ptr(arg_conv);
19445 uint32_t __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint32_t orig) {
19446 LDKEvent* orig_conv = (LDKEvent*)orig;
19447 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19448 *ret_copy = Event_clone(orig_conv);
19449 uint32_t ret_ref = (uintptr_t)ret_copy;
19453 uint32_t __attribute__((export_name("TS_Event_funding_generation_ready"))) TS_Event_funding_generation_ready(int8_tArray temporary_channel_id, int64_t channel_value_satoshis, int8_tArray output_script, int64_t user_channel_id) {
19454 LDKThirtyTwoBytes temporary_channel_id_ref;
19455 CHECK(temporary_channel_id->arr_len == 32);
19456 memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
19457 LDKCVec_u8Z output_script_ref;
19458 output_script_ref.datalen = output_script->arr_len;
19459 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
19460 memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
19461 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19462 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
19463 uint32_t ret_ref = (uintptr_t)ret_copy;
19467 uint32_t __attribute__((export_name("TS_Event_payment_received"))) TS_Event_payment_received(int8_tArray payment_hash, int64_t amt, uint32_t purpose) {
19468 LDKThirtyTwoBytes payment_hash_ref;
19469 CHECK(payment_hash->arr_len == 32);
19470 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
19471 void* purpose_ptr = (void*)(((uintptr_t)purpose) & ~1);
19472 CHECK_ACCESS(purpose_ptr);
19473 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
19474 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uintptr_t)purpose) & ~1));
19475 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19476 *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
19477 uint32_t ret_ref = (uintptr_t)ret_copy;
19481 uint32_t __attribute__((export_name("TS_Event_payment_sent"))) TS_Event_payment_sent(int8_tArray payment_id, int8_tArray payment_preimage, int8_tArray payment_hash, uint32_t fee_paid_msat) {
19482 LDKThirtyTwoBytes payment_id_ref;
19483 CHECK(payment_id->arr_len == 32);
19484 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
19485 LDKThirtyTwoBytes payment_preimage_ref;
19486 CHECK(payment_preimage->arr_len == 32);
19487 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
19488 LDKThirtyTwoBytes payment_hash_ref;
19489 CHECK(payment_hash->arr_len == 32);
19490 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
19491 void* fee_paid_msat_ptr = (void*)(((uintptr_t)fee_paid_msat) & ~1);
19492 CHECK_ACCESS(fee_paid_msat_ptr);
19493 LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
19494 fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)fee_paid_msat) & ~1));
19495 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19496 *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
19497 uint32_t ret_ref = (uintptr_t)ret_copy;
19501 uint32_t __attribute__((export_name("TS_Event_payment_path_failed"))) TS_Event_payment_path_failed(int8_tArray payment_id, int8_tArray payment_hash, jboolean rejected_by_dest, uint32_t network_update, jboolean all_paths_failed, uint32_tArray path, uint32_t short_channel_id, uint32_t retry) {
19502 LDKThirtyTwoBytes payment_id_ref;
19503 CHECK(payment_id->arr_len == 32);
19504 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
19505 LDKThirtyTwoBytes payment_hash_ref;
19506 CHECK(payment_hash->arr_len == 32);
19507 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
19508 void* network_update_ptr = (void*)(((uintptr_t)network_update) & ~1);
19509 CHECK_ACCESS(network_update_ptr);
19510 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
19511 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uintptr_t)network_update) & ~1));
19512 LDKCVec_RouteHopZ path_constr;
19513 path_constr.datalen = path->arr_len;
19514 if (path_constr.datalen > 0)
19515 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
19517 path_constr.data = NULL;
19518 uint32_t* path_vals = path->elems /* XXX path leaks */;
19519 for (size_t k = 0; k < path_constr.datalen; k++) {
19520 uint32_t path_conv_10 = path_vals[k];
19521 LDKRouteHop path_conv_10_conv;
19522 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
19523 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
19524 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
19525 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
19526 path_constr.data[k] = path_conv_10_conv;
19528 void* short_channel_id_ptr = (void*)(((uintptr_t)short_channel_id) & ~1);
19529 CHECK_ACCESS(short_channel_id_ptr);
19530 LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
19531 short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id) & ~1));
19532 LDKRouteParameters retry_conv;
19533 retry_conv.inner = (void*)(retry & (~1));
19534 retry_conv.is_owned = (retry & 1) || (retry == 0);
19535 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
19536 retry_conv = RouteParameters_clone(&retry_conv);
19537 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19538 *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);
19539 uint32_t ret_ref = (uintptr_t)ret_copy;
19543 uint32_t __attribute__((export_name("TS_Event_payment_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash) {
19544 LDKThirtyTwoBytes payment_id_ref;
19545 CHECK(payment_id->arr_len == 32);
19546 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
19547 LDKThirtyTwoBytes payment_hash_ref;
19548 CHECK(payment_hash->arr_len == 32);
19549 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
19550 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19551 *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
19552 uint32_t ret_ref = (uintptr_t)ret_copy;
19556 uint32_t __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
19557 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19558 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
19559 uint32_t ret_ref = (uintptr_t)ret_copy;
19563 uint32_t __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint32_tArray outputs) {
19564 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
19565 outputs_constr.datalen = outputs->arr_len;
19566 if (outputs_constr.datalen > 0)
19567 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
19569 outputs_constr.data = NULL;
19570 uint32_t* outputs_vals = outputs->elems /* XXX outputs leaks */;
19571 for (size_t b = 0; b < outputs_constr.datalen; b++) {
19572 uint32_t outputs_conv_27 = outputs_vals[b];
19573 void* outputs_conv_27_ptr = (void*)(((uintptr_t)outputs_conv_27) & ~1);
19574 CHECK_ACCESS(outputs_conv_27_ptr);
19575 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
19576 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)outputs_conv_27) & ~1));
19577 outputs_constr.data[b] = outputs_conv_27_conv;
19579 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19580 *ret_copy = Event_spendable_outputs(outputs_constr);
19581 uint32_t ret_ref = (uintptr_t)ret_copy;
19585 uint32_t __attribute__((export_name("TS_Event_payment_forwarded"))) TS_Event_payment_forwarded(uint32_t fee_earned_msat, jboolean claim_from_onchain_tx) {
19586 void* fee_earned_msat_ptr = (void*)(((uintptr_t)fee_earned_msat) & ~1);
19587 CHECK_ACCESS(fee_earned_msat_ptr);
19588 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
19589 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)fee_earned_msat) & ~1));
19590 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19591 *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
19592 uint32_t ret_ref = (uintptr_t)ret_copy;
19596 uint32_t __attribute__((export_name("TS_Event_channel_closed"))) TS_Event_channel_closed(int8_tArray channel_id, int64_t user_channel_id, uint32_t reason) {
19597 LDKThirtyTwoBytes channel_id_ref;
19598 CHECK(channel_id->arr_len == 32);
19599 memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
19600 void* reason_ptr = (void*)(((uintptr_t)reason) & ~1);
19601 CHECK_ACCESS(reason_ptr);
19602 LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
19603 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uintptr_t)reason) & ~1));
19604 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19605 *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
19606 uint32_t ret_ref = (uintptr_t)ret_copy;
19610 uint32_t __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
19611 LDKThirtyTwoBytes channel_id_ref;
19612 CHECK(channel_id->arr_len == 32);
19613 memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
19614 LDKTransaction transaction_ref;
19615 transaction_ref.datalen = transaction->arr_len;
19616 transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
19617 memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
19618 transaction_ref.data_is_owned = true;
19619 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19620 *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
19621 uint32_t ret_ref = (uintptr_t)ret_copy;
19625 uint32_t __attribute__((export_name("TS_Event_payment_path_successful"))) TS_Event_payment_path_successful(int8_tArray payment_id, int8_tArray payment_hash, uint32_tArray path) {
19626 LDKThirtyTwoBytes payment_id_ref;
19627 CHECK(payment_id->arr_len == 32);
19628 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
19629 LDKThirtyTwoBytes payment_hash_ref;
19630 CHECK(payment_hash->arr_len == 32);
19631 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
19632 LDKCVec_RouteHopZ path_constr;
19633 path_constr.datalen = path->arr_len;
19634 if (path_constr.datalen > 0)
19635 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
19637 path_constr.data = NULL;
19638 uint32_t* path_vals = path->elems /* XXX path leaks */;
19639 for (size_t k = 0; k < path_constr.datalen; k++) {
19640 uint32_t path_conv_10 = path_vals[k];
19641 LDKRouteHop path_conv_10_conv;
19642 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
19643 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
19644 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
19645 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
19646 path_constr.data[k] = path_conv_10_conv;
19648 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19649 *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
19650 uint32_t ret_ref = (uintptr_t)ret_copy;
19654 uint32_t __attribute__((export_name("TS_Event_open_channel_request"))) TS_Event_open_channel_request(int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_satoshis, int64_t push_msat) {
19655 LDKThirtyTwoBytes temporary_channel_id_ref;
19656 CHECK(temporary_channel_id->arr_len == 32);
19657 memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
19658 LDKPublicKey counterparty_node_id_ref;
19659 CHECK(counterparty_node_id->arr_len == 33);
19660 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
19661 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19662 *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat);
19663 uint32_t ret_ref = (uintptr_t)ret_copy;
19667 int8_tArray __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint32_t obj) {
19668 LDKEvent* obj_conv = (LDKEvent*)obj;
19669 LDKCVec_u8Z ret_var = Event_write(obj_conv);
19670 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
19671 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
19672 CVec_u8Z_free(ret_var);
19676 uint32_t __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
19677 LDKu8slice ser_ref;
19678 ser_ref.datalen = ser->arr_len;
19679 ser_ref.data = ser->elems /* XXX ser leaks */;
19680 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
19681 *ret_conv = Event_read(ser_ref);
19682 return (uint32_t)ret_conv;
19685 void __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint32_t this_ptr) {
19686 if ((this_ptr & 1) != 0) return;
19687 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
19688 CHECK_ACCESS(this_ptr_ptr);
19689 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
19690 FREE((void*)this_ptr);
19691 MessageSendEvent_free(this_ptr_conv);
19694 static inline uintptr_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
19695 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19696 *ret_copy = MessageSendEvent_clone(arg);
19697 uint32_t ret_ref = (uintptr_t)ret_copy;
19700 uint32_t __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint32_t arg) {
19701 LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)arg;
19702 uint32_t ret_val = MessageSendEvent_clone_ptr(arg_conv);
19706 uint32_t __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint32_t orig) {
19707 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
19708 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19709 *ret_copy = MessageSendEvent_clone(orig_conv);
19710 uint32_t ret_ref = (uintptr_t)ret_copy;
19714 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint32_t msg) {
19715 LDKPublicKey node_id_ref;
19716 CHECK(node_id->arr_len == 33);
19717 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
19718 LDKAcceptChannel msg_conv;
19719 msg_conv.inner = (void*)(msg & (~1));
19720 msg_conv.is_owned = (msg & 1) || (msg == 0);
19721 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19722 msg_conv = AcceptChannel_clone(&msg_conv);
19723 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19724 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
19725 uint32_t ret_ref = (uintptr_t)ret_copy;
19729 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint32_t msg) {
19730 LDKPublicKey node_id_ref;
19731 CHECK(node_id->arr_len == 33);
19732 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
19733 LDKOpenChannel msg_conv;
19734 msg_conv.inner = (void*)(msg & (~1));
19735 msg_conv.is_owned = (msg & 1) || (msg == 0);
19736 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19737 msg_conv = OpenChannel_clone(&msg_conv);
19738 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19739 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
19740 uint32_t ret_ref = (uintptr_t)ret_copy;
19744 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_funding_created"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint32_t msg) {
19745 LDKPublicKey node_id_ref;
19746 CHECK(node_id->arr_len == 33);
19747 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
19748 LDKFundingCreated msg_conv;
19749 msg_conv.inner = (void*)(msg & (~1));
19750 msg_conv.is_owned = (msg & 1) || (msg == 0);
19751 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19752 msg_conv = FundingCreated_clone(&msg_conv);
19753 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19754 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
19755 uint32_t ret_ref = (uintptr_t)ret_copy;
19759 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_funding_signed"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint32_t msg) {
19760 LDKPublicKey node_id_ref;
19761 CHECK(node_id->arr_len == 33);
19762 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
19763 LDKFundingSigned msg_conv;
19764 msg_conv.inner = (void*)(msg & (~1));
19765 msg_conv.is_owned = (msg & 1) || (msg == 0);
19766 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19767 msg_conv = FundingSigned_clone(&msg_conv);
19768 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19769 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
19770 uint32_t ret_ref = (uintptr_t)ret_copy;
19774 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_funding_locked"))) TS_MessageSendEvent_send_funding_locked(int8_tArray node_id, uint32_t msg) {
19775 LDKPublicKey node_id_ref;
19776 CHECK(node_id->arr_len == 33);
19777 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
19778 LDKFundingLocked msg_conv;
19779 msg_conv.inner = (void*)(msg & (~1));
19780 msg_conv.is_owned = (msg & 1) || (msg == 0);
19781 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19782 msg_conv = FundingLocked_clone(&msg_conv);
19783 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19784 *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
19785 uint32_t ret_ref = (uintptr_t)ret_copy;
19789 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_announcement_signatures"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint32_t msg) {
19790 LDKPublicKey node_id_ref;
19791 CHECK(node_id->arr_len == 33);
19792 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
19793 LDKAnnouncementSignatures msg_conv;
19794 msg_conv.inner = (void*)(msg & (~1));
19795 msg_conv.is_owned = (msg & 1) || (msg == 0);
19796 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19797 msg_conv = AnnouncementSignatures_clone(&msg_conv);
19798 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19799 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
19800 uint32_t ret_ref = (uintptr_t)ret_copy;
19804 uint32_t __attribute__((export_name("TS_MessageSendEvent_update_htlcs"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint32_t updates) {
19805 LDKPublicKey node_id_ref;
19806 CHECK(node_id->arr_len == 33);
19807 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
19808 LDKCommitmentUpdate updates_conv;
19809 updates_conv.inner = (void*)(updates & (~1));
19810 updates_conv.is_owned = (updates & 1) || (updates == 0);
19811 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
19812 updates_conv = CommitmentUpdate_clone(&updates_conv);
19813 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19814 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
19815 uint32_t ret_ref = (uintptr_t)ret_copy;
19819 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_revoke_and_ack"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint32_t msg) {
19820 LDKPublicKey node_id_ref;
19821 CHECK(node_id->arr_len == 33);
19822 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
19823 LDKRevokeAndACK msg_conv;
19824 msg_conv.inner = (void*)(msg & (~1));
19825 msg_conv.is_owned = (msg & 1) || (msg == 0);
19826 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19827 msg_conv = RevokeAndACK_clone(&msg_conv);
19828 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19829 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
19830 uint32_t ret_ref = (uintptr_t)ret_copy;
19834 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_closing_signed"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint32_t msg) {
19835 LDKPublicKey node_id_ref;
19836 CHECK(node_id->arr_len == 33);
19837 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
19838 LDKClosingSigned msg_conv;
19839 msg_conv.inner = (void*)(msg & (~1));
19840 msg_conv.is_owned = (msg & 1) || (msg == 0);
19841 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19842 msg_conv = ClosingSigned_clone(&msg_conv);
19843 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19844 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
19845 uint32_t ret_ref = (uintptr_t)ret_copy;
19849 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_shutdown"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint32_t msg) {
19850 LDKPublicKey node_id_ref;
19851 CHECK(node_id->arr_len == 33);
19852 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
19853 LDKShutdown msg_conv;
19854 msg_conv.inner = (void*)(msg & (~1));
19855 msg_conv.is_owned = (msg & 1) || (msg == 0);
19856 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19857 msg_conv = Shutdown_clone(&msg_conv);
19858 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19859 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
19860 uint32_t ret_ref = (uintptr_t)ret_copy;
19864 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_channel_reestablish"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint32_t msg) {
19865 LDKPublicKey node_id_ref;
19866 CHECK(node_id->arr_len == 33);
19867 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
19868 LDKChannelReestablish msg_conv;
19869 msg_conv.inner = (void*)(msg & (~1));
19870 msg_conv.is_owned = (msg & 1) || (msg == 0);
19871 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19872 msg_conv = ChannelReestablish_clone(&msg_conv);
19873 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19874 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
19875 uint32_t ret_ref = (uintptr_t)ret_copy;
19879 uint32_t __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_announcement"))) TS_MessageSendEvent_broadcast_channel_announcement(uint32_t msg, uint32_t update_msg) {
19880 LDKChannelAnnouncement msg_conv;
19881 msg_conv.inner = (void*)(msg & (~1));
19882 msg_conv.is_owned = (msg & 1) || (msg == 0);
19883 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19884 msg_conv = ChannelAnnouncement_clone(&msg_conv);
19885 LDKChannelUpdate update_msg_conv;
19886 update_msg_conv.inner = (void*)(update_msg & (~1));
19887 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
19888 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
19889 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
19890 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19891 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
19892 uint32_t ret_ref = (uintptr_t)ret_copy;
19896 uint32_t __attribute__((export_name("TS_MessageSendEvent_broadcast_node_announcement"))) TS_MessageSendEvent_broadcast_node_announcement(uint32_t msg) {
19897 LDKNodeAnnouncement msg_conv;
19898 msg_conv.inner = (void*)(msg & (~1));
19899 msg_conv.is_owned = (msg & 1) || (msg == 0);
19900 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19901 msg_conv = NodeAnnouncement_clone(&msg_conv);
19902 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19903 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
19904 uint32_t ret_ref = (uintptr_t)ret_copy;
19908 uint32_t __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_update"))) TS_MessageSendEvent_broadcast_channel_update(uint32_t msg) {
19909 LDKChannelUpdate msg_conv;
19910 msg_conv.inner = (void*)(msg & (~1));
19911 msg_conv.is_owned = (msg & 1) || (msg == 0);
19912 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19913 msg_conv = ChannelUpdate_clone(&msg_conv);
19914 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19915 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
19916 uint32_t ret_ref = (uintptr_t)ret_copy;
19920 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint32_t msg) {
19921 LDKPublicKey node_id_ref;
19922 CHECK(node_id->arr_len == 33);
19923 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
19924 LDKChannelUpdate msg_conv;
19925 msg_conv.inner = (void*)(msg & (~1));
19926 msg_conv.is_owned = (msg & 1) || (msg == 0);
19927 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19928 msg_conv = ChannelUpdate_clone(&msg_conv);
19929 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19930 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
19931 uint32_t ret_ref = (uintptr_t)ret_copy;
19935 uint32_t __attribute__((export_name("TS_MessageSendEvent_handle_error"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint32_t action) {
19936 LDKPublicKey node_id_ref;
19937 CHECK(node_id->arr_len == 33);
19938 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
19939 void* action_ptr = (void*)(((uintptr_t)action) & ~1);
19940 CHECK_ACCESS(action_ptr);
19941 LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
19942 action_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)action) & ~1));
19943 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19944 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
19945 uint32_t ret_ref = (uintptr_t)ret_copy;
19949 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_channel_range_query"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint32_t msg) {
19950 LDKPublicKey node_id_ref;
19951 CHECK(node_id->arr_len == 33);
19952 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
19953 LDKQueryChannelRange msg_conv;
19954 msg_conv.inner = (void*)(msg & (~1));
19955 msg_conv.is_owned = (msg & 1) || (msg == 0);
19956 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19957 msg_conv = QueryChannelRange_clone(&msg_conv);
19958 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19959 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
19960 uint32_t ret_ref = (uintptr_t)ret_copy;
19964 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_short_ids_query"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint32_t msg) {
19965 LDKPublicKey node_id_ref;
19966 CHECK(node_id->arr_len == 33);
19967 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
19968 LDKQueryShortChannelIds msg_conv;
19969 msg_conv.inner = (void*)(msg & (~1));
19970 msg_conv.is_owned = (msg & 1) || (msg == 0);
19971 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19972 msg_conv = QueryShortChannelIds_clone(&msg_conv);
19973 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19974 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
19975 uint32_t ret_ref = (uintptr_t)ret_copy;
19979 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_reply_channel_range"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint32_t msg) {
19980 LDKPublicKey node_id_ref;
19981 CHECK(node_id->arr_len == 33);
19982 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
19983 LDKReplyChannelRange msg_conv;
19984 msg_conv.inner = (void*)(msg & (~1));
19985 msg_conv.is_owned = (msg & 1) || (msg == 0);
19986 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19987 msg_conv = ReplyChannelRange_clone(&msg_conv);
19988 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19989 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
19990 uint32_t ret_ref = (uintptr_t)ret_copy;
19994 void __attribute__((export_name("TS_MessageSendEventsProvider_free"))) TS_MessageSendEventsProvider_free(uint32_t this_ptr) {
19995 if ((this_ptr & 1) != 0) return;
19996 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
19997 CHECK_ACCESS(this_ptr_ptr);
19998 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
19999 FREE((void*)this_ptr);
20000 MessageSendEventsProvider_free(this_ptr_conv);
20003 void __attribute__((export_name("TS_EventsProvider_free"))) TS_EventsProvider_free(uint32_t this_ptr) {
20004 if ((this_ptr & 1) != 0) return;
20005 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
20006 CHECK_ACCESS(this_ptr_ptr);
20007 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
20008 FREE((void*)this_ptr);
20009 EventsProvider_free(this_ptr_conv);
20012 void __attribute__((export_name("TS_EventHandler_free"))) TS_EventHandler_free(uint32_t this_ptr) {
20013 if ((this_ptr & 1) != 0) return;
20014 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
20015 CHECK_ACCESS(this_ptr_ptr);
20016 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
20017 FREE((void*)this_ptr);
20018 EventHandler_free(this_ptr_conv);
20021 void __attribute__((export_name("TS_APIError_free"))) TS_APIError_free(uint32_t this_ptr) {
20022 if ((this_ptr & 1) != 0) return;
20023 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
20024 CHECK_ACCESS(this_ptr_ptr);
20025 LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
20026 FREE((void*)this_ptr);
20027 APIError_free(this_ptr_conv);
20030 static inline uintptr_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
20031 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20032 *ret_copy = APIError_clone(arg);
20033 uint32_t ret_ref = (uintptr_t)ret_copy;
20036 uint32_t __attribute__((export_name("TS_APIError_clone_ptr"))) TS_APIError_clone_ptr(uint32_t arg) {
20037 LDKAPIError* arg_conv = (LDKAPIError*)arg;
20038 uint32_t ret_val = APIError_clone_ptr(arg_conv);
20042 uint32_t __attribute__((export_name("TS_APIError_clone"))) TS_APIError_clone(uint32_t orig) {
20043 LDKAPIError* orig_conv = (LDKAPIError*)orig;
20044 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20045 *ret_copy = APIError_clone(orig_conv);
20046 uint32_t ret_ref = (uintptr_t)ret_copy;
20050 uint32_t __attribute__((export_name("TS_APIError_apimisuse_error"))) TS_APIError_apimisuse_error(jstring err) {
20051 LDKStr err_conv = str_ref_to_owned_c(err);
20052 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20053 *ret_copy = APIError_apimisuse_error(err_conv);
20054 uint32_t ret_ref = (uintptr_t)ret_copy;
20058 uint32_t __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
20059 LDKStr err_conv = str_ref_to_owned_c(err);
20060 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20061 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
20062 uint32_t ret_ref = (uintptr_t)ret_copy;
20066 uint32_t __attribute__((export_name("TS_APIError_route_error"))) TS_APIError_route_error(jstring err) {
20067 LDKStr err_conv = str_ref_to_owned_c(err);
20068 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20069 *ret_copy = APIError_route_error(err_conv);
20070 uint32_t ret_ref = (uintptr_t)ret_copy;
20074 uint32_t __attribute__((export_name("TS_APIError_channel_unavailable"))) TS_APIError_channel_unavailable(jstring err) {
20075 LDKStr err_conv = str_ref_to_owned_c(err);
20076 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20077 *ret_copy = APIError_channel_unavailable(err_conv);
20078 uint32_t ret_ref = (uintptr_t)ret_copy;
20082 uint32_t __attribute__((export_name("TS_APIError_monitor_update_failed"))) TS_APIError_monitor_update_failed() {
20083 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20084 *ret_copy = APIError_monitor_update_failed();
20085 uint32_t ret_ref = (uintptr_t)ret_copy;
20089 uint32_t __attribute__((export_name("TS_APIError_incompatible_shutdown_script"))) TS_APIError_incompatible_shutdown_script(uint32_t script) {
20090 LDKShutdownScript script_conv;
20091 script_conv.inner = (void*)(script & (~1));
20092 script_conv.is_owned = (script & 1) || (script == 0);
20093 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
20094 script_conv = ShutdownScript_clone(&script_conv);
20095 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
20096 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
20097 uint32_t ret_ref = (uintptr_t)ret_copy;
20101 uint32_t __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_tArray sk) {
20102 LDKu8slice msg_ref;
20103 msg_ref.datalen = msg->arr_len;
20104 msg_ref.data = msg->elems /* XXX msg leaks */;
20105 unsigned char sk_arr[32];
20106 CHECK(sk->arr_len == 32);
20107 memcpy(sk_arr, sk->elems, 32); FREE(sk);
20108 unsigned char (*sk_ref)[32] = &sk_arr;
20109 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
20110 *ret_conv = sign(msg_ref, sk_ref);
20111 return (uint32_t)ret_conv;
20114 uint32_t __attribute__((export_name("TS_recover_pk"))) TS_recover_pk(int8_tArray msg, jstring sig) {
20115 LDKu8slice msg_ref;
20116 msg_ref.datalen = msg->arr_len;
20117 msg_ref.data = msg->elems /* XXX msg leaks */;
20118 LDKStr sig_conv = str_ref_to_owned_c(sig);
20119 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
20120 *ret_conv = recover_pk(msg_ref, sig_conv);
20121 return (uint32_t)ret_conv;
20124 jboolean __attribute__((export_name("TS_verify"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
20125 LDKu8slice msg_ref;
20126 msg_ref.datalen = msg->arr_len;
20127 msg_ref.data = msg->elems /* XXX msg leaks */;
20128 LDKStr sig_conv = str_ref_to_owned_c(sig);
20129 LDKPublicKey pk_ref;
20130 CHECK(pk->arr_len == 33);
20131 memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
20132 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
20136 int8_tArray __attribute__((export_name("TS_construct_invoice_preimage"))) TS_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
20137 LDKu8slice hrp_bytes_ref;
20138 hrp_bytes_ref.datalen = hrp_bytes->arr_len;
20139 hrp_bytes_ref.data = hrp_bytes->elems /* XXX hrp_bytes leaks */;
20140 LDKCVec_u5Z data_without_signature_constr;
20141 data_without_signature_constr.datalen = data_without_signature->arr_len;
20142 if (data_without_signature_constr.datalen > 0)
20143 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
20145 data_without_signature_constr.data = NULL;
20146 int8_t* data_without_signature_vals = (void*) data_without_signature->elems /* XXX data_without_signature leaks */;
20147 for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
20148 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
20150 data_without_signature_constr.data[h] = (LDKu5){ ._0 = data_without_signature_conv_7 };
20152 LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
20153 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
20154 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20155 CVec_u8Z_free(ret_var);
20159 uint32_t __attribute__((export_name("TS_Level_clone"))) TS_Level_clone(uint32_t orig) {
20160 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
20161 uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
20165 uint32_t __attribute__((export_name("TS_Level_gossip"))) TS_Level_gossip() {
20166 uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
20170 uint32_t __attribute__((export_name("TS_Level_trace"))) TS_Level_trace() {
20171 uint32_t ret_conv = LDKLevel_to_js(Level_trace());
20175 uint32_t __attribute__((export_name("TS_Level_debug"))) TS_Level_debug() {
20176 uint32_t ret_conv = LDKLevel_to_js(Level_debug());
20180 uint32_t __attribute__((export_name("TS_Level_info"))) TS_Level_info() {
20181 uint32_t ret_conv = LDKLevel_to_js(Level_info());
20185 uint32_t __attribute__((export_name("TS_Level_warn"))) TS_Level_warn() {
20186 uint32_t ret_conv = LDKLevel_to_js(Level_warn());
20190 uint32_t __attribute__((export_name("TS_Level_error"))) TS_Level_error() {
20191 uint32_t ret_conv = LDKLevel_to_js(Level_error());
20195 jboolean __attribute__((export_name("TS_Level_eq"))) TS_Level_eq(uint32_t a, uint32_t b) {
20196 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
20197 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
20198 jboolean ret_val = Level_eq(a_conv, b_conv);
20202 int64_t __attribute__((export_name("TS_Level_hash"))) TS_Level_hash(uint32_t o) {
20203 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
20204 int64_t ret_val = Level_hash(o_conv);
20208 uint32_t __attribute__((export_name("TS_Level_max"))) TS_Level_max() {
20209 uint32_t ret_conv = LDKLevel_to_js(Level_max());
20213 void __attribute__((export_name("TS_Record_free"))) TS_Record_free(uint32_t this_obj) {
20214 LDKRecord this_obj_conv;
20215 this_obj_conv.inner = (void*)(this_obj & (~1));
20216 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20217 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20218 Record_free(this_obj_conv);
20221 uint32_t __attribute__((export_name("TS_Record_get_level"))) TS_Record_get_level(uint32_t this_ptr) {
20222 LDKRecord this_ptr_conv;
20223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20224 this_ptr_conv.is_owned = false;
20225 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20226 uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
20230 void __attribute__((export_name("TS_Record_set_level"))) TS_Record_set_level(uint32_t this_ptr, uint32_t val) {
20231 LDKRecord this_ptr_conv;
20232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20233 this_ptr_conv.is_owned = false;
20234 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20235 LDKLevel val_conv = LDKLevel_from_js(val);
20236 Record_set_level(&this_ptr_conv, val_conv);
20239 jstring __attribute__((export_name("TS_Record_get_args"))) TS_Record_get_args(uint32_t this_ptr) {
20240 LDKRecord this_ptr_conv;
20241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20242 this_ptr_conv.is_owned = false;
20243 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20244 LDKStr ret_str = Record_get_args(&this_ptr_conv);
20245 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
20250 void __attribute__((export_name("TS_Record_set_args"))) TS_Record_set_args(uint32_t this_ptr, jstring val) {
20251 LDKRecord this_ptr_conv;
20252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20253 this_ptr_conv.is_owned = false;
20254 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20255 LDKStr val_conv = str_ref_to_owned_c(val);
20256 Record_set_args(&this_ptr_conv, val_conv);
20259 jstring __attribute__((export_name("TS_Record_get_module_path"))) TS_Record_get_module_path(uint32_t this_ptr) {
20260 LDKRecord this_ptr_conv;
20261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20262 this_ptr_conv.is_owned = false;
20263 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20264 LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
20265 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
20270 void __attribute__((export_name("TS_Record_set_module_path"))) TS_Record_set_module_path(uint32_t this_ptr, jstring val) {
20271 LDKRecord this_ptr_conv;
20272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20273 this_ptr_conv.is_owned = false;
20274 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20275 LDKStr val_conv = str_ref_to_owned_c(val);
20276 Record_set_module_path(&this_ptr_conv, val_conv);
20279 jstring __attribute__((export_name("TS_Record_get_file"))) TS_Record_get_file(uint32_t this_ptr) {
20280 LDKRecord this_ptr_conv;
20281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20282 this_ptr_conv.is_owned = false;
20283 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20284 LDKStr ret_str = Record_get_file(&this_ptr_conv);
20285 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
20290 void __attribute__((export_name("TS_Record_set_file"))) TS_Record_set_file(uint32_t this_ptr, jstring val) {
20291 LDKRecord this_ptr_conv;
20292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20293 this_ptr_conv.is_owned = false;
20294 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20295 LDKStr val_conv = str_ref_to_owned_c(val);
20296 Record_set_file(&this_ptr_conv, val_conv);
20299 int32_t __attribute__((export_name("TS_Record_get_line"))) TS_Record_get_line(uint32_t this_ptr) {
20300 LDKRecord this_ptr_conv;
20301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20302 this_ptr_conv.is_owned = false;
20303 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20304 int32_t ret_val = Record_get_line(&this_ptr_conv);
20308 void __attribute__((export_name("TS_Record_set_line"))) TS_Record_set_line(uint32_t this_ptr, int32_t val) {
20309 LDKRecord this_ptr_conv;
20310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20311 this_ptr_conv.is_owned = false;
20312 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20313 Record_set_line(&this_ptr_conv, val);
20316 static inline uintptr_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
20317 LDKRecord ret_var = Record_clone(arg);
20318 uint32_t ret_ref = 0;
20319 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20320 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20321 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20322 ret_ref = (uintptr_t)ret_var.inner;
20323 if (ret_var.is_owned) {
20328 uint32_t __attribute__((export_name("TS_Record_clone_ptr"))) TS_Record_clone_ptr(uint32_t arg) {
20329 LDKRecord arg_conv;
20330 arg_conv.inner = (void*)(arg & (~1));
20331 arg_conv.is_owned = false;
20332 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20333 uint32_t ret_val = Record_clone_ptr(&arg_conv);
20337 uint32_t __attribute__((export_name("TS_Record_clone"))) TS_Record_clone(uint32_t orig) {
20338 LDKRecord orig_conv;
20339 orig_conv.inner = (void*)(orig & (~1));
20340 orig_conv.is_owned = false;
20341 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20342 LDKRecord ret_var = Record_clone(&orig_conv);
20343 uint32_t ret_ref = 0;
20344 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20345 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20346 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20347 ret_ref = (uintptr_t)ret_var.inner;
20348 if (ret_var.is_owned) {
20354 void __attribute__((export_name("TS_Logger_free"))) TS_Logger_free(uint32_t this_ptr) {
20355 if ((this_ptr & 1) != 0) return;
20356 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
20357 CHECK_ACCESS(this_ptr_ptr);
20358 LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
20359 FREE((void*)this_ptr);
20360 Logger_free(this_ptr_conv);
20363 void __attribute__((export_name("TS_ChannelHandshakeConfig_free"))) TS_ChannelHandshakeConfig_free(uint32_t this_obj) {
20364 LDKChannelHandshakeConfig this_obj_conv;
20365 this_obj_conv.inner = (void*)(this_obj & (~1));
20366 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20367 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20368 ChannelHandshakeConfig_free(this_obj_conv);
20371 int32_t __attribute__((export_name("TS_ChannelHandshakeConfig_get_minimum_depth"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint32_t this_ptr) {
20372 LDKChannelHandshakeConfig this_ptr_conv;
20373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20374 this_ptr_conv.is_owned = false;
20375 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20376 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
20380 void __attribute__((export_name("TS_ChannelHandshakeConfig_set_minimum_depth"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint32_t this_ptr, int32_t val) {
20381 LDKChannelHandshakeConfig this_ptr_conv;
20382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20383 this_ptr_conv.is_owned = false;
20384 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20385 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
20388 int16_t __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_to_self_delay"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint32_t this_ptr) {
20389 LDKChannelHandshakeConfig this_ptr_conv;
20390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20391 this_ptr_conv.is_owned = false;
20392 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20393 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
20397 void __attribute__((export_name("TS_ChannelHandshakeConfig_set_our_to_self_delay"))) TS_ChannelHandshakeConfig_set_our_to_self_delay(uint32_t this_ptr, int16_t val) {
20398 LDKChannelHandshakeConfig this_ptr_conv;
20399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20400 this_ptr_conv.is_owned = false;
20401 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20402 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
20405 int64_t __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint32_t this_ptr) {
20406 LDKChannelHandshakeConfig this_ptr_conv;
20407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20408 this_ptr_conv.is_owned = false;
20409 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20410 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
20414 void __attribute__((export_name("TS_ChannelHandshakeConfig_set_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_set_our_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
20415 LDKChannelHandshakeConfig this_ptr_conv;
20416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20417 this_ptr_conv.is_owned = false;
20418 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20419 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
20422 uint32_t __attribute__((export_name("TS_ChannelHandshakeConfig_new"))) TS_ChannelHandshakeConfig_new(int32_t minimum_depth_arg, int16_t our_to_self_delay_arg, int64_t our_htlc_minimum_msat_arg) {
20423 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
20424 uint32_t ret_ref = 0;
20425 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20426 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20427 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20428 ret_ref = (uintptr_t)ret_var.inner;
20429 if (ret_var.is_owned) {
20435 static inline uintptr_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
20436 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
20437 uint32_t ret_ref = 0;
20438 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20439 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20440 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20441 ret_ref = (uintptr_t)ret_var.inner;
20442 if (ret_var.is_owned) {
20447 uint32_t __attribute__((export_name("TS_ChannelHandshakeConfig_clone_ptr"))) TS_ChannelHandshakeConfig_clone_ptr(uint32_t arg) {
20448 LDKChannelHandshakeConfig arg_conv;
20449 arg_conv.inner = (void*)(arg & (~1));
20450 arg_conv.is_owned = false;
20451 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20452 uint32_t ret_val = ChannelHandshakeConfig_clone_ptr(&arg_conv);
20456 uint32_t __attribute__((export_name("TS_ChannelHandshakeConfig_clone"))) TS_ChannelHandshakeConfig_clone(uint32_t orig) {
20457 LDKChannelHandshakeConfig orig_conv;
20458 orig_conv.inner = (void*)(orig & (~1));
20459 orig_conv.is_owned = false;
20460 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20461 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
20462 uint32_t ret_ref = 0;
20463 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20464 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20465 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20466 ret_ref = (uintptr_t)ret_var.inner;
20467 if (ret_var.is_owned) {
20473 uint32_t __attribute__((export_name("TS_ChannelHandshakeConfig_default"))) TS_ChannelHandshakeConfig_default() {
20474 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
20475 uint32_t ret_ref = 0;
20476 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20477 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20478 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20479 ret_ref = (uintptr_t)ret_var.inner;
20480 if (ret_var.is_owned) {
20486 void __attribute__((export_name("TS_ChannelHandshakeLimits_free"))) TS_ChannelHandshakeLimits_free(uint32_t this_obj) {
20487 LDKChannelHandshakeLimits this_obj_conv;
20488 this_obj_conv.inner = (void*)(this_obj & (~1));
20489 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20490 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20491 ChannelHandshakeLimits_free(this_obj_conv);
20494 int64_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_funding_satoshis"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint32_t this_ptr) {
20495 LDKChannelHandshakeLimits this_ptr_conv;
20496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20497 this_ptr_conv.is_owned = false;
20498 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20499 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
20503 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_funding_satoshis"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint32_t this_ptr, int64_t val) {
20504 LDKChannelHandshakeLimits this_ptr_conv;
20505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20506 this_ptr_conv.is_owned = false;
20507 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20508 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
20511 int64_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint32_t this_ptr) {
20512 LDKChannelHandshakeLimits this_ptr_conv;
20513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20514 this_ptr_conv.is_owned = false;
20515 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20516 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
20520 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_set_max_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
20521 LDKChannelHandshakeLimits this_ptr_conv;
20522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20523 this_ptr_conv.is_owned = false;
20524 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20525 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
20528 int64_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat"))) TS_ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
20529 LDKChannelHandshakeLimits this_ptr_conv;
20530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20531 this_ptr_conv.is_owned = false;
20532 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20533 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
20537 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat"))) TS_ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
20538 LDKChannelHandshakeLimits this_ptr_conv;
20539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20540 this_ptr_conv.is_owned = false;
20541 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20542 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
20545 int64_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint32_t this_ptr) {
20546 LDKChannelHandshakeLimits this_ptr_conv;
20547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20548 this_ptr_conv.is_owned = false;
20549 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20550 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
20554 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_set_max_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
20555 LDKChannelHandshakeLimits this_ptr_conv;
20556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20557 this_ptr_conv.is_owned = false;
20558 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20559 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
20562 int16_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint32_t this_ptr) {
20563 LDKChannelHandshakeLimits this_ptr_conv;
20564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20565 this_ptr_conv.is_owned = false;
20566 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20567 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
20571 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_set_min_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
20572 LDKChannelHandshakeLimits this_ptr_conv;
20573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20574 this_ptr_conv.is_owned = false;
20575 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20576 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
20579 int32_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_minimum_depth"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint32_t this_ptr) {
20580 LDKChannelHandshakeLimits this_ptr_conv;
20581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20582 this_ptr_conv.is_owned = false;
20583 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20584 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
20588 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_minimum_depth"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint32_t this_ptr, int32_t val) {
20589 LDKChannelHandshakeLimits this_ptr_conv;
20590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20591 this_ptr_conv.is_owned = false;
20592 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20593 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
20596 jboolean __attribute__((export_name("TS_ChannelHandshakeLimits_get_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint32_t this_ptr) {
20597 LDKChannelHandshakeLimits this_ptr_conv;
20598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20599 this_ptr_conv.is_owned = false;
20600 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20601 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
20605 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint32_t this_ptr, jboolean val) {
20606 LDKChannelHandshakeLimits this_ptr_conv;
20607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20608 this_ptr_conv.is_owned = false;
20609 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20610 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
20613 int16_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_their_to_self_delay"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint32_t this_ptr) {
20614 LDKChannelHandshakeLimits this_ptr_conv;
20615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20616 this_ptr_conv.is_owned = false;
20617 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20618 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
20622 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_their_to_self_delay"))) TS_ChannelHandshakeLimits_set_their_to_self_delay(uint32_t this_ptr, int16_t val) {
20623 LDKChannelHandshakeLimits this_ptr_conv;
20624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20625 this_ptr_conv.is_owned = false;
20626 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20627 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
20630 uint32_t __attribute__((export_name("TS_ChannelHandshakeLimits_new"))) TS_ChannelHandshakeLimits_new(int64_t min_funding_satoshis_arg, int64_t max_htlc_minimum_msat_arg, int64_t min_max_htlc_value_in_flight_msat_arg, int64_t max_channel_reserve_satoshis_arg, int16_t min_max_accepted_htlcs_arg, int32_t max_minimum_depth_arg, jboolean force_announced_channel_preference_arg, int16_t their_to_self_delay_arg) {
20631 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);
20632 uint32_t ret_ref = 0;
20633 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20634 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20635 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20636 ret_ref = (uintptr_t)ret_var.inner;
20637 if (ret_var.is_owned) {
20643 static inline uintptr_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
20644 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
20645 uint32_t ret_ref = 0;
20646 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20647 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20648 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20649 ret_ref = (uintptr_t)ret_var.inner;
20650 if (ret_var.is_owned) {
20655 uint32_t __attribute__((export_name("TS_ChannelHandshakeLimits_clone_ptr"))) TS_ChannelHandshakeLimits_clone_ptr(uint32_t arg) {
20656 LDKChannelHandshakeLimits arg_conv;
20657 arg_conv.inner = (void*)(arg & (~1));
20658 arg_conv.is_owned = false;
20659 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20660 uint32_t ret_val = ChannelHandshakeLimits_clone_ptr(&arg_conv);
20664 uint32_t __attribute__((export_name("TS_ChannelHandshakeLimits_clone"))) TS_ChannelHandshakeLimits_clone(uint32_t orig) {
20665 LDKChannelHandshakeLimits orig_conv;
20666 orig_conv.inner = (void*)(orig & (~1));
20667 orig_conv.is_owned = false;
20668 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20669 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
20670 uint32_t ret_ref = 0;
20671 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20672 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20673 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20674 ret_ref = (uintptr_t)ret_var.inner;
20675 if (ret_var.is_owned) {
20681 uint32_t __attribute__((export_name("TS_ChannelHandshakeLimits_default"))) TS_ChannelHandshakeLimits_default() {
20682 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
20683 uint32_t ret_ref = 0;
20684 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20685 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20686 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20687 ret_ref = (uintptr_t)ret_var.inner;
20688 if (ret_var.is_owned) {
20694 void __attribute__((export_name("TS_ChannelConfig_free"))) TS_ChannelConfig_free(uint32_t this_obj) {
20695 LDKChannelConfig this_obj_conv;
20696 this_obj_conv.inner = (void*)(this_obj & (~1));
20697 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20698 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20699 ChannelConfig_free(this_obj_conv);
20702 int32_t __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint32_t this_ptr) {
20703 LDKChannelConfig this_ptr_conv;
20704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20705 this_ptr_conv.is_owned = false;
20706 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20707 int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
20711 void __attribute__((export_name("TS_ChannelConfig_set_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_set_forwarding_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
20712 LDKChannelConfig this_ptr_conv;
20713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20714 this_ptr_conv.is_owned = false;
20715 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20716 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
20719 int32_t __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_base_msat"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint32_t this_ptr) {
20720 LDKChannelConfig this_ptr_conv;
20721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20722 this_ptr_conv.is_owned = false;
20723 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20724 int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
20728 void __attribute__((export_name("TS_ChannelConfig_set_forwarding_fee_base_msat"))) TS_ChannelConfig_set_forwarding_fee_base_msat(uint32_t this_ptr, int32_t val) {
20729 LDKChannelConfig this_ptr_conv;
20730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20731 this_ptr_conv.is_owned = false;
20732 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20733 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
20736 int16_t __attribute__((export_name("TS_ChannelConfig_get_cltv_expiry_delta"))) TS_ChannelConfig_get_cltv_expiry_delta(uint32_t this_ptr) {
20737 LDKChannelConfig this_ptr_conv;
20738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20739 this_ptr_conv.is_owned = false;
20740 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20741 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
20745 void __attribute__((export_name("TS_ChannelConfig_set_cltv_expiry_delta"))) TS_ChannelConfig_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
20746 LDKChannelConfig this_ptr_conv;
20747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20748 this_ptr_conv.is_owned = false;
20749 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20750 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
20753 jboolean __attribute__((export_name("TS_ChannelConfig_get_announced_channel"))) TS_ChannelConfig_get_announced_channel(uint32_t this_ptr) {
20754 LDKChannelConfig this_ptr_conv;
20755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20756 this_ptr_conv.is_owned = false;
20757 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20758 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
20762 void __attribute__((export_name("TS_ChannelConfig_set_announced_channel"))) TS_ChannelConfig_set_announced_channel(uint32_t this_ptr, jboolean val) {
20763 LDKChannelConfig this_ptr_conv;
20764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20765 this_ptr_conv.is_owned = false;
20766 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20767 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
20770 jboolean __attribute__((export_name("TS_ChannelConfig_get_commit_upfront_shutdown_pubkey"))) TS_ChannelConfig_get_commit_upfront_shutdown_pubkey(uint32_t this_ptr) {
20771 LDKChannelConfig this_ptr_conv;
20772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20773 this_ptr_conv.is_owned = false;
20774 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20775 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
20779 void __attribute__((export_name("TS_ChannelConfig_set_commit_upfront_shutdown_pubkey"))) TS_ChannelConfig_set_commit_upfront_shutdown_pubkey(uint32_t this_ptr, jboolean val) {
20780 LDKChannelConfig this_ptr_conv;
20781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20782 this_ptr_conv.is_owned = false;
20783 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20784 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
20787 int64_t __attribute__((export_name("TS_ChannelConfig_get_max_dust_htlc_exposure_msat"))) TS_ChannelConfig_get_max_dust_htlc_exposure_msat(uint32_t this_ptr) {
20788 LDKChannelConfig this_ptr_conv;
20789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20790 this_ptr_conv.is_owned = false;
20791 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20792 int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
20796 void __attribute__((export_name("TS_ChannelConfig_set_max_dust_htlc_exposure_msat"))) TS_ChannelConfig_set_max_dust_htlc_exposure_msat(uint32_t this_ptr, int64_t val) {
20797 LDKChannelConfig this_ptr_conv;
20798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20799 this_ptr_conv.is_owned = false;
20800 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20801 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
20804 int64_t __attribute__((export_name("TS_ChannelConfig_get_force_close_avoidance_max_fee_satoshis"))) TS_ChannelConfig_get_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr) {
20805 LDKChannelConfig this_ptr_conv;
20806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20807 this_ptr_conv.is_owned = false;
20808 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20809 int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
20813 void __attribute__((export_name("TS_ChannelConfig_set_force_close_avoidance_max_fee_satoshis"))) TS_ChannelConfig_set_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
20814 LDKChannelConfig this_ptr_conv;
20815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20816 this_ptr_conv.is_owned = false;
20817 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20818 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
20821 uint32_t __attribute__((export_name("TS_ChannelConfig_new"))) TS_ChannelConfig_new(int32_t forwarding_fee_proportional_millionths_arg, int32_t forwarding_fee_base_msat_arg, int16_t cltv_expiry_delta_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg, int64_t max_dust_htlc_exposure_msat_arg, int64_t force_close_avoidance_max_fee_satoshis_arg) {
20822 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);
20823 uint32_t ret_ref = 0;
20824 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20825 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20826 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20827 ret_ref = (uintptr_t)ret_var.inner;
20828 if (ret_var.is_owned) {
20834 static inline uintptr_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
20835 LDKChannelConfig ret_var = ChannelConfig_clone(arg);
20836 uint32_t ret_ref = 0;
20837 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20838 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20839 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20840 ret_ref = (uintptr_t)ret_var.inner;
20841 if (ret_var.is_owned) {
20846 uint32_t __attribute__((export_name("TS_ChannelConfig_clone_ptr"))) TS_ChannelConfig_clone_ptr(uint32_t arg) {
20847 LDKChannelConfig arg_conv;
20848 arg_conv.inner = (void*)(arg & (~1));
20849 arg_conv.is_owned = false;
20850 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20851 uint32_t ret_val = ChannelConfig_clone_ptr(&arg_conv);
20855 uint32_t __attribute__((export_name("TS_ChannelConfig_clone"))) TS_ChannelConfig_clone(uint32_t orig) {
20856 LDKChannelConfig orig_conv;
20857 orig_conv.inner = (void*)(orig & (~1));
20858 orig_conv.is_owned = false;
20859 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20860 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
20861 uint32_t ret_ref = 0;
20862 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20863 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20864 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20865 ret_ref = (uintptr_t)ret_var.inner;
20866 if (ret_var.is_owned) {
20872 uint32_t __attribute__((export_name("TS_ChannelConfig_default"))) TS_ChannelConfig_default() {
20873 LDKChannelConfig ret_var = ChannelConfig_default();
20874 uint32_t ret_ref = 0;
20875 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20876 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20877 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20878 ret_ref = (uintptr_t)ret_var.inner;
20879 if (ret_var.is_owned) {
20885 int8_tArray __attribute__((export_name("TS_ChannelConfig_write"))) TS_ChannelConfig_write(uint32_t obj) {
20886 LDKChannelConfig obj_conv;
20887 obj_conv.inner = (void*)(obj & (~1));
20888 obj_conv.is_owned = false;
20889 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
20890 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
20891 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
20892 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20893 CVec_u8Z_free(ret_var);
20897 uint32_t __attribute__((export_name("TS_ChannelConfig_read"))) TS_ChannelConfig_read(int8_tArray ser) {
20898 LDKu8slice ser_ref;
20899 ser_ref.datalen = ser->arr_len;
20900 ser_ref.data = ser->elems /* XXX ser leaks */;
20901 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
20902 *ret_conv = ChannelConfig_read(ser_ref);
20903 return (uint32_t)ret_conv;
20906 void __attribute__((export_name("TS_UserConfig_free"))) TS_UserConfig_free(uint32_t this_obj) {
20907 LDKUserConfig this_obj_conv;
20908 this_obj_conv.inner = (void*)(this_obj & (~1));
20909 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20910 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20911 UserConfig_free(this_obj_conv);
20914 uint32_t __attribute__((export_name("TS_UserConfig_get_own_channel_config"))) TS_UserConfig_get_own_channel_config(uint32_t this_ptr) {
20915 LDKUserConfig this_ptr_conv;
20916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20917 this_ptr_conv.is_owned = false;
20918 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20919 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
20920 uint32_t ret_ref = 0;
20921 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20922 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20923 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20924 ret_ref = (uintptr_t)ret_var.inner;
20925 if (ret_var.is_owned) {
20931 void __attribute__((export_name("TS_UserConfig_set_own_channel_config"))) TS_UserConfig_set_own_channel_config(uint32_t this_ptr, uint32_t val) {
20932 LDKUserConfig 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 LDKChannelHandshakeConfig val_conv;
20937 val_conv.inner = (void*)(val & (~1));
20938 val_conv.is_owned = (val & 1) || (val == 0);
20939 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
20940 val_conv = ChannelHandshakeConfig_clone(&val_conv);
20941 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
20944 uint32_t __attribute__((export_name("TS_UserConfig_get_peer_channel_config_limits"))) TS_UserConfig_get_peer_channel_config_limits(uint32_t this_ptr) {
20945 LDKUserConfig this_ptr_conv;
20946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20947 this_ptr_conv.is_owned = false;
20948 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20949 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
20950 uint32_t ret_ref = 0;
20951 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20952 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20953 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20954 ret_ref = (uintptr_t)ret_var.inner;
20955 if (ret_var.is_owned) {
20961 void __attribute__((export_name("TS_UserConfig_set_peer_channel_config_limits"))) TS_UserConfig_set_peer_channel_config_limits(uint32_t this_ptr, uint32_t val) {
20962 LDKUserConfig this_ptr_conv;
20963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20964 this_ptr_conv.is_owned = false;
20965 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20966 LDKChannelHandshakeLimits val_conv;
20967 val_conv.inner = (void*)(val & (~1));
20968 val_conv.is_owned = (val & 1) || (val == 0);
20969 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
20970 val_conv = ChannelHandshakeLimits_clone(&val_conv);
20971 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
20974 uint32_t __attribute__((export_name("TS_UserConfig_get_channel_options"))) TS_UserConfig_get_channel_options(uint32_t this_ptr) {
20975 LDKUserConfig this_ptr_conv;
20976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20977 this_ptr_conv.is_owned = false;
20978 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20979 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
20980 uint32_t ret_ref = 0;
20981 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20982 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20983 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20984 ret_ref = (uintptr_t)ret_var.inner;
20985 if (ret_var.is_owned) {
20991 void __attribute__((export_name("TS_UserConfig_set_channel_options"))) TS_UserConfig_set_channel_options(uint32_t this_ptr, uint32_t val) {
20992 LDKUserConfig this_ptr_conv;
20993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20994 this_ptr_conv.is_owned = false;
20995 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20996 LDKChannelConfig val_conv;
20997 val_conv.inner = (void*)(val & (~1));
20998 val_conv.is_owned = (val & 1) || (val == 0);
20999 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21000 val_conv = ChannelConfig_clone(&val_conv);
21001 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
21004 jboolean __attribute__((export_name("TS_UserConfig_get_accept_forwards_to_priv_channels"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint32_t this_ptr) {
21005 LDKUserConfig this_ptr_conv;
21006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21007 this_ptr_conv.is_owned = false;
21008 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21009 jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
21013 void __attribute__((export_name("TS_UserConfig_set_accept_forwards_to_priv_channels"))) TS_UserConfig_set_accept_forwards_to_priv_channels(uint32_t this_ptr, jboolean val) {
21014 LDKUserConfig this_ptr_conv;
21015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21016 this_ptr_conv.is_owned = false;
21017 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21018 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
21021 jboolean __attribute__((export_name("TS_UserConfig_get_accept_inbound_channels"))) TS_UserConfig_get_accept_inbound_channels(uint32_t this_ptr) {
21022 LDKUserConfig this_ptr_conv;
21023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21024 this_ptr_conv.is_owned = false;
21025 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21026 jboolean ret_val = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
21030 void __attribute__((export_name("TS_UserConfig_set_accept_inbound_channels"))) TS_UserConfig_set_accept_inbound_channels(uint32_t this_ptr, jboolean val) {
21031 LDKUserConfig this_ptr_conv;
21032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21033 this_ptr_conv.is_owned = false;
21034 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21035 UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
21038 jboolean __attribute__((export_name("TS_UserConfig_get_manually_accept_inbound_channels"))) TS_UserConfig_get_manually_accept_inbound_channels(uint32_t this_ptr) {
21039 LDKUserConfig this_ptr_conv;
21040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21041 this_ptr_conv.is_owned = false;
21042 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21043 jboolean ret_val = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
21047 void __attribute__((export_name("TS_UserConfig_set_manually_accept_inbound_channels"))) TS_UserConfig_set_manually_accept_inbound_channels(uint32_t this_ptr, jboolean val) {
21048 LDKUserConfig this_ptr_conv;
21049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21050 this_ptr_conv.is_owned = false;
21051 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21052 UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
21055 uint32_t __attribute__((export_name("TS_UserConfig_new"))) TS_UserConfig_new(uint32_t own_channel_config_arg, uint32_t peer_channel_config_limits_arg, uint32_t channel_options_arg, jboolean accept_forwards_to_priv_channels_arg, jboolean accept_inbound_channels_arg, jboolean manually_accept_inbound_channels_arg) {
21056 LDKChannelHandshakeConfig own_channel_config_arg_conv;
21057 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
21058 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
21059 CHECK_INNER_FIELD_ACCESS_OR_NULL(own_channel_config_arg_conv);
21060 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
21061 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
21062 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
21063 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
21064 CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_channel_config_limits_arg_conv);
21065 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
21066 LDKChannelConfig channel_options_arg_conv;
21067 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
21068 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
21069 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_options_arg_conv);
21070 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
21071 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, manually_accept_inbound_channels_arg);
21072 uint32_t ret_ref = 0;
21073 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21074 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21075 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21076 ret_ref = (uintptr_t)ret_var.inner;
21077 if (ret_var.is_owned) {
21083 static inline uintptr_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
21084 LDKUserConfig ret_var = UserConfig_clone(arg);
21085 uint32_t ret_ref = 0;
21086 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21087 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21088 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21089 ret_ref = (uintptr_t)ret_var.inner;
21090 if (ret_var.is_owned) {
21095 uint32_t __attribute__((export_name("TS_UserConfig_clone_ptr"))) TS_UserConfig_clone_ptr(uint32_t arg) {
21096 LDKUserConfig arg_conv;
21097 arg_conv.inner = (void*)(arg & (~1));
21098 arg_conv.is_owned = false;
21099 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21100 uint32_t ret_val = UserConfig_clone_ptr(&arg_conv);
21104 uint32_t __attribute__((export_name("TS_UserConfig_clone"))) TS_UserConfig_clone(uint32_t orig) {
21105 LDKUserConfig orig_conv;
21106 orig_conv.inner = (void*)(orig & (~1));
21107 orig_conv.is_owned = false;
21108 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21109 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
21110 uint32_t ret_ref = 0;
21111 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21112 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21113 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21114 ret_ref = (uintptr_t)ret_var.inner;
21115 if (ret_var.is_owned) {
21121 uint32_t __attribute__((export_name("TS_UserConfig_default"))) TS_UserConfig_default() {
21122 LDKUserConfig ret_var = UserConfig_default();
21123 uint32_t ret_ref = 0;
21124 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21125 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21126 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21127 ret_ref = (uintptr_t)ret_var.inner;
21128 if (ret_var.is_owned) {
21134 void __attribute__((export_name("TS_BestBlock_free"))) TS_BestBlock_free(uint32_t this_obj) {
21135 LDKBestBlock this_obj_conv;
21136 this_obj_conv.inner = (void*)(this_obj & (~1));
21137 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21138 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21139 BestBlock_free(this_obj_conv);
21142 static inline uintptr_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
21143 LDKBestBlock ret_var = BestBlock_clone(arg);
21144 uint32_t ret_ref = 0;
21145 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21146 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21147 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21148 ret_ref = (uintptr_t)ret_var.inner;
21149 if (ret_var.is_owned) {
21154 uint32_t __attribute__((export_name("TS_BestBlock_clone_ptr"))) TS_BestBlock_clone_ptr(uint32_t arg) {
21155 LDKBestBlock arg_conv;
21156 arg_conv.inner = (void*)(arg & (~1));
21157 arg_conv.is_owned = false;
21158 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21159 uint32_t ret_val = BestBlock_clone_ptr(&arg_conv);
21163 uint32_t __attribute__((export_name("TS_BestBlock_clone"))) TS_BestBlock_clone(uint32_t orig) {
21164 LDKBestBlock orig_conv;
21165 orig_conv.inner = (void*)(orig & (~1));
21166 orig_conv.is_owned = false;
21167 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21168 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
21169 uint32_t ret_ref = 0;
21170 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21171 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21172 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21173 ret_ref = (uintptr_t)ret_var.inner;
21174 if (ret_var.is_owned) {
21180 uint32_t __attribute__((export_name("TS_BestBlock_from_genesis"))) TS_BestBlock_from_genesis(uint32_t network) {
21181 LDKNetwork network_conv = LDKNetwork_from_js(network);
21182 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
21183 uint32_t ret_ref = 0;
21184 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21185 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21186 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21187 ret_ref = (uintptr_t)ret_var.inner;
21188 if (ret_var.is_owned) {
21194 uint32_t __attribute__((export_name("TS_BestBlock_new"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
21195 LDKThirtyTwoBytes block_hash_ref;
21196 CHECK(block_hash->arr_len == 32);
21197 memcpy(block_hash_ref.data, block_hash->elems, 32); FREE(block_hash);
21198 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
21199 uint32_t ret_ref = 0;
21200 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21201 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21202 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21203 ret_ref = (uintptr_t)ret_var.inner;
21204 if (ret_var.is_owned) {
21210 int8_tArray __attribute__((export_name("TS_BestBlock_block_hash"))) TS_BestBlock_block_hash(uint32_t this_arg) {
21211 LDKBestBlock this_arg_conv;
21212 this_arg_conv.inner = (void*)(this_arg & (~1));
21213 this_arg_conv.is_owned = false;
21214 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21215 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
21216 memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
21220 int32_t __attribute__((export_name("TS_BestBlock_height"))) TS_BestBlock_height(uint32_t this_arg) {
21221 LDKBestBlock this_arg_conv;
21222 this_arg_conv.inner = (void*)(this_arg & (~1));
21223 this_arg_conv.is_owned = false;
21224 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21225 int32_t ret_val = BestBlock_height(&this_arg_conv);
21229 uint32_t __attribute__((export_name("TS_AccessError_clone"))) TS_AccessError_clone(uint32_t orig) {
21230 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
21231 uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
21235 uint32_t __attribute__((export_name("TS_AccessError_unknown_chain"))) TS_AccessError_unknown_chain() {
21236 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_chain());
21240 uint32_t __attribute__((export_name("TS_AccessError_unknown_tx"))) TS_AccessError_unknown_tx() {
21241 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_tx());
21245 void __attribute__((export_name("TS_Access_free"))) TS_Access_free(uint32_t this_ptr) {
21246 if ((this_ptr & 1) != 0) return;
21247 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
21248 CHECK_ACCESS(this_ptr_ptr);
21249 LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
21250 FREE((void*)this_ptr);
21251 Access_free(this_ptr_conv);
21254 void __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint32_t this_ptr) {
21255 if ((this_ptr & 1) != 0) return;
21256 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
21257 CHECK_ACCESS(this_ptr_ptr);
21258 LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
21259 FREE((void*)this_ptr);
21260 Listen_free(this_ptr_conv);
21263 void __attribute__((export_name("TS_Confirm_free"))) TS_Confirm_free(uint32_t this_ptr) {
21264 if ((this_ptr & 1) != 0) return;
21265 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
21266 CHECK_ACCESS(this_ptr_ptr);
21267 LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
21268 FREE((void*)this_ptr);
21269 Confirm_free(this_ptr_conv);
21272 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdateErr_clone"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) {
21273 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
21274 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
21278 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdateErr_temporary_failure"))) TS_ChannelMonitorUpdateErr_temporary_failure() {
21279 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_temporary_failure());
21283 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdateErr_permanent_failure"))) TS_ChannelMonitorUpdateErr_permanent_failure() {
21284 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_permanent_failure());
21288 void __attribute__((export_name("TS_Watch_free"))) TS_Watch_free(uint32_t this_ptr) {
21289 if ((this_ptr & 1) != 0) return;
21290 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
21291 CHECK_ACCESS(this_ptr_ptr);
21292 LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
21293 FREE((void*)this_ptr);
21294 Watch_free(this_ptr_conv);
21297 void __attribute__((export_name("TS_Filter_free"))) TS_Filter_free(uint32_t this_ptr) {
21298 if ((this_ptr & 1) != 0) return;
21299 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
21300 CHECK_ACCESS(this_ptr_ptr);
21301 LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
21302 FREE((void*)this_ptr);
21303 Filter_free(this_ptr_conv);
21306 void __attribute__((export_name("TS_WatchedOutput_free"))) TS_WatchedOutput_free(uint32_t this_obj) {
21307 LDKWatchedOutput this_obj_conv;
21308 this_obj_conv.inner = (void*)(this_obj & (~1));
21309 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21310 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21311 WatchedOutput_free(this_obj_conv);
21314 int8_tArray __attribute__((export_name("TS_WatchedOutput_get_block_hash"))) TS_WatchedOutput_get_block_hash(uint32_t this_ptr) {
21315 LDKWatchedOutput this_ptr_conv;
21316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21317 this_ptr_conv.is_owned = false;
21318 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21319 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
21320 memcpy(ret_arr->elems, WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
21324 void __attribute__((export_name("TS_WatchedOutput_set_block_hash"))) TS_WatchedOutput_set_block_hash(uint32_t this_ptr, int8_tArray val) {
21325 LDKWatchedOutput this_ptr_conv;
21326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21327 this_ptr_conv.is_owned = false;
21328 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21329 LDKThirtyTwoBytes val_ref;
21330 CHECK(val->arr_len == 32);
21331 memcpy(val_ref.data, val->elems, 32); FREE(val);
21332 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
21335 uint32_t __attribute__((export_name("TS_WatchedOutput_get_outpoint"))) TS_WatchedOutput_get_outpoint(uint32_t this_ptr) {
21336 LDKWatchedOutput this_ptr_conv;
21337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21338 this_ptr_conv.is_owned = false;
21339 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21340 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
21341 uint32_t ret_ref = 0;
21342 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21343 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21344 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21345 ret_ref = (uintptr_t)ret_var.inner;
21346 if (ret_var.is_owned) {
21352 void __attribute__((export_name("TS_WatchedOutput_set_outpoint"))) TS_WatchedOutput_set_outpoint(uint32_t this_ptr, uint32_t val) {
21353 LDKWatchedOutput this_ptr_conv;
21354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21355 this_ptr_conv.is_owned = false;
21356 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21357 LDKOutPoint val_conv;
21358 val_conv.inner = (void*)(val & (~1));
21359 val_conv.is_owned = (val & 1) || (val == 0);
21360 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21361 val_conv = OutPoint_clone(&val_conv);
21362 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
21365 int8_tArray __attribute__((export_name("TS_WatchedOutput_get_script_pubkey"))) TS_WatchedOutput_get_script_pubkey(uint32_t this_ptr) {
21366 LDKWatchedOutput this_ptr_conv;
21367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21368 this_ptr_conv.is_owned = false;
21369 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21370 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
21371 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21372 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21376 void __attribute__((export_name("TS_WatchedOutput_set_script_pubkey"))) TS_WatchedOutput_set_script_pubkey(uint32_t this_ptr, int8_tArray val) {
21377 LDKWatchedOutput this_ptr_conv;
21378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21379 this_ptr_conv.is_owned = false;
21380 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21381 LDKCVec_u8Z val_ref;
21382 val_ref.datalen = val->arr_len;
21383 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
21384 memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
21385 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
21388 uint32_t __attribute__((export_name("TS_WatchedOutput_new"))) TS_WatchedOutput_new(int8_tArray block_hash_arg, uint32_t outpoint_arg, int8_tArray script_pubkey_arg) {
21389 LDKThirtyTwoBytes block_hash_arg_ref;
21390 CHECK(block_hash_arg->arr_len == 32);
21391 memcpy(block_hash_arg_ref.data, block_hash_arg->elems, 32); FREE(block_hash_arg);
21392 LDKOutPoint outpoint_arg_conv;
21393 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
21394 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
21395 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
21396 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
21397 LDKCVec_u8Z script_pubkey_arg_ref;
21398 script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
21399 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
21400 memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
21401 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
21402 uint32_t ret_ref = 0;
21403 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21404 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21405 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21406 ret_ref = (uintptr_t)ret_var.inner;
21407 if (ret_var.is_owned) {
21413 static inline uintptr_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
21414 LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
21415 uint32_t ret_ref = 0;
21416 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21417 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21418 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21419 ret_ref = (uintptr_t)ret_var.inner;
21420 if (ret_var.is_owned) {
21425 uint32_t __attribute__((export_name("TS_WatchedOutput_clone_ptr"))) TS_WatchedOutput_clone_ptr(uint32_t arg) {
21426 LDKWatchedOutput arg_conv;
21427 arg_conv.inner = (void*)(arg & (~1));
21428 arg_conv.is_owned = false;
21429 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21430 uint32_t ret_val = WatchedOutput_clone_ptr(&arg_conv);
21434 uint32_t __attribute__((export_name("TS_WatchedOutput_clone"))) TS_WatchedOutput_clone(uint32_t orig) {
21435 LDKWatchedOutput orig_conv;
21436 orig_conv.inner = (void*)(orig & (~1));
21437 orig_conv.is_owned = false;
21438 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21439 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
21440 uint32_t ret_ref = 0;
21441 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21442 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21443 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21444 ret_ref = (uintptr_t)ret_var.inner;
21445 if (ret_var.is_owned) {
21451 int64_t __attribute__((export_name("TS_WatchedOutput_hash"))) TS_WatchedOutput_hash(uint32_t o) {
21452 LDKWatchedOutput o_conv;
21453 o_conv.inner = (void*)(o & (~1));
21454 o_conv.is_owned = false;
21455 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21456 int64_t ret_val = WatchedOutput_hash(&o_conv);
21460 void __attribute__((export_name("TS_BroadcasterInterface_free"))) TS_BroadcasterInterface_free(uint32_t this_ptr) {
21461 if ((this_ptr & 1) != 0) return;
21462 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
21463 CHECK_ACCESS(this_ptr_ptr);
21464 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
21465 FREE((void*)this_ptr);
21466 BroadcasterInterface_free(this_ptr_conv);
21469 uint32_t __attribute__((export_name("TS_ConfirmationTarget_clone"))) TS_ConfirmationTarget_clone(uint32_t orig) {
21470 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
21471 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
21475 uint32_t __attribute__((export_name("TS_ConfirmationTarget_background"))) TS_ConfirmationTarget_background() {
21476 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
21480 uint32_t __attribute__((export_name("TS_ConfirmationTarget_normal"))) TS_ConfirmationTarget_normal() {
21481 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
21485 uint32_t __attribute__((export_name("TS_ConfirmationTarget_high_priority"))) TS_ConfirmationTarget_high_priority() {
21486 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
21490 jboolean __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint32_t a, uint32_t b) {
21491 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
21492 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
21493 jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
21497 void __attribute__((export_name("TS_FeeEstimator_free"))) TS_FeeEstimator_free(uint32_t this_ptr) {
21498 if ((this_ptr & 1) != 0) return;
21499 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
21500 CHECK_ACCESS(this_ptr_ptr);
21501 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
21502 FREE((void*)this_ptr);
21503 FeeEstimator_free(this_ptr_conv);
21506 void __attribute__((export_name("TS_MonitorUpdateId_free"))) TS_MonitorUpdateId_free(uint32_t this_obj) {
21507 LDKMonitorUpdateId this_obj_conv;
21508 this_obj_conv.inner = (void*)(this_obj & (~1));
21509 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21510 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21511 MonitorUpdateId_free(this_obj_conv);
21514 static inline uintptr_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
21515 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
21516 uint32_t ret_ref = 0;
21517 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21518 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21519 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21520 ret_ref = (uintptr_t)ret_var.inner;
21521 if (ret_var.is_owned) {
21526 uint32_t __attribute__((export_name("TS_MonitorUpdateId_clone_ptr"))) TS_MonitorUpdateId_clone_ptr(uint32_t arg) {
21527 LDKMonitorUpdateId arg_conv;
21528 arg_conv.inner = (void*)(arg & (~1));
21529 arg_conv.is_owned = false;
21530 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21531 uint32_t ret_val = MonitorUpdateId_clone_ptr(&arg_conv);
21535 uint32_t __attribute__((export_name("TS_MonitorUpdateId_clone"))) TS_MonitorUpdateId_clone(uint32_t orig) {
21536 LDKMonitorUpdateId orig_conv;
21537 orig_conv.inner = (void*)(orig & (~1));
21538 orig_conv.is_owned = false;
21539 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21540 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
21541 uint32_t ret_ref = 0;
21542 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21543 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21544 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21545 ret_ref = (uintptr_t)ret_var.inner;
21546 if (ret_var.is_owned) {
21552 int64_t __attribute__((export_name("TS_MonitorUpdateId_hash"))) TS_MonitorUpdateId_hash(uint32_t o) {
21553 LDKMonitorUpdateId o_conv;
21554 o_conv.inner = (void*)(o & (~1));
21555 o_conv.is_owned = false;
21556 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21557 int64_t ret_val = MonitorUpdateId_hash(&o_conv);
21561 jboolean __attribute__((export_name("TS_MonitorUpdateId_eq"))) TS_MonitorUpdateId_eq(uint32_t a, uint32_t b) {
21562 LDKMonitorUpdateId a_conv;
21563 a_conv.inner = (void*)(a & (~1));
21564 a_conv.is_owned = false;
21565 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
21566 LDKMonitorUpdateId b_conv;
21567 b_conv.inner = (void*)(b & (~1));
21568 b_conv.is_owned = false;
21569 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
21570 jboolean ret_val = MonitorUpdateId_eq(&a_conv, &b_conv);
21574 void __attribute__((export_name("TS_Persist_free"))) TS_Persist_free(uint32_t this_ptr) {
21575 if ((this_ptr & 1) != 0) return;
21576 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
21577 CHECK_ACCESS(this_ptr_ptr);
21578 LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
21579 FREE((void*)this_ptr);
21580 Persist_free(this_ptr_conv);
21583 void __attribute__((export_name("TS_LockedChannelMonitor_free"))) TS_LockedChannelMonitor_free(uint32_t this_obj) {
21584 LDKLockedChannelMonitor this_obj_conv;
21585 this_obj_conv.inner = (void*)(this_obj & (~1));
21586 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21587 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21588 LockedChannelMonitor_free(this_obj_conv);
21591 void __attribute__((export_name("TS_ChainMonitor_free"))) TS_ChainMonitor_free(uint32_t this_obj) {
21592 LDKChainMonitor this_obj_conv;
21593 this_obj_conv.inner = (void*)(this_obj & (~1));
21594 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21595 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21596 ChainMonitor_free(this_obj_conv);
21599 uint32_t __attribute__((export_name("TS_ChainMonitor_new"))) TS_ChainMonitor_new(uint32_t chain_source, uint32_t broadcaster, uint32_t logger, uint32_t feeest, uint32_t persister) {
21600 void* chain_source_ptr = (void*)(((uintptr_t)chain_source) & ~1);
21601 CHECK_ACCESS(chain_source_ptr);
21602 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
21603 // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
21604 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
21605 // Manually implement clone for Java trait instances
21607 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
21608 CHECK_ACCESS(broadcaster_ptr);
21609 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
21610 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
21611 CHECK_ACCESS(logger_ptr);
21612 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
21613 void* feeest_ptr = (void*)(((uintptr_t)feeest) & ~1);
21614 CHECK_ACCESS(feeest_ptr);
21615 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
21616 void* persister_ptr = (void*)(((uintptr_t)persister) & ~1);
21617 CHECK_ACCESS(persister_ptr);
21618 LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
21619 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
21620 uint32_t ret_ref = 0;
21621 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21622 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21623 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21624 ret_ref = (uintptr_t)ret_var.inner;
21625 if (ret_var.is_owned) {
21631 uint32_tArray __attribute__((export_name("TS_ChainMonitor_get_claimable_balances"))) TS_ChainMonitor_get_claimable_balances(uint32_t this_arg, uint32_tArray ignored_channels) {
21632 LDKChainMonitor this_arg_conv;
21633 this_arg_conv.inner = (void*)(this_arg & (~1));
21634 this_arg_conv.is_owned = false;
21635 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21636 LDKCVec_ChannelDetailsZ ignored_channels_constr;
21637 ignored_channels_constr.datalen = ignored_channels->arr_len;
21638 if (ignored_channels_constr.datalen > 0)
21639 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
21641 ignored_channels_constr.data = NULL;
21642 uint32_t* ignored_channels_vals = ignored_channels->elems /* XXX ignored_channels leaks */;
21643 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
21644 uint32_t ignored_channels_conv_16 = ignored_channels_vals[q];
21645 LDKChannelDetails ignored_channels_conv_16_conv;
21646 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
21647 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
21648 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
21649 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
21650 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
21652 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
21653 uint32_tArray ret_arr = NULL;
21654 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
21655 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
21656 for (size_t j = 0; j < ret_var.datalen; j++) {
21657 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
21658 *ret_conv_9_copy = ret_var.data[j];
21659 uint32_t ret_conv_9_ref = (uintptr_t)ret_conv_9_copy;
21660 ret_arr_ptr[j] = ret_conv_9_ref;
21663 FREE(ret_var.data);
21667 uint32_t __attribute__((export_name("TS_ChainMonitor_get_monitor"))) TS_ChainMonitor_get_monitor(uint32_t this_arg, uint32_t funding_txo) {
21668 LDKChainMonitor this_arg_conv;
21669 this_arg_conv.inner = (void*)(this_arg & (~1));
21670 this_arg_conv.is_owned = false;
21671 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21672 LDKOutPoint funding_txo_conv;
21673 funding_txo_conv.inner = (void*)(funding_txo & (~1));
21674 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
21675 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
21676 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
21677 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
21678 *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
21679 return (uint32_t)ret_conv;
21682 uint32_tArray __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ChainMonitor_list_monitors(uint32_t this_arg) {
21683 LDKChainMonitor this_arg_conv;
21684 this_arg_conv.inner = (void*)(this_arg & (~1));
21685 this_arg_conv.is_owned = false;
21686 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21687 LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
21688 uint32_tArray ret_arr = NULL;
21689 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
21690 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
21691 for (size_t k = 0; k < ret_var.datalen; k++) {
21692 LDKOutPoint ret_conv_10_var = ret_var.data[k];
21693 uint32_t ret_conv_10_ref = 0;
21694 CHECK((((uintptr_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21695 CHECK((((uintptr_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21696 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
21697 ret_conv_10_ref = (uintptr_t)ret_conv_10_var.inner;
21698 if (ret_conv_10_var.is_owned) {
21699 ret_conv_10_ref |= 1;
21701 ret_arr_ptr[k] = ret_conv_10_ref;
21704 FREE(ret_var.data);
21708 uint32_t __attribute__((export_name("TS_ChainMonitor_channel_monitor_updated"))) TS_ChainMonitor_channel_monitor_updated(uint32_t this_arg, uint32_t funding_txo, uint32_t completed_update_id) {
21709 LDKChainMonitor this_arg_conv;
21710 this_arg_conv.inner = (void*)(this_arg & (~1));
21711 this_arg_conv.is_owned = false;
21712 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21713 LDKOutPoint funding_txo_conv;
21714 funding_txo_conv.inner = (void*)(funding_txo & (~1));
21715 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
21716 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
21717 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
21718 LDKMonitorUpdateId completed_update_id_conv;
21719 completed_update_id_conv.inner = (void*)(completed_update_id & (~1));
21720 completed_update_id_conv.is_owned = (completed_update_id & 1) || (completed_update_id == 0);
21721 CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
21722 completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
21723 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
21724 *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
21725 return (uint32_t)ret_conv;
21728 uint32_t __attribute__((export_name("TS_ChainMonitor_as_Listen"))) TS_ChainMonitor_as_Listen(uint32_t this_arg) {
21729 LDKChainMonitor this_arg_conv;
21730 this_arg_conv.inner = (void*)(this_arg & (~1));
21731 this_arg_conv.is_owned = false;
21732 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21733 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
21734 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
21735 return (uint32_t)ret_ret;
21738 uint32_t __attribute__((export_name("TS_ChainMonitor_as_Confirm"))) TS_ChainMonitor_as_Confirm(uint32_t this_arg) {
21739 LDKChainMonitor this_arg_conv;
21740 this_arg_conv.inner = (void*)(this_arg & (~1));
21741 this_arg_conv.is_owned = false;
21742 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21743 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
21744 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
21745 return (uint32_t)ret_ret;
21748 uint32_t __attribute__((export_name("TS_ChainMonitor_as_Watch"))) TS_ChainMonitor_as_Watch(uint32_t this_arg) {
21749 LDKChainMonitor this_arg_conv;
21750 this_arg_conv.inner = (void*)(this_arg & (~1));
21751 this_arg_conv.is_owned = false;
21752 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21753 LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
21754 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
21755 return (uint32_t)ret_ret;
21758 uint32_t __attribute__((export_name("TS_ChainMonitor_as_EventsProvider"))) TS_ChainMonitor_as_EventsProvider(uint32_t this_arg) {
21759 LDKChainMonitor this_arg_conv;
21760 this_arg_conv.inner = (void*)(this_arg & (~1));
21761 this_arg_conv.is_owned = false;
21762 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21763 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
21764 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
21765 return (uint32_t)ret_ret;
21768 void __attribute__((export_name("TS_ChannelMonitorUpdate_free"))) TS_ChannelMonitorUpdate_free(uint32_t this_obj) {
21769 LDKChannelMonitorUpdate this_obj_conv;
21770 this_obj_conv.inner = (void*)(this_obj & (~1));
21771 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21772 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21773 ChannelMonitorUpdate_free(this_obj_conv);
21776 int64_t __attribute__((export_name("TS_ChannelMonitorUpdate_get_update_id"))) TS_ChannelMonitorUpdate_get_update_id(uint32_t this_ptr) {
21777 LDKChannelMonitorUpdate this_ptr_conv;
21778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21779 this_ptr_conv.is_owned = false;
21780 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21781 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
21785 void __attribute__((export_name("TS_ChannelMonitorUpdate_set_update_id"))) TS_ChannelMonitorUpdate_set_update_id(uint32_t this_ptr, int64_t val) {
21786 LDKChannelMonitorUpdate this_ptr_conv;
21787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21788 this_ptr_conv.is_owned = false;
21789 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21790 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
21793 static inline uintptr_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
21794 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
21795 uint32_t ret_ref = 0;
21796 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21797 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21798 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21799 ret_ref = (uintptr_t)ret_var.inner;
21800 if (ret_var.is_owned) {
21805 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdate_clone_ptr"))) TS_ChannelMonitorUpdate_clone_ptr(uint32_t arg) {
21806 LDKChannelMonitorUpdate arg_conv;
21807 arg_conv.inner = (void*)(arg & (~1));
21808 arg_conv.is_owned = false;
21809 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21810 uint32_t ret_val = ChannelMonitorUpdate_clone_ptr(&arg_conv);
21814 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdate_clone"))) TS_ChannelMonitorUpdate_clone(uint32_t orig) {
21815 LDKChannelMonitorUpdate orig_conv;
21816 orig_conv.inner = (void*)(orig & (~1));
21817 orig_conv.is_owned = false;
21818 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21819 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
21820 uint32_t ret_ref = 0;
21821 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21822 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21823 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21824 ret_ref = (uintptr_t)ret_var.inner;
21825 if (ret_var.is_owned) {
21831 int8_tArray __attribute__((export_name("TS_ChannelMonitorUpdate_write"))) TS_ChannelMonitorUpdate_write(uint32_t obj) {
21832 LDKChannelMonitorUpdate obj_conv;
21833 obj_conv.inner = (void*)(obj & (~1));
21834 obj_conv.is_owned = false;
21835 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
21836 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
21837 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21838 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21839 CVec_u8Z_free(ret_var);
21843 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdate_read"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
21844 LDKu8slice ser_ref;
21845 ser_ref.datalen = ser->arr_len;
21846 ser_ref.data = ser->elems /* XXX ser leaks */;
21847 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
21848 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
21849 return (uint32_t)ret_conv;
21852 void __attribute__((export_name("TS_MonitorEvent_free"))) TS_MonitorEvent_free(uint32_t this_ptr) {
21853 if ((this_ptr & 1) != 0) return;
21854 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
21855 CHECK_ACCESS(this_ptr_ptr);
21856 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
21857 FREE((void*)this_ptr);
21858 MonitorEvent_free(this_ptr_conv);
21861 static inline uintptr_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
21862 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
21863 *ret_copy = MonitorEvent_clone(arg);
21864 uint32_t ret_ref = (uintptr_t)ret_copy;
21867 uint32_t __attribute__((export_name("TS_MonitorEvent_clone_ptr"))) TS_MonitorEvent_clone_ptr(uint32_t arg) {
21868 LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)arg;
21869 uint32_t ret_val = MonitorEvent_clone_ptr(arg_conv);
21873 uint32_t __attribute__((export_name("TS_MonitorEvent_clone"))) TS_MonitorEvent_clone(uint32_t orig) {
21874 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
21875 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
21876 *ret_copy = MonitorEvent_clone(orig_conv);
21877 uint32_t ret_ref = (uintptr_t)ret_copy;
21881 uint32_t __attribute__((export_name("TS_MonitorEvent_htlcevent"))) TS_MonitorEvent_htlcevent(uint32_t a) {
21882 LDKHTLCUpdate a_conv;
21883 a_conv.inner = (void*)(a & (~1));
21884 a_conv.is_owned = (a & 1) || (a == 0);
21885 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
21886 a_conv = HTLCUpdate_clone(&a_conv);
21887 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
21888 *ret_copy = MonitorEvent_htlcevent(a_conv);
21889 uint32_t ret_ref = (uintptr_t)ret_copy;
21893 uint32_t __attribute__((export_name("TS_MonitorEvent_commitment_tx_confirmed"))) TS_MonitorEvent_commitment_tx_confirmed(uint32_t a) {
21894 LDKOutPoint a_conv;
21895 a_conv.inner = (void*)(a & (~1));
21896 a_conv.is_owned = (a & 1) || (a == 0);
21897 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
21898 a_conv = OutPoint_clone(&a_conv);
21899 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
21900 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
21901 uint32_t ret_ref = (uintptr_t)ret_copy;
21905 uint32_t __attribute__((export_name("TS_MonitorEvent_update_completed"))) TS_MonitorEvent_update_completed(uint32_t funding_txo, int64_t monitor_update_id) {
21906 LDKOutPoint funding_txo_conv;
21907 funding_txo_conv.inner = (void*)(funding_txo & (~1));
21908 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
21909 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
21910 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
21911 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
21912 *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id);
21913 uint32_t ret_ref = (uintptr_t)ret_copy;
21917 uint32_t __attribute__((export_name("TS_MonitorEvent_update_failed"))) TS_MonitorEvent_update_failed(uint32_t a) {
21918 LDKOutPoint a_conv;
21919 a_conv.inner = (void*)(a & (~1));
21920 a_conv.is_owned = (a & 1) || (a == 0);
21921 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
21922 a_conv = OutPoint_clone(&a_conv);
21923 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
21924 *ret_copy = MonitorEvent_update_failed(a_conv);
21925 uint32_t ret_ref = (uintptr_t)ret_copy;
21929 int8_tArray __attribute__((export_name("TS_MonitorEvent_write"))) TS_MonitorEvent_write(uint32_t obj) {
21930 LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)obj;
21931 LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
21932 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21933 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21934 CVec_u8Z_free(ret_var);
21938 uint32_t __attribute__((export_name("TS_MonitorEvent_read"))) TS_MonitorEvent_read(int8_tArray ser) {
21939 LDKu8slice ser_ref;
21940 ser_ref.datalen = ser->arr_len;
21941 ser_ref.data = ser->elems /* XXX ser leaks */;
21942 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
21943 *ret_conv = MonitorEvent_read(ser_ref);
21944 return (uint32_t)ret_conv;
21947 void __attribute__((export_name("TS_HTLCUpdate_free"))) TS_HTLCUpdate_free(uint32_t this_obj) {
21948 LDKHTLCUpdate this_obj_conv;
21949 this_obj_conv.inner = (void*)(this_obj & (~1));
21950 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21951 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21952 HTLCUpdate_free(this_obj_conv);
21955 static inline uintptr_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
21956 LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
21957 uint32_t ret_ref = 0;
21958 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21959 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21960 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21961 ret_ref = (uintptr_t)ret_var.inner;
21962 if (ret_var.is_owned) {
21967 uint32_t __attribute__((export_name("TS_HTLCUpdate_clone_ptr"))) TS_HTLCUpdate_clone_ptr(uint32_t arg) {
21968 LDKHTLCUpdate arg_conv;
21969 arg_conv.inner = (void*)(arg & (~1));
21970 arg_conv.is_owned = false;
21971 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21972 uint32_t ret_val = HTLCUpdate_clone_ptr(&arg_conv);
21976 uint32_t __attribute__((export_name("TS_HTLCUpdate_clone"))) TS_HTLCUpdate_clone(uint32_t orig) {
21977 LDKHTLCUpdate orig_conv;
21978 orig_conv.inner = (void*)(orig & (~1));
21979 orig_conv.is_owned = false;
21980 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21981 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
21982 uint32_t ret_ref = 0;
21983 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21984 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21985 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21986 ret_ref = (uintptr_t)ret_var.inner;
21987 if (ret_var.is_owned) {
21993 int8_tArray __attribute__((export_name("TS_HTLCUpdate_write"))) TS_HTLCUpdate_write(uint32_t obj) {
21994 LDKHTLCUpdate obj_conv;
21995 obj_conv.inner = (void*)(obj & (~1));
21996 obj_conv.is_owned = false;
21997 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
21998 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
21999 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22000 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22001 CVec_u8Z_free(ret_var);
22005 uint32_t __attribute__((export_name("TS_HTLCUpdate_read"))) TS_HTLCUpdate_read(int8_tArray ser) {
22006 LDKu8slice ser_ref;
22007 ser_ref.datalen = ser->arr_len;
22008 ser_ref.data = ser->elems /* XXX ser leaks */;
22009 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
22010 *ret_conv = HTLCUpdate_read(ser_ref);
22011 return (uint32_t)ret_conv;
22014 void __attribute__((export_name("TS_Balance_free"))) TS_Balance_free(uint32_t this_ptr) {
22015 if ((this_ptr & 1) != 0) return;
22016 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22017 CHECK_ACCESS(this_ptr_ptr);
22018 LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
22019 FREE((void*)this_ptr);
22020 Balance_free(this_ptr_conv);
22023 static inline uintptr_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
22024 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22025 *ret_copy = Balance_clone(arg);
22026 uint32_t ret_ref = (uintptr_t)ret_copy;
22029 uint32_t __attribute__((export_name("TS_Balance_clone_ptr"))) TS_Balance_clone_ptr(uint32_t arg) {
22030 LDKBalance* arg_conv = (LDKBalance*)arg;
22031 uint32_t ret_val = Balance_clone_ptr(arg_conv);
22035 uint32_t __attribute__((export_name("TS_Balance_clone"))) TS_Balance_clone(uint32_t orig) {
22036 LDKBalance* orig_conv = (LDKBalance*)orig;
22037 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22038 *ret_copy = Balance_clone(orig_conv);
22039 uint32_t ret_ref = (uintptr_t)ret_copy;
22043 uint32_t __attribute__((export_name("TS_Balance_claimable_on_channel_close"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
22044 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22045 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
22046 uint32_t ret_ref = (uintptr_t)ret_copy;
22050 uint32_t __attribute__((export_name("TS_Balance_claimable_awaiting_confirmations"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
22051 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22052 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
22053 uint32_t ret_ref = (uintptr_t)ret_copy;
22057 uint32_t __attribute__((export_name("TS_Balance_contentious_claimable"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
22058 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22059 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
22060 uint32_t ret_ref = (uintptr_t)ret_copy;
22064 uint32_t __attribute__((export_name("TS_Balance_maybe_claimable_htlcawaiting_timeout"))) TS_Balance_maybe_claimable_htlcawaiting_timeout(int64_t claimable_amount_satoshis, int32_t claimable_height) {
22065 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22066 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
22067 uint32_t ret_ref = (uintptr_t)ret_copy;
22071 jboolean __attribute__((export_name("TS_Balance_eq"))) TS_Balance_eq(uint32_t a, uint32_t b) {
22072 LDKBalance* a_conv = (LDKBalance*)a;
22073 LDKBalance* b_conv = (LDKBalance*)b;
22074 jboolean ret_val = Balance_eq(a_conv, b_conv);
22078 void __attribute__((export_name("TS_ChannelMonitor_free"))) TS_ChannelMonitor_free(uint32_t this_obj) {
22079 LDKChannelMonitor this_obj_conv;
22080 this_obj_conv.inner = (void*)(this_obj & (~1));
22081 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22082 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22083 ChannelMonitor_free(this_obj_conv);
22086 static inline uintptr_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
22087 LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
22088 uint32_t ret_ref = 0;
22089 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22090 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22091 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22092 ret_ref = (uintptr_t)ret_var.inner;
22093 if (ret_var.is_owned) {
22098 uint32_t __attribute__((export_name("TS_ChannelMonitor_clone_ptr"))) TS_ChannelMonitor_clone_ptr(uint32_t arg) {
22099 LDKChannelMonitor arg_conv;
22100 arg_conv.inner = (void*)(arg & (~1));
22101 arg_conv.is_owned = false;
22102 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22103 uint32_t ret_val = ChannelMonitor_clone_ptr(&arg_conv);
22107 uint32_t __attribute__((export_name("TS_ChannelMonitor_clone"))) TS_ChannelMonitor_clone(uint32_t orig) {
22108 LDKChannelMonitor orig_conv;
22109 orig_conv.inner = (void*)(orig & (~1));
22110 orig_conv.is_owned = false;
22111 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22112 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
22113 uint32_t ret_ref = 0;
22114 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22115 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22116 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22117 ret_ref = (uintptr_t)ret_var.inner;
22118 if (ret_var.is_owned) {
22124 int8_tArray __attribute__((export_name("TS_ChannelMonitor_write"))) TS_ChannelMonitor_write(uint32_t obj) {
22125 LDKChannelMonitor obj_conv;
22126 obj_conv.inner = (void*)(obj & (~1));
22127 obj_conv.is_owned = false;
22128 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
22129 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
22130 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22131 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22132 CVec_u8Z_free(ret_var);
22136 uint32_t __attribute__((export_name("TS_ChannelMonitor_update_monitor"))) TS_ChannelMonitor_update_monitor(uint32_t this_arg, uint32_t updates, uint32_t broadcaster, uint32_t fee_estimator, uint32_t logger) {
22137 LDKChannelMonitor this_arg_conv;
22138 this_arg_conv.inner = (void*)(this_arg & (~1));
22139 this_arg_conv.is_owned = false;
22140 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22141 LDKChannelMonitorUpdate updates_conv;
22142 updates_conv.inner = (void*)(updates & (~1));
22143 updates_conv.is_owned = false;
22144 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
22145 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
22146 if (!(broadcaster & 1)) { CHECK_ACCESS(broadcaster_ptr); }
22147 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
22148 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
22149 if (!(fee_estimator & 1)) { CHECK_ACCESS(fee_estimator_ptr); }
22150 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
22151 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
22152 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
22153 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
22154 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
22155 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
22156 return (uint32_t)ret_conv;
22159 int64_t __attribute__((export_name("TS_ChannelMonitor_get_latest_update_id"))) TS_ChannelMonitor_get_latest_update_id(uint32_t this_arg) {
22160 LDKChannelMonitor this_arg_conv;
22161 this_arg_conv.inner = (void*)(this_arg & (~1));
22162 this_arg_conv.is_owned = false;
22163 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22164 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
22168 uint32_t __attribute__((export_name("TS_ChannelMonitor_get_funding_txo"))) TS_ChannelMonitor_get_funding_txo(uint32_t this_arg) {
22169 LDKChannelMonitor this_arg_conv;
22170 this_arg_conv.inner = (void*)(this_arg & (~1));
22171 this_arg_conv.is_owned = false;
22172 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22173 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
22174 *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
22175 return ((uint32_t)ret_conv);
22178 uint32_tArray __attribute__((export_name("TS_ChannelMonitor_get_outputs_to_watch"))) TS_ChannelMonitor_get_outputs_to_watch(uint32_t this_arg) {
22179 LDKChannelMonitor this_arg_conv;
22180 this_arg_conv.inner = (void*)(this_arg & (~1));
22181 this_arg_conv.is_owned = false;
22182 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22183 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
22184 uint32_tArray ret_arr = NULL;
22185 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
22186 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
22187 for (size_t o = 0; o < ret_var.datalen; o++) {
22188 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
22189 *ret_conv_40_conv = ret_var.data[o];
22190 ret_arr_ptr[o] = ((uint32_t)ret_conv_40_conv);
22193 FREE(ret_var.data);
22197 void __attribute__((export_name("TS_ChannelMonitor_load_outputs_to_watch"))) TS_ChannelMonitor_load_outputs_to_watch(uint32_t this_arg, uint32_t filter) {
22198 LDKChannelMonitor this_arg_conv;
22199 this_arg_conv.inner = (void*)(this_arg & (~1));
22200 this_arg_conv.is_owned = false;
22201 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22202 void* filter_ptr = (void*)(((uintptr_t)filter) & ~1);
22203 if (!(filter & 1)) { CHECK_ACCESS(filter_ptr); }
22204 LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
22205 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
22208 uint32_tArray __attribute__((export_name("TS_ChannelMonitor_get_and_clear_pending_monitor_events"))) TS_ChannelMonitor_get_and_clear_pending_monitor_events(uint32_t this_arg) {
22209 LDKChannelMonitor this_arg_conv;
22210 this_arg_conv.inner = (void*)(this_arg & (~1));
22211 this_arg_conv.is_owned = false;
22212 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22213 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
22214 uint32_tArray ret_arr = NULL;
22215 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
22216 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
22217 for (size_t o = 0; o < ret_var.datalen; o++) {
22218 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22219 *ret_conv_14_copy = ret_var.data[o];
22220 uint32_t ret_conv_14_ref = (uintptr_t)ret_conv_14_copy;
22221 ret_arr_ptr[o] = ret_conv_14_ref;
22224 FREE(ret_var.data);
22228 uint32_tArray __attribute__((export_name("TS_ChannelMonitor_get_and_clear_pending_events"))) TS_ChannelMonitor_get_and_clear_pending_events(uint32_t this_arg) {
22229 LDKChannelMonitor this_arg_conv;
22230 this_arg_conv.inner = (void*)(this_arg & (~1));
22231 this_arg_conv.is_owned = false;
22232 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22233 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
22234 uint32_tArray ret_arr = NULL;
22235 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
22236 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
22237 for (size_t h = 0; h < ret_var.datalen; h++) {
22238 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22239 *ret_conv_7_copy = ret_var.data[h];
22240 uint32_t ret_conv_7_ref = (uintptr_t)ret_conv_7_copy;
22241 ret_arr_ptr[h] = ret_conv_7_ref;
22244 FREE(ret_var.data);
22248 ptrArray __attribute__((export_name("TS_ChannelMonitor_get_latest_holder_commitment_txn"))) TS_ChannelMonitor_get_latest_holder_commitment_txn(uint32_t this_arg, uint32_t logger) {
22249 LDKChannelMonitor this_arg_conv;
22250 this_arg_conv.inner = (void*)(this_arg & (~1));
22251 this_arg_conv.is_owned = false;
22252 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22253 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
22254 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
22255 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
22256 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
22257 ptrArray ret_arr = NULL;
22258 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
22259 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
22260 for (size_t m = 0; m < ret_var.datalen; m++) {
22261 LDKTransaction ret_conv_12_var = ret_var.data[m];
22262 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
22263 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
22264 Transaction_free(ret_conv_12_var);
22265 ret_arr_ptr[m] = ret_conv_12_arr;
22268 FREE(ret_var.data);
22272 uint32_tArray __attribute__((export_name("TS_ChannelMonitor_block_connected"))) TS_ChannelMonitor_block_connected(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height, uint32_t broadcaster, uint32_t fee_estimator, uint32_t logger) {
22273 LDKChannelMonitor this_arg_conv;
22274 this_arg_conv.inner = (void*)(this_arg & (~1));
22275 this_arg_conv.is_owned = false;
22276 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22277 unsigned char header_arr[80];
22278 CHECK(header->arr_len == 80);
22279 memcpy(header_arr, header->elems, 80); FREE(header);
22280 unsigned char (*header_ref)[80] = &header_arr;
22281 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
22282 txdata_constr.datalen = txdata->arr_len;
22283 if (txdata_constr.datalen > 0)
22284 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
22286 txdata_constr.data = NULL;
22287 uint32_t* txdata_vals = txdata->elems /* XXX txdata leaks */;
22288 for (size_t c = 0; c < txdata_constr.datalen; c++) {
22289 uint32_t txdata_conv_28 = txdata_vals[c];
22290 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
22291 CHECK_ACCESS(txdata_conv_28_ptr);
22292 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
22293 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
22294 txdata_constr.data[c] = txdata_conv_28_conv;
22296 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
22297 CHECK_ACCESS(broadcaster_ptr);
22298 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
22299 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
22300 CHECK_ACCESS(fee_estimator_ptr);
22301 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
22302 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
22303 CHECK_ACCESS(logger_ptr);
22304 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
22305 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);
22306 uint32_tArray ret_arr = NULL;
22307 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
22308 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
22309 for (size_t n = 0; n < ret_var.datalen; n++) {
22310 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
22311 *ret_conv_39_conv = ret_var.data[n];
22312 ret_arr_ptr[n] = ((uint32_t)ret_conv_39_conv);
22315 FREE(ret_var.data);
22319 void __attribute__((export_name("TS_ChannelMonitor_block_disconnected"))) TS_ChannelMonitor_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height, uint32_t broadcaster, uint32_t fee_estimator, uint32_t logger) {
22320 LDKChannelMonitor this_arg_conv;
22321 this_arg_conv.inner = (void*)(this_arg & (~1));
22322 this_arg_conv.is_owned = false;
22323 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22324 unsigned char header_arr[80];
22325 CHECK(header->arr_len == 80);
22326 memcpy(header_arr, header->elems, 80); FREE(header);
22327 unsigned char (*header_ref)[80] = &header_arr;
22328 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
22329 CHECK_ACCESS(broadcaster_ptr);
22330 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
22331 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
22332 CHECK_ACCESS(fee_estimator_ptr);
22333 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
22334 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
22335 CHECK_ACCESS(logger_ptr);
22336 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
22337 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
22340 uint32_tArray __attribute__((export_name("TS_ChannelMonitor_transactions_confirmed"))) TS_ChannelMonitor_transactions_confirmed(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height, uint32_t broadcaster, uint32_t fee_estimator, uint32_t logger) {
22341 LDKChannelMonitor this_arg_conv;
22342 this_arg_conv.inner = (void*)(this_arg & (~1));
22343 this_arg_conv.is_owned = false;
22344 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22345 unsigned char header_arr[80];
22346 CHECK(header->arr_len == 80);
22347 memcpy(header_arr, header->elems, 80); FREE(header);
22348 unsigned char (*header_ref)[80] = &header_arr;
22349 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
22350 txdata_constr.datalen = txdata->arr_len;
22351 if (txdata_constr.datalen > 0)
22352 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
22354 txdata_constr.data = NULL;
22355 uint32_t* txdata_vals = txdata->elems /* XXX txdata leaks */;
22356 for (size_t c = 0; c < txdata_constr.datalen; c++) {
22357 uint32_t txdata_conv_28 = txdata_vals[c];
22358 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
22359 CHECK_ACCESS(txdata_conv_28_ptr);
22360 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
22361 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
22362 txdata_constr.data[c] = txdata_conv_28_conv;
22364 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
22365 CHECK_ACCESS(broadcaster_ptr);
22366 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
22367 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
22368 CHECK_ACCESS(fee_estimator_ptr);
22369 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
22370 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
22371 CHECK_ACCESS(logger_ptr);
22372 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
22373 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);
22374 uint32_tArray ret_arr = NULL;
22375 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
22376 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
22377 for (size_t n = 0; n < ret_var.datalen; n++) {
22378 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
22379 *ret_conv_39_conv = ret_var.data[n];
22380 ret_arr_ptr[n] = ((uint32_t)ret_conv_39_conv);
22383 FREE(ret_var.data);
22387 void __attribute__((export_name("TS_ChannelMonitor_transaction_unconfirmed"))) TS_ChannelMonitor_transaction_unconfirmed(uint32_t this_arg, int8_tArray txid, uint32_t broadcaster, uint32_t fee_estimator, uint32_t logger) {
22388 LDKChannelMonitor this_arg_conv;
22389 this_arg_conv.inner = (void*)(this_arg & (~1));
22390 this_arg_conv.is_owned = false;
22391 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22392 unsigned char txid_arr[32];
22393 CHECK(txid->arr_len == 32);
22394 memcpy(txid_arr, txid->elems, 32); FREE(txid);
22395 unsigned char (*txid_ref)[32] = &txid_arr;
22396 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
22397 CHECK_ACCESS(broadcaster_ptr);
22398 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
22399 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
22400 CHECK_ACCESS(fee_estimator_ptr);
22401 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
22402 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
22403 CHECK_ACCESS(logger_ptr);
22404 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
22405 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
22408 uint32_tArray __attribute__((export_name("TS_ChannelMonitor_best_block_updated"))) TS_ChannelMonitor_best_block_updated(uint32_t this_arg, int8_tArray header, int32_t height, uint32_t broadcaster, uint32_t fee_estimator, uint32_t logger) {
22409 LDKChannelMonitor this_arg_conv;
22410 this_arg_conv.inner = (void*)(this_arg & (~1));
22411 this_arg_conv.is_owned = false;
22412 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22413 unsigned char header_arr[80];
22414 CHECK(header->arr_len == 80);
22415 memcpy(header_arr, header->elems, 80); FREE(header);
22416 unsigned char (*header_ref)[80] = &header_arr;
22417 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
22418 CHECK_ACCESS(broadcaster_ptr);
22419 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
22420 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
22421 CHECK_ACCESS(fee_estimator_ptr);
22422 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
22423 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
22424 CHECK_ACCESS(logger_ptr);
22425 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
22426 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
22427 uint32_tArray ret_arr = NULL;
22428 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
22429 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
22430 for (size_t n = 0; n < ret_var.datalen; n++) {
22431 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
22432 *ret_conv_39_conv = ret_var.data[n];
22433 ret_arr_ptr[n] = ((uint32_t)ret_conv_39_conv);
22436 FREE(ret_var.data);
22440 ptrArray __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint32_t this_arg) {
22441 LDKChannelMonitor this_arg_conv;
22442 this_arg_conv.inner = (void*)(this_arg & (~1));
22443 this_arg_conv.is_owned = false;
22444 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22445 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
22446 ptrArray ret_arr = NULL;
22447 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
22448 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
22449 for (size_t m = 0; m < ret_var.datalen; m++) {
22450 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
22451 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
22452 ret_arr_ptr[m] = ret_conv_12_arr;
22455 FREE(ret_var.data);
22459 uint32_t __attribute__((export_name("TS_ChannelMonitor_current_best_block"))) TS_ChannelMonitor_current_best_block(uint32_t this_arg) {
22460 LDKChannelMonitor this_arg_conv;
22461 this_arg_conv.inner = (void*)(this_arg & (~1));
22462 this_arg_conv.is_owned = false;
22463 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22464 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
22465 uint32_t ret_ref = 0;
22466 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22467 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22468 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22469 ret_ref = (uintptr_t)ret_var.inner;
22470 if (ret_var.is_owned) {
22476 uint32_tArray __attribute__((export_name("TS_ChannelMonitor_get_claimable_balances"))) TS_ChannelMonitor_get_claimable_balances(uint32_t this_arg) {
22477 LDKChannelMonitor this_arg_conv;
22478 this_arg_conv.inner = (void*)(this_arg & (~1));
22479 this_arg_conv.is_owned = false;
22480 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22481 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
22482 uint32_tArray ret_arr = NULL;
22483 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
22484 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
22485 for (size_t j = 0; j < ret_var.datalen; j++) {
22486 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22487 *ret_conv_9_copy = ret_var.data[j];
22488 uint32_t ret_conv_9_ref = (uintptr_t)ret_conv_9_copy;
22489 ret_arr_ptr[j] = ret_conv_9_ref;
22492 FREE(ret_var.data);
22496 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_read"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint32_t arg) {
22497 LDKu8slice ser_ref;
22498 ser_ref.datalen = ser->arr_len;
22499 ser_ref.data = ser->elems /* XXX ser leaks */;
22500 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
22501 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
22502 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
22503 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
22504 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
22505 return (uint32_t)ret_conv;
22508 void __attribute__((export_name("TS_OutPoint_free"))) TS_OutPoint_free(uint32_t this_obj) {
22509 LDKOutPoint this_obj_conv;
22510 this_obj_conv.inner = (void*)(this_obj & (~1));
22511 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22512 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22513 OutPoint_free(this_obj_conv);
22516 int8_tArray __attribute__((export_name("TS_OutPoint_get_txid"))) TS_OutPoint_get_txid(uint32_t this_ptr) {
22517 LDKOutPoint this_ptr_conv;
22518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22519 this_ptr_conv.is_owned = false;
22520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22521 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
22522 memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
22526 void __attribute__((export_name("TS_OutPoint_set_txid"))) TS_OutPoint_set_txid(uint32_t this_ptr, int8_tArray val) {
22527 LDKOutPoint this_ptr_conv;
22528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22529 this_ptr_conv.is_owned = false;
22530 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22531 LDKThirtyTwoBytes val_ref;
22532 CHECK(val->arr_len == 32);
22533 memcpy(val_ref.data, val->elems, 32); FREE(val);
22534 OutPoint_set_txid(&this_ptr_conv, val_ref);
22537 int16_t __attribute__((export_name("TS_OutPoint_get_index"))) TS_OutPoint_get_index(uint32_t this_ptr) {
22538 LDKOutPoint this_ptr_conv;
22539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22540 this_ptr_conv.is_owned = false;
22541 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22542 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
22546 void __attribute__((export_name("TS_OutPoint_set_index"))) TS_OutPoint_set_index(uint32_t this_ptr, int16_t val) {
22547 LDKOutPoint this_ptr_conv;
22548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22549 this_ptr_conv.is_owned = false;
22550 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22551 OutPoint_set_index(&this_ptr_conv, val);
22554 uint32_t __attribute__((export_name("TS_OutPoint_new"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
22555 LDKThirtyTwoBytes txid_arg_ref;
22556 CHECK(txid_arg->arr_len == 32);
22557 memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
22558 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
22559 uint32_t ret_ref = 0;
22560 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22561 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22562 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22563 ret_ref = (uintptr_t)ret_var.inner;
22564 if (ret_var.is_owned) {
22570 static inline uintptr_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
22571 LDKOutPoint ret_var = OutPoint_clone(arg);
22572 uint32_t ret_ref = 0;
22573 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22574 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22575 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22576 ret_ref = (uintptr_t)ret_var.inner;
22577 if (ret_var.is_owned) {
22582 uint32_t __attribute__((export_name("TS_OutPoint_clone_ptr"))) TS_OutPoint_clone_ptr(uint32_t arg) {
22583 LDKOutPoint arg_conv;
22584 arg_conv.inner = (void*)(arg & (~1));
22585 arg_conv.is_owned = false;
22586 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22587 uint32_t ret_val = OutPoint_clone_ptr(&arg_conv);
22591 uint32_t __attribute__((export_name("TS_OutPoint_clone"))) TS_OutPoint_clone(uint32_t orig) {
22592 LDKOutPoint orig_conv;
22593 orig_conv.inner = (void*)(orig & (~1));
22594 orig_conv.is_owned = false;
22595 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22596 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
22597 uint32_t ret_ref = 0;
22598 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22599 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22600 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22601 ret_ref = (uintptr_t)ret_var.inner;
22602 if (ret_var.is_owned) {
22608 jboolean __attribute__((export_name("TS_OutPoint_eq"))) TS_OutPoint_eq(uint32_t a, uint32_t b) {
22609 LDKOutPoint a_conv;
22610 a_conv.inner = (void*)(a & (~1));
22611 a_conv.is_owned = false;
22612 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22613 LDKOutPoint b_conv;
22614 b_conv.inner = (void*)(b & (~1));
22615 b_conv.is_owned = false;
22616 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
22617 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
22621 int64_t __attribute__((export_name("TS_OutPoint_hash"))) TS_OutPoint_hash(uint32_t o) {
22622 LDKOutPoint o_conv;
22623 o_conv.inner = (void*)(o & (~1));
22624 o_conv.is_owned = false;
22625 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22626 int64_t ret_val = OutPoint_hash(&o_conv);
22630 int8_tArray __attribute__((export_name("TS_OutPoint_to_channel_id"))) TS_OutPoint_to_channel_id(uint32_t this_arg) {
22631 LDKOutPoint this_arg_conv;
22632 this_arg_conv.inner = (void*)(this_arg & (~1));
22633 this_arg_conv.is_owned = false;
22634 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22635 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
22636 memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
22640 int8_tArray __attribute__((export_name("TS_OutPoint_write"))) TS_OutPoint_write(uint32_t obj) {
22641 LDKOutPoint obj_conv;
22642 obj_conv.inner = (void*)(obj & (~1));
22643 obj_conv.is_owned = false;
22644 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
22645 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
22646 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22647 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22648 CVec_u8Z_free(ret_var);
22652 uint32_t __attribute__((export_name("TS_OutPoint_read"))) TS_OutPoint_read(int8_tArray ser) {
22653 LDKu8slice ser_ref;
22654 ser_ref.datalen = ser->arr_len;
22655 ser_ref.data = ser->elems /* XXX ser leaks */;
22656 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
22657 *ret_conv = OutPoint_read(ser_ref);
22658 return (uint32_t)ret_conv;
22661 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_free"))) TS_DelayedPaymentOutputDescriptor_free(uint32_t this_obj) {
22662 LDKDelayedPaymentOutputDescriptor this_obj_conv;
22663 this_obj_conv.inner = (void*)(this_obj & (~1));
22664 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22665 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22666 DelayedPaymentOutputDescriptor_free(this_obj_conv);
22669 uint32_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_outpoint"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
22670 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
22671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22672 this_ptr_conv.is_owned = false;
22673 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22674 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
22675 uint32_t ret_ref = 0;
22676 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22677 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22678 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22679 ret_ref = (uintptr_t)ret_var.inner;
22680 if (ret_var.is_owned) {
22686 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_outpoint"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
22687 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
22688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22689 this_ptr_conv.is_owned = false;
22690 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22691 LDKOutPoint val_conv;
22692 val_conv.inner = (void*)(val & (~1));
22693 val_conv.is_owned = (val & 1) || (val == 0);
22694 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
22695 val_conv = OutPoint_clone(&val_conv);
22696 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
22699 int8_tArray __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint32_t this_ptr) {
22700 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
22701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22702 this_ptr_conv.is_owned = false;
22703 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22704 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
22705 memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
22709 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
22710 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
22711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22712 this_ptr_conv.is_owned = false;
22713 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22714 LDKPublicKey val_ref;
22715 CHECK(val->arr_len == 33);
22716 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
22717 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
22720 int16_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint32_t this_ptr) {
22721 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
22722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22723 this_ptr_conv.is_owned = false;
22724 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22725 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
22729 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint32_t this_ptr, int16_t val) {
22730 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
22731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22732 this_ptr_conv.is_owned = false;
22733 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22734 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
22737 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_output"))) TS_DelayedPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
22738 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
22739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22740 this_ptr_conv.is_owned = false;
22741 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22742 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
22743 CHECK_ACCESS(val_ptr);
22744 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
22745 val_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)val) & ~1));
22746 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
22749 int8_tArray __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint32_t this_ptr) {
22750 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
22751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22752 this_ptr_conv.is_owned = false;
22753 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22754 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
22755 memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
22759 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint32_t this_ptr, int8_tArray val) {
22760 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
22761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22762 this_ptr_conv.is_owned = false;
22763 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22764 LDKPublicKey val_ref;
22765 CHECK(val->arr_len == 33);
22766 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
22767 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
22770 int8_tArray __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
22771 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
22772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22773 this_ptr_conv.is_owned = false;
22774 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22775 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
22776 memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
22780 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
22781 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
22782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22783 this_ptr_conv.is_owned = false;
22784 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22785 LDKThirtyTwoBytes val_ref;
22786 CHECK(val->arr_len == 32);
22787 memcpy(val_ref.data, val->elems, 32); FREE(val);
22788 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
22791 int64_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
22792 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
22793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22794 this_ptr_conv.is_owned = false;
22795 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22796 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
22800 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
22801 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
22802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22803 this_ptr_conv.is_owned = false;
22804 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22805 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
22808 uint32_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_new"))) TS_DelayedPaymentOutputDescriptor_new(uint32_t outpoint_arg, int8_tArray per_commitment_point_arg, int16_t to_self_delay_arg, uint32_t output_arg, int8_tArray revocation_pubkey_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) {
22809 LDKOutPoint outpoint_arg_conv;
22810 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
22811 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
22812 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
22813 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
22814 LDKPublicKey per_commitment_point_arg_ref;
22815 CHECK(per_commitment_point_arg->arr_len == 33);
22816 memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
22817 void* output_arg_ptr = (void*)(((uintptr_t)output_arg) & ~1);
22818 CHECK_ACCESS(output_arg_ptr);
22819 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
22820 output_arg_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output_arg) & ~1));
22821 LDKPublicKey revocation_pubkey_arg_ref;
22822 CHECK(revocation_pubkey_arg->arr_len == 33);
22823 memcpy(revocation_pubkey_arg_ref.compressed_form, revocation_pubkey_arg->elems, 33); FREE(revocation_pubkey_arg);
22824 LDKThirtyTwoBytes channel_keys_id_arg_ref;
22825 CHECK(channel_keys_id_arg->arr_len == 32);
22826 memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
22827 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);
22828 uint32_t ret_ref = 0;
22829 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22830 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22831 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22832 ret_ref = (uintptr_t)ret_var.inner;
22833 if (ret_var.is_owned) {
22839 static inline uintptr_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
22840 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
22841 uint32_t ret_ref = 0;
22842 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22843 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22844 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22845 ret_ref = (uintptr_t)ret_var.inner;
22846 if (ret_var.is_owned) {
22851 uint32_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone_ptr"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint32_t arg) {
22852 LDKDelayedPaymentOutputDescriptor arg_conv;
22853 arg_conv.inner = (void*)(arg & (~1));
22854 arg_conv.is_owned = false;
22855 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22856 uint32_t ret_val = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
22860 uint32_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone"))) TS_DelayedPaymentOutputDescriptor_clone(uint32_t orig) {
22861 LDKDelayedPaymentOutputDescriptor orig_conv;
22862 orig_conv.inner = (void*)(orig & (~1));
22863 orig_conv.is_owned = false;
22864 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22865 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
22866 uint32_t ret_ref = 0;
22867 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22868 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22869 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22870 ret_ref = (uintptr_t)ret_var.inner;
22871 if (ret_var.is_owned) {
22877 int8_tArray __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_write"))) TS_DelayedPaymentOutputDescriptor_write(uint32_t obj) {
22878 LDKDelayedPaymentOutputDescriptor obj_conv;
22879 obj_conv.inner = (void*)(obj & (~1));
22880 obj_conv.is_owned = false;
22881 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
22882 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
22883 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22884 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22885 CVec_u8Z_free(ret_var);
22889 uint32_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_read"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
22890 LDKu8slice ser_ref;
22891 ser_ref.datalen = ser->arr_len;
22892 ser_ref.data = ser->elems /* XXX ser leaks */;
22893 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
22894 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
22895 return (uint32_t)ret_conv;
22898 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_free"))) TS_StaticPaymentOutputDescriptor_free(uint32_t this_obj) {
22899 LDKStaticPaymentOutputDescriptor this_obj_conv;
22900 this_obj_conv.inner = (void*)(this_obj & (~1));
22901 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22902 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22903 StaticPaymentOutputDescriptor_free(this_obj_conv);
22906 uint32_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_outpoint"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
22907 LDKStaticPaymentOutputDescriptor this_ptr_conv;
22908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22909 this_ptr_conv.is_owned = false;
22910 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22911 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
22912 uint32_t ret_ref = 0;
22913 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22914 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22915 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22916 ret_ref = (uintptr_t)ret_var.inner;
22917 if (ret_var.is_owned) {
22923 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_outpoint"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
22924 LDKStaticPaymentOutputDescriptor this_ptr_conv;
22925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22926 this_ptr_conv.is_owned = false;
22927 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22928 LDKOutPoint val_conv;
22929 val_conv.inner = (void*)(val & (~1));
22930 val_conv.is_owned = (val & 1) || (val == 0);
22931 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
22932 val_conv = OutPoint_clone(&val_conv);
22933 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
22936 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_output"))) TS_StaticPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
22937 LDKStaticPaymentOutputDescriptor this_ptr_conv;
22938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22939 this_ptr_conv.is_owned = false;
22940 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22941 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
22942 CHECK_ACCESS(val_ptr);
22943 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
22944 val_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)val) & ~1));
22945 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
22948 int8_tArray __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
22949 LDKStaticPaymentOutputDescriptor this_ptr_conv;
22950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22951 this_ptr_conv.is_owned = false;
22952 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22953 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
22954 memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
22958 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
22959 LDKStaticPaymentOutputDescriptor this_ptr_conv;
22960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22961 this_ptr_conv.is_owned = false;
22962 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22963 LDKThirtyTwoBytes val_ref;
22964 CHECK(val->arr_len == 32);
22965 memcpy(val_ref.data, val->elems, 32); FREE(val);
22966 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
22969 int64_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
22970 LDKStaticPaymentOutputDescriptor this_ptr_conv;
22971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22972 this_ptr_conv.is_owned = false;
22973 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22974 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
22978 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
22979 LDKStaticPaymentOutputDescriptor this_ptr_conv;
22980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22981 this_ptr_conv.is_owned = false;
22982 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22983 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
22986 uint32_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_new"))) TS_StaticPaymentOutputDescriptor_new(uint32_t outpoint_arg, uint32_t output_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) {
22987 LDKOutPoint outpoint_arg_conv;
22988 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
22989 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
22990 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
22991 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
22992 void* output_arg_ptr = (void*)(((uintptr_t)output_arg) & ~1);
22993 CHECK_ACCESS(output_arg_ptr);
22994 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
22995 output_arg_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output_arg) & ~1));
22996 LDKThirtyTwoBytes channel_keys_id_arg_ref;
22997 CHECK(channel_keys_id_arg->arr_len == 32);
22998 memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
22999 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
23000 uint32_t ret_ref = 0;
23001 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23002 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23003 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23004 ret_ref = (uintptr_t)ret_var.inner;
23005 if (ret_var.is_owned) {
23011 static inline uintptr_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
23012 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
23013 uint32_t ret_ref = 0;
23014 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23015 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23016 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23017 ret_ref = (uintptr_t)ret_var.inner;
23018 if (ret_var.is_owned) {
23023 uint32_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone_ptr"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint32_t arg) {
23024 LDKStaticPaymentOutputDescriptor arg_conv;
23025 arg_conv.inner = (void*)(arg & (~1));
23026 arg_conv.is_owned = false;
23027 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23028 uint32_t ret_val = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
23032 uint32_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone"))) TS_StaticPaymentOutputDescriptor_clone(uint32_t orig) {
23033 LDKStaticPaymentOutputDescriptor orig_conv;
23034 orig_conv.inner = (void*)(orig & (~1));
23035 orig_conv.is_owned = false;
23036 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23037 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
23038 uint32_t ret_ref = 0;
23039 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23040 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23041 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23042 ret_ref = (uintptr_t)ret_var.inner;
23043 if (ret_var.is_owned) {
23049 int8_tArray __attribute__((export_name("TS_StaticPaymentOutputDescriptor_write"))) TS_StaticPaymentOutputDescriptor_write(uint32_t obj) {
23050 LDKStaticPaymentOutputDescriptor obj_conv;
23051 obj_conv.inner = (void*)(obj & (~1));
23052 obj_conv.is_owned = false;
23053 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23054 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
23055 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23056 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23057 CVec_u8Z_free(ret_var);
23061 uint32_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_read"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
23062 LDKu8slice ser_ref;
23063 ser_ref.datalen = ser->arr_len;
23064 ser_ref.data = ser->elems /* XXX ser leaks */;
23065 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
23066 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
23067 return (uint32_t)ret_conv;
23070 void __attribute__((export_name("TS_SpendableOutputDescriptor_free"))) TS_SpendableOutputDescriptor_free(uint32_t this_ptr) {
23071 if ((this_ptr & 1) != 0) return;
23072 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23073 CHECK_ACCESS(this_ptr_ptr);
23074 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
23075 FREE((void*)this_ptr);
23076 SpendableOutputDescriptor_free(this_ptr_conv);
23079 static inline uintptr_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
23080 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
23081 *ret_copy = SpendableOutputDescriptor_clone(arg);
23082 uint32_t ret_ref = (uintptr_t)ret_copy;
23085 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_clone_ptr"))) TS_SpendableOutputDescriptor_clone_ptr(uint32_t arg) {
23086 LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)arg;
23087 uint32_t ret_val = SpendableOutputDescriptor_clone_ptr(arg_conv);
23091 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_clone"))) TS_SpendableOutputDescriptor_clone(uint32_t orig) {
23092 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
23093 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
23094 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
23095 uint32_t ret_ref = (uintptr_t)ret_copy;
23099 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_static_output"))) TS_SpendableOutputDescriptor_static_output(uint32_t outpoint, uint32_t output) {
23100 LDKOutPoint outpoint_conv;
23101 outpoint_conv.inner = (void*)(outpoint & (~1));
23102 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
23103 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
23104 outpoint_conv = OutPoint_clone(&outpoint_conv);
23105 void* output_ptr = (void*)(((uintptr_t)output) & ~1);
23106 CHECK_ACCESS(output_ptr);
23107 LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
23108 output_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output) & ~1));
23109 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
23110 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
23111 uint32_t ret_ref = (uintptr_t)ret_copy;
23115 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_delayed_payment_output"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint32_t a) {
23116 LDKDelayedPaymentOutputDescriptor a_conv;
23117 a_conv.inner = (void*)(a & (~1));
23118 a_conv.is_owned = (a & 1) || (a == 0);
23119 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23120 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
23121 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
23122 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
23123 uint32_t ret_ref = (uintptr_t)ret_copy;
23127 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_static_payment_output"))) TS_SpendableOutputDescriptor_static_payment_output(uint32_t a) {
23128 LDKStaticPaymentOutputDescriptor a_conv;
23129 a_conv.inner = (void*)(a & (~1));
23130 a_conv.is_owned = (a & 1) || (a == 0);
23131 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23132 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
23133 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
23134 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
23135 uint32_t ret_ref = (uintptr_t)ret_copy;
23139 int8_tArray __attribute__((export_name("TS_SpendableOutputDescriptor_write"))) TS_SpendableOutputDescriptor_write(uint32_t obj) {
23140 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
23141 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
23142 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23143 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23144 CVec_u8Z_free(ret_var);
23148 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
23149 LDKu8slice ser_ref;
23150 ser_ref.datalen = ser->arr_len;
23151 ser_ref.data = ser->elems /* XXX ser leaks */;
23152 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
23153 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
23154 return (uint32_t)ret_conv;
23157 void __attribute__((export_name("TS_BaseSign_free"))) TS_BaseSign_free(uint32_t this_ptr) {
23158 if ((this_ptr & 1) != 0) return;
23159 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23160 CHECK_ACCESS(this_ptr_ptr);
23161 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
23162 FREE((void*)this_ptr);
23163 BaseSign_free(this_ptr_conv);
23166 static inline uintptr_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
23167 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
23168 *ret_ret = Sign_clone(arg);
23169 return (uint32_t)ret_ret;
23171 uint32_t __attribute__((export_name("TS_Sign_clone_ptr"))) TS_Sign_clone_ptr(uint32_t arg) {
23172 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
23173 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
23174 LDKSign* arg_conv = (LDKSign*)arg_ptr;
23175 uint32_t ret_val = Sign_clone_ptr(arg_conv);
23179 uint32_t __attribute__((export_name("TS_Sign_clone"))) TS_Sign_clone(uint32_t orig) {
23180 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
23181 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
23182 LDKSign* orig_conv = (LDKSign*)orig_ptr;
23183 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
23184 *ret_ret = Sign_clone(orig_conv);
23185 return (uint32_t)ret_ret;
23188 void __attribute__((export_name("TS_Sign_free"))) TS_Sign_free(uint32_t this_ptr) {
23189 if ((this_ptr & 1) != 0) return;
23190 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23191 CHECK_ACCESS(this_ptr_ptr);
23192 LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
23193 FREE((void*)this_ptr);
23194 Sign_free(this_ptr_conv);
23197 uint32_t __attribute__((export_name("TS_Recipient_clone"))) TS_Recipient_clone(uint32_t orig) {
23198 LDKRecipient* orig_conv = (LDKRecipient*)(orig & ~1);
23199 uint32_t ret_conv = LDKRecipient_to_js(Recipient_clone(orig_conv));
23203 uint32_t __attribute__((export_name("TS_Recipient_node"))) TS_Recipient_node() {
23204 uint32_t ret_conv = LDKRecipient_to_js(Recipient_node());
23208 uint32_t __attribute__((export_name("TS_Recipient_phantom_node"))) TS_Recipient_phantom_node() {
23209 uint32_t ret_conv = LDKRecipient_to_js(Recipient_phantom_node());
23213 void __attribute__((export_name("TS_KeysInterface_free"))) TS_KeysInterface_free(uint32_t this_ptr) {
23214 if ((this_ptr & 1) != 0) return;
23215 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23216 CHECK_ACCESS(this_ptr_ptr);
23217 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
23218 FREE((void*)this_ptr);
23219 KeysInterface_free(this_ptr_conv);
23222 void __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint32_t this_obj) {
23223 LDKInMemorySigner this_obj_conv;
23224 this_obj_conv.inner = (void*)(this_obj & (~1));
23225 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23226 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23227 InMemorySigner_free(this_obj_conv);
23230 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_funding_key"))) TS_InMemorySigner_get_funding_key(uint32_t this_ptr) {
23231 LDKInMemorySigner this_ptr_conv;
23232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23233 this_ptr_conv.is_owned = false;
23234 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23235 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23236 memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
23240 void __attribute__((export_name("TS_InMemorySigner_set_funding_key"))) TS_InMemorySigner_set_funding_key(uint32_t this_ptr, int8_tArray val) {
23241 LDKInMemorySigner this_ptr_conv;
23242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23243 this_ptr_conv.is_owned = false;
23244 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23245 LDKSecretKey val_ref;
23246 CHECK(val->arr_len == 32);
23247 memcpy(val_ref.bytes, val->elems, 32); FREE(val);
23248 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
23251 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_revocation_base_key"))) TS_InMemorySigner_get_revocation_base_key(uint32_t this_ptr) {
23252 LDKInMemorySigner this_ptr_conv;
23253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23254 this_ptr_conv.is_owned = false;
23255 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23256 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23257 memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
23261 void __attribute__((export_name("TS_InMemorySigner_set_revocation_base_key"))) TS_InMemorySigner_set_revocation_base_key(uint32_t this_ptr, int8_tArray val) {
23262 LDKInMemorySigner this_ptr_conv;
23263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23264 this_ptr_conv.is_owned = false;
23265 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23266 LDKSecretKey val_ref;
23267 CHECK(val->arr_len == 32);
23268 memcpy(val_ref.bytes, val->elems, 32); FREE(val);
23269 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
23272 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_payment_key"))) TS_InMemorySigner_get_payment_key(uint32_t this_ptr) {
23273 LDKInMemorySigner this_ptr_conv;
23274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23275 this_ptr_conv.is_owned = false;
23276 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23277 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23278 memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
23282 void __attribute__((export_name("TS_InMemorySigner_set_payment_key"))) TS_InMemorySigner_set_payment_key(uint32_t this_ptr, int8_tArray val) {
23283 LDKInMemorySigner this_ptr_conv;
23284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23285 this_ptr_conv.is_owned = false;
23286 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23287 LDKSecretKey val_ref;
23288 CHECK(val->arr_len == 32);
23289 memcpy(val_ref.bytes, val->elems, 32); FREE(val);
23290 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
23293 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_delayed_payment_base_key"))) TS_InMemorySigner_get_delayed_payment_base_key(uint32_t this_ptr) {
23294 LDKInMemorySigner this_ptr_conv;
23295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23296 this_ptr_conv.is_owned = false;
23297 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23298 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23299 memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
23303 void __attribute__((export_name("TS_InMemorySigner_set_delayed_payment_base_key"))) TS_InMemorySigner_set_delayed_payment_base_key(uint32_t this_ptr, int8_tArray val) {
23304 LDKInMemorySigner this_ptr_conv;
23305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23306 this_ptr_conv.is_owned = false;
23307 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23308 LDKSecretKey val_ref;
23309 CHECK(val->arr_len == 32);
23310 memcpy(val_ref.bytes, val->elems, 32); FREE(val);
23311 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
23314 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_htlc_base_key"))) TS_InMemorySigner_get_htlc_base_key(uint32_t this_ptr) {
23315 LDKInMemorySigner this_ptr_conv;
23316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23317 this_ptr_conv.is_owned = false;
23318 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23319 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23320 memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
23324 void __attribute__((export_name("TS_InMemorySigner_set_htlc_base_key"))) TS_InMemorySigner_set_htlc_base_key(uint32_t this_ptr, int8_tArray val) {
23325 LDKInMemorySigner this_ptr_conv;
23326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23327 this_ptr_conv.is_owned = false;
23328 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23329 LDKSecretKey val_ref;
23330 CHECK(val->arr_len == 32);
23331 memcpy(val_ref.bytes, val->elems, 32); FREE(val);
23332 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
23335 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_commitment_seed"))) TS_InMemorySigner_get_commitment_seed(uint32_t this_ptr) {
23336 LDKInMemorySigner this_ptr_conv;
23337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23338 this_ptr_conv.is_owned = false;
23339 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23340 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23341 memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
23345 void __attribute__((export_name("TS_InMemorySigner_set_commitment_seed"))) TS_InMemorySigner_set_commitment_seed(uint32_t this_ptr, int8_tArray val) {
23346 LDKInMemorySigner this_ptr_conv;
23347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23348 this_ptr_conv.is_owned = false;
23349 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23350 LDKThirtyTwoBytes val_ref;
23351 CHECK(val->arr_len == 32);
23352 memcpy(val_ref.data, val->elems, 32); FREE(val);
23353 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
23356 static inline uintptr_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
23357 LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
23358 uint32_t ret_ref = 0;
23359 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23360 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23361 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23362 ret_ref = (uintptr_t)ret_var.inner;
23363 if (ret_var.is_owned) {
23368 uint32_t __attribute__((export_name("TS_InMemorySigner_clone_ptr"))) TS_InMemorySigner_clone_ptr(uint32_t arg) {
23369 LDKInMemorySigner arg_conv;
23370 arg_conv.inner = (void*)(arg & (~1));
23371 arg_conv.is_owned = false;
23372 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23373 uint32_t ret_val = InMemorySigner_clone_ptr(&arg_conv);
23377 uint32_t __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySigner_clone(uint32_t orig) {
23378 LDKInMemorySigner orig_conv;
23379 orig_conv.inner = (void*)(orig & (~1));
23380 orig_conv.is_owned = false;
23381 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23382 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
23383 uint32_t ret_ref = 0;
23384 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23385 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23386 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23387 ret_ref = (uintptr_t)ret_var.inner;
23388 if (ret_var.is_owned) {
23394 uint32_t __attribute__((export_name("TS_InMemorySigner_new"))) TS_InMemorySigner_new(int8_tArray node_secret, 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) {
23395 LDKSecretKey node_secret_ref;
23396 CHECK(node_secret->arr_len == 32);
23397 memcpy(node_secret_ref.bytes, node_secret->elems, 32); FREE(node_secret);
23398 LDKSecretKey funding_key_ref;
23399 CHECK(funding_key->arr_len == 32);
23400 memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
23401 LDKSecretKey revocation_base_key_ref;
23402 CHECK(revocation_base_key->arr_len == 32);
23403 memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
23404 LDKSecretKey payment_key_ref;
23405 CHECK(payment_key->arr_len == 32);
23406 memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
23407 LDKSecretKey delayed_payment_base_key_ref;
23408 CHECK(delayed_payment_base_key->arr_len == 32);
23409 memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
23410 LDKSecretKey htlc_base_key_ref;
23411 CHECK(htlc_base_key->arr_len == 32);
23412 memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
23413 LDKThirtyTwoBytes commitment_seed_ref;
23414 CHECK(commitment_seed->arr_len == 32);
23415 memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
23416 LDKThirtyTwoBytes channel_keys_id_ref;
23417 CHECK(channel_keys_id->arr_len == 32);
23418 memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
23419 LDKInMemorySigner ret_var = InMemorySigner_new(node_secret_ref, 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);
23420 uint32_t ret_ref = 0;
23421 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23422 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23423 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23424 ret_ref = (uintptr_t)ret_var.inner;
23425 if (ret_var.is_owned) {
23431 uint32_t __attribute__((export_name("TS_InMemorySigner_counterparty_pubkeys"))) TS_InMemorySigner_counterparty_pubkeys(uint32_t this_arg) {
23432 LDKInMemorySigner this_arg_conv;
23433 this_arg_conv.inner = (void*)(this_arg & (~1));
23434 this_arg_conv.is_owned = false;
23435 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23436 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
23437 uint32_t ret_ref = 0;
23438 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23439 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23440 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23441 ret_ref = (uintptr_t)ret_var.inner;
23442 if (ret_var.is_owned) {
23448 int16_t __attribute__((export_name("TS_InMemorySigner_counterparty_selected_contest_delay"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint32_t this_arg) {
23449 LDKInMemorySigner this_arg_conv;
23450 this_arg_conv.inner = (void*)(this_arg & (~1));
23451 this_arg_conv.is_owned = false;
23452 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23453 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
23457 int16_t __attribute__((export_name("TS_InMemorySigner_holder_selected_contest_delay"))) TS_InMemorySigner_holder_selected_contest_delay(uint32_t this_arg) {
23458 LDKInMemorySigner this_arg_conv;
23459 this_arg_conv.inner = (void*)(this_arg & (~1));
23460 this_arg_conv.is_owned = false;
23461 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23462 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
23466 jboolean __attribute__((export_name("TS_InMemorySigner_is_outbound"))) TS_InMemorySigner_is_outbound(uint32_t this_arg) {
23467 LDKInMemorySigner this_arg_conv;
23468 this_arg_conv.inner = (void*)(this_arg & (~1));
23469 this_arg_conv.is_owned = false;
23470 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23471 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
23475 uint32_t __attribute__((export_name("TS_InMemorySigner_funding_outpoint"))) TS_InMemorySigner_funding_outpoint(uint32_t this_arg) {
23476 LDKInMemorySigner this_arg_conv;
23477 this_arg_conv.inner = (void*)(this_arg & (~1));
23478 this_arg_conv.is_owned = false;
23479 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23480 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
23481 uint32_t ret_ref = 0;
23482 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23483 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23484 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23485 ret_ref = (uintptr_t)ret_var.inner;
23486 if (ret_var.is_owned) {
23492 uint32_t __attribute__((export_name("TS_InMemorySigner_get_channel_parameters"))) TS_InMemorySigner_get_channel_parameters(uint32_t this_arg) {
23493 LDKInMemorySigner this_arg_conv;
23494 this_arg_conv.inner = (void*)(this_arg & (~1));
23495 this_arg_conv.is_owned = false;
23496 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23497 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
23498 uint32_t ret_ref = 0;
23499 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23500 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23501 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23502 ret_ref = (uintptr_t)ret_var.inner;
23503 if (ret_var.is_owned) {
23509 jboolean __attribute__((export_name("TS_InMemorySigner_opt_anchors"))) TS_InMemorySigner_opt_anchors(uint32_t this_arg) {
23510 LDKInMemorySigner this_arg_conv;
23511 this_arg_conv.inner = (void*)(this_arg & (~1));
23512 this_arg_conv.is_owned = false;
23513 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23514 jboolean ret_val = InMemorySigner_opt_anchors(&this_arg_conv);
23518 uint32_t __attribute__((export_name("TS_InMemorySigner_sign_counterparty_payment_input"))) TS_InMemorySigner_sign_counterparty_payment_input(uint32_t this_arg, int8_tArray spend_tx, uint32_t input_idx, uint32_t descriptor) {
23519 LDKInMemorySigner this_arg_conv;
23520 this_arg_conv.inner = (void*)(this_arg & (~1));
23521 this_arg_conv.is_owned = false;
23522 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23523 LDKTransaction spend_tx_ref;
23524 spend_tx_ref.datalen = spend_tx->arr_len;
23525 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
23526 memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
23527 spend_tx_ref.data_is_owned = true;
23528 LDKStaticPaymentOutputDescriptor descriptor_conv;
23529 descriptor_conv.inner = (void*)(descriptor & (~1));
23530 descriptor_conv.is_owned = false;
23531 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
23532 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
23533 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
23534 return (uint32_t)ret_conv;
23537 uint32_t __attribute__((export_name("TS_InMemorySigner_sign_dynamic_p2wsh_input"))) TS_InMemorySigner_sign_dynamic_p2wsh_input(uint32_t this_arg, int8_tArray spend_tx, uint32_t input_idx, uint32_t descriptor) {
23538 LDKInMemorySigner this_arg_conv;
23539 this_arg_conv.inner = (void*)(this_arg & (~1));
23540 this_arg_conv.is_owned = false;
23541 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23542 LDKTransaction spend_tx_ref;
23543 spend_tx_ref.datalen = spend_tx->arr_len;
23544 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
23545 memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
23546 spend_tx_ref.data_is_owned = true;
23547 LDKDelayedPaymentOutputDescriptor descriptor_conv;
23548 descriptor_conv.inner = (void*)(descriptor & (~1));
23549 descriptor_conv.is_owned = false;
23550 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
23551 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
23552 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
23553 return (uint32_t)ret_conv;
23556 uint32_t __attribute__((export_name("TS_InMemorySigner_as_BaseSign"))) TS_InMemorySigner_as_BaseSign(uint32_t this_arg) {
23557 LDKInMemorySigner this_arg_conv;
23558 this_arg_conv.inner = (void*)(this_arg & (~1));
23559 this_arg_conv.is_owned = false;
23560 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23561 LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
23562 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
23563 return (uint32_t)ret_ret;
23566 uint32_t __attribute__((export_name("TS_InMemorySigner_as_Sign"))) TS_InMemorySigner_as_Sign(uint32_t this_arg) {
23567 LDKInMemorySigner this_arg_conv;
23568 this_arg_conv.inner = (void*)(this_arg & (~1));
23569 this_arg_conv.is_owned = false;
23570 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23571 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
23572 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
23573 return (uint32_t)ret_ret;
23576 int8_tArray __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemorySigner_write(uint32_t obj) {
23577 LDKInMemorySigner obj_conv;
23578 obj_conv.inner = (void*)(obj & (~1));
23579 obj_conv.is_owned = false;
23580 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23581 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
23582 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23583 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23584 CVec_u8Z_free(ret_var);
23588 uint32_t __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser, int8_tArray arg) {
23589 LDKu8slice ser_ref;
23590 ser_ref.datalen = ser->arr_len;
23591 ser_ref.data = ser->elems /* XXX ser leaks */;
23592 LDKSecretKey arg_ref;
23593 CHECK(arg->arr_len == 32);
23594 memcpy(arg_ref.bytes, arg->elems, 32); FREE(arg);
23595 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
23596 *ret_conv = InMemorySigner_read(ser_ref, arg_ref);
23597 return (uint32_t)ret_conv;
23600 void __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(uint32_t this_obj) {
23601 LDKKeysManager this_obj_conv;
23602 this_obj_conv.inner = (void*)(this_obj & (~1));
23603 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23604 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23605 KeysManager_free(this_obj_conv);
23608 uint32_t __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
23609 unsigned char seed_arr[32];
23610 CHECK(seed->arr_len == 32);
23611 memcpy(seed_arr, seed->elems, 32); FREE(seed);
23612 unsigned char (*seed_ref)[32] = &seed_arr;
23613 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
23614 uint32_t ret_ref = 0;
23615 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23616 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23617 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23618 ret_ref = (uintptr_t)ret_var.inner;
23619 if (ret_var.is_owned) {
23625 uint32_t __attribute__((export_name("TS_KeysManager_derive_channel_keys"))) TS_KeysManager_derive_channel_keys(uint32_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
23626 LDKKeysManager this_arg_conv;
23627 this_arg_conv.inner = (void*)(this_arg & (~1));
23628 this_arg_conv.is_owned = false;
23629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23630 unsigned char params_arr[32];
23631 CHECK(params->arr_len == 32);
23632 memcpy(params_arr, params->elems, 32); FREE(params);
23633 unsigned char (*params_ref)[32] = ¶ms_arr;
23634 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
23635 uint32_t ret_ref = 0;
23636 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23637 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23638 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23639 ret_ref = (uintptr_t)ret_var.inner;
23640 if (ret_var.is_owned) {
23646 uint32_t __attribute__((export_name("TS_KeysManager_spend_spendable_outputs"))) TS_KeysManager_spend_spendable_outputs(uint32_t this_arg, uint32_tArray descriptors, uint32_tArray outputs, int8_tArray change_destination_script, int32_t feerate_sat_per_1000_weight) {
23647 LDKKeysManager this_arg_conv;
23648 this_arg_conv.inner = (void*)(this_arg & (~1));
23649 this_arg_conv.is_owned = false;
23650 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23651 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
23652 descriptors_constr.datalen = descriptors->arr_len;
23653 if (descriptors_constr.datalen > 0)
23654 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
23656 descriptors_constr.data = NULL;
23657 uint32_t* descriptors_vals = descriptors->elems /* XXX descriptors leaks */;
23658 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
23659 uint32_t descriptors_conv_27 = descriptors_vals[b];
23660 void* descriptors_conv_27_ptr = (void*)(((uintptr_t)descriptors_conv_27) & ~1);
23661 CHECK_ACCESS(descriptors_conv_27_ptr);
23662 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
23663 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)descriptors_conv_27) & ~1));
23664 descriptors_constr.data[b] = descriptors_conv_27_conv;
23666 LDKCVec_TxOutZ outputs_constr;
23667 outputs_constr.datalen = outputs->arr_len;
23668 if (outputs_constr.datalen > 0)
23669 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
23671 outputs_constr.data = NULL;
23672 uint32_t* outputs_vals = outputs->elems /* XXX outputs leaks */;
23673 for (size_t h = 0; h < outputs_constr.datalen; h++) {
23674 uint32_t outputs_conv_7 = outputs_vals[h];
23675 void* outputs_conv_7_ptr = (void*)(((uintptr_t)outputs_conv_7) & ~1);
23676 CHECK_ACCESS(outputs_conv_7_ptr);
23677 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
23678 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)outputs_conv_7) & ~1));
23679 outputs_constr.data[h] = outputs_conv_7_conv;
23681 LDKCVec_u8Z change_destination_script_ref;
23682 change_destination_script_ref.datalen = change_destination_script->arr_len;
23683 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
23684 memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
23685 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
23686 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
23687 return (uint32_t)ret_conv;
23690 uint32_t __attribute__((export_name("TS_KeysManager_as_KeysInterface"))) TS_KeysManager_as_KeysInterface(uint32_t this_arg) {
23691 LDKKeysManager this_arg_conv;
23692 this_arg_conv.inner = (void*)(this_arg & (~1));
23693 this_arg_conv.is_owned = false;
23694 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23695 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
23696 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
23697 return (uint32_t)ret_ret;
23700 void __attribute__((export_name("TS_PhantomKeysManager_free"))) TS_PhantomKeysManager_free(uint32_t this_obj) {
23701 LDKPhantomKeysManager this_obj_conv;
23702 this_obj_conv.inner = (void*)(this_obj & (~1));
23703 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23704 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23705 PhantomKeysManager_free(this_obj_conv);
23708 uint32_t __attribute__((export_name("TS_PhantomKeysManager_as_KeysInterface"))) TS_PhantomKeysManager_as_KeysInterface(uint32_t this_arg) {
23709 LDKPhantomKeysManager this_arg_conv;
23710 this_arg_conv.inner = (void*)(this_arg & (~1));
23711 this_arg_conv.is_owned = false;
23712 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23713 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
23714 *ret_ret = PhantomKeysManager_as_KeysInterface(&this_arg_conv);
23715 return (uint32_t)ret_ret;
23718 uint32_t __attribute__((export_name("TS_PhantomKeysManager_new"))) TS_PhantomKeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos, int8_tArray cross_node_seed) {
23719 unsigned char seed_arr[32];
23720 CHECK(seed->arr_len == 32);
23721 memcpy(seed_arr, seed->elems, 32); FREE(seed);
23722 unsigned char (*seed_ref)[32] = &seed_arr;
23723 unsigned char cross_node_seed_arr[32];
23724 CHECK(cross_node_seed->arr_len == 32);
23725 memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
23726 unsigned char (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
23727 LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
23728 uint32_t ret_ref = 0;
23729 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23730 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23731 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23732 ret_ref = (uintptr_t)ret_var.inner;
23733 if (ret_var.is_owned) {
23739 uint32_t __attribute__((export_name("TS_PhantomKeysManager_spend_spendable_outputs"))) TS_PhantomKeysManager_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) {
23740 LDKPhantomKeysManager this_arg_conv;
23741 this_arg_conv.inner = (void*)(this_arg & (~1));
23742 this_arg_conv.is_owned = false;
23743 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23744 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
23745 descriptors_constr.datalen = descriptors->arr_len;
23746 if (descriptors_constr.datalen > 0)
23747 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
23749 descriptors_constr.data = NULL;
23750 uint32_t* descriptors_vals = descriptors->elems /* XXX descriptors leaks */;
23751 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
23752 uint32_t descriptors_conv_27 = descriptors_vals[b];
23753 void* descriptors_conv_27_ptr = (void*)(((uintptr_t)descriptors_conv_27) & ~1);
23754 CHECK_ACCESS(descriptors_conv_27_ptr);
23755 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
23756 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)descriptors_conv_27) & ~1));
23757 descriptors_constr.data[b] = descriptors_conv_27_conv;
23759 LDKCVec_TxOutZ outputs_constr;
23760 outputs_constr.datalen = outputs->arr_len;
23761 if (outputs_constr.datalen > 0)
23762 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
23764 outputs_constr.data = NULL;
23765 uint32_t* outputs_vals = outputs->elems /* XXX outputs leaks */;
23766 for (size_t h = 0; h < outputs_constr.datalen; h++) {
23767 uint32_t outputs_conv_7 = outputs_vals[h];
23768 void* outputs_conv_7_ptr = (void*)(((uintptr_t)outputs_conv_7) & ~1);
23769 CHECK_ACCESS(outputs_conv_7_ptr);
23770 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
23771 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)outputs_conv_7) & ~1));
23772 outputs_constr.data[h] = outputs_conv_7_conv;
23774 LDKCVec_u8Z change_destination_script_ref;
23775 change_destination_script_ref.datalen = change_destination_script->arr_len;
23776 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
23777 memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
23778 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
23779 *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
23780 return (uint32_t)ret_conv;
23783 uint32_t __attribute__((export_name("TS_PhantomKeysManager_derive_channel_keys"))) TS_PhantomKeysManager_derive_channel_keys(uint32_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
23784 LDKPhantomKeysManager this_arg_conv;
23785 this_arg_conv.inner = (void*)(this_arg & (~1));
23786 this_arg_conv.is_owned = false;
23787 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23788 unsigned char params_arr[32];
23789 CHECK(params->arr_len == 32);
23790 memcpy(params_arr, params->elems, 32); FREE(params);
23791 unsigned char (*params_ref)[32] = ¶ms_arr;
23792 LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
23793 uint32_t ret_ref = 0;
23794 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23795 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23796 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23797 ret_ref = (uintptr_t)ret_var.inner;
23798 if (ret_var.is_owned) {
23804 void __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint32_t this_obj) {
23805 LDKChannelManager this_obj_conv;
23806 this_obj_conv.inner = (void*)(this_obj & (~1));
23807 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23808 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23809 ChannelManager_free(this_obj_conv);
23812 void __attribute__((export_name("TS_ChainParameters_free"))) TS_ChainParameters_free(uint32_t this_obj) {
23813 LDKChainParameters this_obj_conv;
23814 this_obj_conv.inner = (void*)(this_obj & (~1));
23815 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23816 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23817 ChainParameters_free(this_obj_conv);
23820 uint32_t __attribute__((export_name("TS_ChainParameters_get_network"))) TS_ChainParameters_get_network(uint32_t this_ptr) {
23821 LDKChainParameters this_ptr_conv;
23822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23823 this_ptr_conv.is_owned = false;
23824 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23825 uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
23829 void __attribute__((export_name("TS_ChainParameters_set_network"))) TS_ChainParameters_set_network(uint32_t this_ptr, uint32_t val) {
23830 LDKChainParameters this_ptr_conv;
23831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23832 this_ptr_conv.is_owned = false;
23833 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23834 LDKNetwork val_conv = LDKNetwork_from_js(val);
23835 ChainParameters_set_network(&this_ptr_conv, val_conv);
23838 uint32_t __attribute__((export_name("TS_ChainParameters_get_best_block"))) TS_ChainParameters_get_best_block(uint32_t this_ptr) {
23839 LDKChainParameters this_ptr_conv;
23840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23841 this_ptr_conv.is_owned = false;
23842 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23843 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
23844 uint32_t ret_ref = 0;
23845 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23846 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23847 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23848 ret_ref = (uintptr_t)ret_var.inner;
23849 if (ret_var.is_owned) {
23855 void __attribute__((export_name("TS_ChainParameters_set_best_block"))) TS_ChainParameters_set_best_block(uint32_t this_ptr, uint32_t val) {
23856 LDKChainParameters this_ptr_conv;
23857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23858 this_ptr_conv.is_owned = false;
23859 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23860 LDKBestBlock val_conv;
23861 val_conv.inner = (void*)(val & (~1));
23862 val_conv.is_owned = (val & 1) || (val == 0);
23863 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23864 val_conv = BestBlock_clone(&val_conv);
23865 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
23868 uint32_t __attribute__((export_name("TS_ChainParameters_new"))) TS_ChainParameters_new(uint32_t network_arg, uint32_t best_block_arg) {
23869 LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
23870 LDKBestBlock best_block_arg_conv;
23871 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
23872 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
23873 CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
23874 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
23875 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
23876 uint32_t ret_ref = 0;
23877 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23878 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23879 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23880 ret_ref = (uintptr_t)ret_var.inner;
23881 if (ret_var.is_owned) {
23887 static inline uintptr_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
23888 LDKChainParameters ret_var = ChainParameters_clone(arg);
23889 uint32_t ret_ref = 0;
23890 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23891 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23892 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23893 ret_ref = (uintptr_t)ret_var.inner;
23894 if (ret_var.is_owned) {
23899 uint32_t __attribute__((export_name("TS_ChainParameters_clone_ptr"))) TS_ChainParameters_clone_ptr(uint32_t arg) {
23900 LDKChainParameters arg_conv;
23901 arg_conv.inner = (void*)(arg & (~1));
23902 arg_conv.is_owned = false;
23903 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23904 uint32_t ret_val = ChainParameters_clone_ptr(&arg_conv);
23908 uint32_t __attribute__((export_name("TS_ChainParameters_clone"))) TS_ChainParameters_clone(uint32_t orig) {
23909 LDKChainParameters orig_conv;
23910 orig_conv.inner = (void*)(orig & (~1));
23911 orig_conv.is_owned = false;
23912 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23913 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
23914 uint32_t ret_ref = 0;
23915 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23916 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23917 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23918 ret_ref = (uintptr_t)ret_var.inner;
23919 if (ret_var.is_owned) {
23925 void __attribute__((export_name("TS_CounterpartyForwardingInfo_free"))) TS_CounterpartyForwardingInfo_free(uint32_t this_obj) {
23926 LDKCounterpartyForwardingInfo this_obj_conv;
23927 this_obj_conv.inner = (void*)(this_obj & (~1));
23928 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23929 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23930 CounterpartyForwardingInfo_free(this_obj_conv);
23933 int32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_base_msat"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint32_t this_ptr) {
23934 LDKCounterpartyForwardingInfo this_ptr_conv;
23935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23936 this_ptr_conv.is_owned = false;
23937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23938 int32_t ret_val = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
23942 void __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_base_msat"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
23943 LDKCounterpartyForwardingInfo this_ptr_conv;
23944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23945 this_ptr_conv.is_owned = false;
23946 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23947 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
23950 int32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint32_t this_ptr) {
23951 LDKCounterpartyForwardingInfo this_ptr_conv;
23952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23953 this_ptr_conv.is_owned = false;
23954 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23955 int32_t ret_val = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
23959 void __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
23960 LDKCounterpartyForwardingInfo this_ptr_conv;
23961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23962 this_ptr_conv.is_owned = false;
23963 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23964 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
23967 int16_t __attribute__((export_name("TS_CounterpartyForwardingInfo_get_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
23968 LDKCounterpartyForwardingInfo this_ptr_conv;
23969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23970 this_ptr_conv.is_owned = false;
23971 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23972 int16_t ret_val = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
23976 void __attribute__((export_name("TS_CounterpartyForwardingInfo_set_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
23977 LDKCounterpartyForwardingInfo 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 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
23984 uint32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_new"))) TS_CounterpartyForwardingInfo_new(int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg) {
23985 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
23986 uint32_t ret_ref = 0;
23987 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23988 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23989 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23990 ret_ref = (uintptr_t)ret_var.inner;
23991 if (ret_var.is_owned) {
23997 static inline uintptr_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
23998 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
23999 uint32_t ret_ref = 0;
24000 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24001 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24002 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24003 ret_ref = (uintptr_t)ret_var.inner;
24004 if (ret_var.is_owned) {
24009 uint32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_clone_ptr"))) TS_CounterpartyForwardingInfo_clone_ptr(uint32_t arg) {
24010 LDKCounterpartyForwardingInfo arg_conv;
24011 arg_conv.inner = (void*)(arg & (~1));
24012 arg_conv.is_owned = false;
24013 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24014 uint32_t ret_val = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
24018 uint32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_clone"))) TS_CounterpartyForwardingInfo_clone(uint32_t orig) {
24019 LDKCounterpartyForwardingInfo orig_conv;
24020 orig_conv.inner = (void*)(orig & (~1));
24021 orig_conv.is_owned = false;
24022 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24023 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
24024 uint32_t ret_ref = 0;
24025 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24026 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24027 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24028 ret_ref = (uintptr_t)ret_var.inner;
24029 if (ret_var.is_owned) {
24035 void __attribute__((export_name("TS_ChannelCounterparty_free"))) TS_ChannelCounterparty_free(uint32_t this_obj) {
24036 LDKChannelCounterparty this_obj_conv;
24037 this_obj_conv.inner = (void*)(this_obj & (~1));
24038 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24039 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24040 ChannelCounterparty_free(this_obj_conv);
24043 int8_tArray __attribute__((export_name("TS_ChannelCounterparty_get_node_id"))) TS_ChannelCounterparty_get_node_id(uint32_t this_ptr) {
24044 LDKChannelCounterparty this_ptr_conv;
24045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24046 this_ptr_conv.is_owned = false;
24047 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24048 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
24049 memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
24053 void __attribute__((export_name("TS_ChannelCounterparty_set_node_id"))) TS_ChannelCounterparty_set_node_id(uint32_t this_ptr, int8_tArray val) {
24054 LDKChannelCounterparty this_ptr_conv;
24055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24056 this_ptr_conv.is_owned = false;
24057 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24058 LDKPublicKey val_ref;
24059 CHECK(val->arr_len == 33);
24060 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
24061 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
24064 uint32_t __attribute__((export_name("TS_ChannelCounterparty_get_features"))) TS_ChannelCounterparty_get_features(uint32_t this_ptr) {
24065 LDKChannelCounterparty this_ptr_conv;
24066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24067 this_ptr_conv.is_owned = false;
24068 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24069 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
24070 uint32_t ret_ref = 0;
24071 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24072 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24073 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24074 ret_ref = (uintptr_t)ret_var.inner;
24075 if (ret_var.is_owned) {
24081 void __attribute__((export_name("TS_ChannelCounterparty_set_features"))) TS_ChannelCounterparty_set_features(uint32_t this_ptr, uint32_t val) {
24082 LDKChannelCounterparty this_ptr_conv;
24083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24084 this_ptr_conv.is_owned = false;
24085 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24086 LDKInitFeatures val_conv;
24087 val_conv.inner = (void*)(val & (~1));
24088 val_conv.is_owned = (val & 1) || (val == 0);
24089 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24090 val_conv = InitFeatures_clone(&val_conv);
24091 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
24094 int64_t __attribute__((export_name("TS_ChannelCounterparty_get_unspendable_punishment_reserve"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint32_t this_ptr) {
24095 LDKChannelCounterparty this_ptr_conv;
24096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24097 this_ptr_conv.is_owned = false;
24098 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24099 int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
24103 void __attribute__((export_name("TS_ChannelCounterparty_set_unspendable_punishment_reserve"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint32_t this_ptr, int64_t val) {
24104 LDKChannelCounterparty this_ptr_conv;
24105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24106 this_ptr_conv.is_owned = false;
24107 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24108 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
24111 uint32_t __attribute__((export_name("TS_ChannelCounterparty_get_forwarding_info"))) TS_ChannelCounterparty_get_forwarding_info(uint32_t this_ptr) {
24112 LDKChannelCounterparty this_ptr_conv;
24113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24114 this_ptr_conv.is_owned = false;
24115 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24116 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
24117 uint32_t ret_ref = 0;
24118 if ((uintptr_t)ret_var.inner > 4096) {
24119 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24120 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24121 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24122 ret_ref = (uintptr_t)ret_var.inner;
24123 if (ret_var.is_owned) {
24130 void __attribute__((export_name("TS_ChannelCounterparty_set_forwarding_info"))) TS_ChannelCounterparty_set_forwarding_info(uint32_t this_ptr, uint32_t val) {
24131 LDKChannelCounterparty this_ptr_conv;
24132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24133 this_ptr_conv.is_owned = false;
24134 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24135 LDKCounterpartyForwardingInfo val_conv;
24136 val_conv.inner = (void*)(val & (~1));
24137 val_conv.is_owned = (val & 1) || (val == 0);
24138 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24139 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
24140 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
24143 uint32_t __attribute__((export_name("TS_ChannelCounterparty_new"))) TS_ChannelCounterparty_new(int8_tArray node_id_arg, uint32_t features_arg, int64_t unspendable_punishment_reserve_arg, uint32_t forwarding_info_arg) {
24144 LDKPublicKey node_id_arg_ref;
24145 CHECK(node_id_arg->arr_len == 33);
24146 memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
24147 LDKInitFeatures features_arg_conv;
24148 features_arg_conv.inner = (void*)(features_arg & (~1));
24149 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
24150 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
24151 features_arg_conv = InitFeatures_clone(&features_arg_conv);
24152 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
24153 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
24154 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
24155 CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
24156 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
24157 LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv);
24158 uint32_t ret_ref = 0;
24159 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24160 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24161 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24162 ret_ref = (uintptr_t)ret_var.inner;
24163 if (ret_var.is_owned) {
24169 static inline uintptr_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
24170 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
24171 uint32_t ret_ref = 0;
24172 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24173 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24174 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24175 ret_ref = (uintptr_t)ret_var.inner;
24176 if (ret_var.is_owned) {
24181 uint32_t __attribute__((export_name("TS_ChannelCounterparty_clone_ptr"))) TS_ChannelCounterparty_clone_ptr(uint32_t arg) {
24182 LDKChannelCounterparty arg_conv;
24183 arg_conv.inner = (void*)(arg & (~1));
24184 arg_conv.is_owned = false;
24185 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24186 uint32_t ret_val = ChannelCounterparty_clone_ptr(&arg_conv);
24190 uint32_t __attribute__((export_name("TS_ChannelCounterparty_clone"))) TS_ChannelCounterparty_clone(uint32_t orig) {
24191 LDKChannelCounterparty orig_conv;
24192 orig_conv.inner = (void*)(orig & (~1));
24193 orig_conv.is_owned = false;
24194 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24195 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
24196 uint32_t ret_ref = 0;
24197 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24198 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24199 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24200 ret_ref = (uintptr_t)ret_var.inner;
24201 if (ret_var.is_owned) {
24207 void __attribute__((export_name("TS_ChannelDetails_free"))) TS_ChannelDetails_free(uint32_t this_obj) {
24208 LDKChannelDetails this_obj_conv;
24209 this_obj_conv.inner = (void*)(this_obj & (~1));
24210 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24211 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24212 ChannelDetails_free(this_obj_conv);
24215 int8_tArray __attribute__((export_name("TS_ChannelDetails_get_channel_id"))) TS_ChannelDetails_get_channel_id(uint32_t this_ptr) {
24216 LDKChannelDetails this_ptr_conv;
24217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24218 this_ptr_conv.is_owned = false;
24219 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24220 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24221 memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
24225 void __attribute__((export_name("TS_ChannelDetails_set_channel_id"))) TS_ChannelDetails_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24226 LDKChannelDetails this_ptr_conv;
24227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24228 this_ptr_conv.is_owned = false;
24229 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24230 LDKThirtyTwoBytes val_ref;
24231 CHECK(val->arr_len == 32);
24232 memcpy(val_ref.data, val->elems, 32); FREE(val);
24233 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
24236 uint32_t __attribute__((export_name("TS_ChannelDetails_get_counterparty"))) TS_ChannelDetails_get_counterparty(uint32_t this_ptr) {
24237 LDKChannelDetails this_ptr_conv;
24238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24239 this_ptr_conv.is_owned = false;
24240 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24241 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
24242 uint32_t ret_ref = 0;
24243 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24244 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24245 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24246 ret_ref = (uintptr_t)ret_var.inner;
24247 if (ret_var.is_owned) {
24253 void __attribute__((export_name("TS_ChannelDetails_set_counterparty"))) TS_ChannelDetails_set_counterparty(uint32_t this_ptr, uint32_t val) {
24254 LDKChannelDetails this_ptr_conv;
24255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24256 this_ptr_conv.is_owned = false;
24257 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24258 LDKChannelCounterparty val_conv;
24259 val_conv.inner = (void*)(val & (~1));
24260 val_conv.is_owned = (val & 1) || (val == 0);
24261 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24262 val_conv = ChannelCounterparty_clone(&val_conv);
24263 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
24266 uint32_t __attribute__((export_name("TS_ChannelDetails_get_funding_txo"))) TS_ChannelDetails_get_funding_txo(uint32_t this_ptr) {
24267 LDKChannelDetails this_ptr_conv;
24268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24269 this_ptr_conv.is_owned = false;
24270 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24271 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
24272 uint32_t ret_ref = 0;
24273 if ((uintptr_t)ret_var.inner > 4096) {
24274 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24275 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24276 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24277 ret_ref = (uintptr_t)ret_var.inner;
24278 if (ret_var.is_owned) {
24285 void __attribute__((export_name("TS_ChannelDetails_set_funding_txo"))) TS_ChannelDetails_set_funding_txo(uint32_t this_ptr, uint32_t val) {
24286 LDKChannelDetails 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 LDKOutPoint val_conv;
24291 val_conv.inner = (void*)(val & (~1));
24292 val_conv.is_owned = (val & 1) || (val == 0);
24293 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24294 val_conv = OutPoint_clone(&val_conv);
24295 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
24298 uint32_t __attribute__((export_name("TS_ChannelDetails_get_short_channel_id"))) TS_ChannelDetails_get_short_channel_id(uint32_t this_ptr) {
24299 LDKChannelDetails this_ptr_conv;
24300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24301 this_ptr_conv.is_owned = false;
24302 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24303 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24304 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
24305 uint32_t ret_ref = (uintptr_t)ret_copy;
24309 void __attribute__((export_name("TS_ChannelDetails_set_short_channel_id"))) TS_ChannelDetails_set_short_channel_id(uint32_t this_ptr, uint32_t val) {
24310 LDKChannelDetails this_ptr_conv;
24311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24312 this_ptr_conv.is_owned = false;
24313 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24314 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
24315 CHECK_ACCESS(val_ptr);
24316 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
24317 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
24318 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
24321 int64_t __attribute__((export_name("TS_ChannelDetails_get_channel_value_satoshis"))) TS_ChannelDetails_get_channel_value_satoshis(uint32_t this_ptr) {
24322 LDKChannelDetails this_ptr_conv;
24323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24324 this_ptr_conv.is_owned = false;
24325 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24326 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
24330 void __attribute__((export_name("TS_ChannelDetails_set_channel_value_satoshis"))) TS_ChannelDetails_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
24331 LDKChannelDetails this_ptr_conv;
24332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24333 this_ptr_conv.is_owned = false;
24334 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24335 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
24338 uint32_t __attribute__((export_name("TS_ChannelDetails_get_unspendable_punishment_reserve"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint32_t this_ptr) {
24339 LDKChannelDetails this_ptr_conv;
24340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24341 this_ptr_conv.is_owned = false;
24342 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24343 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24344 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
24345 uint32_t ret_ref = (uintptr_t)ret_copy;
24349 void __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_reserve"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint32_t this_ptr, uint32_t val) {
24350 LDKChannelDetails this_ptr_conv;
24351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24352 this_ptr_conv.is_owned = false;
24353 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24354 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
24355 CHECK_ACCESS(val_ptr);
24356 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
24357 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
24358 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
24361 int64_t __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint32_t this_ptr) {
24362 LDKChannelDetails this_ptr_conv;
24363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24364 this_ptr_conv.is_owned = false;
24365 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24366 int64_t ret_val = ChannelDetails_get_user_channel_id(&this_ptr_conv);
24370 void __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint32_t this_ptr, int64_t val) {
24371 LDKChannelDetails this_ptr_conv;
24372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24373 this_ptr_conv.is_owned = false;
24374 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24375 ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
24378 int64_t __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint32_t this_ptr) {
24379 LDKChannelDetails this_ptr_conv;
24380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24381 this_ptr_conv.is_owned = false;
24382 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24383 int64_t ret_val = ChannelDetails_get_balance_msat(&this_ptr_conv);
24387 void __attribute__((export_name("TS_ChannelDetails_set_balance_msat"))) TS_ChannelDetails_set_balance_msat(uint32_t this_ptr, int64_t val) {
24388 LDKChannelDetails this_ptr_conv;
24389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24390 this_ptr_conv.is_owned = false;
24391 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24392 ChannelDetails_set_balance_msat(&this_ptr_conv, val);
24395 int64_t __attribute__((export_name("TS_ChannelDetails_get_outbound_capacity_msat"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) {
24396 LDKChannelDetails this_ptr_conv;
24397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24398 this_ptr_conv.is_owned = false;
24399 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24400 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
24404 void __attribute__((export_name("TS_ChannelDetails_set_outbound_capacity_msat"))) TS_ChannelDetails_set_outbound_capacity_msat(uint32_t this_ptr, int64_t val) {
24405 LDKChannelDetails this_ptr_conv;
24406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24407 this_ptr_conv.is_owned = false;
24408 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24409 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
24412 int64_t __attribute__((export_name("TS_ChannelDetails_get_inbound_capacity_msat"))) TS_ChannelDetails_get_inbound_capacity_msat(uint32_t this_ptr) {
24413 LDKChannelDetails this_ptr_conv;
24414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24415 this_ptr_conv.is_owned = false;
24416 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24417 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
24421 void __attribute__((export_name("TS_ChannelDetails_set_inbound_capacity_msat"))) TS_ChannelDetails_set_inbound_capacity_msat(uint32_t this_ptr, int64_t val) {
24422 LDKChannelDetails this_ptr_conv;
24423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24424 this_ptr_conv.is_owned = false;
24425 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24426 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
24429 uint32_t __attribute__((export_name("TS_ChannelDetails_get_confirmations_required"))) TS_ChannelDetails_get_confirmations_required(uint32_t this_ptr) {
24430 LDKChannelDetails this_ptr_conv;
24431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24432 this_ptr_conv.is_owned = false;
24433 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24434 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
24435 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
24436 uint32_t ret_ref = (uintptr_t)ret_copy;
24440 void __attribute__((export_name("TS_ChannelDetails_set_confirmations_required"))) TS_ChannelDetails_set_confirmations_required(uint32_t this_ptr, uint32_t val) {
24441 LDKChannelDetails this_ptr_conv;
24442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24443 this_ptr_conv.is_owned = false;
24444 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24445 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
24446 CHECK_ACCESS(val_ptr);
24447 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
24448 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)val) & ~1));
24449 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
24452 uint32_t __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint32_t this_ptr) {
24453 LDKChannelDetails this_ptr_conv;
24454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24455 this_ptr_conv.is_owned = false;
24456 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24457 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
24458 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
24459 uint32_t ret_ref = (uintptr_t)ret_copy;
24463 void __attribute__((export_name("TS_ChannelDetails_set_force_close_spend_delay"))) TS_ChannelDetails_set_force_close_spend_delay(uint32_t this_ptr, uint32_t val) {
24464 LDKChannelDetails this_ptr_conv;
24465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24466 this_ptr_conv.is_owned = false;
24467 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24468 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
24469 CHECK_ACCESS(val_ptr);
24470 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
24471 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uintptr_t)val) & ~1));
24472 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
24475 jboolean __attribute__((export_name("TS_ChannelDetails_get_is_outbound"))) TS_ChannelDetails_get_is_outbound(uint32_t this_ptr) {
24476 LDKChannelDetails this_ptr_conv;
24477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24478 this_ptr_conv.is_owned = false;
24479 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24480 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
24484 void __attribute__((export_name("TS_ChannelDetails_set_is_outbound"))) TS_ChannelDetails_set_is_outbound(uint32_t this_ptr, jboolean val) {
24485 LDKChannelDetails this_ptr_conv;
24486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24487 this_ptr_conv.is_owned = false;
24488 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24489 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
24492 jboolean __attribute__((export_name("TS_ChannelDetails_get_is_funding_locked"))) TS_ChannelDetails_get_is_funding_locked(uint32_t this_ptr) {
24493 LDKChannelDetails this_ptr_conv;
24494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24495 this_ptr_conv.is_owned = false;
24496 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24497 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
24501 void __attribute__((export_name("TS_ChannelDetails_set_is_funding_locked"))) TS_ChannelDetails_set_is_funding_locked(uint32_t this_ptr, jboolean val) {
24502 LDKChannelDetails 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 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
24509 jboolean __attribute__((export_name("TS_ChannelDetails_get_is_usable"))) TS_ChannelDetails_get_is_usable(uint32_t this_ptr) {
24510 LDKChannelDetails this_ptr_conv;
24511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24512 this_ptr_conv.is_owned = false;
24513 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24514 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
24518 void __attribute__((export_name("TS_ChannelDetails_set_is_usable"))) TS_ChannelDetails_set_is_usable(uint32_t this_ptr, jboolean val) {
24519 LDKChannelDetails this_ptr_conv;
24520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24521 this_ptr_conv.is_owned = false;
24522 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24523 ChannelDetails_set_is_usable(&this_ptr_conv, val);
24526 jboolean __attribute__((export_name("TS_ChannelDetails_get_is_public"))) TS_ChannelDetails_get_is_public(uint32_t this_ptr) {
24527 LDKChannelDetails this_ptr_conv;
24528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24529 this_ptr_conv.is_owned = false;
24530 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24531 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
24535 void __attribute__((export_name("TS_ChannelDetails_set_is_public"))) TS_ChannelDetails_set_is_public(uint32_t this_ptr, jboolean val) {
24536 LDKChannelDetails this_ptr_conv;
24537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24538 this_ptr_conv.is_owned = false;
24539 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24540 ChannelDetails_set_is_public(&this_ptr_conv, val);
24543 uint32_t __attribute__((export_name("TS_ChannelDetails_new"))) TS_ChannelDetails_new(int8_tArray channel_id_arg, uint32_t counterparty_arg, uint32_t funding_txo_arg, uint32_t short_channel_id_arg, int64_t channel_value_satoshis_arg, uint32_t unspendable_punishment_reserve_arg, int64_t user_channel_id_arg, int64_t balance_msat_arg, int64_t outbound_capacity_msat_arg, int64_t inbound_capacity_msat_arg, uint32_t confirmations_required_arg, uint32_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_funding_locked_arg, jboolean is_usable_arg, jboolean is_public_arg) {
24544 LDKThirtyTwoBytes channel_id_arg_ref;
24545 CHECK(channel_id_arg->arr_len == 32);
24546 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
24547 LDKChannelCounterparty counterparty_arg_conv;
24548 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
24549 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
24550 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
24551 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
24552 LDKOutPoint funding_txo_arg_conv;
24553 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
24554 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
24555 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
24556 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
24557 void* short_channel_id_arg_ptr = (void*)(((uintptr_t)short_channel_id_arg) & ~1);
24558 CHECK_ACCESS(short_channel_id_arg_ptr);
24559 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
24560 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id_arg) & ~1));
24561 void* unspendable_punishment_reserve_arg_ptr = (void*)(((uintptr_t)unspendable_punishment_reserve_arg) & ~1);
24562 CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
24563 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
24564 void* confirmations_required_arg_ptr = (void*)(((uintptr_t)confirmations_required_arg) & ~1);
24565 CHECK_ACCESS(confirmations_required_arg_ptr);
24566 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
24567 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)confirmations_required_arg) & ~1));
24568 void* force_close_spend_delay_arg_ptr = (void*)(((uintptr_t)force_close_spend_delay_arg) & ~1);
24569 CHECK_ACCESS(force_close_spend_delay_arg_ptr);
24570 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
24571 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uintptr_t)force_close_spend_delay_arg) & ~1));
24572 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);
24573 uint32_t ret_ref = 0;
24574 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24575 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24576 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24577 ret_ref = (uintptr_t)ret_var.inner;
24578 if (ret_var.is_owned) {
24584 static inline uintptr_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
24585 LDKChannelDetails ret_var = ChannelDetails_clone(arg);
24586 uint32_t ret_ref = 0;
24587 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24588 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24589 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24590 ret_ref = (uintptr_t)ret_var.inner;
24591 if (ret_var.is_owned) {
24596 uint32_t __attribute__((export_name("TS_ChannelDetails_clone_ptr"))) TS_ChannelDetails_clone_ptr(uint32_t arg) {
24597 LDKChannelDetails arg_conv;
24598 arg_conv.inner = (void*)(arg & (~1));
24599 arg_conv.is_owned = false;
24600 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24601 uint32_t ret_val = ChannelDetails_clone_ptr(&arg_conv);
24605 uint32_t __attribute__((export_name("TS_ChannelDetails_clone"))) TS_ChannelDetails_clone(uint32_t orig) {
24606 LDKChannelDetails orig_conv;
24607 orig_conv.inner = (void*)(orig & (~1));
24608 orig_conv.is_owned = false;
24609 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24610 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
24611 uint32_t ret_ref = 0;
24612 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24613 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24614 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24615 ret_ref = (uintptr_t)ret_var.inner;
24616 if (ret_var.is_owned) {
24622 void __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint32_t this_ptr) {
24623 if ((this_ptr & 1) != 0) return;
24624 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24625 CHECK_ACCESS(this_ptr_ptr);
24626 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
24627 FREE((void*)this_ptr);
24628 PaymentSendFailure_free(this_ptr_conv);
24631 static inline uintptr_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
24632 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
24633 *ret_copy = PaymentSendFailure_clone(arg);
24634 uint32_t ret_ref = (uintptr_t)ret_copy;
24637 uint32_t __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint32_t arg) {
24638 LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)arg;
24639 uint32_t ret_val = PaymentSendFailure_clone_ptr(arg_conv);
24643 uint32_t __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint32_t orig) {
24644 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
24645 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
24646 *ret_copy = PaymentSendFailure_clone(orig_conv);
24647 uint32_t ret_ref = (uintptr_t)ret_copy;
24651 uint32_t __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint32_t a) {
24652 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
24653 CHECK_ACCESS(a_ptr);
24654 LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
24655 a_conv = APIError_clone((LDKAPIError*)(((uintptr_t)a) & ~1));
24656 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
24657 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
24658 uint32_t ret_ref = (uintptr_t)ret_copy;
24662 uint32_t __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint32_tArray a) {
24663 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
24664 a_constr.datalen = a->arr_len;
24665 if (a_constr.datalen > 0)
24666 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
24668 a_constr.data = NULL;
24669 uint32_t* a_vals = a->elems /* XXX a leaks */;
24670 for (size_t w = 0; w < a_constr.datalen; w++) {
24671 uint32_t a_conv_22 = a_vals[w];
24672 void* a_conv_22_ptr = (void*)(((uintptr_t)a_conv_22) & ~1);
24673 CHECK_ACCESS(a_conv_22_ptr);
24674 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
24675 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uintptr_t)a_conv_22) & ~1));
24676 a_constr.data[w] = a_conv_22_conv;
24678 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
24679 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
24680 uint32_t ret_ref = (uintptr_t)ret_copy;
24684 uint32_t __attribute__((export_name("TS_PaymentSendFailure_all_failed_retry_safe"))) TS_PaymentSendFailure_all_failed_retry_safe(uint32_tArray a) {
24685 LDKCVec_APIErrorZ a_constr;
24686 a_constr.datalen = a->arr_len;
24687 if (a_constr.datalen > 0)
24688 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
24690 a_constr.data = NULL;
24691 uint32_t* a_vals = a->elems /* XXX a leaks */;
24692 for (size_t k = 0; k < a_constr.datalen; k++) {
24693 uint32_t a_conv_10 = a_vals[k];
24694 void* a_conv_10_ptr = (void*)(((uintptr_t)a_conv_10) & ~1);
24695 CHECK_ACCESS(a_conv_10_ptr);
24696 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
24697 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uintptr_t)a_conv_10) & ~1));
24698 a_constr.data[k] = a_conv_10_conv;
24700 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
24701 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
24702 uint32_t ret_ref = (uintptr_t)ret_copy;
24706 uint32_t __attribute__((export_name("TS_PaymentSendFailure_partial_failure"))) TS_PaymentSendFailure_partial_failure(uint32_tArray results, uint32_t failed_paths_retry, int8_tArray payment_id) {
24707 LDKCVec_CResult_NoneAPIErrorZZ results_constr;
24708 results_constr.datalen = results->arr_len;
24709 if (results_constr.datalen > 0)
24710 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
24712 results_constr.data = NULL;
24713 uint32_t* results_vals = results->elems /* XXX results leaks */;
24714 for (size_t w = 0; w < results_constr.datalen; w++) {
24715 uint32_t results_conv_22 = results_vals[w];
24716 void* results_conv_22_ptr = (void*)(((uintptr_t)results_conv_22) & ~1);
24717 CHECK_ACCESS(results_conv_22_ptr);
24718 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
24719 results_constr.data[w] = results_conv_22_conv;
24721 LDKRouteParameters failed_paths_retry_conv;
24722 failed_paths_retry_conv.inner = (void*)(failed_paths_retry & (~1));
24723 failed_paths_retry_conv.is_owned = (failed_paths_retry & 1) || (failed_paths_retry == 0);
24724 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
24725 failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
24726 LDKThirtyTwoBytes payment_id_ref;
24727 CHECK(payment_id->arr_len == 32);
24728 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
24729 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
24730 *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
24731 uint32_t ret_ref = (uintptr_t)ret_copy;
24735 void __attribute__((export_name("TS_PhantomRouteHints_free"))) TS_PhantomRouteHints_free(uint32_t this_obj) {
24736 LDKPhantomRouteHints this_obj_conv;
24737 this_obj_conv.inner = (void*)(this_obj & (~1));
24738 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24739 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24740 PhantomRouteHints_free(this_obj_conv);
24743 uint32_tArray __attribute__((export_name("TS_PhantomRouteHints_get_channels"))) TS_PhantomRouteHints_get_channels(uint32_t this_ptr) {
24744 LDKPhantomRouteHints 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 LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
24749 uint32_tArray ret_arr = NULL;
24750 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
24751 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
24752 for (size_t q = 0; q < ret_var.datalen; q++) {
24753 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
24754 uint32_t ret_conv_16_ref = 0;
24755 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24756 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24757 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
24758 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
24759 if (ret_conv_16_var.is_owned) {
24760 ret_conv_16_ref |= 1;
24762 ret_arr_ptr[q] = ret_conv_16_ref;
24765 FREE(ret_var.data);
24769 void __attribute__((export_name("TS_PhantomRouteHints_set_channels"))) TS_PhantomRouteHints_set_channels(uint32_t this_ptr, uint32_tArray val) {
24770 LDKPhantomRouteHints this_ptr_conv;
24771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24772 this_ptr_conv.is_owned = false;
24773 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24774 LDKCVec_ChannelDetailsZ val_constr;
24775 val_constr.datalen = val->arr_len;
24776 if (val_constr.datalen > 0)
24777 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
24779 val_constr.data = NULL;
24780 uint32_t* val_vals = val->elems /* XXX val leaks */;
24781 for (size_t q = 0; q < val_constr.datalen; q++) {
24782 uint32_t val_conv_16 = val_vals[q];
24783 LDKChannelDetails val_conv_16_conv;
24784 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
24785 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
24786 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
24787 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
24788 val_constr.data[q] = val_conv_16_conv;
24790 PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
24793 int64_t __attribute__((export_name("TS_PhantomRouteHints_get_phantom_scid"))) TS_PhantomRouteHints_get_phantom_scid(uint32_t this_ptr) {
24794 LDKPhantomRouteHints this_ptr_conv;
24795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24796 this_ptr_conv.is_owned = false;
24797 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24798 int64_t ret_val = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
24802 void __attribute__((export_name("TS_PhantomRouteHints_set_phantom_scid"))) TS_PhantomRouteHints_set_phantom_scid(uint32_t this_ptr, int64_t val) {
24803 LDKPhantomRouteHints this_ptr_conv;
24804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24805 this_ptr_conv.is_owned = false;
24806 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24807 PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
24810 int8_tArray __attribute__((export_name("TS_PhantomRouteHints_get_real_node_pubkey"))) TS_PhantomRouteHints_get_real_node_pubkey(uint32_t this_ptr) {
24811 LDKPhantomRouteHints this_ptr_conv;
24812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24813 this_ptr_conv.is_owned = false;
24814 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24815 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
24816 memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
24820 void __attribute__((export_name("TS_PhantomRouteHints_set_real_node_pubkey"))) TS_PhantomRouteHints_set_real_node_pubkey(uint32_t this_ptr, int8_tArray val) {
24821 LDKPhantomRouteHints this_ptr_conv;
24822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24823 this_ptr_conv.is_owned = false;
24824 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24825 LDKPublicKey val_ref;
24826 CHECK(val->arr_len == 33);
24827 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
24828 PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
24831 uint32_t __attribute__((export_name("TS_PhantomRouteHints_new"))) TS_PhantomRouteHints_new(uint32_tArray channels_arg, int64_t phantom_scid_arg, int8_tArray real_node_pubkey_arg) {
24832 LDKCVec_ChannelDetailsZ channels_arg_constr;
24833 channels_arg_constr.datalen = channels_arg->arr_len;
24834 if (channels_arg_constr.datalen > 0)
24835 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
24837 channels_arg_constr.data = NULL;
24838 uint32_t* channels_arg_vals = channels_arg->elems /* XXX channels_arg leaks */;
24839 for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
24840 uint32_t channels_arg_conv_16 = channels_arg_vals[q];
24841 LDKChannelDetails channels_arg_conv_16_conv;
24842 channels_arg_conv_16_conv.inner = (void*)(channels_arg_conv_16 & (~1));
24843 channels_arg_conv_16_conv.is_owned = (channels_arg_conv_16 & 1) || (channels_arg_conv_16 == 0);
24844 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
24845 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
24846 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
24848 LDKPublicKey real_node_pubkey_arg_ref;
24849 CHECK(real_node_pubkey_arg->arr_len == 33);
24850 memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
24851 LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
24852 uint32_t ret_ref = 0;
24853 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24854 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24855 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24856 ret_ref = (uintptr_t)ret_var.inner;
24857 if (ret_var.is_owned) {
24863 static inline uintptr_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
24864 LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
24865 uint32_t ret_ref = 0;
24866 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24867 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24868 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24869 ret_ref = (uintptr_t)ret_var.inner;
24870 if (ret_var.is_owned) {
24875 uint32_t __attribute__((export_name("TS_PhantomRouteHints_clone_ptr"))) TS_PhantomRouteHints_clone_ptr(uint32_t arg) {
24876 LDKPhantomRouteHints arg_conv;
24877 arg_conv.inner = (void*)(arg & (~1));
24878 arg_conv.is_owned = false;
24879 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24880 uint32_t ret_val = PhantomRouteHints_clone_ptr(&arg_conv);
24884 uint32_t __attribute__((export_name("TS_PhantomRouteHints_clone"))) TS_PhantomRouteHints_clone(uint32_t orig) {
24885 LDKPhantomRouteHints orig_conv;
24886 orig_conv.inner = (void*)(orig & (~1));
24887 orig_conv.is_owned = false;
24888 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24889 LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
24890 uint32_t ret_ref = 0;
24891 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24892 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24893 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24894 ret_ref = (uintptr_t)ret_var.inner;
24895 if (ret_var.is_owned) {
24901 uint32_t __attribute__((export_name("TS_ChannelManager_new"))) TS_ChannelManager_new(uint32_t fee_est, uint32_t chain_monitor, uint32_t tx_broadcaster, uint32_t logger, uint32_t keys_manager, uint32_t config, uint32_t params) {
24902 void* fee_est_ptr = (void*)(((uintptr_t)fee_est) & ~1);
24903 CHECK_ACCESS(fee_est_ptr);
24904 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
24905 void* chain_monitor_ptr = (void*)(((uintptr_t)chain_monitor) & ~1);
24906 CHECK_ACCESS(chain_monitor_ptr);
24907 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
24908 void* tx_broadcaster_ptr = (void*)(((uintptr_t)tx_broadcaster) & ~1);
24909 CHECK_ACCESS(tx_broadcaster_ptr);
24910 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
24911 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
24912 CHECK_ACCESS(logger_ptr);
24913 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24914 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
24915 CHECK_ACCESS(keys_manager_ptr);
24916 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
24917 LDKUserConfig config_conv;
24918 config_conv.inner = (void*)(config & (~1));
24919 config_conv.is_owned = (config & 1) || (config == 0);
24920 CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
24921 config_conv = UserConfig_clone(&config_conv);
24922 LDKChainParameters params_conv;
24923 params_conv.inner = (void*)(params & (~1));
24924 params_conv.is_owned = (params & 1) || (params == 0);
24925 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
24926 params_conv = ChainParameters_clone(¶ms_conv);
24927 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
24928 uint32_t ret_ref = 0;
24929 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24930 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24931 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24932 ret_ref = (uintptr_t)ret_var.inner;
24933 if (ret_var.is_owned) {
24939 uint32_t __attribute__((export_name("TS_ChannelManager_get_current_default_configuration"))) TS_ChannelManager_get_current_default_configuration(uint32_t this_arg) {
24940 LDKChannelManager this_arg_conv;
24941 this_arg_conv.inner = (void*)(this_arg & (~1));
24942 this_arg_conv.is_owned = false;
24943 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24944 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
24945 uint32_t ret_ref = 0;
24946 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24947 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24948 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24949 ret_ref = (uintptr_t)ret_var.inner;
24950 if (ret_var.is_owned) {
24956 uint32_t __attribute__((export_name("TS_ChannelManager_create_channel"))) TS_ChannelManager_create_channel(uint32_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int64_t user_channel_id, uint32_t override_config) {
24957 LDKChannelManager this_arg_conv;
24958 this_arg_conv.inner = (void*)(this_arg & (~1));
24959 this_arg_conv.is_owned = false;
24960 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24961 LDKPublicKey their_network_key_ref;
24962 CHECK(their_network_key->arr_len == 33);
24963 memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
24964 LDKUserConfig override_config_conv;
24965 override_config_conv.inner = (void*)(override_config & (~1));
24966 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
24967 CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
24968 override_config_conv = UserConfig_clone(&override_config_conv);
24969 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
24970 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
24971 return (uint32_t)ret_conv;
24974 uint32_tArray __attribute__((export_name("TS_ChannelManager_list_channels"))) TS_ChannelManager_list_channels(uint32_t this_arg) {
24975 LDKChannelManager this_arg_conv;
24976 this_arg_conv.inner = (void*)(this_arg & (~1));
24977 this_arg_conv.is_owned = false;
24978 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24979 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
24980 uint32_tArray ret_arr = NULL;
24981 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
24982 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
24983 for (size_t q = 0; q < ret_var.datalen; q++) {
24984 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
24985 uint32_t ret_conv_16_ref = 0;
24986 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24987 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24988 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
24989 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
24990 if (ret_conv_16_var.is_owned) {
24991 ret_conv_16_ref |= 1;
24993 ret_arr_ptr[q] = ret_conv_16_ref;
24996 FREE(ret_var.data);
25000 uint32_tArray __attribute__((export_name("TS_ChannelManager_list_usable_channels"))) TS_ChannelManager_list_usable_channels(uint32_t this_arg) {
25001 LDKChannelManager this_arg_conv;
25002 this_arg_conv.inner = (void*)(this_arg & (~1));
25003 this_arg_conv.is_owned = false;
25004 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25005 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
25006 uint32_tArray ret_arr = NULL;
25007 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
25008 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
25009 for (size_t q = 0; q < ret_var.datalen; q++) {
25010 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
25011 uint32_t ret_conv_16_ref = 0;
25012 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25013 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25014 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
25015 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
25016 if (ret_conv_16_var.is_owned) {
25017 ret_conv_16_ref |= 1;
25019 ret_arr_ptr[q] = ret_conv_16_ref;
25022 FREE(ret_var.data);
25026 uint32_t __attribute__((export_name("TS_ChannelManager_close_channel"))) TS_ChannelManager_close_channel(uint32_t this_arg, int8_tArray channel_id) {
25027 LDKChannelManager this_arg_conv;
25028 this_arg_conv.inner = (void*)(this_arg & (~1));
25029 this_arg_conv.is_owned = false;
25030 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25031 unsigned char channel_id_arr[32];
25032 CHECK(channel_id->arr_len == 32);
25033 memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
25034 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
25035 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
25036 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
25037 return (uint32_t)ret_conv;
25040 uint32_t __attribute__((export_name("TS_ChannelManager_close_channel_with_target_feerate"))) TS_ChannelManager_close_channel_with_target_feerate(uint32_t this_arg, int8_tArray channel_id, int32_t target_feerate_sats_per_1000_weight) {
25041 LDKChannelManager this_arg_conv;
25042 this_arg_conv.inner = (void*)(this_arg & (~1));
25043 this_arg_conv.is_owned = false;
25044 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25045 unsigned char channel_id_arr[32];
25046 CHECK(channel_id->arr_len == 32);
25047 memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
25048 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
25049 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
25050 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
25051 return (uint32_t)ret_conv;
25054 uint32_t __attribute__((export_name("TS_ChannelManager_force_close_channel"))) TS_ChannelManager_force_close_channel(uint32_t this_arg, int8_tArray channel_id) {
25055 LDKChannelManager this_arg_conv;
25056 this_arg_conv.inner = (void*)(this_arg & (~1));
25057 this_arg_conv.is_owned = false;
25058 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25059 unsigned char channel_id_arr[32];
25060 CHECK(channel_id->arr_len == 32);
25061 memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
25062 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
25063 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
25064 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
25065 return (uint32_t)ret_conv;
25068 void __attribute__((export_name("TS_ChannelManager_force_close_all_channels"))) TS_ChannelManager_force_close_all_channels(uint32_t this_arg) {
25069 LDKChannelManager this_arg_conv;
25070 this_arg_conv.inner = (void*)(this_arg & (~1));
25071 this_arg_conv.is_owned = false;
25072 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25073 ChannelManager_force_close_all_channels(&this_arg_conv);
25076 uint32_t __attribute__((export_name("TS_ChannelManager_send_payment"))) TS_ChannelManager_send_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
25077 LDKChannelManager this_arg_conv;
25078 this_arg_conv.inner = (void*)(this_arg & (~1));
25079 this_arg_conv.is_owned = false;
25080 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25081 LDKRoute route_conv;
25082 route_conv.inner = (void*)(route & (~1));
25083 route_conv.is_owned = false;
25084 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
25085 LDKThirtyTwoBytes payment_hash_ref;
25086 CHECK(payment_hash->arr_len == 32);
25087 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
25088 LDKThirtyTwoBytes payment_secret_ref;
25089 CHECK(payment_secret->arr_len == 32);
25090 memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
25091 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
25092 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
25093 return (uint32_t)ret_conv;
25096 uint32_t __attribute__((export_name("TS_ChannelManager_retry_payment"))) TS_ChannelManager_retry_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_id) {
25097 LDKChannelManager this_arg_conv;
25098 this_arg_conv.inner = (void*)(this_arg & (~1));
25099 this_arg_conv.is_owned = false;
25100 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25101 LDKRoute route_conv;
25102 route_conv.inner = (void*)(route & (~1));
25103 route_conv.is_owned = false;
25104 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
25105 LDKThirtyTwoBytes payment_id_ref;
25106 CHECK(payment_id->arr_len == 32);
25107 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
25108 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
25109 *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
25110 return (uint32_t)ret_conv;
25113 void __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_ChannelManager_abandon_payment(uint32_t this_arg, int8_tArray payment_id) {
25114 LDKChannelManager this_arg_conv;
25115 this_arg_conv.inner = (void*)(this_arg & (~1));
25116 this_arg_conv.is_owned = false;
25117 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25118 LDKThirtyTwoBytes payment_id_ref;
25119 CHECK(payment_id->arr_len == 32);
25120 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
25121 ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
25124 uint32_t __attribute__((export_name("TS_ChannelManager_send_spontaneous_payment"))) TS_ChannelManager_send_spontaneous_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_preimage) {
25125 LDKChannelManager this_arg_conv;
25126 this_arg_conv.inner = (void*)(this_arg & (~1));
25127 this_arg_conv.is_owned = false;
25128 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25129 LDKRoute route_conv;
25130 route_conv.inner = (void*)(route & (~1));
25131 route_conv.is_owned = false;
25132 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
25133 LDKThirtyTwoBytes payment_preimage_ref;
25134 CHECK(payment_preimage->arr_len == 32);
25135 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
25136 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
25137 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
25138 return (uint32_t)ret_conv;
25141 uint32_t __attribute__((export_name("TS_ChannelManager_funding_transaction_generated"))) TS_ChannelManager_funding_transaction_generated(uint32_t this_arg, int8_tArray temporary_channel_id, int8_tArray funding_transaction) {
25142 LDKChannelManager this_arg_conv;
25143 this_arg_conv.inner = (void*)(this_arg & (~1));
25144 this_arg_conv.is_owned = false;
25145 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25146 unsigned char temporary_channel_id_arr[32];
25147 CHECK(temporary_channel_id->arr_len == 32);
25148 memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
25149 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
25150 LDKTransaction funding_transaction_ref;
25151 funding_transaction_ref.datalen = funding_transaction->arr_len;
25152 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
25153 memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
25154 funding_transaction_ref.data_is_owned = true;
25155 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
25156 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
25157 return (uint32_t)ret_conv;
25160 void __attribute__((export_name("TS_ChannelManager_broadcast_node_announcement"))) TS_ChannelManager_broadcast_node_announcement(uint32_t this_arg, int8_tArray rgb, int8_tArray alias, uint32_tArray addresses) {
25161 LDKChannelManager this_arg_conv;
25162 this_arg_conv.inner = (void*)(this_arg & (~1));
25163 this_arg_conv.is_owned = false;
25164 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25165 LDKThreeBytes rgb_ref;
25166 CHECK(rgb->arr_len == 3);
25167 memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
25168 LDKThirtyTwoBytes alias_ref;
25169 CHECK(alias->arr_len == 32);
25170 memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
25171 LDKCVec_NetAddressZ addresses_constr;
25172 addresses_constr.datalen = addresses->arr_len;
25173 if (addresses_constr.datalen > 0)
25174 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
25176 addresses_constr.data = NULL;
25177 uint32_t* addresses_vals = addresses->elems /* XXX addresses leaks */;
25178 for (size_t m = 0; m < addresses_constr.datalen; m++) {
25179 uint32_t addresses_conv_12 = addresses_vals[m];
25180 void* addresses_conv_12_ptr = (void*)(((uintptr_t)addresses_conv_12) & ~1);
25181 CHECK_ACCESS(addresses_conv_12_ptr);
25182 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
25183 addresses_constr.data[m] = addresses_conv_12_conv;
25185 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
25188 void __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint32_t this_arg) {
25189 LDKChannelManager this_arg_conv;
25190 this_arg_conv.inner = (void*)(this_arg & (~1));
25191 this_arg_conv.is_owned = false;
25192 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25193 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
25196 void __attribute__((export_name("TS_ChannelManager_timer_tick_occurred"))) TS_ChannelManager_timer_tick_occurred(uint32_t this_arg) {
25197 LDKChannelManager this_arg_conv;
25198 this_arg_conv.inner = (void*)(this_arg & (~1));
25199 this_arg_conv.is_owned = false;
25200 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25201 ChannelManager_timer_tick_occurred(&this_arg_conv);
25204 jboolean __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_ChannelManager_fail_htlc_backwards(uint32_t this_arg, int8_tArray payment_hash) {
25205 LDKChannelManager this_arg_conv;
25206 this_arg_conv.inner = (void*)(this_arg & (~1));
25207 this_arg_conv.is_owned = false;
25208 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25209 unsigned char payment_hash_arr[32];
25210 CHECK(payment_hash->arr_len == 32);
25211 memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
25212 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
25213 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
25217 jboolean __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint32_t this_arg, int8_tArray payment_preimage) {
25218 LDKChannelManager this_arg_conv;
25219 this_arg_conv.inner = (void*)(this_arg & (~1));
25220 this_arg_conv.is_owned = false;
25221 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25222 LDKThirtyTwoBytes payment_preimage_ref;
25223 CHECK(payment_preimage->arr_len == 32);
25224 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
25225 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
25229 int8_tArray __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) TS_ChannelManager_get_our_node_id(uint32_t this_arg) {
25230 LDKChannelManager this_arg_conv;
25231 this_arg_conv.inner = (void*)(this_arg & (~1));
25232 this_arg_conv.is_owned = false;
25233 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25234 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
25235 memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
25239 uint32_t __attribute__((export_name("TS_ChannelManager_accept_inbound_channel"))) TS_ChannelManager_accept_inbound_channel(uint32_t this_arg, int8_tArray temporary_channel_id) {
25240 LDKChannelManager this_arg_conv;
25241 this_arg_conv.inner = (void*)(this_arg & (~1));
25242 this_arg_conv.is_owned = false;
25243 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25244 unsigned char temporary_channel_id_arr[32];
25245 CHECK(temporary_channel_id->arr_len == 32);
25246 memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
25247 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
25248 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
25249 *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref);
25250 return (uint32_t)ret_conv;
25253 uint32_t __attribute__((export_name("TS_ChannelManager_create_inbound_payment"))) TS_ChannelManager_create_inbound_payment(uint32_t this_arg, uint32_t min_value_msat, int32_t invoice_expiry_delta_secs) {
25254 LDKChannelManager this_arg_conv;
25255 this_arg_conv.inner = (void*)(this_arg & (~1));
25256 this_arg_conv.is_owned = false;
25257 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25258 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
25259 CHECK_ACCESS(min_value_msat_ptr);
25260 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
25261 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
25262 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
25263 *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
25264 return (uint32_t)ret_conv;
25267 uint32_t __attribute__((export_name("TS_ChannelManager_create_inbound_payment_legacy"))) TS_ChannelManager_create_inbound_payment_legacy(uint32_t this_arg, uint32_t min_value_msat, int32_t invoice_expiry_delta_secs) {
25268 LDKChannelManager this_arg_conv;
25269 this_arg_conv.inner = (void*)(this_arg & (~1));
25270 this_arg_conv.is_owned = false;
25271 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25272 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
25273 CHECK_ACCESS(min_value_msat_ptr);
25274 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
25275 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
25276 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
25277 *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
25278 return (uint32_t)ret_conv;
25281 uint32_t __attribute__((export_name("TS_ChannelManager_create_inbound_payment_for_hash"))) TS_ChannelManager_create_inbound_payment_for_hash(uint32_t this_arg, int8_tArray payment_hash, uint32_t min_value_msat, int32_t invoice_expiry_delta_secs) {
25282 LDKChannelManager this_arg_conv;
25283 this_arg_conv.inner = (void*)(this_arg & (~1));
25284 this_arg_conv.is_owned = false;
25285 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25286 LDKThirtyTwoBytes payment_hash_ref;
25287 CHECK(payment_hash->arr_len == 32);
25288 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
25289 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
25290 CHECK_ACCESS(min_value_msat_ptr);
25291 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
25292 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
25293 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
25294 *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
25295 return (uint32_t)ret_conv;
25298 uint32_t __attribute__((export_name("TS_ChannelManager_create_inbound_payment_for_hash_legacy"))) TS_ChannelManager_create_inbound_payment_for_hash_legacy(uint32_t this_arg, int8_tArray payment_hash, uint32_t min_value_msat, int32_t invoice_expiry_delta_secs) {
25299 LDKChannelManager this_arg_conv;
25300 this_arg_conv.inner = (void*)(this_arg & (~1));
25301 this_arg_conv.is_owned = false;
25302 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25303 LDKThirtyTwoBytes payment_hash_ref;
25304 CHECK(payment_hash->arr_len == 32);
25305 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
25306 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
25307 CHECK_ACCESS(min_value_msat_ptr);
25308 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
25309 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
25310 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
25311 *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
25312 return (uint32_t)ret_conv;
25315 uint32_t __attribute__((export_name("TS_ChannelManager_get_payment_preimage"))) TS_ChannelManager_get_payment_preimage(uint32_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret) {
25316 LDKChannelManager this_arg_conv;
25317 this_arg_conv.inner = (void*)(this_arg & (~1));
25318 this_arg_conv.is_owned = false;
25319 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25320 LDKThirtyTwoBytes payment_hash_ref;
25321 CHECK(payment_hash->arr_len == 32);
25322 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
25323 LDKThirtyTwoBytes payment_secret_ref;
25324 CHECK(payment_secret->arr_len == 32);
25325 memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
25326 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
25327 *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
25328 return (uint32_t)ret_conv;
25331 int64_t __attribute__((export_name("TS_ChannelManager_get_phantom_scid"))) TS_ChannelManager_get_phantom_scid(uint32_t this_arg) {
25332 LDKChannelManager this_arg_conv;
25333 this_arg_conv.inner = (void*)(this_arg & (~1));
25334 this_arg_conv.is_owned = false;
25335 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25336 int64_t ret_val = ChannelManager_get_phantom_scid(&this_arg_conv);
25340 uint32_t __attribute__((export_name("TS_ChannelManager_get_phantom_route_hints"))) TS_ChannelManager_get_phantom_route_hints(uint32_t this_arg) {
25341 LDKChannelManager this_arg_conv;
25342 this_arg_conv.inner = (void*)(this_arg & (~1));
25343 this_arg_conv.is_owned = false;
25344 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25345 LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
25346 uint32_t ret_ref = 0;
25347 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25348 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25349 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25350 ret_ref = (uintptr_t)ret_var.inner;
25351 if (ret_var.is_owned) {
25357 uint32_t __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint32_t this_arg) {
25358 LDKChannelManager this_arg_conv;
25359 this_arg_conv.inner = (void*)(this_arg & (~1));
25360 this_arg_conv.is_owned = false;
25361 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25362 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
25363 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
25364 return (uint32_t)ret_ret;
25367 uint32_t __attribute__((export_name("TS_ChannelManager_as_EventsProvider"))) TS_ChannelManager_as_EventsProvider(uint32_t this_arg) {
25368 LDKChannelManager this_arg_conv;
25369 this_arg_conv.inner = (void*)(this_arg & (~1));
25370 this_arg_conv.is_owned = false;
25371 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25372 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
25373 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
25374 return (uint32_t)ret_ret;
25377 uint32_t __attribute__((export_name("TS_ChannelManager_as_Listen"))) TS_ChannelManager_as_Listen(uint32_t this_arg) {
25378 LDKChannelManager this_arg_conv;
25379 this_arg_conv.inner = (void*)(this_arg & (~1));
25380 this_arg_conv.is_owned = false;
25381 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25382 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
25383 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
25384 return (uint32_t)ret_ret;
25387 uint32_t __attribute__((export_name("TS_ChannelManager_as_Confirm"))) TS_ChannelManager_as_Confirm(uint32_t this_arg) {
25388 LDKChannelManager this_arg_conv;
25389 this_arg_conv.inner = (void*)(this_arg & (~1));
25390 this_arg_conv.is_owned = false;
25391 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25392 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
25393 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
25394 return (uint32_t)ret_ret;
25397 void __attribute__((export_name("TS_ChannelManager_await_persistable_update"))) TS_ChannelManager_await_persistable_update(uint32_t this_arg) {
25398 LDKChannelManager this_arg_conv;
25399 this_arg_conv.inner = (void*)(this_arg & (~1));
25400 this_arg_conv.is_owned = false;
25401 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25402 ChannelManager_await_persistable_update(&this_arg_conv);
25405 uint32_t __attribute__((export_name("TS_ChannelManager_current_best_block"))) TS_ChannelManager_current_best_block(uint32_t this_arg) {
25406 LDKChannelManager this_arg_conv;
25407 this_arg_conv.inner = (void*)(this_arg & (~1));
25408 this_arg_conv.is_owned = false;
25409 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25410 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
25411 uint32_t ret_ref = 0;
25412 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25413 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25414 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25415 ret_ref = (uintptr_t)ret_var.inner;
25416 if (ret_var.is_owned) {
25422 uint32_t __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(uint32_t this_arg) {
25423 LDKChannelManager this_arg_conv;
25424 this_arg_conv.inner = (void*)(this_arg & (~1));
25425 this_arg_conv.is_owned = false;
25426 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25427 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
25428 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
25429 return (uint32_t)ret_ret;
25432 int8_tArray __attribute__((export_name("TS_CounterpartyForwardingInfo_write"))) TS_CounterpartyForwardingInfo_write(uint32_t obj) {
25433 LDKCounterpartyForwardingInfo obj_conv;
25434 obj_conv.inner = (void*)(obj & (~1));
25435 obj_conv.is_owned = false;
25436 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25437 LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
25438 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25439 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25440 CVec_u8Z_free(ret_var);
25444 uint32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_read"))) TS_CounterpartyForwardingInfo_read(int8_tArray ser) {
25445 LDKu8slice ser_ref;
25446 ser_ref.datalen = ser->arr_len;
25447 ser_ref.data = ser->elems /* XXX ser leaks */;
25448 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
25449 *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
25450 return (uint32_t)ret_conv;
25453 int8_tArray __attribute__((export_name("TS_ChannelCounterparty_write"))) TS_ChannelCounterparty_write(uint32_t obj) {
25454 LDKChannelCounterparty obj_conv;
25455 obj_conv.inner = (void*)(obj & (~1));
25456 obj_conv.is_owned = false;
25457 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25458 LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
25459 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25460 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25461 CVec_u8Z_free(ret_var);
25465 uint32_t __attribute__((export_name("TS_ChannelCounterparty_read"))) TS_ChannelCounterparty_read(int8_tArray ser) {
25466 LDKu8slice ser_ref;
25467 ser_ref.datalen = ser->arr_len;
25468 ser_ref.data = ser->elems /* XXX ser leaks */;
25469 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
25470 *ret_conv = ChannelCounterparty_read(ser_ref);
25471 return (uint32_t)ret_conv;
25474 int8_tArray __attribute__((export_name("TS_ChannelDetails_write"))) TS_ChannelDetails_write(uint32_t obj) {
25475 LDKChannelDetails obj_conv;
25476 obj_conv.inner = (void*)(obj & (~1));
25477 obj_conv.is_owned = false;
25478 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25479 LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
25480 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25481 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25482 CVec_u8Z_free(ret_var);
25486 uint32_t __attribute__((export_name("TS_ChannelDetails_read"))) TS_ChannelDetails_read(int8_tArray ser) {
25487 LDKu8slice ser_ref;
25488 ser_ref.datalen = ser->arr_len;
25489 ser_ref.data = ser->elems /* XXX ser leaks */;
25490 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
25491 *ret_conv = ChannelDetails_read(ser_ref);
25492 return (uint32_t)ret_conv;
25495 int8_tArray __attribute__((export_name("TS_PhantomRouteHints_write"))) TS_PhantomRouteHints_write(uint32_t obj) {
25496 LDKPhantomRouteHints obj_conv;
25497 obj_conv.inner = (void*)(obj & (~1));
25498 obj_conv.is_owned = false;
25499 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25500 LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
25501 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25502 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25503 CVec_u8Z_free(ret_var);
25507 uint32_t __attribute__((export_name("TS_PhantomRouteHints_read"))) TS_PhantomRouteHints_read(int8_tArray ser) {
25508 LDKu8slice ser_ref;
25509 ser_ref.datalen = ser->arr_len;
25510 ser_ref.data = ser->elems /* XXX ser leaks */;
25511 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
25512 *ret_conv = PhantomRouteHints_read(ser_ref);
25513 return (uint32_t)ret_conv;
25516 int8_tArray __attribute__((export_name("TS_ChannelManager_write"))) TS_ChannelManager_write(uint32_t obj) {
25517 LDKChannelManager obj_conv;
25518 obj_conv.inner = (void*)(obj & (~1));
25519 obj_conv.is_owned = false;
25520 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25521 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
25522 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25523 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25524 CVec_u8Z_free(ret_var);
25528 void __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelManagerReadArgs_free(uint32_t this_obj) {
25529 LDKChannelManagerReadArgs this_obj_conv;
25530 this_obj_conv.inner = (void*)(this_obj & (~1));
25531 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25532 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25533 ChannelManagerReadArgs_free(this_obj_conv);
25536 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_keys_manager"))) TS_ChannelManagerReadArgs_get_keys_manager(uint32_t this_ptr) {
25537 LDKChannelManagerReadArgs this_ptr_conv;
25538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25539 this_ptr_conv.is_owned = false;
25540 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25541 // WARNING: This object doesn't live past this scope, needs clone!
25542 uint32_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv)) | 1;
25546 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_keys_manager"))) TS_ChannelManagerReadArgs_set_keys_manager(uint32_t this_ptr, uint32_t val) {
25547 LDKChannelManagerReadArgs this_ptr_conv;
25548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25549 this_ptr_conv.is_owned = false;
25550 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25551 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25552 CHECK_ACCESS(val_ptr);
25553 LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
25554 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
25557 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint32_t this_ptr) {
25558 LDKChannelManagerReadArgs this_ptr_conv;
25559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25560 this_ptr_conv.is_owned = false;
25561 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25562 // WARNING: This object doesn't live past this scope, needs clone!
25563 uint32_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv)) | 1;
25567 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_fee_estimator"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint32_t this_ptr, uint32_t val) {
25568 LDKChannelManagerReadArgs this_ptr_conv;
25569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25570 this_ptr_conv.is_owned = false;
25571 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25572 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25573 CHECK_ACCESS(val_ptr);
25574 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
25575 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
25578 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_chain_monitor"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint32_t this_ptr) {
25579 LDKChannelManagerReadArgs this_ptr_conv;
25580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25581 this_ptr_conv.is_owned = false;
25582 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25583 // WARNING: This object doesn't live past this scope, needs clone!
25584 uint32_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv)) | 1;
25588 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_chain_monitor"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint32_t this_ptr, uint32_t val) {
25589 LDKChannelManagerReadArgs this_ptr_conv;
25590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25591 this_ptr_conv.is_owned = false;
25592 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25593 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25594 CHECK_ACCESS(val_ptr);
25595 LDKWatch val_conv = *(LDKWatch*)(val_ptr);
25596 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
25599 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_tx_broadcaster"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint32_t this_ptr) {
25600 LDKChannelManagerReadArgs this_ptr_conv;
25601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25602 this_ptr_conv.is_owned = false;
25603 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25604 // WARNING: This object doesn't live past this scope, needs clone!
25605 uint32_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv)) | 1;
25609 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint32_t this_ptr, uint32_t val) {
25610 LDKChannelManagerReadArgs this_ptr_conv;
25611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25612 this_ptr_conv.is_owned = false;
25613 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25614 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25615 CHECK_ACCESS(val_ptr);
25616 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
25617 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
25620 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint32_t this_ptr) {
25621 LDKChannelManagerReadArgs this_ptr_conv;
25622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25623 this_ptr_conv.is_owned = false;
25624 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25625 // WARNING: This object doesn't live past this scope, needs clone!
25626 uint32_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv)) | 1;
25630 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_logger"))) TS_ChannelManagerReadArgs_set_logger(uint32_t this_ptr, uint32_t val) {
25631 LDKChannelManagerReadArgs this_ptr_conv;
25632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25633 this_ptr_conv.is_owned = false;
25634 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25635 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25636 CHECK_ACCESS(val_ptr);
25637 LDKLogger val_conv = *(LDKLogger*)(val_ptr);
25638 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
25641 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_default_config"))) TS_ChannelManagerReadArgs_get_default_config(uint32_t this_ptr) {
25642 LDKChannelManagerReadArgs this_ptr_conv;
25643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25644 this_ptr_conv.is_owned = false;
25645 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25646 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
25647 uint32_t ret_ref = 0;
25648 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25649 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25650 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25651 ret_ref = (uintptr_t)ret_var.inner;
25652 if (ret_var.is_owned) {
25658 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config"))) TS_ChannelManagerReadArgs_set_default_config(uint32_t this_ptr, uint32_t val) {
25659 LDKChannelManagerReadArgs this_ptr_conv;
25660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25661 this_ptr_conv.is_owned = false;
25662 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25663 LDKUserConfig val_conv;
25664 val_conv.inner = (void*)(val & (~1));
25665 val_conv.is_owned = (val & 1) || (val == 0);
25666 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25667 val_conv = UserConfig_clone(&val_conv);
25668 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
25671 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_new"))) TS_ChannelManagerReadArgs_new(uint32_t keys_manager, uint32_t fee_estimator, uint32_t chain_monitor, uint32_t tx_broadcaster, uint32_t logger, uint32_t default_config, uint32_tArray channel_monitors) {
25672 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
25673 CHECK_ACCESS(keys_manager_ptr);
25674 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
25675 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
25676 CHECK_ACCESS(fee_estimator_ptr);
25677 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25678 void* chain_monitor_ptr = (void*)(((uintptr_t)chain_monitor) & ~1);
25679 CHECK_ACCESS(chain_monitor_ptr);
25680 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
25681 void* tx_broadcaster_ptr = (void*)(((uintptr_t)tx_broadcaster) & ~1);
25682 CHECK_ACCESS(tx_broadcaster_ptr);
25683 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
25684 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
25685 CHECK_ACCESS(logger_ptr);
25686 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25687 LDKUserConfig default_config_conv;
25688 default_config_conv.inner = (void*)(default_config & (~1));
25689 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
25690 CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
25691 default_config_conv = UserConfig_clone(&default_config_conv);
25692 LDKCVec_ChannelMonitorZ channel_monitors_constr;
25693 channel_monitors_constr.datalen = channel_monitors->arr_len;
25694 if (channel_monitors_constr.datalen > 0)
25695 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
25697 channel_monitors_constr.data = NULL;
25698 uint32_t* channel_monitors_vals = channel_monitors->elems /* XXX channel_monitors leaks */;
25699 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
25700 uint32_t channel_monitors_conv_16 = channel_monitors_vals[q];
25701 LDKChannelMonitor channel_monitors_conv_16_conv;
25702 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
25703 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
25704 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
25705 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
25707 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);
25708 uint32_t ret_ref = 0;
25709 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25710 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25711 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25712 ret_ref = (uintptr_t)ret_var.inner;
25713 if (ret_var.is_owned) {
25719 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_read"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint32_t arg) {
25720 LDKu8slice ser_ref;
25721 ser_ref.datalen = ser->arr_len;
25722 ser_ref.data = ser->elems /* XXX ser leaks */;
25723 LDKChannelManagerReadArgs arg_conv;
25724 arg_conv.inner = (void*)(arg & (~1));
25725 arg_conv.is_owned = (arg & 1) || (arg == 0);
25726 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25727 // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
25728 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
25729 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
25730 return (uint32_t)ret_conv;
25733 void __attribute__((export_name("TS_DecodeError_free"))) TS_DecodeError_free(uint32_t this_obj) {
25734 LDKDecodeError this_obj_conv;
25735 this_obj_conv.inner = (void*)(this_obj & (~1));
25736 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25737 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25738 DecodeError_free(this_obj_conv);
25741 static inline uintptr_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
25742 LDKDecodeError ret_var = DecodeError_clone(arg);
25743 uint32_t ret_ref = 0;
25744 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25745 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25746 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25747 ret_ref = (uintptr_t)ret_var.inner;
25748 if (ret_var.is_owned) {
25753 uint32_t __attribute__((export_name("TS_DecodeError_clone_ptr"))) TS_DecodeError_clone_ptr(uint32_t arg) {
25754 LDKDecodeError arg_conv;
25755 arg_conv.inner = (void*)(arg & (~1));
25756 arg_conv.is_owned = false;
25757 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25758 uint32_t ret_val = DecodeError_clone_ptr(&arg_conv);
25762 uint32_t __attribute__((export_name("TS_DecodeError_clone"))) TS_DecodeError_clone(uint32_t orig) {
25763 LDKDecodeError orig_conv;
25764 orig_conv.inner = (void*)(orig & (~1));
25765 orig_conv.is_owned = false;
25766 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25767 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
25768 uint32_t ret_ref = 0;
25769 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25770 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25771 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25772 ret_ref = (uintptr_t)ret_var.inner;
25773 if (ret_var.is_owned) {
25779 void __attribute__((export_name("TS_Init_free"))) TS_Init_free(uint32_t this_obj) {
25780 LDKInit this_obj_conv;
25781 this_obj_conv.inner = (void*)(this_obj & (~1));
25782 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25783 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25784 Init_free(this_obj_conv);
25787 uint32_t __attribute__((export_name("TS_Init_get_features"))) TS_Init_get_features(uint32_t this_ptr) {
25788 LDKInit this_ptr_conv;
25789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25790 this_ptr_conv.is_owned = false;
25791 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25792 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
25793 uint32_t ret_ref = 0;
25794 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25795 CHECK((((uintptr_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 = (uintptr_t)ret_var.inner;
25798 if (ret_var.is_owned) {
25804 void __attribute__((export_name("TS_Init_set_features"))) TS_Init_set_features(uint32_t this_ptr, uint32_t val) {
25805 LDKInit this_ptr_conv;
25806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25807 this_ptr_conv.is_owned = false;
25808 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25809 LDKInitFeatures val_conv;
25810 val_conv.inner = (void*)(val & (~1));
25811 val_conv.is_owned = (val & 1) || (val == 0);
25812 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25813 val_conv = InitFeatures_clone(&val_conv);
25814 Init_set_features(&this_ptr_conv, val_conv);
25817 uint32_t __attribute__((export_name("TS_Init_new"))) TS_Init_new(uint32_t features_arg) {
25818 LDKInitFeatures features_arg_conv;
25819 features_arg_conv.inner = (void*)(features_arg & (~1));
25820 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
25821 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
25822 features_arg_conv = InitFeatures_clone(&features_arg_conv);
25823 LDKInit ret_var = Init_new(features_arg_conv);
25824 uint32_t ret_ref = 0;
25825 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25826 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25827 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25828 ret_ref = (uintptr_t)ret_var.inner;
25829 if (ret_var.is_owned) {
25835 static inline uintptr_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
25836 LDKInit ret_var = Init_clone(arg);
25837 uint32_t ret_ref = 0;
25838 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25839 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25840 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25841 ret_ref = (uintptr_t)ret_var.inner;
25842 if (ret_var.is_owned) {
25847 uint32_t __attribute__((export_name("TS_Init_clone_ptr"))) TS_Init_clone_ptr(uint32_t arg) {
25849 arg_conv.inner = (void*)(arg & (~1));
25850 arg_conv.is_owned = false;
25851 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25852 uint32_t ret_val = Init_clone_ptr(&arg_conv);
25856 uint32_t __attribute__((export_name("TS_Init_clone"))) TS_Init_clone(uint32_t orig) {
25858 orig_conv.inner = (void*)(orig & (~1));
25859 orig_conv.is_owned = false;
25860 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25861 LDKInit ret_var = Init_clone(&orig_conv);
25862 uint32_t ret_ref = 0;
25863 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25864 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25865 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25866 ret_ref = (uintptr_t)ret_var.inner;
25867 if (ret_var.is_owned) {
25873 void __attribute__((export_name("TS_ErrorMessage_free"))) TS_ErrorMessage_free(uint32_t this_obj) {
25874 LDKErrorMessage this_obj_conv;
25875 this_obj_conv.inner = (void*)(this_obj & (~1));
25876 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25877 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25878 ErrorMessage_free(this_obj_conv);
25881 int8_tArray __attribute__((export_name("TS_ErrorMessage_get_channel_id"))) TS_ErrorMessage_get_channel_id(uint32_t this_ptr) {
25882 LDKErrorMessage this_ptr_conv;
25883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25884 this_ptr_conv.is_owned = false;
25885 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25886 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25887 memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
25891 void __attribute__((export_name("TS_ErrorMessage_set_channel_id"))) TS_ErrorMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
25892 LDKErrorMessage this_ptr_conv;
25893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25894 this_ptr_conv.is_owned = false;
25895 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25896 LDKThirtyTwoBytes val_ref;
25897 CHECK(val->arr_len == 32);
25898 memcpy(val_ref.data, val->elems, 32); FREE(val);
25899 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
25902 jstring __attribute__((export_name("TS_ErrorMessage_get_data"))) TS_ErrorMessage_get_data(uint32_t this_ptr) {
25903 LDKErrorMessage this_ptr_conv;
25904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25905 this_ptr_conv.is_owned = false;
25906 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25907 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
25908 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
25913 void __attribute__((export_name("TS_ErrorMessage_set_data"))) TS_ErrorMessage_set_data(uint32_t this_ptr, jstring val) {
25914 LDKErrorMessage this_ptr_conv;
25915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25916 this_ptr_conv.is_owned = false;
25917 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25918 LDKStr val_conv = str_ref_to_owned_c(val);
25919 ErrorMessage_set_data(&this_ptr_conv, val_conv);
25922 uint32_t __attribute__((export_name("TS_ErrorMessage_new"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
25923 LDKThirtyTwoBytes channel_id_arg_ref;
25924 CHECK(channel_id_arg->arr_len == 32);
25925 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
25926 LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
25927 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
25928 uint32_t ret_ref = 0;
25929 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25930 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25931 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25932 ret_ref = (uintptr_t)ret_var.inner;
25933 if (ret_var.is_owned) {
25939 static inline uintptr_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
25940 LDKErrorMessage ret_var = ErrorMessage_clone(arg);
25941 uint32_t ret_ref = 0;
25942 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25943 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25944 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25945 ret_ref = (uintptr_t)ret_var.inner;
25946 if (ret_var.is_owned) {
25951 uint32_t __attribute__((export_name("TS_ErrorMessage_clone_ptr"))) TS_ErrorMessage_clone_ptr(uint32_t arg) {
25952 LDKErrorMessage arg_conv;
25953 arg_conv.inner = (void*)(arg & (~1));
25954 arg_conv.is_owned = false;
25955 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25956 uint32_t ret_val = ErrorMessage_clone_ptr(&arg_conv);
25960 uint32_t __attribute__((export_name("TS_ErrorMessage_clone"))) TS_ErrorMessage_clone(uint32_t orig) {
25961 LDKErrorMessage orig_conv;
25962 orig_conv.inner = (void*)(orig & (~1));
25963 orig_conv.is_owned = false;
25964 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25965 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
25966 uint32_t ret_ref = 0;
25967 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25968 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25969 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25970 ret_ref = (uintptr_t)ret_var.inner;
25971 if (ret_var.is_owned) {
25977 void __attribute__((export_name("TS_WarningMessage_free"))) TS_WarningMessage_free(uint32_t this_obj) {
25978 LDKWarningMessage this_obj_conv;
25979 this_obj_conv.inner = (void*)(this_obj & (~1));
25980 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25981 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25982 WarningMessage_free(this_obj_conv);
25985 int8_tArray __attribute__((export_name("TS_WarningMessage_get_channel_id"))) TS_WarningMessage_get_channel_id(uint32_t this_ptr) {
25986 LDKWarningMessage this_ptr_conv;
25987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25988 this_ptr_conv.is_owned = false;
25989 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25990 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25991 memcpy(ret_arr->elems, *WarningMessage_get_channel_id(&this_ptr_conv), 32);
25995 void __attribute__((export_name("TS_WarningMessage_set_channel_id"))) TS_WarningMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
25996 LDKWarningMessage this_ptr_conv;
25997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25998 this_ptr_conv.is_owned = false;
25999 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26000 LDKThirtyTwoBytes val_ref;
26001 CHECK(val->arr_len == 32);
26002 memcpy(val_ref.data, val->elems, 32); FREE(val);
26003 WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
26006 jstring __attribute__((export_name("TS_WarningMessage_get_data"))) TS_WarningMessage_get_data(uint32_t this_ptr) {
26007 LDKWarningMessage this_ptr_conv;
26008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26009 this_ptr_conv.is_owned = false;
26010 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26011 LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
26012 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
26017 void __attribute__((export_name("TS_WarningMessage_set_data"))) TS_WarningMessage_set_data(uint32_t this_ptr, jstring val) {
26018 LDKWarningMessage this_ptr_conv;
26019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26020 this_ptr_conv.is_owned = false;
26021 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26022 LDKStr val_conv = str_ref_to_owned_c(val);
26023 WarningMessage_set_data(&this_ptr_conv, val_conv);
26026 uint32_t __attribute__((export_name("TS_WarningMessage_new"))) TS_WarningMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
26027 LDKThirtyTwoBytes channel_id_arg_ref;
26028 CHECK(channel_id_arg->arr_len == 32);
26029 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
26030 LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
26031 LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
26032 uint32_t ret_ref = 0;
26033 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26034 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26035 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26036 ret_ref = (uintptr_t)ret_var.inner;
26037 if (ret_var.is_owned) {
26043 static inline uintptr_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
26044 LDKWarningMessage ret_var = WarningMessage_clone(arg);
26045 uint32_t ret_ref = 0;
26046 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26047 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26048 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26049 ret_ref = (uintptr_t)ret_var.inner;
26050 if (ret_var.is_owned) {
26055 uint32_t __attribute__((export_name("TS_WarningMessage_clone_ptr"))) TS_WarningMessage_clone_ptr(uint32_t arg) {
26056 LDKWarningMessage arg_conv;
26057 arg_conv.inner = (void*)(arg & (~1));
26058 arg_conv.is_owned = false;
26059 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26060 uint32_t ret_val = WarningMessage_clone_ptr(&arg_conv);
26064 uint32_t __attribute__((export_name("TS_WarningMessage_clone"))) TS_WarningMessage_clone(uint32_t orig) {
26065 LDKWarningMessage orig_conv;
26066 orig_conv.inner = (void*)(orig & (~1));
26067 orig_conv.is_owned = false;
26068 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26069 LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
26070 uint32_t ret_ref = 0;
26071 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26072 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26073 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26074 ret_ref = (uintptr_t)ret_var.inner;
26075 if (ret_var.is_owned) {
26081 void __attribute__((export_name("TS_Ping_free"))) TS_Ping_free(uint32_t this_obj) {
26082 LDKPing this_obj_conv;
26083 this_obj_conv.inner = (void*)(this_obj & (~1));
26084 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26085 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26086 Ping_free(this_obj_conv);
26089 int16_t __attribute__((export_name("TS_Ping_get_ponglen"))) TS_Ping_get_ponglen(uint32_t this_ptr) {
26090 LDKPing this_ptr_conv;
26091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26092 this_ptr_conv.is_owned = false;
26093 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26094 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
26098 void __attribute__((export_name("TS_Ping_set_ponglen"))) TS_Ping_set_ponglen(uint32_t this_ptr, int16_t val) {
26099 LDKPing this_ptr_conv;
26100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26101 this_ptr_conv.is_owned = false;
26102 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26103 Ping_set_ponglen(&this_ptr_conv, val);
26106 int16_t __attribute__((export_name("TS_Ping_get_byteslen"))) TS_Ping_get_byteslen(uint32_t this_ptr) {
26107 LDKPing this_ptr_conv;
26108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26109 this_ptr_conv.is_owned = false;
26110 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26111 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
26115 void __attribute__((export_name("TS_Ping_set_byteslen"))) TS_Ping_set_byteslen(uint32_t this_ptr, int16_t val) {
26116 LDKPing this_ptr_conv;
26117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26118 this_ptr_conv.is_owned = false;
26119 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26120 Ping_set_byteslen(&this_ptr_conv, val);
26123 uint32_t __attribute__((export_name("TS_Ping_new"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
26124 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
26125 uint32_t ret_ref = 0;
26126 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26127 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26128 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26129 ret_ref = (uintptr_t)ret_var.inner;
26130 if (ret_var.is_owned) {
26136 static inline uintptr_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
26137 LDKPing ret_var = Ping_clone(arg);
26138 uint32_t ret_ref = 0;
26139 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26140 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26141 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26142 ret_ref = (uintptr_t)ret_var.inner;
26143 if (ret_var.is_owned) {
26148 uint32_t __attribute__((export_name("TS_Ping_clone_ptr"))) TS_Ping_clone_ptr(uint32_t arg) {
26150 arg_conv.inner = (void*)(arg & (~1));
26151 arg_conv.is_owned = false;
26152 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26153 uint32_t ret_val = Ping_clone_ptr(&arg_conv);
26157 uint32_t __attribute__((export_name("TS_Ping_clone"))) TS_Ping_clone(uint32_t orig) {
26159 orig_conv.inner = (void*)(orig & (~1));
26160 orig_conv.is_owned = false;
26161 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26162 LDKPing ret_var = Ping_clone(&orig_conv);
26163 uint32_t ret_ref = 0;
26164 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26165 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26166 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26167 ret_ref = (uintptr_t)ret_var.inner;
26168 if (ret_var.is_owned) {
26174 void __attribute__((export_name("TS_Pong_free"))) TS_Pong_free(uint32_t this_obj) {
26175 LDKPong this_obj_conv;
26176 this_obj_conv.inner = (void*)(this_obj & (~1));
26177 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26178 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26179 Pong_free(this_obj_conv);
26182 int16_t __attribute__((export_name("TS_Pong_get_byteslen"))) TS_Pong_get_byteslen(uint32_t this_ptr) {
26183 LDKPong this_ptr_conv;
26184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26185 this_ptr_conv.is_owned = false;
26186 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26187 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
26191 void __attribute__((export_name("TS_Pong_set_byteslen"))) TS_Pong_set_byteslen(uint32_t this_ptr, int16_t val) {
26192 LDKPong this_ptr_conv;
26193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26194 this_ptr_conv.is_owned = false;
26195 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26196 Pong_set_byteslen(&this_ptr_conv, val);
26199 uint32_t __attribute__((export_name("TS_Pong_new"))) TS_Pong_new(int16_t byteslen_arg) {
26200 LDKPong ret_var = Pong_new(byteslen_arg);
26201 uint32_t ret_ref = 0;
26202 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26203 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26204 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26205 ret_ref = (uintptr_t)ret_var.inner;
26206 if (ret_var.is_owned) {
26212 static inline uintptr_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
26213 LDKPong ret_var = Pong_clone(arg);
26214 uint32_t ret_ref = 0;
26215 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26216 CHECK((((uintptr_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 = (uintptr_t)ret_var.inner;
26219 if (ret_var.is_owned) {
26224 uint32_t __attribute__((export_name("TS_Pong_clone_ptr"))) TS_Pong_clone_ptr(uint32_t arg) {
26226 arg_conv.inner = (void*)(arg & (~1));
26227 arg_conv.is_owned = false;
26228 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26229 uint32_t ret_val = Pong_clone_ptr(&arg_conv);
26233 uint32_t __attribute__((export_name("TS_Pong_clone"))) TS_Pong_clone(uint32_t orig) {
26235 orig_conv.inner = (void*)(orig & (~1));
26236 orig_conv.is_owned = false;
26237 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26238 LDKPong ret_var = Pong_clone(&orig_conv);
26239 uint32_t ret_ref = 0;
26240 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26241 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26242 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26243 ret_ref = (uintptr_t)ret_var.inner;
26244 if (ret_var.is_owned) {
26250 void __attribute__((export_name("TS_OpenChannel_free"))) TS_OpenChannel_free(uint32_t this_obj) {
26251 LDKOpenChannel this_obj_conv;
26252 this_obj_conv.inner = (void*)(this_obj & (~1));
26253 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26254 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26255 OpenChannel_free(this_obj_conv);
26258 int8_tArray __attribute__((export_name("TS_OpenChannel_get_chain_hash"))) TS_OpenChannel_get_chain_hash(uint32_t this_ptr) {
26259 LDKOpenChannel this_ptr_conv;
26260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26261 this_ptr_conv.is_owned = false;
26262 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26263 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26264 memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
26268 void __attribute__((export_name("TS_OpenChannel_set_chain_hash"))) TS_OpenChannel_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26269 LDKOpenChannel this_ptr_conv;
26270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26271 this_ptr_conv.is_owned = false;
26272 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26273 LDKThirtyTwoBytes val_ref;
26274 CHECK(val->arr_len == 32);
26275 memcpy(val_ref.data, val->elems, 32); FREE(val);
26276 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
26279 int8_tArray __attribute__((export_name("TS_OpenChannel_get_temporary_channel_id"))) TS_OpenChannel_get_temporary_channel_id(uint32_t this_ptr) {
26280 LDKOpenChannel this_ptr_conv;
26281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26282 this_ptr_conv.is_owned = false;
26283 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26284 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26285 memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
26289 void __attribute__((export_name("TS_OpenChannel_set_temporary_channel_id"))) TS_OpenChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
26290 LDKOpenChannel this_ptr_conv;
26291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26292 this_ptr_conv.is_owned = false;
26293 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26294 LDKThirtyTwoBytes val_ref;
26295 CHECK(val->arr_len == 32);
26296 memcpy(val_ref.data, val->elems, 32); FREE(val);
26297 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
26300 int64_t __attribute__((export_name("TS_OpenChannel_get_funding_satoshis"))) TS_OpenChannel_get_funding_satoshis(uint32_t this_ptr) {
26301 LDKOpenChannel this_ptr_conv;
26302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26303 this_ptr_conv.is_owned = false;
26304 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26305 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
26309 void __attribute__((export_name("TS_OpenChannel_set_funding_satoshis"))) TS_OpenChannel_set_funding_satoshis(uint32_t this_ptr, int64_t val) {
26310 LDKOpenChannel 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 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
26317 int64_t __attribute__((export_name("TS_OpenChannel_get_push_msat"))) TS_OpenChannel_get_push_msat(uint32_t this_ptr) {
26318 LDKOpenChannel this_ptr_conv;
26319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26320 this_ptr_conv.is_owned = false;
26321 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26322 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
26326 void __attribute__((export_name("TS_OpenChannel_set_push_msat"))) TS_OpenChannel_set_push_msat(uint32_t this_ptr, int64_t val) {
26327 LDKOpenChannel 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 OpenChannel_set_push_msat(&this_ptr_conv, val);
26334 int64_t __attribute__((export_name("TS_OpenChannel_get_dust_limit_satoshis"))) TS_OpenChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
26335 LDKOpenChannel this_ptr_conv;
26336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26337 this_ptr_conv.is_owned = false;
26338 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26339 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
26343 void __attribute__((export_name("TS_OpenChannel_set_dust_limit_satoshis"))) TS_OpenChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
26344 LDKOpenChannel 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 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
26351 int64_t __attribute__((export_name("TS_OpenChannel_get_max_htlc_value_in_flight_msat"))) TS_OpenChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
26352 LDKOpenChannel this_ptr_conv;
26353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26354 this_ptr_conv.is_owned = false;
26355 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26356 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
26360 void __attribute__((export_name("TS_OpenChannel_set_max_htlc_value_in_flight_msat"))) TS_OpenChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
26361 LDKOpenChannel this_ptr_conv;
26362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26363 this_ptr_conv.is_owned = false;
26364 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26365 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
26368 int64_t __attribute__((export_name("TS_OpenChannel_get_channel_reserve_satoshis"))) TS_OpenChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
26369 LDKOpenChannel this_ptr_conv;
26370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26371 this_ptr_conv.is_owned = false;
26372 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26373 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
26377 void __attribute__((export_name("TS_OpenChannel_set_channel_reserve_satoshis"))) TS_OpenChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
26378 LDKOpenChannel this_ptr_conv;
26379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26380 this_ptr_conv.is_owned = false;
26381 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26382 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
26385 int64_t __attribute__((export_name("TS_OpenChannel_get_htlc_minimum_msat"))) TS_OpenChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
26386 LDKOpenChannel this_ptr_conv;
26387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26388 this_ptr_conv.is_owned = false;
26389 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26390 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
26394 void __attribute__((export_name("TS_OpenChannel_set_htlc_minimum_msat"))) TS_OpenChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
26395 LDKOpenChannel this_ptr_conv;
26396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26397 this_ptr_conv.is_owned = false;
26398 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26399 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
26402 int32_t __attribute__((export_name("TS_OpenChannel_get_feerate_per_kw"))) TS_OpenChannel_get_feerate_per_kw(uint32_t this_ptr) {
26403 LDKOpenChannel this_ptr_conv;
26404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26405 this_ptr_conv.is_owned = false;
26406 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26407 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
26411 void __attribute__((export_name("TS_OpenChannel_set_feerate_per_kw"))) TS_OpenChannel_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
26412 LDKOpenChannel this_ptr_conv;
26413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26414 this_ptr_conv.is_owned = false;
26415 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26416 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
26419 int16_t __attribute__((export_name("TS_OpenChannel_get_to_self_delay"))) TS_OpenChannel_get_to_self_delay(uint32_t this_ptr) {
26420 LDKOpenChannel this_ptr_conv;
26421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26422 this_ptr_conv.is_owned = false;
26423 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26424 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
26428 void __attribute__((export_name("TS_OpenChannel_set_to_self_delay"))) TS_OpenChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
26429 LDKOpenChannel this_ptr_conv;
26430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26431 this_ptr_conv.is_owned = false;
26432 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26433 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
26436 int16_t __attribute__((export_name("TS_OpenChannel_get_max_accepted_htlcs"))) TS_OpenChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
26437 LDKOpenChannel this_ptr_conv;
26438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26439 this_ptr_conv.is_owned = false;
26440 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26441 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
26445 void __attribute__((export_name("TS_OpenChannel_set_max_accepted_htlcs"))) TS_OpenChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
26446 LDKOpenChannel 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 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
26453 int8_tArray __attribute__((export_name("TS_OpenChannel_get_funding_pubkey"))) TS_OpenChannel_get_funding_pubkey(uint32_t this_ptr) {
26454 LDKOpenChannel this_ptr_conv;
26455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26456 this_ptr_conv.is_owned = false;
26457 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26458 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26459 memcpy(ret_arr->elems, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
26463 void __attribute__((export_name("TS_OpenChannel_set_funding_pubkey"))) TS_OpenChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
26464 LDKOpenChannel this_ptr_conv;
26465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26466 this_ptr_conv.is_owned = false;
26467 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26468 LDKPublicKey val_ref;
26469 CHECK(val->arr_len == 33);
26470 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26471 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
26474 int8_tArray __attribute__((export_name("TS_OpenChannel_get_revocation_basepoint"))) TS_OpenChannel_get_revocation_basepoint(uint32_t this_ptr) {
26475 LDKOpenChannel this_ptr_conv;
26476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26477 this_ptr_conv.is_owned = false;
26478 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26479 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26480 memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
26484 void __attribute__((export_name("TS_OpenChannel_set_revocation_basepoint"))) TS_OpenChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
26485 LDKOpenChannel this_ptr_conv;
26486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26487 this_ptr_conv.is_owned = false;
26488 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26489 LDKPublicKey val_ref;
26490 CHECK(val->arr_len == 33);
26491 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26492 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
26495 int8_tArray __attribute__((export_name("TS_OpenChannel_get_payment_point"))) TS_OpenChannel_get_payment_point(uint32_t this_ptr) {
26496 LDKOpenChannel this_ptr_conv;
26497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26498 this_ptr_conv.is_owned = false;
26499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26500 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26501 memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
26505 void __attribute__((export_name("TS_OpenChannel_set_payment_point"))) TS_OpenChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
26506 LDKOpenChannel this_ptr_conv;
26507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26508 this_ptr_conv.is_owned = false;
26509 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26510 LDKPublicKey val_ref;
26511 CHECK(val->arr_len == 33);
26512 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26513 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
26516 int8_tArray __attribute__((export_name("TS_OpenChannel_get_delayed_payment_basepoint"))) TS_OpenChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
26517 LDKOpenChannel this_ptr_conv;
26518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26519 this_ptr_conv.is_owned = false;
26520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26521 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26522 memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
26526 void __attribute__((export_name("TS_OpenChannel_set_delayed_payment_basepoint"))) TS_OpenChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
26527 LDKOpenChannel this_ptr_conv;
26528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26529 this_ptr_conv.is_owned = false;
26530 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26531 LDKPublicKey val_ref;
26532 CHECK(val->arr_len == 33);
26533 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26534 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
26537 int8_tArray __attribute__((export_name("TS_OpenChannel_get_htlc_basepoint"))) TS_OpenChannel_get_htlc_basepoint(uint32_t this_ptr) {
26538 LDKOpenChannel this_ptr_conv;
26539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26540 this_ptr_conv.is_owned = false;
26541 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26542 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26543 memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
26547 void __attribute__((export_name("TS_OpenChannel_set_htlc_basepoint"))) TS_OpenChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
26548 LDKOpenChannel this_ptr_conv;
26549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26550 this_ptr_conv.is_owned = false;
26551 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26552 LDKPublicKey val_ref;
26553 CHECK(val->arr_len == 33);
26554 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26555 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
26558 int8_tArray __attribute__((export_name("TS_OpenChannel_get_first_per_commitment_point"))) TS_OpenChannel_get_first_per_commitment_point(uint32_t this_ptr) {
26559 LDKOpenChannel 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 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26564 memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
26568 void __attribute__((export_name("TS_OpenChannel_set_first_per_commitment_point"))) TS_OpenChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
26569 LDKOpenChannel this_ptr_conv;
26570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26571 this_ptr_conv.is_owned = false;
26572 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26573 LDKPublicKey val_ref;
26574 CHECK(val->arr_len == 33);
26575 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26576 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
26579 int8_t __attribute__((export_name("TS_OpenChannel_get_channel_flags"))) TS_OpenChannel_get_channel_flags(uint32_t this_ptr) {
26580 LDKOpenChannel this_ptr_conv;
26581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26582 this_ptr_conv.is_owned = false;
26583 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26584 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
26588 void __attribute__((export_name("TS_OpenChannel_set_channel_flags"))) TS_OpenChannel_set_channel_flags(uint32_t this_ptr, int8_t val) {
26589 LDKOpenChannel this_ptr_conv;
26590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26591 this_ptr_conv.is_owned = false;
26592 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26593 OpenChannel_set_channel_flags(&this_ptr_conv, val);
26596 uint32_t __attribute__((export_name("TS_OpenChannel_get_channel_type"))) TS_OpenChannel_get_channel_type(uint32_t this_ptr) {
26597 LDKOpenChannel this_ptr_conv;
26598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26599 this_ptr_conv.is_owned = false;
26600 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26601 LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
26602 uint32_t ret_ref = 0;
26603 if ((uintptr_t)ret_var.inner > 4096) {
26604 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26605 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26606 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26607 ret_ref = (uintptr_t)ret_var.inner;
26608 if (ret_var.is_owned) {
26615 void __attribute__((export_name("TS_OpenChannel_set_channel_type"))) TS_OpenChannel_set_channel_type(uint32_t this_ptr, uint32_t val) {
26616 LDKOpenChannel this_ptr_conv;
26617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26618 this_ptr_conv.is_owned = false;
26619 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26620 LDKChannelTypeFeatures val_conv;
26621 val_conv.inner = (void*)(val & (~1));
26622 val_conv.is_owned = (val & 1) || (val == 0);
26623 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26624 val_conv = ChannelTypeFeatures_clone(&val_conv);
26625 OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
26628 static inline uintptr_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
26629 LDKOpenChannel ret_var = OpenChannel_clone(arg);
26630 uint32_t ret_ref = 0;
26631 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26632 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26633 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26634 ret_ref = (uintptr_t)ret_var.inner;
26635 if (ret_var.is_owned) {
26640 uint32_t __attribute__((export_name("TS_OpenChannel_clone_ptr"))) TS_OpenChannel_clone_ptr(uint32_t arg) {
26641 LDKOpenChannel arg_conv;
26642 arg_conv.inner = (void*)(arg & (~1));
26643 arg_conv.is_owned = false;
26644 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26645 uint32_t ret_val = OpenChannel_clone_ptr(&arg_conv);
26649 uint32_t __attribute__((export_name("TS_OpenChannel_clone"))) TS_OpenChannel_clone(uint32_t orig) {
26650 LDKOpenChannel orig_conv;
26651 orig_conv.inner = (void*)(orig & (~1));
26652 orig_conv.is_owned = false;
26653 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26654 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
26655 uint32_t ret_ref = 0;
26656 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26657 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26658 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26659 ret_ref = (uintptr_t)ret_var.inner;
26660 if (ret_var.is_owned) {
26666 void __attribute__((export_name("TS_AcceptChannel_free"))) TS_AcceptChannel_free(uint32_t this_obj) {
26667 LDKAcceptChannel this_obj_conv;
26668 this_obj_conv.inner = (void*)(this_obj & (~1));
26669 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26670 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26671 AcceptChannel_free(this_obj_conv);
26674 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_temporary_channel_id"))) TS_AcceptChannel_get_temporary_channel_id(uint32_t this_ptr) {
26675 LDKAcceptChannel this_ptr_conv;
26676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26677 this_ptr_conv.is_owned = false;
26678 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26679 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26680 memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
26684 void __attribute__((export_name("TS_AcceptChannel_set_temporary_channel_id"))) TS_AcceptChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
26685 LDKAcceptChannel this_ptr_conv;
26686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26687 this_ptr_conv.is_owned = false;
26688 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26689 LDKThirtyTwoBytes val_ref;
26690 CHECK(val->arr_len == 32);
26691 memcpy(val_ref.data, val->elems, 32); FREE(val);
26692 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
26695 int64_t __attribute__((export_name("TS_AcceptChannel_get_dust_limit_satoshis"))) TS_AcceptChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
26696 LDKAcceptChannel 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 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
26704 void __attribute__((export_name("TS_AcceptChannel_set_dust_limit_satoshis"))) TS_AcceptChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
26705 LDKAcceptChannel this_ptr_conv;
26706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26707 this_ptr_conv.is_owned = false;
26708 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26709 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
26712 int64_t __attribute__((export_name("TS_AcceptChannel_get_max_htlc_value_in_flight_msat"))) TS_AcceptChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
26713 LDKAcceptChannel this_ptr_conv;
26714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26715 this_ptr_conv.is_owned = false;
26716 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26717 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
26721 void __attribute__((export_name("TS_AcceptChannel_set_max_htlc_value_in_flight_msat"))) TS_AcceptChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
26722 LDKAcceptChannel this_ptr_conv;
26723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26724 this_ptr_conv.is_owned = false;
26725 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26726 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
26729 int64_t __attribute__((export_name("TS_AcceptChannel_get_channel_reserve_satoshis"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
26730 LDKAcceptChannel this_ptr_conv;
26731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26732 this_ptr_conv.is_owned = false;
26733 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26734 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
26738 void __attribute__((export_name("TS_AcceptChannel_set_channel_reserve_satoshis"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
26739 LDKAcceptChannel this_ptr_conv;
26740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26741 this_ptr_conv.is_owned = false;
26742 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26743 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
26746 int64_t __attribute__((export_name("TS_AcceptChannel_get_htlc_minimum_msat"))) TS_AcceptChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
26747 LDKAcceptChannel this_ptr_conv;
26748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26749 this_ptr_conv.is_owned = false;
26750 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26751 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
26755 void __attribute__((export_name("TS_AcceptChannel_set_htlc_minimum_msat"))) TS_AcceptChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
26756 LDKAcceptChannel this_ptr_conv;
26757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26758 this_ptr_conv.is_owned = false;
26759 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26760 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
26763 int32_t __attribute__((export_name("TS_AcceptChannel_get_minimum_depth"))) TS_AcceptChannel_get_minimum_depth(uint32_t this_ptr) {
26764 LDKAcceptChannel this_ptr_conv;
26765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26766 this_ptr_conv.is_owned = false;
26767 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26768 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
26772 void __attribute__((export_name("TS_AcceptChannel_set_minimum_depth"))) TS_AcceptChannel_set_minimum_depth(uint32_t this_ptr, int32_t val) {
26773 LDKAcceptChannel this_ptr_conv;
26774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26775 this_ptr_conv.is_owned = false;
26776 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26777 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
26780 int16_t __attribute__((export_name("TS_AcceptChannel_get_to_self_delay"))) TS_AcceptChannel_get_to_self_delay(uint32_t this_ptr) {
26781 LDKAcceptChannel this_ptr_conv;
26782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26783 this_ptr_conv.is_owned = false;
26784 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26785 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
26789 void __attribute__((export_name("TS_AcceptChannel_set_to_self_delay"))) TS_AcceptChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
26790 LDKAcceptChannel this_ptr_conv;
26791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26792 this_ptr_conv.is_owned = false;
26793 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26794 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
26797 int16_t __attribute__((export_name("TS_AcceptChannel_get_max_accepted_htlcs"))) TS_AcceptChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
26798 LDKAcceptChannel this_ptr_conv;
26799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26800 this_ptr_conv.is_owned = false;
26801 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26802 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
26806 void __attribute__((export_name("TS_AcceptChannel_set_max_accepted_htlcs"))) TS_AcceptChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
26807 LDKAcceptChannel this_ptr_conv;
26808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26809 this_ptr_conv.is_owned = false;
26810 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26811 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
26814 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_funding_pubkey"))) TS_AcceptChannel_get_funding_pubkey(uint32_t this_ptr) {
26815 LDKAcceptChannel this_ptr_conv;
26816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26817 this_ptr_conv.is_owned = false;
26818 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26819 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26820 memcpy(ret_arr->elems, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
26824 void __attribute__((export_name("TS_AcceptChannel_set_funding_pubkey"))) TS_AcceptChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
26825 LDKAcceptChannel this_ptr_conv;
26826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26827 this_ptr_conv.is_owned = false;
26828 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26829 LDKPublicKey val_ref;
26830 CHECK(val->arr_len == 33);
26831 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26832 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
26835 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_revocation_basepoint"))) TS_AcceptChannel_get_revocation_basepoint(uint32_t this_ptr) {
26836 LDKAcceptChannel this_ptr_conv;
26837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26838 this_ptr_conv.is_owned = false;
26839 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26840 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26841 memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
26845 void __attribute__((export_name("TS_AcceptChannel_set_revocation_basepoint"))) TS_AcceptChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
26846 LDKAcceptChannel this_ptr_conv;
26847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26848 this_ptr_conv.is_owned = false;
26849 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26850 LDKPublicKey val_ref;
26851 CHECK(val->arr_len == 33);
26852 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26853 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
26856 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_payment_point"))) TS_AcceptChannel_get_payment_point(uint32_t this_ptr) {
26857 LDKAcceptChannel this_ptr_conv;
26858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26859 this_ptr_conv.is_owned = false;
26860 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26861 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26862 memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
26866 void __attribute__((export_name("TS_AcceptChannel_set_payment_point"))) TS_AcceptChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
26867 LDKAcceptChannel this_ptr_conv;
26868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26869 this_ptr_conv.is_owned = false;
26870 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26871 LDKPublicKey val_ref;
26872 CHECK(val->arr_len == 33);
26873 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26874 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
26877 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_delayed_payment_basepoint"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
26878 LDKAcceptChannel this_ptr_conv;
26879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26880 this_ptr_conv.is_owned = false;
26881 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26882 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26883 memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
26887 void __attribute__((export_name("TS_AcceptChannel_set_delayed_payment_basepoint"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
26888 LDKAcceptChannel this_ptr_conv;
26889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26890 this_ptr_conv.is_owned = false;
26891 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26892 LDKPublicKey val_ref;
26893 CHECK(val->arr_len == 33);
26894 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26895 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
26898 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_htlc_basepoint"))) TS_AcceptChannel_get_htlc_basepoint(uint32_t this_ptr) {
26899 LDKAcceptChannel this_ptr_conv;
26900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26901 this_ptr_conv.is_owned = false;
26902 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26903 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26904 memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
26908 void __attribute__((export_name("TS_AcceptChannel_set_htlc_basepoint"))) TS_AcceptChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
26909 LDKAcceptChannel this_ptr_conv;
26910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26911 this_ptr_conv.is_owned = false;
26912 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26913 LDKPublicKey val_ref;
26914 CHECK(val->arr_len == 33);
26915 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26916 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
26919 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_first_per_commitment_point"))) TS_AcceptChannel_get_first_per_commitment_point(uint32_t this_ptr) {
26920 LDKAcceptChannel this_ptr_conv;
26921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26922 this_ptr_conv.is_owned = false;
26923 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26924 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26925 memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
26929 void __attribute__((export_name("TS_AcceptChannel_set_first_per_commitment_point"))) TS_AcceptChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
26930 LDKAcceptChannel this_ptr_conv;
26931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26932 this_ptr_conv.is_owned = false;
26933 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26934 LDKPublicKey val_ref;
26935 CHECK(val->arr_len == 33);
26936 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26937 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
26940 uint32_t __attribute__((export_name("TS_AcceptChannel_get_channel_type"))) TS_AcceptChannel_get_channel_type(uint32_t this_ptr) {
26941 LDKAcceptChannel this_ptr_conv;
26942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26943 this_ptr_conv.is_owned = false;
26944 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26945 LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
26946 uint32_t ret_ref = 0;
26947 if ((uintptr_t)ret_var.inner > 4096) {
26948 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26949 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26950 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26951 ret_ref = (uintptr_t)ret_var.inner;
26952 if (ret_var.is_owned) {
26959 void __attribute__((export_name("TS_AcceptChannel_set_channel_type"))) TS_AcceptChannel_set_channel_type(uint32_t this_ptr, uint32_t val) {
26960 LDKAcceptChannel this_ptr_conv;
26961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26962 this_ptr_conv.is_owned = false;
26963 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26964 LDKChannelTypeFeatures val_conv;
26965 val_conv.inner = (void*)(val & (~1));
26966 val_conv.is_owned = (val & 1) || (val == 0);
26967 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26968 val_conv = ChannelTypeFeatures_clone(&val_conv);
26969 AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
26972 static inline uintptr_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
26973 LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
26974 uint32_t ret_ref = 0;
26975 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26976 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26977 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26978 ret_ref = (uintptr_t)ret_var.inner;
26979 if (ret_var.is_owned) {
26984 uint32_t __attribute__((export_name("TS_AcceptChannel_clone_ptr"))) TS_AcceptChannel_clone_ptr(uint32_t arg) {
26985 LDKAcceptChannel arg_conv;
26986 arg_conv.inner = (void*)(arg & (~1));
26987 arg_conv.is_owned = false;
26988 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26989 uint32_t ret_val = AcceptChannel_clone_ptr(&arg_conv);
26993 uint32_t __attribute__((export_name("TS_AcceptChannel_clone"))) TS_AcceptChannel_clone(uint32_t orig) {
26994 LDKAcceptChannel orig_conv;
26995 orig_conv.inner = (void*)(orig & (~1));
26996 orig_conv.is_owned = false;
26997 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26998 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
26999 uint32_t ret_ref = 0;
27000 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27001 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27002 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27003 ret_ref = (uintptr_t)ret_var.inner;
27004 if (ret_var.is_owned) {
27010 void __attribute__((export_name("TS_FundingCreated_free"))) TS_FundingCreated_free(uint32_t this_obj) {
27011 LDKFundingCreated this_obj_conv;
27012 this_obj_conv.inner = (void*)(this_obj & (~1));
27013 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27014 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27015 FundingCreated_free(this_obj_conv);
27018 int8_tArray __attribute__((export_name("TS_FundingCreated_get_temporary_channel_id"))) TS_FundingCreated_get_temporary_channel_id(uint32_t this_ptr) {
27019 LDKFundingCreated this_ptr_conv;
27020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27021 this_ptr_conv.is_owned = false;
27022 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27023 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27024 memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
27028 void __attribute__((export_name("TS_FundingCreated_set_temporary_channel_id"))) TS_FundingCreated_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
27029 LDKFundingCreated this_ptr_conv;
27030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27031 this_ptr_conv.is_owned = false;
27032 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27033 LDKThirtyTwoBytes val_ref;
27034 CHECK(val->arr_len == 32);
27035 memcpy(val_ref.data, val->elems, 32); FREE(val);
27036 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
27039 int8_tArray __attribute__((export_name("TS_FundingCreated_get_funding_txid"))) TS_FundingCreated_get_funding_txid(uint32_t this_ptr) {
27040 LDKFundingCreated this_ptr_conv;
27041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27042 this_ptr_conv.is_owned = false;
27043 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27044 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27045 memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
27049 void __attribute__((export_name("TS_FundingCreated_set_funding_txid"))) TS_FundingCreated_set_funding_txid(uint32_t this_ptr, int8_tArray val) {
27050 LDKFundingCreated this_ptr_conv;
27051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27052 this_ptr_conv.is_owned = false;
27053 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27054 LDKThirtyTwoBytes val_ref;
27055 CHECK(val->arr_len == 32);
27056 memcpy(val_ref.data, val->elems, 32); FREE(val);
27057 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
27060 int16_t __attribute__((export_name("TS_FundingCreated_get_funding_output_index"))) TS_FundingCreated_get_funding_output_index(uint32_t this_ptr) {
27061 LDKFundingCreated this_ptr_conv;
27062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27063 this_ptr_conv.is_owned = false;
27064 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27065 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
27069 void __attribute__((export_name("TS_FundingCreated_set_funding_output_index"))) TS_FundingCreated_set_funding_output_index(uint32_t this_ptr, int16_t val) {
27070 LDKFundingCreated this_ptr_conv;
27071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27072 this_ptr_conv.is_owned = false;
27073 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27074 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
27077 int8_tArray __attribute__((export_name("TS_FundingCreated_get_signature"))) TS_FundingCreated_get_signature(uint32_t this_ptr) {
27078 LDKFundingCreated this_ptr_conv;
27079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27080 this_ptr_conv.is_owned = false;
27081 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27082 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
27083 memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
27087 void __attribute__((export_name("TS_FundingCreated_set_signature"))) TS_FundingCreated_set_signature(uint32_t this_ptr, int8_tArray val) {
27088 LDKFundingCreated this_ptr_conv;
27089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27090 this_ptr_conv.is_owned = false;
27091 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27092 LDKSignature val_ref;
27093 CHECK(val->arr_len == 64);
27094 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
27095 FundingCreated_set_signature(&this_ptr_conv, val_ref);
27098 uint32_t __attribute__((export_name("TS_FundingCreated_new"))) TS_FundingCreated_new(int8_tArray temporary_channel_id_arg, int8_tArray funding_txid_arg, int16_t funding_output_index_arg, int8_tArray signature_arg) {
27099 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
27100 CHECK(temporary_channel_id_arg->arr_len == 32);
27101 memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
27102 LDKThirtyTwoBytes funding_txid_arg_ref;
27103 CHECK(funding_txid_arg->arr_len == 32);
27104 memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
27105 LDKSignature signature_arg_ref;
27106 CHECK(signature_arg->arr_len == 64);
27107 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
27108 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
27109 uint32_t ret_ref = 0;
27110 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27111 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27112 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27113 ret_ref = (uintptr_t)ret_var.inner;
27114 if (ret_var.is_owned) {
27120 static inline uintptr_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
27121 LDKFundingCreated ret_var = FundingCreated_clone(arg);
27122 uint32_t ret_ref = 0;
27123 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27124 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27125 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27126 ret_ref = (uintptr_t)ret_var.inner;
27127 if (ret_var.is_owned) {
27132 uint32_t __attribute__((export_name("TS_FundingCreated_clone_ptr"))) TS_FundingCreated_clone_ptr(uint32_t arg) {
27133 LDKFundingCreated arg_conv;
27134 arg_conv.inner = (void*)(arg & (~1));
27135 arg_conv.is_owned = false;
27136 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27137 uint32_t ret_val = FundingCreated_clone_ptr(&arg_conv);
27141 uint32_t __attribute__((export_name("TS_FundingCreated_clone"))) TS_FundingCreated_clone(uint32_t orig) {
27142 LDKFundingCreated orig_conv;
27143 orig_conv.inner = (void*)(orig & (~1));
27144 orig_conv.is_owned = false;
27145 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27146 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
27147 uint32_t ret_ref = 0;
27148 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27149 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27150 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27151 ret_ref = (uintptr_t)ret_var.inner;
27152 if (ret_var.is_owned) {
27158 void __attribute__((export_name("TS_FundingSigned_free"))) TS_FundingSigned_free(uint32_t this_obj) {
27159 LDKFundingSigned this_obj_conv;
27160 this_obj_conv.inner = (void*)(this_obj & (~1));
27161 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27162 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27163 FundingSigned_free(this_obj_conv);
27166 int8_tArray __attribute__((export_name("TS_FundingSigned_get_channel_id"))) TS_FundingSigned_get_channel_id(uint32_t this_ptr) {
27167 LDKFundingSigned 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 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27172 memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
27176 void __attribute__((export_name("TS_FundingSigned_set_channel_id"))) TS_FundingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
27177 LDKFundingSigned this_ptr_conv;
27178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27179 this_ptr_conv.is_owned = false;
27180 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27181 LDKThirtyTwoBytes val_ref;
27182 CHECK(val->arr_len == 32);
27183 memcpy(val_ref.data, val->elems, 32); FREE(val);
27184 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
27187 int8_tArray __attribute__((export_name("TS_FundingSigned_get_signature"))) TS_FundingSigned_get_signature(uint32_t this_ptr) {
27188 LDKFundingSigned this_ptr_conv;
27189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27190 this_ptr_conv.is_owned = false;
27191 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27192 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
27193 memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
27197 void __attribute__((export_name("TS_FundingSigned_set_signature"))) TS_FundingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
27198 LDKFundingSigned this_ptr_conv;
27199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27200 this_ptr_conv.is_owned = false;
27201 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27202 LDKSignature val_ref;
27203 CHECK(val->arr_len == 64);
27204 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
27205 FundingSigned_set_signature(&this_ptr_conv, val_ref);
27208 uint32_t __attribute__((export_name("TS_FundingSigned_new"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
27209 LDKThirtyTwoBytes channel_id_arg_ref;
27210 CHECK(channel_id_arg->arr_len == 32);
27211 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
27212 LDKSignature signature_arg_ref;
27213 CHECK(signature_arg->arr_len == 64);
27214 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
27215 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
27216 uint32_t ret_ref = 0;
27217 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27218 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27219 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27220 ret_ref = (uintptr_t)ret_var.inner;
27221 if (ret_var.is_owned) {
27227 static inline uintptr_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
27228 LDKFundingSigned ret_var = FundingSigned_clone(arg);
27229 uint32_t ret_ref = 0;
27230 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27231 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27232 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27233 ret_ref = (uintptr_t)ret_var.inner;
27234 if (ret_var.is_owned) {
27239 uint32_t __attribute__((export_name("TS_FundingSigned_clone_ptr"))) TS_FundingSigned_clone_ptr(uint32_t arg) {
27240 LDKFundingSigned arg_conv;
27241 arg_conv.inner = (void*)(arg & (~1));
27242 arg_conv.is_owned = false;
27243 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27244 uint32_t ret_val = FundingSigned_clone_ptr(&arg_conv);
27248 uint32_t __attribute__((export_name("TS_FundingSigned_clone"))) TS_FundingSigned_clone(uint32_t orig) {
27249 LDKFundingSigned orig_conv;
27250 orig_conv.inner = (void*)(orig & (~1));
27251 orig_conv.is_owned = false;
27252 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27253 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
27254 uint32_t ret_ref = 0;
27255 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27256 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27257 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27258 ret_ref = (uintptr_t)ret_var.inner;
27259 if (ret_var.is_owned) {
27265 void __attribute__((export_name("TS_FundingLocked_free"))) TS_FundingLocked_free(uint32_t this_obj) {
27266 LDKFundingLocked this_obj_conv;
27267 this_obj_conv.inner = (void*)(this_obj & (~1));
27268 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27269 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27270 FundingLocked_free(this_obj_conv);
27273 int8_tArray __attribute__((export_name("TS_FundingLocked_get_channel_id"))) TS_FundingLocked_get_channel_id(uint32_t this_ptr) {
27274 LDKFundingLocked this_ptr_conv;
27275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27276 this_ptr_conv.is_owned = false;
27277 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27278 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27279 memcpy(ret_arr->elems, *FundingLocked_get_channel_id(&this_ptr_conv), 32);
27283 void __attribute__((export_name("TS_FundingLocked_set_channel_id"))) TS_FundingLocked_set_channel_id(uint32_t this_ptr, int8_tArray val) {
27284 LDKFundingLocked this_ptr_conv;
27285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27286 this_ptr_conv.is_owned = false;
27287 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27288 LDKThirtyTwoBytes val_ref;
27289 CHECK(val->arr_len == 32);
27290 memcpy(val_ref.data, val->elems, 32); FREE(val);
27291 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
27294 int8_tArray __attribute__((export_name("TS_FundingLocked_get_next_per_commitment_point"))) TS_FundingLocked_get_next_per_commitment_point(uint32_t this_ptr) {
27295 LDKFundingLocked this_ptr_conv;
27296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27297 this_ptr_conv.is_owned = false;
27298 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27299 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27300 memcpy(ret_arr->elems, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
27304 void __attribute__((export_name("TS_FundingLocked_set_next_per_commitment_point"))) TS_FundingLocked_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
27305 LDKFundingLocked this_ptr_conv;
27306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27307 this_ptr_conv.is_owned = false;
27308 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27309 LDKPublicKey val_ref;
27310 CHECK(val->arr_len == 33);
27311 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27312 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
27315 uint32_t __attribute__((export_name("TS_FundingLocked_new"))) TS_FundingLocked_new(int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
27316 LDKThirtyTwoBytes channel_id_arg_ref;
27317 CHECK(channel_id_arg->arr_len == 32);
27318 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
27319 LDKPublicKey next_per_commitment_point_arg_ref;
27320 CHECK(next_per_commitment_point_arg->arr_len == 33);
27321 memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
27322 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
27323 uint32_t ret_ref = 0;
27324 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27325 CHECK((((uintptr_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 = (uintptr_t)ret_var.inner;
27328 if (ret_var.is_owned) {
27334 static inline uintptr_t FundingLocked_clone_ptr(LDKFundingLocked *NONNULL_PTR arg) {
27335 LDKFundingLocked ret_var = FundingLocked_clone(arg);
27336 uint32_t ret_ref = 0;
27337 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27338 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27339 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27340 ret_ref = (uintptr_t)ret_var.inner;
27341 if (ret_var.is_owned) {
27346 uint32_t __attribute__((export_name("TS_FundingLocked_clone_ptr"))) TS_FundingLocked_clone_ptr(uint32_t arg) {
27347 LDKFundingLocked arg_conv;
27348 arg_conv.inner = (void*)(arg & (~1));
27349 arg_conv.is_owned = false;
27350 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27351 uint32_t ret_val = FundingLocked_clone_ptr(&arg_conv);
27355 uint32_t __attribute__((export_name("TS_FundingLocked_clone"))) TS_FundingLocked_clone(uint32_t orig) {
27356 LDKFundingLocked orig_conv;
27357 orig_conv.inner = (void*)(orig & (~1));
27358 orig_conv.is_owned = false;
27359 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27360 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
27361 uint32_t ret_ref = 0;
27362 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27363 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27364 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27365 ret_ref = (uintptr_t)ret_var.inner;
27366 if (ret_var.is_owned) {
27372 void __attribute__((export_name("TS_Shutdown_free"))) TS_Shutdown_free(uint32_t this_obj) {
27373 LDKShutdown this_obj_conv;
27374 this_obj_conv.inner = (void*)(this_obj & (~1));
27375 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27376 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27377 Shutdown_free(this_obj_conv);
27380 int8_tArray __attribute__((export_name("TS_Shutdown_get_channel_id"))) TS_Shutdown_get_channel_id(uint32_t this_ptr) {
27381 LDKShutdown this_ptr_conv;
27382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27383 this_ptr_conv.is_owned = false;
27384 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27385 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27386 memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
27390 void __attribute__((export_name("TS_Shutdown_set_channel_id"))) TS_Shutdown_set_channel_id(uint32_t this_ptr, int8_tArray val) {
27391 LDKShutdown this_ptr_conv;
27392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27393 this_ptr_conv.is_owned = false;
27394 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27395 LDKThirtyTwoBytes val_ref;
27396 CHECK(val->arr_len == 32);
27397 memcpy(val_ref.data, val->elems, 32); FREE(val);
27398 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
27401 int8_tArray __attribute__((export_name("TS_Shutdown_get_scriptpubkey"))) TS_Shutdown_get_scriptpubkey(uint32_t this_ptr) {
27402 LDKShutdown this_ptr_conv;
27403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27404 this_ptr_conv.is_owned = false;
27405 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27406 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
27407 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27408 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27412 void __attribute__((export_name("TS_Shutdown_set_scriptpubkey"))) TS_Shutdown_set_scriptpubkey(uint32_t this_ptr, int8_tArray val) {
27413 LDKShutdown this_ptr_conv;
27414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27415 this_ptr_conv.is_owned = false;
27416 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27417 LDKCVec_u8Z val_ref;
27418 val_ref.datalen = val->arr_len;
27419 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
27420 memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
27421 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
27424 uint32_t __attribute__((export_name("TS_Shutdown_new"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
27425 LDKThirtyTwoBytes channel_id_arg_ref;
27426 CHECK(channel_id_arg->arr_len == 32);
27427 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
27428 LDKCVec_u8Z scriptpubkey_arg_ref;
27429 scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
27430 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
27431 memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
27432 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
27433 uint32_t ret_ref = 0;
27434 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27435 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27436 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27437 ret_ref = (uintptr_t)ret_var.inner;
27438 if (ret_var.is_owned) {
27444 static inline uintptr_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
27445 LDKShutdown ret_var = Shutdown_clone(arg);
27446 uint32_t ret_ref = 0;
27447 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27448 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27449 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27450 ret_ref = (uintptr_t)ret_var.inner;
27451 if (ret_var.is_owned) {
27456 uint32_t __attribute__((export_name("TS_Shutdown_clone_ptr"))) TS_Shutdown_clone_ptr(uint32_t arg) {
27457 LDKShutdown arg_conv;
27458 arg_conv.inner = (void*)(arg & (~1));
27459 arg_conv.is_owned = false;
27460 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27461 uint32_t ret_val = Shutdown_clone_ptr(&arg_conv);
27465 uint32_t __attribute__((export_name("TS_Shutdown_clone"))) TS_Shutdown_clone(uint32_t orig) {
27466 LDKShutdown orig_conv;
27467 orig_conv.inner = (void*)(orig & (~1));
27468 orig_conv.is_owned = false;
27469 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27470 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
27471 uint32_t ret_ref = 0;
27472 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27473 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27474 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27475 ret_ref = (uintptr_t)ret_var.inner;
27476 if (ret_var.is_owned) {
27482 void __attribute__((export_name("TS_ClosingSignedFeeRange_free"))) TS_ClosingSignedFeeRange_free(uint32_t this_obj) {
27483 LDKClosingSignedFeeRange this_obj_conv;
27484 this_obj_conv.inner = (void*)(this_obj & (~1));
27485 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27486 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27487 ClosingSignedFeeRange_free(this_obj_conv);
27490 int64_t __attribute__((export_name("TS_ClosingSignedFeeRange_get_min_fee_satoshis"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint32_t this_ptr) {
27491 LDKClosingSignedFeeRange this_ptr_conv;
27492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27493 this_ptr_conv.is_owned = false;
27494 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27495 int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
27499 void __attribute__((export_name("TS_ClosingSignedFeeRange_set_min_fee_satoshis"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint32_t this_ptr, int64_t val) {
27500 LDKClosingSignedFeeRange this_ptr_conv;
27501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27502 this_ptr_conv.is_owned = false;
27503 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27504 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
27507 int64_t __attribute__((export_name("TS_ClosingSignedFeeRange_get_max_fee_satoshis"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint32_t this_ptr) {
27508 LDKClosingSignedFeeRange this_ptr_conv;
27509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27510 this_ptr_conv.is_owned = false;
27511 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27512 int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
27516 void __attribute__((export_name("TS_ClosingSignedFeeRange_set_max_fee_satoshis"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
27517 LDKClosingSignedFeeRange this_ptr_conv;
27518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27519 this_ptr_conv.is_owned = false;
27520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27521 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
27524 uint32_t __attribute__((export_name("TS_ClosingSignedFeeRange_new"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
27525 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
27526 uint32_t ret_ref = 0;
27527 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27528 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27529 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27530 ret_ref = (uintptr_t)ret_var.inner;
27531 if (ret_var.is_owned) {
27537 static inline uintptr_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
27538 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
27539 uint32_t ret_ref = 0;
27540 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27541 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27542 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27543 ret_ref = (uintptr_t)ret_var.inner;
27544 if (ret_var.is_owned) {
27549 uint32_t __attribute__((export_name("TS_ClosingSignedFeeRange_clone_ptr"))) TS_ClosingSignedFeeRange_clone_ptr(uint32_t arg) {
27550 LDKClosingSignedFeeRange arg_conv;
27551 arg_conv.inner = (void*)(arg & (~1));
27552 arg_conv.is_owned = false;
27553 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27554 uint32_t ret_val = ClosingSignedFeeRange_clone_ptr(&arg_conv);
27558 uint32_t __attribute__((export_name("TS_ClosingSignedFeeRange_clone"))) TS_ClosingSignedFeeRange_clone(uint32_t orig) {
27559 LDKClosingSignedFeeRange orig_conv;
27560 orig_conv.inner = (void*)(orig & (~1));
27561 orig_conv.is_owned = false;
27562 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27563 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
27564 uint32_t ret_ref = 0;
27565 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27566 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27567 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27568 ret_ref = (uintptr_t)ret_var.inner;
27569 if (ret_var.is_owned) {
27575 void __attribute__((export_name("TS_ClosingSigned_free"))) TS_ClosingSigned_free(uint32_t this_obj) {
27576 LDKClosingSigned this_obj_conv;
27577 this_obj_conv.inner = (void*)(this_obj & (~1));
27578 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27579 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27580 ClosingSigned_free(this_obj_conv);
27583 int8_tArray __attribute__((export_name("TS_ClosingSigned_get_channel_id"))) TS_ClosingSigned_get_channel_id(uint32_t this_ptr) {
27584 LDKClosingSigned this_ptr_conv;
27585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27586 this_ptr_conv.is_owned = false;
27587 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27588 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27589 memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
27593 void __attribute__((export_name("TS_ClosingSigned_set_channel_id"))) TS_ClosingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
27594 LDKClosingSigned this_ptr_conv;
27595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27596 this_ptr_conv.is_owned = false;
27597 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27598 LDKThirtyTwoBytes val_ref;
27599 CHECK(val->arr_len == 32);
27600 memcpy(val_ref.data, val->elems, 32); FREE(val);
27601 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
27604 int64_t __attribute__((export_name("TS_ClosingSigned_get_fee_satoshis"))) TS_ClosingSigned_get_fee_satoshis(uint32_t this_ptr) {
27605 LDKClosingSigned this_ptr_conv;
27606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27607 this_ptr_conv.is_owned = false;
27608 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27609 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
27613 void __attribute__((export_name("TS_ClosingSigned_set_fee_satoshis"))) TS_ClosingSigned_set_fee_satoshis(uint32_t this_ptr, int64_t val) {
27614 LDKClosingSigned this_ptr_conv;
27615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27616 this_ptr_conv.is_owned = false;
27617 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27618 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
27621 int8_tArray __attribute__((export_name("TS_ClosingSigned_get_signature"))) TS_ClosingSigned_get_signature(uint32_t this_ptr) {
27622 LDKClosingSigned this_ptr_conv;
27623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27624 this_ptr_conv.is_owned = false;
27625 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27626 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
27627 memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
27631 void __attribute__((export_name("TS_ClosingSigned_set_signature"))) TS_ClosingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
27632 LDKClosingSigned this_ptr_conv;
27633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27634 this_ptr_conv.is_owned = false;
27635 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27636 LDKSignature val_ref;
27637 CHECK(val->arr_len == 64);
27638 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
27639 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
27642 uint32_t __attribute__((export_name("TS_ClosingSigned_get_fee_range"))) TS_ClosingSigned_get_fee_range(uint32_t this_ptr) {
27643 LDKClosingSigned this_ptr_conv;
27644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27645 this_ptr_conv.is_owned = false;
27646 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27647 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
27648 uint32_t ret_ref = 0;
27649 if ((uintptr_t)ret_var.inner > 4096) {
27650 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27651 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27652 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27653 ret_ref = (uintptr_t)ret_var.inner;
27654 if (ret_var.is_owned) {
27661 void __attribute__((export_name("TS_ClosingSigned_set_fee_range"))) TS_ClosingSigned_set_fee_range(uint32_t this_ptr, uint32_t val) {
27662 LDKClosingSigned this_ptr_conv;
27663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27664 this_ptr_conv.is_owned = false;
27665 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27666 LDKClosingSignedFeeRange val_conv;
27667 val_conv.inner = (void*)(val & (~1));
27668 val_conv.is_owned = (val & 1) || (val == 0);
27669 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27670 val_conv = ClosingSignedFeeRange_clone(&val_conv);
27671 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
27674 uint32_t __attribute__((export_name("TS_ClosingSigned_new"))) TS_ClosingSigned_new(int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg, uint32_t fee_range_arg) {
27675 LDKThirtyTwoBytes channel_id_arg_ref;
27676 CHECK(channel_id_arg->arr_len == 32);
27677 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
27678 LDKSignature signature_arg_ref;
27679 CHECK(signature_arg->arr_len == 64);
27680 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
27681 LDKClosingSignedFeeRange fee_range_arg_conv;
27682 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
27683 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
27684 CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
27685 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
27686 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
27687 uint32_t ret_ref = 0;
27688 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27689 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27690 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27691 ret_ref = (uintptr_t)ret_var.inner;
27692 if (ret_var.is_owned) {
27698 static inline uintptr_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
27699 LDKClosingSigned ret_var = ClosingSigned_clone(arg);
27700 uint32_t ret_ref = 0;
27701 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27702 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27703 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27704 ret_ref = (uintptr_t)ret_var.inner;
27705 if (ret_var.is_owned) {
27710 uint32_t __attribute__((export_name("TS_ClosingSigned_clone_ptr"))) TS_ClosingSigned_clone_ptr(uint32_t arg) {
27711 LDKClosingSigned arg_conv;
27712 arg_conv.inner = (void*)(arg & (~1));
27713 arg_conv.is_owned = false;
27714 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27715 uint32_t ret_val = ClosingSigned_clone_ptr(&arg_conv);
27719 uint32_t __attribute__((export_name("TS_ClosingSigned_clone"))) TS_ClosingSigned_clone(uint32_t orig) {
27720 LDKClosingSigned orig_conv;
27721 orig_conv.inner = (void*)(orig & (~1));
27722 orig_conv.is_owned = false;
27723 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27724 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
27725 uint32_t ret_ref = 0;
27726 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27727 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27728 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27729 ret_ref = (uintptr_t)ret_var.inner;
27730 if (ret_var.is_owned) {
27736 void __attribute__((export_name("TS_UpdateAddHTLC_free"))) TS_UpdateAddHTLC_free(uint32_t this_obj) {
27737 LDKUpdateAddHTLC this_obj_conv;
27738 this_obj_conv.inner = (void*)(this_obj & (~1));
27739 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27740 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27741 UpdateAddHTLC_free(this_obj_conv);
27744 int8_tArray __attribute__((export_name("TS_UpdateAddHTLC_get_channel_id"))) TS_UpdateAddHTLC_get_channel_id(uint32_t this_ptr) {
27745 LDKUpdateAddHTLC this_ptr_conv;
27746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27747 this_ptr_conv.is_owned = false;
27748 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27749 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27750 memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
27754 void __attribute__((export_name("TS_UpdateAddHTLC_set_channel_id"))) TS_UpdateAddHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
27755 LDKUpdateAddHTLC this_ptr_conv;
27756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27757 this_ptr_conv.is_owned = false;
27758 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27759 LDKThirtyTwoBytes val_ref;
27760 CHECK(val->arr_len == 32);
27761 memcpy(val_ref.data, val->elems, 32); FREE(val);
27762 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
27765 int64_t __attribute__((export_name("TS_UpdateAddHTLC_get_htlc_id"))) TS_UpdateAddHTLC_get_htlc_id(uint32_t this_ptr) {
27766 LDKUpdateAddHTLC this_ptr_conv;
27767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27768 this_ptr_conv.is_owned = false;
27769 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27770 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
27774 void __attribute__((export_name("TS_UpdateAddHTLC_set_htlc_id"))) TS_UpdateAddHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
27775 LDKUpdateAddHTLC this_ptr_conv;
27776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27777 this_ptr_conv.is_owned = false;
27778 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27779 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
27782 int64_t __attribute__((export_name("TS_UpdateAddHTLC_get_amount_msat"))) TS_UpdateAddHTLC_get_amount_msat(uint32_t this_ptr) {
27783 LDKUpdateAddHTLC this_ptr_conv;
27784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27785 this_ptr_conv.is_owned = false;
27786 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27787 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
27791 void __attribute__((export_name("TS_UpdateAddHTLC_set_amount_msat"))) TS_UpdateAddHTLC_set_amount_msat(uint32_t this_ptr, int64_t val) {
27792 LDKUpdateAddHTLC this_ptr_conv;
27793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27794 this_ptr_conv.is_owned = false;
27795 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27796 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
27799 int8_tArray __attribute__((export_name("TS_UpdateAddHTLC_get_payment_hash"))) TS_UpdateAddHTLC_get_payment_hash(uint32_t this_ptr) {
27800 LDKUpdateAddHTLC this_ptr_conv;
27801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27802 this_ptr_conv.is_owned = false;
27803 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27804 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27805 memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
27809 void __attribute__((export_name("TS_UpdateAddHTLC_set_payment_hash"))) TS_UpdateAddHTLC_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
27810 LDKUpdateAddHTLC this_ptr_conv;
27811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27812 this_ptr_conv.is_owned = false;
27813 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27814 LDKThirtyTwoBytes val_ref;
27815 CHECK(val->arr_len == 32);
27816 memcpy(val_ref.data, val->elems, 32); FREE(val);
27817 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
27820 int32_t __attribute__((export_name("TS_UpdateAddHTLC_get_cltv_expiry"))) TS_UpdateAddHTLC_get_cltv_expiry(uint32_t this_ptr) {
27821 LDKUpdateAddHTLC this_ptr_conv;
27822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27823 this_ptr_conv.is_owned = false;
27824 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27825 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
27829 void __attribute__((export_name("TS_UpdateAddHTLC_set_cltv_expiry"))) TS_UpdateAddHTLC_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
27830 LDKUpdateAddHTLC this_ptr_conv;
27831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27832 this_ptr_conv.is_owned = false;
27833 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27834 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
27837 static inline uintptr_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
27838 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
27839 uint32_t ret_ref = 0;
27840 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27841 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27842 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27843 ret_ref = (uintptr_t)ret_var.inner;
27844 if (ret_var.is_owned) {
27849 uint32_t __attribute__((export_name("TS_UpdateAddHTLC_clone_ptr"))) TS_UpdateAddHTLC_clone_ptr(uint32_t arg) {
27850 LDKUpdateAddHTLC arg_conv;
27851 arg_conv.inner = (void*)(arg & (~1));
27852 arg_conv.is_owned = false;
27853 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27854 uint32_t ret_val = UpdateAddHTLC_clone_ptr(&arg_conv);
27858 uint32_t __attribute__((export_name("TS_UpdateAddHTLC_clone"))) TS_UpdateAddHTLC_clone(uint32_t orig) {
27859 LDKUpdateAddHTLC orig_conv;
27860 orig_conv.inner = (void*)(orig & (~1));
27861 orig_conv.is_owned = false;
27862 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27863 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
27864 uint32_t ret_ref = 0;
27865 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27866 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27867 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27868 ret_ref = (uintptr_t)ret_var.inner;
27869 if (ret_var.is_owned) {
27875 void __attribute__((export_name("TS_UpdateFulfillHTLC_free"))) TS_UpdateFulfillHTLC_free(uint32_t this_obj) {
27876 LDKUpdateFulfillHTLC this_obj_conv;
27877 this_obj_conv.inner = (void*)(this_obj & (~1));
27878 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27879 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27880 UpdateFulfillHTLC_free(this_obj_conv);
27883 int8_tArray __attribute__((export_name("TS_UpdateFulfillHTLC_get_channel_id"))) TS_UpdateFulfillHTLC_get_channel_id(uint32_t this_ptr) {
27884 LDKUpdateFulfillHTLC this_ptr_conv;
27885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27886 this_ptr_conv.is_owned = false;
27887 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27888 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27889 memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
27893 void __attribute__((export_name("TS_UpdateFulfillHTLC_set_channel_id"))) TS_UpdateFulfillHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
27894 LDKUpdateFulfillHTLC this_ptr_conv;
27895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27896 this_ptr_conv.is_owned = false;
27897 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27898 LDKThirtyTwoBytes val_ref;
27899 CHECK(val->arr_len == 32);
27900 memcpy(val_ref.data, val->elems, 32); FREE(val);
27901 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
27904 int64_t __attribute__((export_name("TS_UpdateFulfillHTLC_get_htlc_id"))) TS_UpdateFulfillHTLC_get_htlc_id(uint32_t this_ptr) {
27905 LDKUpdateFulfillHTLC this_ptr_conv;
27906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27907 this_ptr_conv.is_owned = false;
27908 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27909 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
27913 void __attribute__((export_name("TS_UpdateFulfillHTLC_set_htlc_id"))) TS_UpdateFulfillHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
27914 LDKUpdateFulfillHTLC this_ptr_conv;
27915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27916 this_ptr_conv.is_owned = false;
27917 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27918 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
27921 int8_tArray __attribute__((export_name("TS_UpdateFulfillHTLC_get_payment_preimage"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint32_t this_ptr) {
27922 LDKUpdateFulfillHTLC this_ptr_conv;
27923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27924 this_ptr_conv.is_owned = false;
27925 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27926 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27927 memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
27931 void __attribute__((export_name("TS_UpdateFulfillHTLC_set_payment_preimage"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint32_t this_ptr, int8_tArray val) {
27932 LDKUpdateFulfillHTLC this_ptr_conv;
27933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27934 this_ptr_conv.is_owned = false;
27935 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27936 LDKThirtyTwoBytes val_ref;
27937 CHECK(val->arr_len == 32);
27938 memcpy(val_ref.data, val->elems, 32); FREE(val);
27939 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
27942 uint32_t __attribute__((export_name("TS_UpdateFulfillHTLC_new"))) TS_UpdateFulfillHTLC_new(int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
27943 LDKThirtyTwoBytes channel_id_arg_ref;
27944 CHECK(channel_id_arg->arr_len == 32);
27945 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
27946 LDKThirtyTwoBytes payment_preimage_arg_ref;
27947 CHECK(payment_preimage_arg->arr_len == 32);
27948 memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
27949 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
27950 uint32_t ret_ref = 0;
27951 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27952 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27953 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27954 ret_ref = (uintptr_t)ret_var.inner;
27955 if (ret_var.is_owned) {
27961 static inline uintptr_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
27962 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
27963 uint32_t ret_ref = 0;
27964 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27965 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27966 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27967 ret_ref = (uintptr_t)ret_var.inner;
27968 if (ret_var.is_owned) {
27973 uint32_t __attribute__((export_name("TS_UpdateFulfillHTLC_clone_ptr"))) TS_UpdateFulfillHTLC_clone_ptr(uint32_t arg) {
27974 LDKUpdateFulfillHTLC arg_conv;
27975 arg_conv.inner = (void*)(arg & (~1));
27976 arg_conv.is_owned = false;
27977 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27978 uint32_t ret_val = UpdateFulfillHTLC_clone_ptr(&arg_conv);
27982 uint32_t __attribute__((export_name("TS_UpdateFulfillHTLC_clone"))) TS_UpdateFulfillHTLC_clone(uint32_t orig) {
27983 LDKUpdateFulfillHTLC orig_conv;
27984 orig_conv.inner = (void*)(orig & (~1));
27985 orig_conv.is_owned = false;
27986 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27987 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
27988 uint32_t ret_ref = 0;
27989 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27990 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27991 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27992 ret_ref = (uintptr_t)ret_var.inner;
27993 if (ret_var.is_owned) {
27999 void __attribute__((export_name("TS_UpdateFailHTLC_free"))) TS_UpdateFailHTLC_free(uint32_t this_obj) {
28000 LDKUpdateFailHTLC this_obj_conv;
28001 this_obj_conv.inner = (void*)(this_obj & (~1));
28002 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28003 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28004 UpdateFailHTLC_free(this_obj_conv);
28007 int8_tArray __attribute__((export_name("TS_UpdateFailHTLC_get_channel_id"))) TS_UpdateFailHTLC_get_channel_id(uint32_t this_ptr) {
28008 LDKUpdateFailHTLC this_ptr_conv;
28009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28010 this_ptr_conv.is_owned = false;
28011 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28012 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28013 memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
28017 void __attribute__((export_name("TS_UpdateFailHTLC_set_channel_id"))) TS_UpdateFailHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
28018 LDKUpdateFailHTLC this_ptr_conv;
28019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28020 this_ptr_conv.is_owned = false;
28021 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28022 LDKThirtyTwoBytes val_ref;
28023 CHECK(val->arr_len == 32);
28024 memcpy(val_ref.data, val->elems, 32); FREE(val);
28025 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
28028 int64_t __attribute__((export_name("TS_UpdateFailHTLC_get_htlc_id"))) TS_UpdateFailHTLC_get_htlc_id(uint32_t this_ptr) {
28029 LDKUpdateFailHTLC this_ptr_conv;
28030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28031 this_ptr_conv.is_owned = false;
28032 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28033 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
28037 void __attribute__((export_name("TS_UpdateFailHTLC_set_htlc_id"))) TS_UpdateFailHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
28038 LDKUpdateFailHTLC this_ptr_conv;
28039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28040 this_ptr_conv.is_owned = false;
28041 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28042 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
28045 static inline uintptr_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
28046 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
28047 uint32_t ret_ref = 0;
28048 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28049 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28050 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28051 ret_ref = (uintptr_t)ret_var.inner;
28052 if (ret_var.is_owned) {
28057 uint32_t __attribute__((export_name("TS_UpdateFailHTLC_clone_ptr"))) TS_UpdateFailHTLC_clone_ptr(uint32_t arg) {
28058 LDKUpdateFailHTLC arg_conv;
28059 arg_conv.inner = (void*)(arg & (~1));
28060 arg_conv.is_owned = false;
28061 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28062 uint32_t ret_val = UpdateFailHTLC_clone_ptr(&arg_conv);
28066 uint32_t __attribute__((export_name("TS_UpdateFailHTLC_clone"))) TS_UpdateFailHTLC_clone(uint32_t orig) {
28067 LDKUpdateFailHTLC orig_conv;
28068 orig_conv.inner = (void*)(orig & (~1));
28069 orig_conv.is_owned = false;
28070 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28071 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
28072 uint32_t ret_ref = 0;
28073 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28074 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28075 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28076 ret_ref = (uintptr_t)ret_var.inner;
28077 if (ret_var.is_owned) {
28083 void __attribute__((export_name("TS_UpdateFailMalformedHTLC_free"))) TS_UpdateFailMalformedHTLC_free(uint32_t this_obj) {
28084 LDKUpdateFailMalformedHTLC this_obj_conv;
28085 this_obj_conv.inner = (void*)(this_obj & (~1));
28086 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28087 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28088 UpdateFailMalformedHTLC_free(this_obj_conv);
28091 int8_tArray __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_channel_id"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint32_t this_ptr) {
28092 LDKUpdateFailMalformedHTLC this_ptr_conv;
28093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28094 this_ptr_conv.is_owned = false;
28095 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28096 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28097 memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
28101 void __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_channel_id"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
28102 LDKUpdateFailMalformedHTLC this_ptr_conv;
28103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28104 this_ptr_conv.is_owned = false;
28105 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28106 LDKThirtyTwoBytes val_ref;
28107 CHECK(val->arr_len == 32);
28108 memcpy(val_ref.data, val->elems, 32); FREE(val);
28109 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
28112 int64_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_htlc_id"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint32_t this_ptr) {
28113 LDKUpdateFailMalformedHTLC this_ptr_conv;
28114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28115 this_ptr_conv.is_owned = false;
28116 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28117 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
28121 void __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_htlc_id"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
28122 LDKUpdateFailMalformedHTLC this_ptr_conv;
28123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28124 this_ptr_conv.is_owned = false;
28125 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28126 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
28129 int16_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_failure_code"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint32_t this_ptr) {
28130 LDKUpdateFailMalformedHTLC this_ptr_conv;
28131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28132 this_ptr_conv.is_owned = false;
28133 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28134 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
28138 void __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_failure_code"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint32_t this_ptr, int16_t val) {
28139 LDKUpdateFailMalformedHTLC this_ptr_conv;
28140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28141 this_ptr_conv.is_owned = false;
28142 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28143 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
28146 static inline uintptr_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
28147 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
28148 uint32_t ret_ref = 0;
28149 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28150 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28151 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28152 ret_ref = (uintptr_t)ret_var.inner;
28153 if (ret_var.is_owned) {
28158 uint32_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone_ptr"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint32_t arg) {
28159 LDKUpdateFailMalformedHTLC arg_conv;
28160 arg_conv.inner = (void*)(arg & (~1));
28161 arg_conv.is_owned = false;
28162 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28163 uint32_t ret_val = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
28167 uint32_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone"))) TS_UpdateFailMalformedHTLC_clone(uint32_t orig) {
28168 LDKUpdateFailMalformedHTLC orig_conv;
28169 orig_conv.inner = (void*)(orig & (~1));
28170 orig_conv.is_owned = false;
28171 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28172 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
28173 uint32_t ret_ref = 0;
28174 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28175 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28176 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28177 ret_ref = (uintptr_t)ret_var.inner;
28178 if (ret_var.is_owned) {
28184 void __attribute__((export_name("TS_CommitmentSigned_free"))) TS_CommitmentSigned_free(uint32_t this_obj) {
28185 LDKCommitmentSigned this_obj_conv;
28186 this_obj_conv.inner = (void*)(this_obj & (~1));
28187 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28188 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28189 CommitmentSigned_free(this_obj_conv);
28192 int8_tArray __attribute__((export_name("TS_CommitmentSigned_get_channel_id"))) TS_CommitmentSigned_get_channel_id(uint32_t this_ptr) {
28193 LDKCommitmentSigned this_ptr_conv;
28194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28195 this_ptr_conv.is_owned = false;
28196 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28197 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28198 memcpy(ret_arr->elems, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
28202 void __attribute__((export_name("TS_CommitmentSigned_set_channel_id"))) TS_CommitmentSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
28203 LDKCommitmentSigned this_ptr_conv;
28204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28205 this_ptr_conv.is_owned = false;
28206 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28207 LDKThirtyTwoBytes val_ref;
28208 CHECK(val->arr_len == 32);
28209 memcpy(val_ref.data, val->elems, 32); FREE(val);
28210 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
28213 int8_tArray __attribute__((export_name("TS_CommitmentSigned_get_signature"))) TS_CommitmentSigned_get_signature(uint32_t this_ptr) {
28214 LDKCommitmentSigned this_ptr_conv;
28215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28216 this_ptr_conv.is_owned = false;
28217 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28218 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
28219 memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
28223 void __attribute__((export_name("TS_CommitmentSigned_set_signature"))) TS_CommitmentSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
28224 LDKCommitmentSigned this_ptr_conv;
28225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28226 this_ptr_conv.is_owned = false;
28227 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28228 LDKSignature val_ref;
28229 CHECK(val->arr_len == 64);
28230 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
28231 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
28234 void __attribute__((export_name("TS_CommitmentSigned_set_htlc_signatures"))) TS_CommitmentSigned_set_htlc_signatures(uint32_t this_ptr, ptrArray val) {
28235 LDKCommitmentSigned this_ptr_conv;
28236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28237 this_ptr_conv.is_owned = false;
28238 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28239 LDKCVec_SignatureZ val_constr;
28240 val_constr.datalen = val->arr_len;
28241 if (val_constr.datalen > 0)
28242 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
28244 val_constr.data = NULL;
28245 int8_tArray* val_vals = (void*) val->elems /* XXX val leaks */;
28246 for (size_t m = 0; m < val_constr.datalen; m++) {
28247 int8_tArray val_conv_12 = val_vals[m];
28248 LDKSignature val_conv_12_ref;
28249 CHECK(val_conv_12->arr_len == 64);
28250 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
28251 val_constr.data[m] = val_conv_12_ref;
28253 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
28256 uint32_t __attribute__((export_name("TS_CommitmentSigned_new"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
28257 LDKThirtyTwoBytes channel_id_arg_ref;
28258 CHECK(channel_id_arg->arr_len == 32);
28259 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28260 LDKSignature signature_arg_ref;
28261 CHECK(signature_arg->arr_len == 64);
28262 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
28263 LDKCVec_SignatureZ htlc_signatures_arg_constr;
28264 htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
28265 if (htlc_signatures_arg_constr.datalen > 0)
28266 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
28268 htlc_signatures_arg_constr.data = NULL;
28269 int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems /* XXX htlc_signatures_arg leaks */;
28270 for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
28271 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
28272 LDKSignature htlc_signatures_arg_conv_12_ref;
28273 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
28274 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64); FREE(htlc_signatures_arg_conv_12);
28275 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
28277 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
28278 uint32_t ret_ref = 0;
28279 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28280 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28281 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28282 ret_ref = (uintptr_t)ret_var.inner;
28283 if (ret_var.is_owned) {
28289 static inline uintptr_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
28290 LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
28291 uint32_t ret_ref = 0;
28292 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28293 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28294 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28295 ret_ref = (uintptr_t)ret_var.inner;
28296 if (ret_var.is_owned) {
28301 uint32_t __attribute__((export_name("TS_CommitmentSigned_clone_ptr"))) TS_CommitmentSigned_clone_ptr(uint32_t arg) {
28302 LDKCommitmentSigned arg_conv;
28303 arg_conv.inner = (void*)(arg & (~1));
28304 arg_conv.is_owned = false;
28305 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28306 uint32_t ret_val = CommitmentSigned_clone_ptr(&arg_conv);
28310 uint32_t __attribute__((export_name("TS_CommitmentSigned_clone"))) TS_CommitmentSigned_clone(uint32_t orig) {
28311 LDKCommitmentSigned orig_conv;
28312 orig_conv.inner = (void*)(orig & (~1));
28313 orig_conv.is_owned = false;
28314 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28315 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
28316 uint32_t ret_ref = 0;
28317 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28318 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28319 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28320 ret_ref = (uintptr_t)ret_var.inner;
28321 if (ret_var.is_owned) {
28327 void __attribute__((export_name("TS_RevokeAndACK_free"))) TS_RevokeAndACK_free(uint32_t this_obj) {
28328 LDKRevokeAndACK this_obj_conv;
28329 this_obj_conv.inner = (void*)(this_obj & (~1));
28330 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28331 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28332 RevokeAndACK_free(this_obj_conv);
28335 int8_tArray __attribute__((export_name("TS_RevokeAndACK_get_channel_id"))) TS_RevokeAndACK_get_channel_id(uint32_t this_ptr) {
28336 LDKRevokeAndACK this_ptr_conv;
28337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28338 this_ptr_conv.is_owned = false;
28339 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28340 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28341 memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
28345 void __attribute__((export_name("TS_RevokeAndACK_set_channel_id"))) TS_RevokeAndACK_set_channel_id(uint32_t this_ptr, int8_tArray val) {
28346 LDKRevokeAndACK this_ptr_conv;
28347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28348 this_ptr_conv.is_owned = false;
28349 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28350 LDKThirtyTwoBytes val_ref;
28351 CHECK(val->arr_len == 32);
28352 memcpy(val_ref.data, val->elems, 32); FREE(val);
28353 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
28356 int8_tArray __attribute__((export_name("TS_RevokeAndACK_get_per_commitment_secret"))) TS_RevokeAndACK_get_per_commitment_secret(uint32_t this_ptr) {
28357 LDKRevokeAndACK this_ptr_conv;
28358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28359 this_ptr_conv.is_owned = false;
28360 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28361 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28362 memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
28366 void __attribute__((export_name("TS_RevokeAndACK_set_per_commitment_secret"))) TS_RevokeAndACK_set_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
28367 LDKRevokeAndACK this_ptr_conv;
28368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28369 this_ptr_conv.is_owned = false;
28370 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28371 LDKThirtyTwoBytes val_ref;
28372 CHECK(val->arr_len == 32);
28373 memcpy(val_ref.data, val->elems, 32); FREE(val);
28374 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
28377 int8_tArray __attribute__((export_name("TS_RevokeAndACK_get_next_per_commitment_point"))) TS_RevokeAndACK_get_next_per_commitment_point(uint32_t this_ptr) {
28378 LDKRevokeAndACK this_ptr_conv;
28379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28380 this_ptr_conv.is_owned = false;
28381 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28382 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28383 memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
28387 void __attribute__((export_name("TS_RevokeAndACK_set_next_per_commitment_point"))) TS_RevokeAndACK_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
28388 LDKRevokeAndACK this_ptr_conv;
28389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28390 this_ptr_conv.is_owned = false;
28391 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28392 LDKPublicKey val_ref;
28393 CHECK(val->arr_len == 33);
28394 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28395 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
28398 uint32_t __attribute__((export_name("TS_RevokeAndACK_new"))) TS_RevokeAndACK_new(int8_tArray channel_id_arg, int8_tArray per_commitment_secret_arg, int8_tArray next_per_commitment_point_arg) {
28399 LDKThirtyTwoBytes channel_id_arg_ref;
28400 CHECK(channel_id_arg->arr_len == 32);
28401 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28402 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
28403 CHECK(per_commitment_secret_arg->arr_len == 32);
28404 memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
28405 LDKPublicKey next_per_commitment_point_arg_ref;
28406 CHECK(next_per_commitment_point_arg->arr_len == 33);
28407 memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
28408 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
28409 uint32_t ret_ref = 0;
28410 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28411 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28412 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28413 ret_ref = (uintptr_t)ret_var.inner;
28414 if (ret_var.is_owned) {
28420 static inline uintptr_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
28421 LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
28422 uint32_t ret_ref = 0;
28423 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28424 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28425 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28426 ret_ref = (uintptr_t)ret_var.inner;
28427 if (ret_var.is_owned) {
28432 uint32_t __attribute__((export_name("TS_RevokeAndACK_clone_ptr"))) TS_RevokeAndACK_clone_ptr(uint32_t arg) {
28433 LDKRevokeAndACK arg_conv;
28434 arg_conv.inner = (void*)(arg & (~1));
28435 arg_conv.is_owned = false;
28436 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28437 uint32_t ret_val = RevokeAndACK_clone_ptr(&arg_conv);
28441 uint32_t __attribute__((export_name("TS_RevokeAndACK_clone"))) TS_RevokeAndACK_clone(uint32_t orig) {
28442 LDKRevokeAndACK orig_conv;
28443 orig_conv.inner = (void*)(orig & (~1));
28444 orig_conv.is_owned = false;
28445 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28446 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
28447 uint32_t ret_ref = 0;
28448 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28449 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28450 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28451 ret_ref = (uintptr_t)ret_var.inner;
28452 if (ret_var.is_owned) {
28458 void __attribute__((export_name("TS_UpdateFee_free"))) TS_UpdateFee_free(uint32_t this_obj) {
28459 LDKUpdateFee this_obj_conv;
28460 this_obj_conv.inner = (void*)(this_obj & (~1));
28461 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28462 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28463 UpdateFee_free(this_obj_conv);
28466 int8_tArray __attribute__((export_name("TS_UpdateFee_get_channel_id"))) TS_UpdateFee_get_channel_id(uint32_t this_ptr) {
28467 LDKUpdateFee this_ptr_conv;
28468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28469 this_ptr_conv.is_owned = false;
28470 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28471 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28472 memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
28476 void __attribute__((export_name("TS_UpdateFee_set_channel_id"))) TS_UpdateFee_set_channel_id(uint32_t this_ptr, int8_tArray val) {
28477 LDKUpdateFee this_ptr_conv;
28478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28479 this_ptr_conv.is_owned = false;
28480 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28481 LDKThirtyTwoBytes val_ref;
28482 CHECK(val->arr_len == 32);
28483 memcpy(val_ref.data, val->elems, 32); FREE(val);
28484 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
28487 int32_t __attribute__((export_name("TS_UpdateFee_get_feerate_per_kw"))) TS_UpdateFee_get_feerate_per_kw(uint32_t this_ptr) {
28488 LDKUpdateFee this_ptr_conv;
28489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28490 this_ptr_conv.is_owned = false;
28491 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28492 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
28496 void __attribute__((export_name("TS_UpdateFee_set_feerate_per_kw"))) TS_UpdateFee_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
28497 LDKUpdateFee this_ptr_conv;
28498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28499 this_ptr_conv.is_owned = false;
28500 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28501 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
28504 uint32_t __attribute__((export_name("TS_UpdateFee_new"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
28505 LDKThirtyTwoBytes channel_id_arg_ref;
28506 CHECK(channel_id_arg->arr_len == 32);
28507 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28508 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
28509 uint32_t ret_ref = 0;
28510 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28511 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28512 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28513 ret_ref = (uintptr_t)ret_var.inner;
28514 if (ret_var.is_owned) {
28520 static inline uintptr_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
28521 LDKUpdateFee ret_var = UpdateFee_clone(arg);
28522 uint32_t ret_ref = 0;
28523 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28524 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28525 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28526 ret_ref = (uintptr_t)ret_var.inner;
28527 if (ret_var.is_owned) {
28532 uint32_t __attribute__((export_name("TS_UpdateFee_clone_ptr"))) TS_UpdateFee_clone_ptr(uint32_t arg) {
28533 LDKUpdateFee arg_conv;
28534 arg_conv.inner = (void*)(arg & (~1));
28535 arg_conv.is_owned = false;
28536 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28537 uint32_t ret_val = UpdateFee_clone_ptr(&arg_conv);
28541 uint32_t __attribute__((export_name("TS_UpdateFee_clone"))) TS_UpdateFee_clone(uint32_t orig) {
28542 LDKUpdateFee orig_conv;
28543 orig_conv.inner = (void*)(orig & (~1));
28544 orig_conv.is_owned = false;
28545 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28546 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
28547 uint32_t ret_ref = 0;
28548 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28549 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28550 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28551 ret_ref = (uintptr_t)ret_var.inner;
28552 if (ret_var.is_owned) {
28558 void __attribute__((export_name("TS_DataLossProtect_free"))) TS_DataLossProtect_free(uint32_t this_obj) {
28559 LDKDataLossProtect this_obj_conv;
28560 this_obj_conv.inner = (void*)(this_obj & (~1));
28561 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28562 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28563 DataLossProtect_free(this_obj_conv);
28566 int8_tArray __attribute__((export_name("TS_DataLossProtect_get_your_last_per_commitment_secret"))) TS_DataLossProtect_get_your_last_per_commitment_secret(uint32_t this_ptr) {
28567 LDKDataLossProtect this_ptr_conv;
28568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28569 this_ptr_conv.is_owned = false;
28570 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28571 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28572 memcpy(ret_arr->elems, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
28576 void __attribute__((export_name("TS_DataLossProtect_set_your_last_per_commitment_secret"))) TS_DataLossProtect_set_your_last_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
28577 LDKDataLossProtect this_ptr_conv;
28578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28579 this_ptr_conv.is_owned = false;
28580 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28581 LDKThirtyTwoBytes val_ref;
28582 CHECK(val->arr_len == 32);
28583 memcpy(val_ref.data, val->elems, 32); FREE(val);
28584 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
28587 int8_tArray __attribute__((export_name("TS_DataLossProtect_get_my_current_per_commitment_point"))) TS_DataLossProtect_get_my_current_per_commitment_point(uint32_t this_ptr) {
28588 LDKDataLossProtect this_ptr_conv;
28589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28590 this_ptr_conv.is_owned = false;
28591 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28592 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28593 memcpy(ret_arr->elems, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
28597 void __attribute__((export_name("TS_DataLossProtect_set_my_current_per_commitment_point"))) TS_DataLossProtect_set_my_current_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
28598 LDKDataLossProtect this_ptr_conv;
28599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28600 this_ptr_conv.is_owned = false;
28601 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28602 LDKPublicKey val_ref;
28603 CHECK(val->arr_len == 33);
28604 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28605 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
28608 uint32_t __attribute__((export_name("TS_DataLossProtect_new"))) TS_DataLossProtect_new(int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
28609 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
28610 CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
28611 memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
28612 LDKPublicKey my_current_per_commitment_point_arg_ref;
28613 CHECK(my_current_per_commitment_point_arg->arr_len == 33);
28614 memcpy(my_current_per_commitment_point_arg_ref.compressed_form, my_current_per_commitment_point_arg->elems, 33); FREE(my_current_per_commitment_point_arg);
28615 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
28616 uint32_t ret_ref = 0;
28617 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28618 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28619 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28620 ret_ref = (uintptr_t)ret_var.inner;
28621 if (ret_var.is_owned) {
28627 static inline uintptr_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
28628 LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
28629 uint32_t ret_ref = 0;
28630 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28631 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28632 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28633 ret_ref = (uintptr_t)ret_var.inner;
28634 if (ret_var.is_owned) {
28639 uint32_t __attribute__((export_name("TS_DataLossProtect_clone_ptr"))) TS_DataLossProtect_clone_ptr(uint32_t arg) {
28640 LDKDataLossProtect arg_conv;
28641 arg_conv.inner = (void*)(arg & (~1));
28642 arg_conv.is_owned = false;
28643 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28644 uint32_t ret_val = DataLossProtect_clone_ptr(&arg_conv);
28648 uint32_t __attribute__((export_name("TS_DataLossProtect_clone"))) TS_DataLossProtect_clone(uint32_t orig) {
28649 LDKDataLossProtect orig_conv;
28650 orig_conv.inner = (void*)(orig & (~1));
28651 orig_conv.is_owned = false;
28652 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28653 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
28654 uint32_t ret_ref = 0;
28655 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28656 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28657 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28658 ret_ref = (uintptr_t)ret_var.inner;
28659 if (ret_var.is_owned) {
28665 void __attribute__((export_name("TS_ChannelReestablish_free"))) TS_ChannelReestablish_free(uint32_t this_obj) {
28666 LDKChannelReestablish this_obj_conv;
28667 this_obj_conv.inner = (void*)(this_obj & (~1));
28668 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28669 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28670 ChannelReestablish_free(this_obj_conv);
28673 int8_tArray __attribute__((export_name("TS_ChannelReestablish_get_channel_id"))) TS_ChannelReestablish_get_channel_id(uint32_t this_ptr) {
28674 LDKChannelReestablish this_ptr_conv;
28675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28676 this_ptr_conv.is_owned = false;
28677 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28678 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28679 memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
28683 void __attribute__((export_name("TS_ChannelReestablish_set_channel_id"))) TS_ChannelReestablish_set_channel_id(uint32_t this_ptr, int8_tArray val) {
28684 LDKChannelReestablish this_ptr_conv;
28685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28686 this_ptr_conv.is_owned = false;
28687 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28688 LDKThirtyTwoBytes val_ref;
28689 CHECK(val->arr_len == 32);
28690 memcpy(val_ref.data, val->elems, 32); FREE(val);
28691 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
28694 int64_t __attribute__((export_name("TS_ChannelReestablish_get_next_local_commitment_number"))) TS_ChannelReestablish_get_next_local_commitment_number(uint32_t this_ptr) {
28695 LDKChannelReestablish this_ptr_conv;
28696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28697 this_ptr_conv.is_owned = false;
28698 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28699 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
28703 void __attribute__((export_name("TS_ChannelReestablish_set_next_local_commitment_number"))) TS_ChannelReestablish_set_next_local_commitment_number(uint32_t this_ptr, int64_t val) {
28704 LDKChannelReestablish this_ptr_conv;
28705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28706 this_ptr_conv.is_owned = false;
28707 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28708 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
28711 int64_t __attribute__((export_name("TS_ChannelReestablish_get_next_remote_commitment_number"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint32_t this_ptr) {
28712 LDKChannelReestablish this_ptr_conv;
28713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28714 this_ptr_conv.is_owned = false;
28715 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28716 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
28720 void __attribute__((export_name("TS_ChannelReestablish_set_next_remote_commitment_number"))) TS_ChannelReestablish_set_next_remote_commitment_number(uint32_t this_ptr, int64_t val) {
28721 LDKChannelReestablish this_ptr_conv;
28722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28723 this_ptr_conv.is_owned = false;
28724 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28725 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
28728 static inline uintptr_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
28729 LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
28730 uint32_t ret_ref = 0;
28731 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28732 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28733 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28734 ret_ref = (uintptr_t)ret_var.inner;
28735 if (ret_var.is_owned) {
28740 uint32_t __attribute__((export_name("TS_ChannelReestablish_clone_ptr"))) TS_ChannelReestablish_clone_ptr(uint32_t arg) {
28741 LDKChannelReestablish arg_conv;
28742 arg_conv.inner = (void*)(arg & (~1));
28743 arg_conv.is_owned = false;
28744 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28745 uint32_t ret_val = ChannelReestablish_clone_ptr(&arg_conv);
28749 uint32_t __attribute__((export_name("TS_ChannelReestablish_clone"))) TS_ChannelReestablish_clone(uint32_t orig) {
28750 LDKChannelReestablish orig_conv;
28751 orig_conv.inner = (void*)(orig & (~1));
28752 orig_conv.is_owned = false;
28753 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28754 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
28755 uint32_t ret_ref = 0;
28756 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28757 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28758 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28759 ret_ref = (uintptr_t)ret_var.inner;
28760 if (ret_var.is_owned) {
28766 void __attribute__((export_name("TS_AnnouncementSignatures_free"))) TS_AnnouncementSignatures_free(uint32_t this_obj) {
28767 LDKAnnouncementSignatures this_obj_conv;
28768 this_obj_conv.inner = (void*)(this_obj & (~1));
28769 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28770 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28771 AnnouncementSignatures_free(this_obj_conv);
28774 int8_tArray __attribute__((export_name("TS_AnnouncementSignatures_get_channel_id"))) TS_AnnouncementSignatures_get_channel_id(uint32_t this_ptr) {
28775 LDKAnnouncementSignatures this_ptr_conv;
28776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28777 this_ptr_conv.is_owned = false;
28778 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28779 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28780 memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
28784 void __attribute__((export_name("TS_AnnouncementSignatures_set_channel_id"))) TS_AnnouncementSignatures_set_channel_id(uint32_t this_ptr, int8_tArray val) {
28785 LDKAnnouncementSignatures this_ptr_conv;
28786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28787 this_ptr_conv.is_owned = false;
28788 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28789 LDKThirtyTwoBytes val_ref;
28790 CHECK(val->arr_len == 32);
28791 memcpy(val_ref.data, val->elems, 32); FREE(val);
28792 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
28795 int64_t __attribute__((export_name("TS_AnnouncementSignatures_get_short_channel_id"))) TS_AnnouncementSignatures_get_short_channel_id(uint32_t this_ptr) {
28796 LDKAnnouncementSignatures this_ptr_conv;
28797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28798 this_ptr_conv.is_owned = false;
28799 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28800 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
28804 void __attribute__((export_name("TS_AnnouncementSignatures_set_short_channel_id"))) TS_AnnouncementSignatures_set_short_channel_id(uint32_t this_ptr, int64_t val) {
28805 LDKAnnouncementSignatures this_ptr_conv;
28806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28807 this_ptr_conv.is_owned = false;
28808 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28809 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
28812 int8_tArray __attribute__((export_name("TS_AnnouncementSignatures_get_node_signature"))) TS_AnnouncementSignatures_get_node_signature(uint32_t this_ptr) {
28813 LDKAnnouncementSignatures this_ptr_conv;
28814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28815 this_ptr_conv.is_owned = false;
28816 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28817 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
28818 memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
28822 void __attribute__((export_name("TS_AnnouncementSignatures_set_node_signature"))) TS_AnnouncementSignatures_set_node_signature(uint32_t this_ptr, int8_tArray val) {
28823 LDKAnnouncementSignatures this_ptr_conv;
28824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28825 this_ptr_conv.is_owned = false;
28826 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28827 LDKSignature val_ref;
28828 CHECK(val->arr_len == 64);
28829 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
28830 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
28833 int8_tArray __attribute__((export_name("TS_AnnouncementSignatures_get_bitcoin_signature"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint32_t this_ptr) {
28834 LDKAnnouncementSignatures this_ptr_conv;
28835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28836 this_ptr_conv.is_owned = false;
28837 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28838 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
28839 memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
28843 void __attribute__((export_name("TS_AnnouncementSignatures_set_bitcoin_signature"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint32_t this_ptr, int8_tArray val) {
28844 LDKAnnouncementSignatures this_ptr_conv;
28845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28846 this_ptr_conv.is_owned = false;
28847 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28848 LDKSignature val_ref;
28849 CHECK(val->arr_len == 64);
28850 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
28851 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
28854 uint32_t __attribute__((export_name("TS_AnnouncementSignatures_new"))) TS_AnnouncementSignatures_new(int8_tArray channel_id_arg, int64_t short_channel_id_arg, int8_tArray node_signature_arg, int8_tArray bitcoin_signature_arg) {
28855 LDKThirtyTwoBytes channel_id_arg_ref;
28856 CHECK(channel_id_arg->arr_len == 32);
28857 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28858 LDKSignature node_signature_arg_ref;
28859 CHECK(node_signature_arg->arr_len == 64);
28860 memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
28861 LDKSignature bitcoin_signature_arg_ref;
28862 CHECK(bitcoin_signature_arg->arr_len == 64);
28863 memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
28864 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
28865 uint32_t ret_ref = 0;
28866 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28867 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28868 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28869 ret_ref = (uintptr_t)ret_var.inner;
28870 if (ret_var.is_owned) {
28876 static inline uintptr_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
28877 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
28878 uint32_t ret_ref = 0;
28879 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28880 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28881 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28882 ret_ref = (uintptr_t)ret_var.inner;
28883 if (ret_var.is_owned) {
28888 uint32_t __attribute__((export_name("TS_AnnouncementSignatures_clone_ptr"))) TS_AnnouncementSignatures_clone_ptr(uint32_t arg) {
28889 LDKAnnouncementSignatures arg_conv;
28890 arg_conv.inner = (void*)(arg & (~1));
28891 arg_conv.is_owned = false;
28892 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28893 uint32_t ret_val = AnnouncementSignatures_clone_ptr(&arg_conv);
28897 uint32_t __attribute__((export_name("TS_AnnouncementSignatures_clone"))) TS_AnnouncementSignatures_clone(uint32_t orig) {
28898 LDKAnnouncementSignatures orig_conv;
28899 orig_conv.inner = (void*)(orig & (~1));
28900 orig_conv.is_owned = false;
28901 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28902 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
28903 uint32_t ret_ref = 0;
28904 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28905 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28906 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28907 ret_ref = (uintptr_t)ret_var.inner;
28908 if (ret_var.is_owned) {
28914 void __attribute__((export_name("TS_NetAddress_free"))) TS_NetAddress_free(uint32_t this_ptr) {
28915 if ((this_ptr & 1) != 0) return;
28916 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
28917 CHECK_ACCESS(this_ptr_ptr);
28918 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
28919 FREE((void*)this_ptr);
28920 NetAddress_free(this_ptr_conv);
28923 static inline uintptr_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
28924 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
28925 *ret_copy = NetAddress_clone(arg);
28926 uint32_t ret_ref = (uintptr_t)ret_copy;
28929 uint32_t __attribute__((export_name("TS_NetAddress_clone_ptr"))) TS_NetAddress_clone_ptr(uint32_t arg) {
28930 LDKNetAddress* arg_conv = (LDKNetAddress*)arg;
28931 uint32_t ret_val = NetAddress_clone_ptr(arg_conv);
28935 uint32_t __attribute__((export_name("TS_NetAddress_clone"))) TS_NetAddress_clone(uint32_t orig) {
28936 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
28937 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
28938 *ret_copy = NetAddress_clone(orig_conv);
28939 uint32_t ret_ref = (uintptr_t)ret_copy;
28943 uint32_t __attribute__((export_name("TS_NetAddress_ipv4"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
28944 LDKFourBytes addr_ref;
28945 CHECK(addr->arr_len == 4);
28946 memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
28947 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
28948 *ret_copy = NetAddress_ipv4(addr_ref, port);
28949 uint32_t ret_ref = (uintptr_t)ret_copy;
28953 uint32_t __attribute__((export_name("TS_NetAddress_ipv6"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
28954 LDKSixteenBytes addr_ref;
28955 CHECK(addr->arr_len == 16);
28956 memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
28957 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
28958 *ret_copy = NetAddress_ipv6(addr_ref, port);
28959 uint32_t ret_ref = (uintptr_t)ret_copy;
28963 uint32_t __attribute__((export_name("TS_NetAddress_onion_v2"))) TS_NetAddress_onion_v2(int8_tArray a) {
28964 LDKTwelveBytes a_ref;
28965 CHECK(a->arr_len == 12);
28966 memcpy(a_ref.data, a->elems, 12); FREE(a);
28967 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
28968 *ret_copy = NetAddress_onion_v2(a_ref);
28969 uint32_t ret_ref = (uintptr_t)ret_copy;
28973 uint32_t __attribute__((export_name("TS_NetAddress_onion_v3"))) TS_NetAddress_onion_v3(int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
28974 LDKThirtyTwoBytes ed25519_pubkey_ref;
28975 CHECK(ed25519_pubkey->arr_len == 32);
28976 memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
28977 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
28978 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
28979 uint32_t ret_ref = (uintptr_t)ret_copy;
28983 int8_tArray __attribute__((export_name("TS_NetAddress_write"))) TS_NetAddress_write(uint32_t obj) {
28984 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
28985 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
28986 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
28987 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28988 CVec_u8Z_free(ret_var);
28992 uint32_t __attribute__((export_name("TS_NetAddress_read"))) TS_NetAddress_read(int8_tArray ser) {
28993 LDKu8slice ser_ref;
28994 ser_ref.datalen = ser->arr_len;
28995 ser_ref.data = ser->elems /* XXX ser leaks */;
28996 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
28997 *ret_conv = NetAddress_read(ser_ref);
28998 return (uint32_t)ret_conv;
29001 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint32_t this_obj) {
29002 LDKUnsignedNodeAnnouncement this_obj_conv;
29003 this_obj_conv.inner = (void*)(this_obj & (~1));
29004 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29005 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29006 UnsignedNodeAnnouncement_free(this_obj_conv);
29009 uint32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_features"))) TS_UnsignedNodeAnnouncement_get_features(uint32_t this_ptr) {
29010 LDKUnsignedNodeAnnouncement this_ptr_conv;
29011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29012 this_ptr_conv.is_owned = false;
29013 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29014 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
29015 uint32_t ret_ref = 0;
29016 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29017 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29018 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29019 ret_ref = (uintptr_t)ret_var.inner;
29020 if (ret_var.is_owned) {
29026 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_features"))) TS_UnsignedNodeAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
29027 LDKUnsignedNodeAnnouncement this_ptr_conv;
29028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29029 this_ptr_conv.is_owned = false;
29030 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29031 LDKNodeFeatures val_conv;
29032 val_conv.inner = (void*)(val & (~1));
29033 val_conv.is_owned = (val & 1) || (val == 0);
29034 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29035 val_conv = NodeFeatures_clone(&val_conv);
29036 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
29039 int32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_timestamp"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint32_t this_ptr) {
29040 LDKUnsignedNodeAnnouncement this_ptr_conv;
29041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29042 this_ptr_conv.is_owned = false;
29043 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29044 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
29048 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint32_t this_ptr, int32_t val) {
29049 LDKUnsignedNodeAnnouncement this_ptr_conv;
29050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29051 this_ptr_conv.is_owned = false;
29052 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29053 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
29056 int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint32_t this_ptr) {
29057 LDKUnsignedNodeAnnouncement this_ptr_conv;
29058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29059 this_ptr_conv.is_owned = false;
29060 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29061 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29062 memcpy(ret_arr->elems, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
29066 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint32_t this_ptr, int8_tArray val) {
29067 LDKUnsignedNodeAnnouncement this_ptr_conv;
29068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29069 this_ptr_conv.is_owned = false;
29070 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29071 LDKPublicKey val_ref;
29072 CHECK(val->arr_len == 33);
29073 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29074 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
29077 int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint32_t this_ptr) {
29078 LDKUnsignedNodeAnnouncement 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 int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
29083 memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
29087 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_rgb"))) TS_UnsignedNodeAnnouncement_set_rgb(uint32_t this_ptr, int8_tArray val) {
29088 LDKUnsignedNodeAnnouncement this_ptr_conv;
29089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29090 this_ptr_conv.is_owned = false;
29091 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29092 LDKThreeBytes val_ref;
29093 CHECK(val->arr_len == 3);
29094 memcpy(val_ref.data, val->elems, 3); FREE(val);
29095 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
29098 int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_alias"))) TS_UnsignedNodeAnnouncement_get_alias(uint32_t this_ptr) {
29099 LDKUnsignedNodeAnnouncement this_ptr_conv;
29100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29101 this_ptr_conv.is_owned = false;
29102 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29103 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29104 memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
29108 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_alias"))) TS_UnsignedNodeAnnouncement_set_alias(uint32_t this_ptr, int8_tArray val) {
29109 LDKUnsignedNodeAnnouncement this_ptr_conv;
29110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29111 this_ptr_conv.is_owned = false;
29112 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29113 LDKThirtyTwoBytes val_ref;
29114 CHECK(val->arr_len == 32);
29115 memcpy(val_ref.data, val->elems, 32); FREE(val);
29116 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
29119 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_addresses"))) TS_UnsignedNodeAnnouncement_set_addresses(uint32_t this_ptr, uint32_tArray val) {
29120 LDKUnsignedNodeAnnouncement this_ptr_conv;
29121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29122 this_ptr_conv.is_owned = false;
29123 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29124 LDKCVec_NetAddressZ val_constr;
29125 val_constr.datalen = val->arr_len;
29126 if (val_constr.datalen > 0)
29127 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
29129 val_constr.data = NULL;
29130 uint32_t* val_vals = val->elems /* XXX val leaks */;
29131 for (size_t m = 0; m < val_constr.datalen; m++) {
29132 uint32_t val_conv_12 = val_vals[m];
29133 void* val_conv_12_ptr = (void*)(((uintptr_t)val_conv_12) & ~1);
29134 CHECK_ACCESS(val_conv_12_ptr);
29135 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
29136 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)val_conv_12) & ~1));
29137 val_constr.data[m] = val_conv_12_conv;
29139 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
29142 static inline uintptr_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
29143 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
29144 uint32_t ret_ref = 0;
29145 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29146 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29147 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29148 ret_ref = (uintptr_t)ret_var.inner;
29149 if (ret_var.is_owned) {
29154 uint32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone_ptr"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint32_t arg) {
29155 LDKUnsignedNodeAnnouncement arg_conv;
29156 arg_conv.inner = (void*)(arg & (~1));
29157 arg_conv.is_owned = false;
29158 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29159 uint32_t ret_val = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
29163 uint32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone"))) TS_UnsignedNodeAnnouncement_clone(uint32_t orig) {
29164 LDKUnsignedNodeAnnouncement orig_conv;
29165 orig_conv.inner = (void*)(orig & (~1));
29166 orig_conv.is_owned = false;
29167 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29168 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
29169 uint32_t ret_ref = 0;
29170 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29171 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29172 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29173 ret_ref = (uintptr_t)ret_var.inner;
29174 if (ret_var.is_owned) {
29180 void __attribute__((export_name("TS_NodeAnnouncement_free"))) TS_NodeAnnouncement_free(uint32_t this_obj) {
29181 LDKNodeAnnouncement this_obj_conv;
29182 this_obj_conv.inner = (void*)(this_obj & (~1));
29183 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29184 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29185 NodeAnnouncement_free(this_obj_conv);
29188 int8_tArray __attribute__((export_name("TS_NodeAnnouncement_get_signature"))) TS_NodeAnnouncement_get_signature(uint32_t this_ptr) {
29189 LDKNodeAnnouncement this_ptr_conv;
29190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29191 this_ptr_conv.is_owned = false;
29192 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29193 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
29194 memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
29198 void __attribute__((export_name("TS_NodeAnnouncement_set_signature"))) TS_NodeAnnouncement_set_signature(uint32_t this_ptr, int8_tArray val) {
29199 LDKNodeAnnouncement this_ptr_conv;
29200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29201 this_ptr_conv.is_owned = false;
29202 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29203 LDKSignature val_ref;
29204 CHECK(val->arr_len == 64);
29205 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
29206 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
29209 uint32_t __attribute__((export_name("TS_NodeAnnouncement_get_contents"))) TS_NodeAnnouncement_get_contents(uint32_t this_ptr) {
29210 LDKNodeAnnouncement this_ptr_conv;
29211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29212 this_ptr_conv.is_owned = false;
29213 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29214 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
29215 uint32_t ret_ref = 0;
29216 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29217 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29218 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29219 ret_ref = (uintptr_t)ret_var.inner;
29220 if (ret_var.is_owned) {
29226 void __attribute__((export_name("TS_NodeAnnouncement_set_contents"))) TS_NodeAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
29227 LDKNodeAnnouncement this_ptr_conv;
29228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29229 this_ptr_conv.is_owned = false;
29230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29231 LDKUnsignedNodeAnnouncement val_conv;
29232 val_conv.inner = (void*)(val & (~1));
29233 val_conv.is_owned = (val & 1) || (val == 0);
29234 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29235 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
29236 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
29239 uint32_t __attribute__((export_name("TS_NodeAnnouncement_new"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint32_t contents_arg) {
29240 LDKSignature signature_arg_ref;
29241 CHECK(signature_arg->arr_len == 64);
29242 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
29243 LDKUnsignedNodeAnnouncement contents_arg_conv;
29244 contents_arg_conv.inner = (void*)(contents_arg & (~1));
29245 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
29246 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
29247 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
29248 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
29249 uint32_t ret_ref = 0;
29250 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29251 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29252 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29253 ret_ref = (uintptr_t)ret_var.inner;
29254 if (ret_var.is_owned) {
29260 static inline uintptr_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
29261 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
29262 uint32_t ret_ref = 0;
29263 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29264 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29265 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29266 ret_ref = (uintptr_t)ret_var.inner;
29267 if (ret_var.is_owned) {
29272 uint32_t __attribute__((export_name("TS_NodeAnnouncement_clone_ptr"))) TS_NodeAnnouncement_clone_ptr(uint32_t arg) {
29273 LDKNodeAnnouncement arg_conv;
29274 arg_conv.inner = (void*)(arg & (~1));
29275 arg_conv.is_owned = false;
29276 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29277 uint32_t ret_val = NodeAnnouncement_clone_ptr(&arg_conv);
29281 uint32_t __attribute__((export_name("TS_NodeAnnouncement_clone"))) TS_NodeAnnouncement_clone(uint32_t orig) {
29282 LDKNodeAnnouncement orig_conv;
29283 orig_conv.inner = (void*)(orig & (~1));
29284 orig_conv.is_owned = false;
29285 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29286 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
29287 uint32_t ret_ref = 0;
29288 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29289 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29290 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29291 ret_ref = (uintptr_t)ret_var.inner;
29292 if (ret_var.is_owned) {
29298 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_free"))) TS_UnsignedChannelAnnouncement_free(uint32_t this_obj) {
29299 LDKUnsignedChannelAnnouncement this_obj_conv;
29300 this_obj_conv.inner = (void*)(this_obj & (~1));
29301 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29302 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29303 UnsignedChannelAnnouncement_free(this_obj_conv);
29306 uint32_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_features"))) TS_UnsignedChannelAnnouncement_get_features(uint32_t this_ptr) {
29307 LDKUnsignedChannelAnnouncement this_ptr_conv;
29308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29309 this_ptr_conv.is_owned = false;
29310 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29311 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
29312 uint32_t ret_ref = 0;
29313 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29314 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29315 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29316 ret_ref = (uintptr_t)ret_var.inner;
29317 if (ret_var.is_owned) {
29323 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_features"))) TS_UnsignedChannelAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
29324 LDKUnsignedChannelAnnouncement this_ptr_conv;
29325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29326 this_ptr_conv.is_owned = false;
29327 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29328 LDKChannelFeatures val_conv;
29329 val_conv.inner = (void*)(val & (~1));
29330 val_conv.is_owned = (val & 1) || (val == 0);
29331 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29332 val_conv = ChannelFeatures_clone(&val_conv);
29333 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
29336 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_chain_hash"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint32_t this_ptr) {
29337 LDKUnsignedChannelAnnouncement this_ptr_conv;
29338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29339 this_ptr_conv.is_owned = false;
29340 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29341 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29342 memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
29346 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_chain_hash"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
29347 LDKUnsignedChannelAnnouncement this_ptr_conv;
29348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29349 this_ptr_conv.is_owned = false;
29350 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29351 LDKThirtyTwoBytes val_ref;
29352 CHECK(val->arr_len == 32);
29353 memcpy(val_ref.data, val->elems, 32); FREE(val);
29354 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
29357 int64_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_short_channel_id"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint32_t this_ptr) {
29358 LDKUnsignedChannelAnnouncement this_ptr_conv;
29359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29360 this_ptr_conv.is_owned = false;
29361 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29362 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
29366 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_channel_id"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint32_t this_ptr, int64_t val) {
29367 LDKUnsignedChannelAnnouncement this_ptr_conv;
29368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29369 this_ptr_conv.is_owned = false;
29370 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29371 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
29374 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint32_t this_ptr) {
29375 LDKUnsignedChannelAnnouncement this_ptr_conv;
29376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29377 this_ptr_conv.is_owned = false;
29378 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29379 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29380 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
29384 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint32_t this_ptr, int8_tArray val) {
29385 LDKUnsignedChannelAnnouncement this_ptr_conv;
29386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29387 this_ptr_conv.is_owned = false;
29388 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29389 LDKPublicKey val_ref;
29390 CHECK(val->arr_len == 33);
29391 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29392 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
29395 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint32_t this_ptr) {
29396 LDKUnsignedChannelAnnouncement this_ptr_conv;
29397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29398 this_ptr_conv.is_owned = false;
29399 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29400 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29401 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
29405 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint32_t this_ptr, int8_tArray val) {
29406 LDKUnsignedChannelAnnouncement this_ptr_conv;
29407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29408 this_ptr_conv.is_owned = false;
29409 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29410 LDKPublicKey val_ref;
29411 CHECK(val->arr_len == 33);
29412 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29413 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
29416 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint32_t this_ptr) {
29417 LDKUnsignedChannelAnnouncement 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 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29422 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
29426 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint32_t this_ptr, int8_tArray val) {
29427 LDKUnsignedChannelAnnouncement this_ptr_conv;
29428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29429 this_ptr_conv.is_owned = false;
29430 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29431 LDKPublicKey val_ref;
29432 CHECK(val->arr_len == 33);
29433 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29434 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
29437 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint32_t this_ptr) {
29438 LDKUnsignedChannelAnnouncement this_ptr_conv;
29439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29440 this_ptr_conv.is_owned = false;
29441 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29442 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29443 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
29447 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint32_t this_ptr, int8_tArray val) {
29448 LDKUnsignedChannelAnnouncement this_ptr_conv;
29449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29450 this_ptr_conv.is_owned = false;
29451 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29452 LDKPublicKey val_ref;
29453 CHECK(val->arr_len == 33);
29454 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29455 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
29458 static inline uintptr_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
29459 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
29460 uint32_t ret_ref = 0;
29461 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29462 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29463 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29464 ret_ref = (uintptr_t)ret_var.inner;
29465 if (ret_var.is_owned) {
29470 uint32_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone_ptr"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint32_t arg) {
29471 LDKUnsignedChannelAnnouncement arg_conv;
29472 arg_conv.inner = (void*)(arg & (~1));
29473 arg_conv.is_owned = false;
29474 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29475 uint32_t ret_val = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
29479 uint32_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone"))) TS_UnsignedChannelAnnouncement_clone(uint32_t orig) {
29480 LDKUnsignedChannelAnnouncement orig_conv;
29481 orig_conv.inner = (void*)(orig & (~1));
29482 orig_conv.is_owned = false;
29483 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29484 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
29485 uint32_t ret_ref = 0;
29486 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29487 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29488 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29489 ret_ref = (uintptr_t)ret_var.inner;
29490 if (ret_var.is_owned) {
29496 void __attribute__((export_name("TS_ChannelAnnouncement_free"))) TS_ChannelAnnouncement_free(uint32_t this_obj) {
29497 LDKChannelAnnouncement this_obj_conv;
29498 this_obj_conv.inner = (void*)(this_obj & (~1));
29499 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29500 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29501 ChannelAnnouncement_free(this_obj_conv);
29504 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_1"))) TS_ChannelAnnouncement_get_node_signature_1(uint32_t this_ptr) {
29505 LDKChannelAnnouncement this_ptr_conv;
29506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29507 this_ptr_conv.is_owned = false;
29508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29509 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
29510 memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
29514 void __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_1"))) TS_ChannelAnnouncement_set_node_signature_1(uint32_t this_ptr, int8_tArray val) {
29515 LDKChannelAnnouncement this_ptr_conv;
29516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29517 this_ptr_conv.is_owned = false;
29518 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29519 LDKSignature val_ref;
29520 CHECK(val->arr_len == 64);
29521 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
29522 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
29525 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_2"))) TS_ChannelAnnouncement_get_node_signature_2(uint32_t this_ptr) {
29526 LDKChannelAnnouncement this_ptr_conv;
29527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29528 this_ptr_conv.is_owned = false;
29529 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29530 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
29531 memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
29535 void __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_2"))) TS_ChannelAnnouncement_set_node_signature_2(uint32_t this_ptr, int8_tArray val) {
29536 LDKChannelAnnouncement this_ptr_conv;
29537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29538 this_ptr_conv.is_owned = false;
29539 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29540 LDKSignature val_ref;
29541 CHECK(val->arr_len == 64);
29542 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
29543 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
29546 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_1"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint32_t this_ptr) {
29547 LDKChannelAnnouncement this_ptr_conv;
29548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29549 this_ptr_conv.is_owned = false;
29550 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29551 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
29552 memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
29556 void __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_1"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint32_t this_ptr, int8_tArray val) {
29557 LDKChannelAnnouncement this_ptr_conv;
29558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29559 this_ptr_conv.is_owned = false;
29560 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29561 LDKSignature val_ref;
29562 CHECK(val->arr_len == 64);
29563 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
29564 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
29567 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_2"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint32_t this_ptr) {
29568 LDKChannelAnnouncement this_ptr_conv;
29569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29570 this_ptr_conv.is_owned = false;
29571 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29572 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
29573 memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
29577 void __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_2"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint32_t this_ptr, int8_tArray val) {
29578 LDKChannelAnnouncement this_ptr_conv;
29579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29580 this_ptr_conv.is_owned = false;
29581 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29582 LDKSignature val_ref;
29583 CHECK(val->arr_len == 64);
29584 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
29585 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
29588 uint32_t __attribute__((export_name("TS_ChannelAnnouncement_get_contents"))) TS_ChannelAnnouncement_get_contents(uint32_t this_ptr) {
29589 LDKChannelAnnouncement this_ptr_conv;
29590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29591 this_ptr_conv.is_owned = false;
29592 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29593 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
29594 uint32_t ret_ref = 0;
29595 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29596 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29597 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29598 ret_ref = (uintptr_t)ret_var.inner;
29599 if (ret_var.is_owned) {
29605 void __attribute__((export_name("TS_ChannelAnnouncement_set_contents"))) TS_ChannelAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
29606 LDKChannelAnnouncement this_ptr_conv;
29607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29608 this_ptr_conv.is_owned = false;
29609 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29610 LDKUnsignedChannelAnnouncement val_conv;
29611 val_conv.inner = (void*)(val & (~1));
29612 val_conv.is_owned = (val & 1) || (val == 0);
29613 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29614 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
29615 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
29618 uint32_t __attribute__((export_name("TS_ChannelAnnouncement_new"))) TS_ChannelAnnouncement_new(int8_tArray node_signature_1_arg, int8_tArray node_signature_2_arg, int8_tArray bitcoin_signature_1_arg, int8_tArray bitcoin_signature_2_arg, uint32_t contents_arg) {
29619 LDKSignature node_signature_1_arg_ref;
29620 CHECK(node_signature_1_arg->arr_len == 64);
29621 memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
29622 LDKSignature node_signature_2_arg_ref;
29623 CHECK(node_signature_2_arg->arr_len == 64);
29624 memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
29625 LDKSignature bitcoin_signature_1_arg_ref;
29626 CHECK(bitcoin_signature_1_arg->arr_len == 64);
29627 memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
29628 LDKSignature bitcoin_signature_2_arg_ref;
29629 CHECK(bitcoin_signature_2_arg->arr_len == 64);
29630 memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
29631 LDKUnsignedChannelAnnouncement contents_arg_conv;
29632 contents_arg_conv.inner = (void*)(contents_arg & (~1));
29633 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
29634 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
29635 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
29636 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);
29637 uint32_t ret_ref = 0;
29638 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29639 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29640 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29641 ret_ref = (uintptr_t)ret_var.inner;
29642 if (ret_var.is_owned) {
29648 static inline uintptr_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
29649 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
29650 uint32_t ret_ref = 0;
29651 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29652 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29653 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29654 ret_ref = (uintptr_t)ret_var.inner;
29655 if (ret_var.is_owned) {
29660 uint32_t __attribute__((export_name("TS_ChannelAnnouncement_clone_ptr"))) TS_ChannelAnnouncement_clone_ptr(uint32_t arg) {
29661 LDKChannelAnnouncement arg_conv;
29662 arg_conv.inner = (void*)(arg & (~1));
29663 arg_conv.is_owned = false;
29664 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29665 uint32_t ret_val = ChannelAnnouncement_clone_ptr(&arg_conv);
29669 uint32_t __attribute__((export_name("TS_ChannelAnnouncement_clone"))) TS_ChannelAnnouncement_clone(uint32_t orig) {
29670 LDKChannelAnnouncement orig_conv;
29671 orig_conv.inner = (void*)(orig & (~1));
29672 orig_conv.is_owned = false;
29673 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29674 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
29675 uint32_t ret_ref = 0;
29676 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29677 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29678 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29679 ret_ref = (uintptr_t)ret_var.inner;
29680 if (ret_var.is_owned) {
29686 void __attribute__((export_name("TS_UnsignedChannelUpdate_free"))) TS_UnsignedChannelUpdate_free(uint32_t this_obj) {
29687 LDKUnsignedChannelUpdate this_obj_conv;
29688 this_obj_conv.inner = (void*)(this_obj & (~1));
29689 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29690 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29691 UnsignedChannelUpdate_free(this_obj_conv);
29694 int8_tArray __attribute__((export_name("TS_UnsignedChannelUpdate_get_chain_hash"))) TS_UnsignedChannelUpdate_get_chain_hash(uint32_t this_ptr) {
29695 LDKUnsignedChannelUpdate this_ptr_conv;
29696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29697 this_ptr_conv.is_owned = false;
29698 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29699 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29700 memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
29704 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_chain_hash"))) TS_UnsignedChannelUpdate_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
29705 LDKUnsignedChannelUpdate this_ptr_conv;
29706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29707 this_ptr_conv.is_owned = false;
29708 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29709 LDKThirtyTwoBytes val_ref;
29710 CHECK(val->arr_len == 32);
29711 memcpy(val_ref.data, val->elems, 32); FREE(val);
29712 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
29715 int64_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_short_channel_id"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint32_t this_ptr) {
29716 LDKUnsignedChannelUpdate this_ptr_conv;
29717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29718 this_ptr_conv.is_owned = false;
29719 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29720 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
29724 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_short_channel_id"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint32_t this_ptr, int64_t val) {
29725 LDKUnsignedChannelUpdate this_ptr_conv;
29726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29727 this_ptr_conv.is_owned = false;
29728 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29729 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
29732 int32_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_timestamp"))) TS_UnsignedChannelUpdate_get_timestamp(uint32_t this_ptr) {
29733 LDKUnsignedChannelUpdate this_ptr_conv;
29734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29735 this_ptr_conv.is_owned = false;
29736 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29737 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
29741 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_timestamp"))) TS_UnsignedChannelUpdate_set_timestamp(uint32_t this_ptr, int32_t val) {
29742 LDKUnsignedChannelUpdate this_ptr_conv;
29743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29744 this_ptr_conv.is_owned = false;
29745 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29746 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
29749 int8_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_flags"))) TS_UnsignedChannelUpdate_get_flags(uint32_t this_ptr) {
29750 LDKUnsignedChannelUpdate this_ptr_conv;
29751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29752 this_ptr_conv.is_owned = false;
29753 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29754 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
29758 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_flags"))) TS_UnsignedChannelUpdate_set_flags(uint32_t this_ptr, int8_t val) {
29759 LDKUnsignedChannelUpdate this_ptr_conv;
29760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29761 this_ptr_conv.is_owned = false;
29762 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29763 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
29766 int16_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint32_t this_ptr) {
29767 LDKUnsignedChannelUpdate this_ptr_conv;
29768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29769 this_ptr_conv.is_owned = false;
29770 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29771 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
29775 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
29776 LDKUnsignedChannelUpdate this_ptr_conv;
29777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29778 this_ptr_conv.is_owned = false;
29779 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29780 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
29783 int64_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint32_t this_ptr) {
29784 LDKUnsignedChannelUpdate this_ptr_conv;
29785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29786 this_ptr_conv.is_owned = false;
29787 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29788 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
29792 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
29793 LDKUnsignedChannelUpdate 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 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
29800 int32_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_base_msat"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint32_t this_ptr) {
29801 LDKUnsignedChannelUpdate this_ptr_conv;
29802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29803 this_ptr_conv.is_owned = false;
29804 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29805 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
29809 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_base_msat"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
29810 LDKUnsignedChannelUpdate this_ptr_conv;
29811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29812 this_ptr_conv.is_owned = false;
29813 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29814 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
29817 int32_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint32_t this_ptr) {
29818 LDKUnsignedChannelUpdate this_ptr_conv;
29819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29820 this_ptr_conv.is_owned = false;
29821 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29822 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
29826 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
29827 LDKUnsignedChannelUpdate this_ptr_conv;
29828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29829 this_ptr_conv.is_owned = false;
29830 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29831 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
29834 static inline uintptr_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
29835 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
29836 uint32_t ret_ref = 0;
29837 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29838 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29839 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29840 ret_ref = (uintptr_t)ret_var.inner;
29841 if (ret_var.is_owned) {
29846 uint32_t __attribute__((export_name("TS_UnsignedChannelUpdate_clone_ptr"))) TS_UnsignedChannelUpdate_clone_ptr(uint32_t arg) {
29847 LDKUnsignedChannelUpdate arg_conv;
29848 arg_conv.inner = (void*)(arg & (~1));
29849 arg_conv.is_owned = false;
29850 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29851 uint32_t ret_val = UnsignedChannelUpdate_clone_ptr(&arg_conv);
29855 uint32_t __attribute__((export_name("TS_UnsignedChannelUpdate_clone"))) TS_UnsignedChannelUpdate_clone(uint32_t orig) {
29856 LDKUnsignedChannelUpdate orig_conv;
29857 orig_conv.inner = (void*)(orig & (~1));
29858 orig_conv.is_owned = false;
29859 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29860 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
29861 uint32_t ret_ref = 0;
29862 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29863 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29864 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29865 ret_ref = (uintptr_t)ret_var.inner;
29866 if (ret_var.is_owned) {
29872 void __attribute__((export_name("TS_ChannelUpdate_free"))) TS_ChannelUpdate_free(uint32_t this_obj) {
29873 LDKChannelUpdate this_obj_conv;
29874 this_obj_conv.inner = (void*)(this_obj & (~1));
29875 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29876 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29877 ChannelUpdate_free(this_obj_conv);
29880 int8_tArray __attribute__((export_name("TS_ChannelUpdate_get_signature"))) TS_ChannelUpdate_get_signature(uint32_t this_ptr) {
29881 LDKChannelUpdate this_ptr_conv;
29882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29883 this_ptr_conv.is_owned = false;
29884 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29885 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
29886 memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
29890 void __attribute__((export_name("TS_ChannelUpdate_set_signature"))) TS_ChannelUpdate_set_signature(uint32_t this_ptr, int8_tArray val) {
29891 LDKChannelUpdate this_ptr_conv;
29892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29893 this_ptr_conv.is_owned = false;
29894 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29895 LDKSignature val_ref;
29896 CHECK(val->arr_len == 64);
29897 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
29898 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
29901 uint32_t __attribute__((export_name("TS_ChannelUpdate_get_contents"))) TS_ChannelUpdate_get_contents(uint32_t this_ptr) {
29902 LDKChannelUpdate this_ptr_conv;
29903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29904 this_ptr_conv.is_owned = false;
29905 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29906 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
29907 uint32_t ret_ref = 0;
29908 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29909 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29910 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29911 ret_ref = (uintptr_t)ret_var.inner;
29912 if (ret_var.is_owned) {
29918 void __attribute__((export_name("TS_ChannelUpdate_set_contents"))) TS_ChannelUpdate_set_contents(uint32_t this_ptr, uint32_t val) {
29919 LDKChannelUpdate this_ptr_conv;
29920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29921 this_ptr_conv.is_owned = false;
29922 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29923 LDKUnsignedChannelUpdate val_conv;
29924 val_conv.inner = (void*)(val & (~1));
29925 val_conv.is_owned = (val & 1) || (val == 0);
29926 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29927 val_conv = UnsignedChannelUpdate_clone(&val_conv);
29928 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
29931 uint32_t __attribute__((export_name("TS_ChannelUpdate_new"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint32_t contents_arg) {
29932 LDKSignature signature_arg_ref;
29933 CHECK(signature_arg->arr_len == 64);
29934 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
29935 LDKUnsignedChannelUpdate contents_arg_conv;
29936 contents_arg_conv.inner = (void*)(contents_arg & (~1));
29937 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
29938 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
29939 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
29940 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
29941 uint32_t ret_ref = 0;
29942 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29943 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29944 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29945 ret_ref = (uintptr_t)ret_var.inner;
29946 if (ret_var.is_owned) {
29952 static inline uintptr_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
29953 LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
29954 uint32_t ret_ref = 0;
29955 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29956 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29957 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29958 ret_ref = (uintptr_t)ret_var.inner;
29959 if (ret_var.is_owned) {
29964 uint32_t __attribute__((export_name("TS_ChannelUpdate_clone_ptr"))) TS_ChannelUpdate_clone_ptr(uint32_t arg) {
29965 LDKChannelUpdate arg_conv;
29966 arg_conv.inner = (void*)(arg & (~1));
29967 arg_conv.is_owned = false;
29968 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29969 uint32_t ret_val = ChannelUpdate_clone_ptr(&arg_conv);
29973 uint32_t __attribute__((export_name("TS_ChannelUpdate_clone"))) TS_ChannelUpdate_clone(uint32_t orig) {
29974 LDKChannelUpdate orig_conv;
29975 orig_conv.inner = (void*)(orig & (~1));
29976 orig_conv.is_owned = false;
29977 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29978 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
29979 uint32_t ret_ref = 0;
29980 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29981 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29982 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29983 ret_ref = (uintptr_t)ret_var.inner;
29984 if (ret_var.is_owned) {
29990 void __attribute__((export_name("TS_QueryChannelRange_free"))) TS_QueryChannelRange_free(uint32_t this_obj) {
29991 LDKQueryChannelRange this_obj_conv;
29992 this_obj_conv.inner = (void*)(this_obj & (~1));
29993 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29994 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29995 QueryChannelRange_free(this_obj_conv);
29998 int8_tArray __attribute__((export_name("TS_QueryChannelRange_get_chain_hash"))) TS_QueryChannelRange_get_chain_hash(uint32_t this_ptr) {
29999 LDKQueryChannelRange this_ptr_conv;
30000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30001 this_ptr_conv.is_owned = false;
30002 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30003 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30004 memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
30008 void __attribute__((export_name("TS_QueryChannelRange_set_chain_hash"))) TS_QueryChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
30009 LDKQueryChannelRange this_ptr_conv;
30010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30011 this_ptr_conv.is_owned = false;
30012 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30013 LDKThirtyTwoBytes val_ref;
30014 CHECK(val->arr_len == 32);
30015 memcpy(val_ref.data, val->elems, 32); FREE(val);
30016 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
30019 int32_t __attribute__((export_name("TS_QueryChannelRange_get_first_blocknum"))) TS_QueryChannelRange_get_first_blocknum(uint32_t this_ptr) {
30020 LDKQueryChannelRange this_ptr_conv;
30021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30022 this_ptr_conv.is_owned = false;
30023 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30024 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
30028 void __attribute__((export_name("TS_QueryChannelRange_set_first_blocknum"))) TS_QueryChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
30029 LDKQueryChannelRange this_ptr_conv;
30030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30031 this_ptr_conv.is_owned = false;
30032 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30033 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
30036 int32_t __attribute__((export_name("TS_QueryChannelRange_get_number_of_blocks"))) TS_QueryChannelRange_get_number_of_blocks(uint32_t this_ptr) {
30037 LDKQueryChannelRange this_ptr_conv;
30038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30039 this_ptr_conv.is_owned = false;
30040 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30041 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
30045 void __attribute__((export_name("TS_QueryChannelRange_set_number_of_blocks"))) TS_QueryChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
30046 LDKQueryChannelRange this_ptr_conv;
30047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30048 this_ptr_conv.is_owned = false;
30049 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30050 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
30053 uint32_t __attribute__((export_name("TS_QueryChannelRange_new"))) TS_QueryChannelRange_new(int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
30054 LDKThirtyTwoBytes chain_hash_arg_ref;
30055 CHECK(chain_hash_arg->arr_len == 32);
30056 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
30057 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
30058 uint32_t ret_ref = 0;
30059 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30060 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30061 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30062 ret_ref = (uintptr_t)ret_var.inner;
30063 if (ret_var.is_owned) {
30069 static inline uintptr_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
30070 LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
30071 uint32_t ret_ref = 0;
30072 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30073 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30074 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30075 ret_ref = (uintptr_t)ret_var.inner;
30076 if (ret_var.is_owned) {
30081 uint32_t __attribute__((export_name("TS_QueryChannelRange_clone_ptr"))) TS_QueryChannelRange_clone_ptr(uint32_t arg) {
30082 LDKQueryChannelRange arg_conv;
30083 arg_conv.inner = (void*)(arg & (~1));
30084 arg_conv.is_owned = false;
30085 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30086 uint32_t ret_val = QueryChannelRange_clone_ptr(&arg_conv);
30090 uint32_t __attribute__((export_name("TS_QueryChannelRange_clone"))) TS_QueryChannelRange_clone(uint32_t orig) {
30091 LDKQueryChannelRange orig_conv;
30092 orig_conv.inner = (void*)(orig & (~1));
30093 orig_conv.is_owned = false;
30094 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30095 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
30096 uint32_t ret_ref = 0;
30097 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30098 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30099 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30100 ret_ref = (uintptr_t)ret_var.inner;
30101 if (ret_var.is_owned) {
30107 void __attribute__((export_name("TS_ReplyChannelRange_free"))) TS_ReplyChannelRange_free(uint32_t this_obj) {
30108 LDKReplyChannelRange this_obj_conv;
30109 this_obj_conv.inner = (void*)(this_obj & (~1));
30110 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30111 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30112 ReplyChannelRange_free(this_obj_conv);
30115 int8_tArray __attribute__((export_name("TS_ReplyChannelRange_get_chain_hash"))) TS_ReplyChannelRange_get_chain_hash(uint32_t this_ptr) {
30116 LDKReplyChannelRange this_ptr_conv;
30117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30118 this_ptr_conv.is_owned = false;
30119 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30120 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30121 memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
30125 void __attribute__((export_name("TS_ReplyChannelRange_set_chain_hash"))) TS_ReplyChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
30126 LDKReplyChannelRange this_ptr_conv;
30127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30128 this_ptr_conv.is_owned = false;
30129 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30130 LDKThirtyTwoBytes val_ref;
30131 CHECK(val->arr_len == 32);
30132 memcpy(val_ref.data, val->elems, 32); FREE(val);
30133 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
30136 int32_t __attribute__((export_name("TS_ReplyChannelRange_get_first_blocknum"))) TS_ReplyChannelRange_get_first_blocknum(uint32_t this_ptr) {
30137 LDKReplyChannelRange this_ptr_conv;
30138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30139 this_ptr_conv.is_owned = false;
30140 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30141 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
30145 void __attribute__((export_name("TS_ReplyChannelRange_set_first_blocknum"))) TS_ReplyChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
30146 LDKReplyChannelRange this_ptr_conv;
30147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30148 this_ptr_conv.is_owned = false;
30149 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30150 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
30153 int32_t __attribute__((export_name("TS_ReplyChannelRange_get_number_of_blocks"))) TS_ReplyChannelRange_get_number_of_blocks(uint32_t this_ptr) {
30154 LDKReplyChannelRange this_ptr_conv;
30155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30156 this_ptr_conv.is_owned = false;
30157 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30158 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
30162 void __attribute__((export_name("TS_ReplyChannelRange_set_number_of_blocks"))) TS_ReplyChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
30163 LDKReplyChannelRange this_ptr_conv;
30164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30165 this_ptr_conv.is_owned = false;
30166 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30167 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
30170 jboolean __attribute__((export_name("TS_ReplyChannelRange_get_sync_complete"))) TS_ReplyChannelRange_get_sync_complete(uint32_t this_ptr) {
30171 LDKReplyChannelRange this_ptr_conv;
30172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30173 this_ptr_conv.is_owned = false;
30174 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30175 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
30179 void __attribute__((export_name("TS_ReplyChannelRange_set_sync_complete"))) TS_ReplyChannelRange_set_sync_complete(uint32_t this_ptr, jboolean val) {
30180 LDKReplyChannelRange this_ptr_conv;
30181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30182 this_ptr_conv.is_owned = false;
30183 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30184 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
30187 void __attribute__((export_name("TS_ReplyChannelRange_set_short_channel_ids"))) TS_ReplyChannelRange_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
30188 LDKReplyChannelRange this_ptr_conv;
30189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30190 this_ptr_conv.is_owned = false;
30191 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30192 LDKCVec_u64Z val_constr;
30193 val_constr.datalen = val->arr_len;
30194 if (val_constr.datalen > 0)
30195 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
30197 val_constr.data = NULL;
30198 int64_t* val_vals = val->elems /* XXX val leaks */;
30199 for (size_t i = 0; i < val_constr.datalen; i++) {
30200 int64_t val_conv_8 = val_vals[i];
30201 val_constr.data[i] = val_conv_8;
30203 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
30206 uint32_t __attribute__((export_name("TS_ReplyChannelRange_new"))) TS_ReplyChannelRange_new(int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg, jboolean sync_complete_arg, int64_tArray short_channel_ids_arg) {
30207 LDKThirtyTwoBytes chain_hash_arg_ref;
30208 CHECK(chain_hash_arg->arr_len == 32);
30209 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
30210 LDKCVec_u64Z short_channel_ids_arg_constr;
30211 short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
30212 if (short_channel_ids_arg_constr.datalen > 0)
30213 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
30215 short_channel_ids_arg_constr.data = NULL;
30216 int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems /* XXX short_channel_ids_arg leaks */;
30217 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
30218 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
30219 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
30221 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
30222 uint32_t ret_ref = 0;
30223 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30224 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30225 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30226 ret_ref = (uintptr_t)ret_var.inner;
30227 if (ret_var.is_owned) {
30233 static inline uintptr_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
30234 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
30235 uint32_t ret_ref = 0;
30236 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30237 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30238 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30239 ret_ref = (uintptr_t)ret_var.inner;
30240 if (ret_var.is_owned) {
30245 uint32_t __attribute__((export_name("TS_ReplyChannelRange_clone_ptr"))) TS_ReplyChannelRange_clone_ptr(uint32_t arg) {
30246 LDKReplyChannelRange arg_conv;
30247 arg_conv.inner = (void*)(arg & (~1));
30248 arg_conv.is_owned = false;
30249 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30250 uint32_t ret_val = ReplyChannelRange_clone_ptr(&arg_conv);
30254 uint32_t __attribute__((export_name("TS_ReplyChannelRange_clone"))) TS_ReplyChannelRange_clone(uint32_t orig) {
30255 LDKReplyChannelRange orig_conv;
30256 orig_conv.inner = (void*)(orig & (~1));
30257 orig_conv.is_owned = false;
30258 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30259 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
30260 uint32_t ret_ref = 0;
30261 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30262 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30263 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30264 ret_ref = (uintptr_t)ret_var.inner;
30265 if (ret_var.is_owned) {
30271 void __attribute__((export_name("TS_QueryShortChannelIds_free"))) TS_QueryShortChannelIds_free(uint32_t this_obj) {
30272 LDKQueryShortChannelIds this_obj_conv;
30273 this_obj_conv.inner = (void*)(this_obj & (~1));
30274 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30275 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30276 QueryShortChannelIds_free(this_obj_conv);
30279 int8_tArray __attribute__((export_name("TS_QueryShortChannelIds_get_chain_hash"))) TS_QueryShortChannelIds_get_chain_hash(uint32_t this_ptr) {
30280 LDKQueryShortChannelIds this_ptr_conv;
30281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30282 this_ptr_conv.is_owned = false;
30283 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30284 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30285 memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
30289 void __attribute__((export_name("TS_QueryShortChannelIds_set_chain_hash"))) TS_QueryShortChannelIds_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
30290 LDKQueryShortChannelIds this_ptr_conv;
30291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30292 this_ptr_conv.is_owned = false;
30293 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30294 LDKThirtyTwoBytes val_ref;
30295 CHECK(val->arr_len == 32);
30296 memcpy(val_ref.data, val->elems, 32); FREE(val);
30297 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
30300 void __attribute__((export_name("TS_QueryShortChannelIds_set_short_channel_ids"))) TS_QueryShortChannelIds_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
30301 LDKQueryShortChannelIds this_ptr_conv;
30302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30303 this_ptr_conv.is_owned = false;
30304 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30305 LDKCVec_u64Z val_constr;
30306 val_constr.datalen = val->arr_len;
30307 if (val_constr.datalen > 0)
30308 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
30310 val_constr.data = NULL;
30311 int64_t* val_vals = val->elems /* XXX val leaks */;
30312 for (size_t i = 0; i < val_constr.datalen; i++) {
30313 int64_t val_conv_8 = val_vals[i];
30314 val_constr.data[i] = val_conv_8;
30316 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
30319 uint32_t __attribute__((export_name("TS_QueryShortChannelIds_new"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
30320 LDKThirtyTwoBytes chain_hash_arg_ref;
30321 CHECK(chain_hash_arg->arr_len == 32);
30322 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
30323 LDKCVec_u64Z short_channel_ids_arg_constr;
30324 short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
30325 if (short_channel_ids_arg_constr.datalen > 0)
30326 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
30328 short_channel_ids_arg_constr.data = NULL;
30329 int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems /* XXX short_channel_ids_arg leaks */;
30330 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
30331 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
30332 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
30334 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
30335 uint32_t ret_ref = 0;
30336 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30337 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30338 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30339 ret_ref = (uintptr_t)ret_var.inner;
30340 if (ret_var.is_owned) {
30346 static inline uintptr_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
30347 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
30348 uint32_t ret_ref = 0;
30349 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30350 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30351 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30352 ret_ref = (uintptr_t)ret_var.inner;
30353 if (ret_var.is_owned) {
30358 uint32_t __attribute__((export_name("TS_QueryShortChannelIds_clone_ptr"))) TS_QueryShortChannelIds_clone_ptr(uint32_t arg) {
30359 LDKQueryShortChannelIds arg_conv;
30360 arg_conv.inner = (void*)(arg & (~1));
30361 arg_conv.is_owned = false;
30362 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30363 uint32_t ret_val = QueryShortChannelIds_clone_ptr(&arg_conv);
30367 uint32_t __attribute__((export_name("TS_QueryShortChannelIds_clone"))) TS_QueryShortChannelIds_clone(uint32_t orig) {
30368 LDKQueryShortChannelIds orig_conv;
30369 orig_conv.inner = (void*)(orig & (~1));
30370 orig_conv.is_owned = false;
30371 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30372 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
30373 uint32_t ret_ref = 0;
30374 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30375 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30376 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30377 ret_ref = (uintptr_t)ret_var.inner;
30378 if (ret_var.is_owned) {
30384 void __attribute__((export_name("TS_ReplyShortChannelIdsEnd_free"))) TS_ReplyShortChannelIdsEnd_free(uint32_t this_obj) {
30385 LDKReplyShortChannelIdsEnd this_obj_conv;
30386 this_obj_conv.inner = (void*)(this_obj & (~1));
30387 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30388 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30389 ReplyShortChannelIdsEnd_free(this_obj_conv);
30392 int8_tArray __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_chain_hash"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint32_t this_ptr) {
30393 LDKReplyShortChannelIdsEnd this_ptr_conv;
30394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30395 this_ptr_conv.is_owned = false;
30396 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30397 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30398 memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
30402 void __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_chain_hash"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
30403 LDKReplyShortChannelIdsEnd this_ptr_conv;
30404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30405 this_ptr_conv.is_owned = false;
30406 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30407 LDKThirtyTwoBytes val_ref;
30408 CHECK(val->arr_len == 32);
30409 memcpy(val_ref.data, val->elems, 32); FREE(val);
30410 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
30413 jboolean __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_full_information"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint32_t this_ptr) {
30414 LDKReplyShortChannelIdsEnd this_ptr_conv;
30415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30416 this_ptr_conv.is_owned = false;
30417 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30418 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
30422 void __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_full_information"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint32_t this_ptr, jboolean val) {
30423 LDKReplyShortChannelIdsEnd this_ptr_conv;
30424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30425 this_ptr_conv.is_owned = false;
30426 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30427 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
30430 uint32_t __attribute__((export_name("TS_ReplyShortChannelIdsEnd_new"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
30431 LDKThirtyTwoBytes chain_hash_arg_ref;
30432 CHECK(chain_hash_arg->arr_len == 32);
30433 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
30434 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
30435 uint32_t ret_ref = 0;
30436 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30437 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30438 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30439 ret_ref = (uintptr_t)ret_var.inner;
30440 if (ret_var.is_owned) {
30446 static inline uintptr_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
30447 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
30448 uint32_t ret_ref = 0;
30449 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30450 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30451 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30452 ret_ref = (uintptr_t)ret_var.inner;
30453 if (ret_var.is_owned) {
30458 uint32_t __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone_ptr"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint32_t arg) {
30459 LDKReplyShortChannelIdsEnd arg_conv;
30460 arg_conv.inner = (void*)(arg & (~1));
30461 arg_conv.is_owned = false;
30462 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30463 uint32_t ret_val = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
30467 uint32_t __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone"))) TS_ReplyShortChannelIdsEnd_clone(uint32_t orig) {
30468 LDKReplyShortChannelIdsEnd orig_conv;
30469 orig_conv.inner = (void*)(orig & (~1));
30470 orig_conv.is_owned = false;
30471 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30472 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
30473 uint32_t ret_ref = 0;
30474 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30475 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30476 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30477 ret_ref = (uintptr_t)ret_var.inner;
30478 if (ret_var.is_owned) {
30484 void __attribute__((export_name("TS_GossipTimestampFilter_free"))) TS_GossipTimestampFilter_free(uint32_t this_obj) {
30485 LDKGossipTimestampFilter this_obj_conv;
30486 this_obj_conv.inner = (void*)(this_obj & (~1));
30487 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30488 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30489 GossipTimestampFilter_free(this_obj_conv);
30492 int8_tArray __attribute__((export_name("TS_GossipTimestampFilter_get_chain_hash"))) TS_GossipTimestampFilter_get_chain_hash(uint32_t this_ptr) {
30493 LDKGossipTimestampFilter this_ptr_conv;
30494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30495 this_ptr_conv.is_owned = false;
30496 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30497 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30498 memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
30502 void __attribute__((export_name("TS_GossipTimestampFilter_set_chain_hash"))) TS_GossipTimestampFilter_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
30503 LDKGossipTimestampFilter this_ptr_conv;
30504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30505 this_ptr_conv.is_owned = false;
30506 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30507 LDKThirtyTwoBytes val_ref;
30508 CHECK(val->arr_len == 32);
30509 memcpy(val_ref.data, val->elems, 32); FREE(val);
30510 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
30513 int32_t __attribute__((export_name("TS_GossipTimestampFilter_get_first_timestamp"))) TS_GossipTimestampFilter_get_first_timestamp(uint32_t this_ptr) {
30514 LDKGossipTimestampFilter this_ptr_conv;
30515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30516 this_ptr_conv.is_owned = false;
30517 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30518 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
30522 void __attribute__((export_name("TS_GossipTimestampFilter_set_first_timestamp"))) TS_GossipTimestampFilter_set_first_timestamp(uint32_t this_ptr, int32_t val) {
30523 LDKGossipTimestampFilter this_ptr_conv;
30524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30525 this_ptr_conv.is_owned = false;
30526 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30527 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
30530 int32_t __attribute__((export_name("TS_GossipTimestampFilter_get_timestamp_range"))) TS_GossipTimestampFilter_get_timestamp_range(uint32_t this_ptr) {
30531 LDKGossipTimestampFilter this_ptr_conv;
30532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30533 this_ptr_conv.is_owned = false;
30534 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30535 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
30539 void __attribute__((export_name("TS_GossipTimestampFilter_set_timestamp_range"))) TS_GossipTimestampFilter_set_timestamp_range(uint32_t this_ptr, int32_t val) {
30540 LDKGossipTimestampFilter this_ptr_conv;
30541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30542 this_ptr_conv.is_owned = false;
30543 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30544 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
30547 uint32_t __attribute__((export_name("TS_GossipTimestampFilter_new"))) TS_GossipTimestampFilter_new(int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
30548 LDKThirtyTwoBytes chain_hash_arg_ref;
30549 CHECK(chain_hash_arg->arr_len == 32);
30550 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
30551 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
30552 uint32_t ret_ref = 0;
30553 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30554 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30555 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30556 ret_ref = (uintptr_t)ret_var.inner;
30557 if (ret_var.is_owned) {
30563 static inline uintptr_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
30564 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
30565 uint32_t ret_ref = 0;
30566 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30567 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30568 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30569 ret_ref = (uintptr_t)ret_var.inner;
30570 if (ret_var.is_owned) {
30575 uint32_t __attribute__((export_name("TS_GossipTimestampFilter_clone_ptr"))) TS_GossipTimestampFilter_clone_ptr(uint32_t arg) {
30576 LDKGossipTimestampFilter arg_conv;
30577 arg_conv.inner = (void*)(arg & (~1));
30578 arg_conv.is_owned = false;
30579 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30580 uint32_t ret_val = GossipTimestampFilter_clone_ptr(&arg_conv);
30584 uint32_t __attribute__((export_name("TS_GossipTimestampFilter_clone"))) TS_GossipTimestampFilter_clone(uint32_t orig) {
30585 LDKGossipTimestampFilter orig_conv;
30586 orig_conv.inner = (void*)(orig & (~1));
30587 orig_conv.is_owned = false;
30588 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30589 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
30590 uint32_t ret_ref = 0;
30591 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30592 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30593 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30594 ret_ref = (uintptr_t)ret_var.inner;
30595 if (ret_var.is_owned) {
30601 void __attribute__((export_name("TS_ErrorAction_free"))) TS_ErrorAction_free(uint32_t this_ptr) {
30602 if ((this_ptr & 1) != 0) return;
30603 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
30604 CHECK_ACCESS(this_ptr_ptr);
30605 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
30606 FREE((void*)this_ptr);
30607 ErrorAction_free(this_ptr_conv);
30610 static inline uintptr_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
30611 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
30612 *ret_copy = ErrorAction_clone(arg);
30613 uint32_t ret_ref = (uintptr_t)ret_copy;
30616 uint32_t __attribute__((export_name("TS_ErrorAction_clone_ptr"))) TS_ErrorAction_clone_ptr(uint32_t arg) {
30617 LDKErrorAction* arg_conv = (LDKErrorAction*)arg;
30618 uint32_t ret_val = ErrorAction_clone_ptr(arg_conv);
30622 uint32_t __attribute__((export_name("TS_ErrorAction_clone"))) TS_ErrorAction_clone(uint32_t orig) {
30623 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
30624 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
30625 *ret_copy = ErrorAction_clone(orig_conv);
30626 uint32_t ret_ref = (uintptr_t)ret_copy;
30630 uint32_t __attribute__((export_name("TS_ErrorAction_disconnect_peer"))) TS_ErrorAction_disconnect_peer(uint32_t msg) {
30631 LDKErrorMessage msg_conv;
30632 msg_conv.inner = (void*)(msg & (~1));
30633 msg_conv.is_owned = (msg & 1) || (msg == 0);
30634 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
30635 msg_conv = ErrorMessage_clone(&msg_conv);
30636 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
30637 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
30638 uint32_t ret_ref = (uintptr_t)ret_copy;
30642 uint32_t __attribute__((export_name("TS_ErrorAction_ignore_error"))) TS_ErrorAction_ignore_error() {
30643 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
30644 *ret_copy = ErrorAction_ignore_error();
30645 uint32_t ret_ref = (uintptr_t)ret_copy;
30649 uint32_t __attribute__((export_name("TS_ErrorAction_ignore_and_log"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
30650 LDKLevel a_conv = LDKLevel_from_js(a);
30651 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
30652 *ret_copy = ErrorAction_ignore_and_log(a_conv);
30653 uint32_t ret_ref = (uintptr_t)ret_copy;
30657 uint32_t __attribute__((export_name("TS_ErrorAction_ignore_duplicate_gossip"))) TS_ErrorAction_ignore_duplicate_gossip() {
30658 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
30659 *ret_copy = ErrorAction_ignore_duplicate_gossip();
30660 uint32_t ret_ref = (uintptr_t)ret_copy;
30664 uint32_t __attribute__((export_name("TS_ErrorAction_send_error_message"))) TS_ErrorAction_send_error_message(uint32_t msg) {
30665 LDKErrorMessage msg_conv;
30666 msg_conv.inner = (void*)(msg & (~1));
30667 msg_conv.is_owned = (msg & 1) || (msg == 0);
30668 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
30669 msg_conv = ErrorMessage_clone(&msg_conv);
30670 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
30671 *ret_copy = ErrorAction_send_error_message(msg_conv);
30672 uint32_t ret_ref = (uintptr_t)ret_copy;
30676 uint32_t __attribute__((export_name("TS_ErrorAction_send_warning_message"))) TS_ErrorAction_send_warning_message(uint32_t msg, uint32_t log_level) {
30677 LDKWarningMessage msg_conv;
30678 msg_conv.inner = (void*)(msg & (~1));
30679 msg_conv.is_owned = (msg & 1) || (msg == 0);
30680 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
30681 msg_conv = WarningMessage_clone(&msg_conv);
30682 LDKLevel log_level_conv = LDKLevel_from_js(log_level);
30683 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
30684 *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
30685 uint32_t ret_ref = (uintptr_t)ret_copy;
30689 void __attribute__((export_name("TS_LightningError_free"))) TS_LightningError_free(uint32_t this_obj) {
30690 LDKLightningError this_obj_conv;
30691 this_obj_conv.inner = (void*)(this_obj & (~1));
30692 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30693 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30694 LightningError_free(this_obj_conv);
30697 jstring __attribute__((export_name("TS_LightningError_get_err"))) TS_LightningError_get_err(uint32_t this_ptr) {
30698 LDKLightningError this_ptr_conv;
30699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30700 this_ptr_conv.is_owned = false;
30701 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30702 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
30703 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
30708 void __attribute__((export_name("TS_LightningError_set_err"))) TS_LightningError_set_err(uint32_t this_ptr, jstring val) {
30709 LDKLightningError this_ptr_conv;
30710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30711 this_ptr_conv.is_owned = false;
30712 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30713 LDKStr val_conv = str_ref_to_owned_c(val);
30714 LightningError_set_err(&this_ptr_conv, val_conv);
30717 uint32_t __attribute__((export_name("TS_LightningError_get_action"))) TS_LightningError_get_action(uint32_t this_ptr) {
30718 LDKLightningError this_ptr_conv;
30719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30720 this_ptr_conv.is_owned = false;
30721 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30722 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
30723 *ret_copy = LightningError_get_action(&this_ptr_conv);
30724 uint32_t ret_ref = (uintptr_t)ret_copy;
30728 void __attribute__((export_name("TS_LightningError_set_action"))) TS_LightningError_set_action(uint32_t this_ptr, uint32_t val) {
30729 LDKLightningError this_ptr_conv;
30730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30731 this_ptr_conv.is_owned = false;
30732 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30733 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
30734 CHECK_ACCESS(val_ptr);
30735 LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
30736 val_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)val) & ~1));
30737 LightningError_set_action(&this_ptr_conv, val_conv);
30740 uint32_t __attribute__((export_name("TS_LightningError_new"))) TS_LightningError_new(jstring err_arg, uint32_t action_arg) {
30741 LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
30742 void* action_arg_ptr = (void*)(((uintptr_t)action_arg) & ~1);
30743 CHECK_ACCESS(action_arg_ptr);
30744 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
30745 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)action_arg) & ~1));
30746 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
30747 uint32_t ret_ref = 0;
30748 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30749 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30750 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30751 ret_ref = (uintptr_t)ret_var.inner;
30752 if (ret_var.is_owned) {
30758 static inline uintptr_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
30759 LDKLightningError ret_var = LightningError_clone(arg);
30760 uint32_t ret_ref = 0;
30761 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30762 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30763 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30764 ret_ref = (uintptr_t)ret_var.inner;
30765 if (ret_var.is_owned) {
30770 uint32_t __attribute__((export_name("TS_LightningError_clone_ptr"))) TS_LightningError_clone_ptr(uint32_t arg) {
30771 LDKLightningError arg_conv;
30772 arg_conv.inner = (void*)(arg & (~1));
30773 arg_conv.is_owned = false;
30774 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30775 uint32_t ret_val = LightningError_clone_ptr(&arg_conv);
30779 uint32_t __attribute__((export_name("TS_LightningError_clone"))) TS_LightningError_clone(uint32_t orig) {
30780 LDKLightningError orig_conv;
30781 orig_conv.inner = (void*)(orig & (~1));
30782 orig_conv.is_owned = false;
30783 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30784 LDKLightningError ret_var = LightningError_clone(&orig_conv);
30785 uint32_t ret_ref = 0;
30786 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30787 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30788 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30789 ret_ref = (uintptr_t)ret_var.inner;
30790 if (ret_var.is_owned) {
30796 void __attribute__((export_name("TS_CommitmentUpdate_free"))) TS_CommitmentUpdate_free(uint32_t this_obj) {
30797 LDKCommitmentUpdate this_obj_conv;
30798 this_obj_conv.inner = (void*)(this_obj & (~1));
30799 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30800 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30801 CommitmentUpdate_free(this_obj_conv);
30804 uint32_tArray __attribute__((export_name("TS_CommitmentUpdate_get_update_add_htlcs"))) TS_CommitmentUpdate_get_update_add_htlcs(uint32_t this_ptr) {
30805 LDKCommitmentUpdate this_ptr_conv;
30806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30807 this_ptr_conv.is_owned = false;
30808 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30809 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
30810 uint32_tArray ret_arr = NULL;
30811 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
30812 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
30813 for (size_t p = 0; p < ret_var.datalen; p++) {
30814 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
30815 uint32_t ret_conv_15_ref = 0;
30816 CHECK((((uintptr_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30817 CHECK((((uintptr_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30818 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
30819 ret_conv_15_ref = (uintptr_t)ret_conv_15_var.inner;
30820 if (ret_conv_15_var.is_owned) {
30821 ret_conv_15_ref |= 1;
30823 ret_arr_ptr[p] = ret_conv_15_ref;
30826 FREE(ret_var.data);
30830 void __attribute__((export_name("TS_CommitmentUpdate_set_update_add_htlcs"))) TS_CommitmentUpdate_set_update_add_htlcs(uint32_t this_ptr, uint32_tArray val) {
30831 LDKCommitmentUpdate this_ptr_conv;
30832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30833 this_ptr_conv.is_owned = false;
30834 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30835 LDKCVec_UpdateAddHTLCZ val_constr;
30836 val_constr.datalen = val->arr_len;
30837 if (val_constr.datalen > 0)
30838 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
30840 val_constr.data = NULL;
30841 uint32_t* val_vals = val->elems /* XXX val leaks */;
30842 for (size_t p = 0; p < val_constr.datalen; p++) {
30843 uint32_t val_conv_15 = val_vals[p];
30844 LDKUpdateAddHTLC val_conv_15_conv;
30845 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
30846 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
30847 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
30848 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
30849 val_constr.data[p] = val_conv_15_conv;
30851 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
30854 uint32_tArray __attribute__((export_name("TS_CommitmentUpdate_get_update_fulfill_htlcs"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint32_t this_ptr) {
30855 LDKCommitmentUpdate this_ptr_conv;
30856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30857 this_ptr_conv.is_owned = false;
30858 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30859 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
30860 uint32_tArray ret_arr = NULL;
30861 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
30862 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
30863 for (size_t t = 0; t < ret_var.datalen; t++) {
30864 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
30865 uint32_t ret_conv_19_ref = 0;
30866 CHECK((((uintptr_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30867 CHECK((((uintptr_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30868 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
30869 ret_conv_19_ref = (uintptr_t)ret_conv_19_var.inner;
30870 if (ret_conv_19_var.is_owned) {
30871 ret_conv_19_ref |= 1;
30873 ret_arr_ptr[t] = ret_conv_19_ref;
30876 FREE(ret_var.data);
30880 void __attribute__((export_name("TS_CommitmentUpdate_set_update_fulfill_htlcs"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint32_t this_ptr, uint32_tArray val) {
30881 LDKCommitmentUpdate this_ptr_conv;
30882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30883 this_ptr_conv.is_owned = false;
30884 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30885 LDKCVec_UpdateFulfillHTLCZ val_constr;
30886 val_constr.datalen = val->arr_len;
30887 if (val_constr.datalen > 0)
30888 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
30890 val_constr.data = NULL;
30891 uint32_t* val_vals = val->elems /* XXX val leaks */;
30892 for (size_t t = 0; t < val_constr.datalen; t++) {
30893 uint32_t val_conv_19 = val_vals[t];
30894 LDKUpdateFulfillHTLC val_conv_19_conv;
30895 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
30896 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
30897 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
30898 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
30899 val_constr.data[t] = val_conv_19_conv;
30901 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
30904 uint32_tArray __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_htlcs"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint32_t this_ptr) {
30905 LDKCommitmentUpdate this_ptr_conv;
30906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30907 this_ptr_conv.is_owned = false;
30908 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30909 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
30910 uint32_tArray ret_arr = NULL;
30911 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
30912 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
30913 for (size_t q = 0; q < ret_var.datalen; q++) {
30914 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
30915 uint32_t ret_conv_16_ref = 0;
30916 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30917 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30918 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
30919 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
30920 if (ret_conv_16_var.is_owned) {
30921 ret_conv_16_ref |= 1;
30923 ret_arr_ptr[q] = ret_conv_16_ref;
30926 FREE(ret_var.data);
30930 void __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_htlcs"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint32_t this_ptr, uint32_tArray val) {
30931 LDKCommitmentUpdate this_ptr_conv;
30932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30933 this_ptr_conv.is_owned = false;
30934 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30935 LDKCVec_UpdateFailHTLCZ val_constr;
30936 val_constr.datalen = val->arr_len;
30937 if (val_constr.datalen > 0)
30938 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
30940 val_constr.data = NULL;
30941 uint32_t* val_vals = val->elems /* XXX val leaks */;
30942 for (size_t q = 0; q < val_constr.datalen; q++) {
30943 uint32_t val_conv_16 = val_vals[q];
30944 LDKUpdateFailHTLC val_conv_16_conv;
30945 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
30946 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
30947 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
30948 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
30949 val_constr.data[q] = val_conv_16_conv;
30951 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
30954 uint32_tArray __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint32_t this_ptr) {
30955 LDKCommitmentUpdate this_ptr_conv;
30956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30957 this_ptr_conv.is_owned = false;
30958 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30959 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
30960 uint32_tArray ret_arr = NULL;
30961 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
30962 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
30963 for (size_t z = 0; z < ret_var.datalen; z++) {
30964 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
30965 uint32_t ret_conv_25_ref = 0;
30966 CHECK((((uintptr_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30967 CHECK((((uintptr_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30968 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
30969 ret_conv_25_ref = (uintptr_t)ret_conv_25_var.inner;
30970 if (ret_conv_25_var.is_owned) {
30971 ret_conv_25_ref |= 1;
30973 ret_arr_ptr[z] = ret_conv_25_ref;
30976 FREE(ret_var.data);
30980 void __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_set_update_fail_malformed_htlcs(uint32_t this_ptr, uint32_tArray val) {
30981 LDKCommitmentUpdate this_ptr_conv;
30982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30983 this_ptr_conv.is_owned = false;
30984 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30985 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
30986 val_constr.datalen = val->arr_len;
30987 if (val_constr.datalen > 0)
30988 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
30990 val_constr.data = NULL;
30991 uint32_t* val_vals = val->elems /* XXX val leaks */;
30992 for (size_t z = 0; z < val_constr.datalen; z++) {
30993 uint32_t val_conv_25 = val_vals[z];
30994 LDKUpdateFailMalformedHTLC val_conv_25_conv;
30995 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
30996 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
30997 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
30998 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
30999 val_constr.data[z] = val_conv_25_conv;
31001 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
31004 uint32_t __attribute__((export_name("TS_CommitmentUpdate_get_update_fee"))) TS_CommitmentUpdate_get_update_fee(uint32_t this_ptr) {
31005 LDKCommitmentUpdate this_ptr_conv;
31006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31007 this_ptr_conv.is_owned = false;
31008 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31009 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
31010 uint32_t ret_ref = 0;
31011 if ((uintptr_t)ret_var.inner > 4096) {
31012 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31013 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31014 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31015 ret_ref = (uintptr_t)ret_var.inner;
31016 if (ret_var.is_owned) {
31023 void __attribute__((export_name("TS_CommitmentUpdate_set_update_fee"))) TS_CommitmentUpdate_set_update_fee(uint32_t this_ptr, uint32_t val) {
31024 LDKCommitmentUpdate this_ptr_conv;
31025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31026 this_ptr_conv.is_owned = false;
31027 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31028 LDKUpdateFee val_conv;
31029 val_conv.inner = (void*)(val & (~1));
31030 val_conv.is_owned = (val & 1) || (val == 0);
31031 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31032 val_conv = UpdateFee_clone(&val_conv);
31033 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
31036 uint32_t __attribute__((export_name("TS_CommitmentUpdate_get_commitment_signed"))) TS_CommitmentUpdate_get_commitment_signed(uint32_t this_ptr) {
31037 LDKCommitmentUpdate this_ptr_conv;
31038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31039 this_ptr_conv.is_owned = false;
31040 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31041 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
31042 uint32_t ret_ref = 0;
31043 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31044 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31045 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31046 ret_ref = (uintptr_t)ret_var.inner;
31047 if (ret_var.is_owned) {
31053 void __attribute__((export_name("TS_CommitmentUpdate_set_commitment_signed"))) TS_CommitmentUpdate_set_commitment_signed(uint32_t this_ptr, uint32_t val) {
31054 LDKCommitmentUpdate this_ptr_conv;
31055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31056 this_ptr_conv.is_owned = false;
31057 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31058 LDKCommitmentSigned val_conv;
31059 val_conv.inner = (void*)(val & (~1));
31060 val_conv.is_owned = (val & 1) || (val == 0);
31061 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31062 val_conv = CommitmentSigned_clone(&val_conv);
31063 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
31066 uint32_t __attribute__((export_name("TS_CommitmentUpdate_new"))) TS_CommitmentUpdate_new(uint32_tArray update_add_htlcs_arg, uint32_tArray update_fulfill_htlcs_arg, uint32_tArray update_fail_htlcs_arg, uint32_tArray update_fail_malformed_htlcs_arg, uint32_t update_fee_arg, uint32_t commitment_signed_arg) {
31067 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
31068 update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
31069 if (update_add_htlcs_arg_constr.datalen > 0)
31070 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
31072 update_add_htlcs_arg_constr.data = NULL;
31073 uint32_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems /* XXX update_add_htlcs_arg leaks */;
31074 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
31075 uint32_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
31076 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
31077 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
31078 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
31079 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
31080 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
31081 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
31083 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
31084 update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
31085 if (update_fulfill_htlcs_arg_constr.datalen > 0)
31086 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
31088 update_fulfill_htlcs_arg_constr.data = NULL;
31089 uint32_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems /* XXX update_fulfill_htlcs_arg leaks */;
31090 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
31091 uint32_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
31092 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
31093 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
31094 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
31095 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
31096 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
31097 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
31099 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
31100 update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
31101 if (update_fail_htlcs_arg_constr.datalen > 0)
31102 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
31104 update_fail_htlcs_arg_constr.data = NULL;
31105 uint32_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems /* XXX update_fail_htlcs_arg leaks */;
31106 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
31107 uint32_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
31108 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
31109 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
31110 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
31111 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
31112 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
31113 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
31115 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
31116 update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
31117 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
31118 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
31120 update_fail_malformed_htlcs_arg_constr.data = NULL;
31121 uint32_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems /* XXX update_fail_malformed_htlcs_arg leaks */;
31122 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
31123 uint32_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
31124 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
31125 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
31126 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);
31127 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
31128 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
31129 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
31131 LDKUpdateFee update_fee_arg_conv;
31132 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
31133 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
31134 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
31135 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
31136 LDKCommitmentSigned commitment_signed_arg_conv;
31137 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
31138 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
31139 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
31140 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
31141 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);
31142 uint32_t ret_ref = 0;
31143 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31144 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31145 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31146 ret_ref = (uintptr_t)ret_var.inner;
31147 if (ret_var.is_owned) {
31153 static inline uintptr_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
31154 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
31155 uint32_t ret_ref = 0;
31156 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31157 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31158 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31159 ret_ref = (uintptr_t)ret_var.inner;
31160 if (ret_var.is_owned) {
31165 uint32_t __attribute__((export_name("TS_CommitmentUpdate_clone_ptr"))) TS_CommitmentUpdate_clone_ptr(uint32_t arg) {
31166 LDKCommitmentUpdate arg_conv;
31167 arg_conv.inner = (void*)(arg & (~1));
31168 arg_conv.is_owned = false;
31169 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31170 uint32_t ret_val = CommitmentUpdate_clone_ptr(&arg_conv);
31174 uint32_t __attribute__((export_name("TS_CommitmentUpdate_clone"))) TS_CommitmentUpdate_clone(uint32_t orig) {
31175 LDKCommitmentUpdate orig_conv;
31176 orig_conv.inner = (void*)(orig & (~1));
31177 orig_conv.is_owned = false;
31178 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31179 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
31180 uint32_t ret_ref = 0;
31181 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31182 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31183 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31184 ret_ref = (uintptr_t)ret_var.inner;
31185 if (ret_var.is_owned) {
31191 void __attribute__((export_name("TS_ChannelMessageHandler_free"))) TS_ChannelMessageHandler_free(uint32_t this_ptr) {
31192 if ((this_ptr & 1) != 0) return;
31193 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
31194 CHECK_ACCESS(this_ptr_ptr);
31195 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
31196 FREE((void*)this_ptr);
31197 ChannelMessageHandler_free(this_ptr_conv);
31200 void __attribute__((export_name("TS_RoutingMessageHandler_free"))) TS_RoutingMessageHandler_free(uint32_t this_ptr) {
31201 if ((this_ptr & 1) != 0) return;
31202 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
31203 CHECK_ACCESS(this_ptr_ptr);
31204 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
31205 FREE((void*)this_ptr);
31206 RoutingMessageHandler_free(this_ptr_conv);
31209 int8_tArray __attribute__((export_name("TS_AcceptChannel_write"))) TS_AcceptChannel_write(uint32_t obj) {
31210 LDKAcceptChannel obj_conv;
31211 obj_conv.inner = (void*)(obj & (~1));
31212 obj_conv.is_owned = false;
31213 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31214 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
31215 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31216 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31217 CVec_u8Z_free(ret_var);
31221 uint32_t __attribute__((export_name("TS_AcceptChannel_read"))) TS_AcceptChannel_read(int8_tArray ser) {
31222 LDKu8slice ser_ref;
31223 ser_ref.datalen = ser->arr_len;
31224 ser_ref.data = ser->elems /* XXX ser leaks */;
31225 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
31226 *ret_conv = AcceptChannel_read(ser_ref);
31227 return (uint32_t)ret_conv;
31230 int8_tArray __attribute__((export_name("TS_AnnouncementSignatures_write"))) TS_AnnouncementSignatures_write(uint32_t obj) {
31231 LDKAnnouncementSignatures obj_conv;
31232 obj_conv.inner = (void*)(obj & (~1));
31233 obj_conv.is_owned = false;
31234 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31235 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
31236 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31237 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31238 CVec_u8Z_free(ret_var);
31242 uint32_t __attribute__((export_name("TS_AnnouncementSignatures_read"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
31243 LDKu8slice ser_ref;
31244 ser_ref.datalen = ser->arr_len;
31245 ser_ref.data = ser->elems /* XXX ser leaks */;
31246 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
31247 *ret_conv = AnnouncementSignatures_read(ser_ref);
31248 return (uint32_t)ret_conv;
31251 int8_tArray __attribute__((export_name("TS_ChannelReestablish_write"))) TS_ChannelReestablish_write(uint32_t obj) {
31252 LDKChannelReestablish obj_conv;
31253 obj_conv.inner = (void*)(obj & (~1));
31254 obj_conv.is_owned = false;
31255 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31256 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
31257 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31258 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31259 CVec_u8Z_free(ret_var);
31263 uint32_t __attribute__((export_name("TS_ChannelReestablish_read"))) TS_ChannelReestablish_read(int8_tArray ser) {
31264 LDKu8slice ser_ref;
31265 ser_ref.datalen = ser->arr_len;
31266 ser_ref.data = ser->elems /* XXX ser leaks */;
31267 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
31268 *ret_conv = ChannelReestablish_read(ser_ref);
31269 return (uint32_t)ret_conv;
31272 int8_tArray __attribute__((export_name("TS_ClosingSigned_write"))) TS_ClosingSigned_write(uint32_t obj) {
31273 LDKClosingSigned obj_conv;
31274 obj_conv.inner = (void*)(obj & (~1));
31275 obj_conv.is_owned = false;
31276 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31277 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
31278 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31279 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31280 CVec_u8Z_free(ret_var);
31284 uint32_t __attribute__((export_name("TS_ClosingSigned_read"))) TS_ClosingSigned_read(int8_tArray ser) {
31285 LDKu8slice ser_ref;
31286 ser_ref.datalen = ser->arr_len;
31287 ser_ref.data = ser->elems /* XXX ser leaks */;
31288 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
31289 *ret_conv = ClosingSigned_read(ser_ref);
31290 return (uint32_t)ret_conv;
31293 int8_tArray __attribute__((export_name("TS_ClosingSignedFeeRange_write"))) TS_ClosingSignedFeeRange_write(uint32_t obj) {
31294 LDKClosingSignedFeeRange obj_conv;
31295 obj_conv.inner = (void*)(obj & (~1));
31296 obj_conv.is_owned = false;
31297 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31298 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
31299 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31300 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31301 CVec_u8Z_free(ret_var);
31305 uint32_t __attribute__((export_name("TS_ClosingSignedFeeRange_read"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
31306 LDKu8slice ser_ref;
31307 ser_ref.datalen = ser->arr_len;
31308 ser_ref.data = ser->elems /* XXX ser leaks */;
31309 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
31310 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
31311 return (uint32_t)ret_conv;
31314 int8_tArray __attribute__((export_name("TS_CommitmentSigned_write"))) TS_CommitmentSigned_write(uint32_t obj) {
31315 LDKCommitmentSigned obj_conv;
31316 obj_conv.inner = (void*)(obj & (~1));
31317 obj_conv.is_owned = false;
31318 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31319 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
31320 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31321 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31322 CVec_u8Z_free(ret_var);
31326 uint32_t __attribute__((export_name("TS_CommitmentSigned_read"))) TS_CommitmentSigned_read(int8_tArray ser) {
31327 LDKu8slice ser_ref;
31328 ser_ref.datalen = ser->arr_len;
31329 ser_ref.data = ser->elems /* XXX ser leaks */;
31330 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
31331 *ret_conv = CommitmentSigned_read(ser_ref);
31332 return (uint32_t)ret_conv;
31335 int8_tArray __attribute__((export_name("TS_FundingCreated_write"))) TS_FundingCreated_write(uint32_t obj) {
31336 LDKFundingCreated obj_conv;
31337 obj_conv.inner = (void*)(obj & (~1));
31338 obj_conv.is_owned = false;
31339 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31340 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
31341 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31342 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31343 CVec_u8Z_free(ret_var);
31347 uint32_t __attribute__((export_name("TS_FundingCreated_read"))) TS_FundingCreated_read(int8_tArray ser) {
31348 LDKu8slice ser_ref;
31349 ser_ref.datalen = ser->arr_len;
31350 ser_ref.data = ser->elems /* XXX ser leaks */;
31351 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
31352 *ret_conv = FundingCreated_read(ser_ref);
31353 return (uint32_t)ret_conv;
31356 int8_tArray __attribute__((export_name("TS_FundingSigned_write"))) TS_FundingSigned_write(uint32_t obj) {
31357 LDKFundingSigned obj_conv;
31358 obj_conv.inner = (void*)(obj & (~1));
31359 obj_conv.is_owned = false;
31360 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31361 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
31362 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31363 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31364 CVec_u8Z_free(ret_var);
31368 uint32_t __attribute__((export_name("TS_FundingSigned_read"))) TS_FundingSigned_read(int8_tArray ser) {
31369 LDKu8slice ser_ref;
31370 ser_ref.datalen = ser->arr_len;
31371 ser_ref.data = ser->elems /* XXX ser leaks */;
31372 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
31373 *ret_conv = FundingSigned_read(ser_ref);
31374 return (uint32_t)ret_conv;
31377 int8_tArray __attribute__((export_name("TS_FundingLocked_write"))) TS_FundingLocked_write(uint32_t obj) {
31378 LDKFundingLocked obj_conv;
31379 obj_conv.inner = (void*)(obj & (~1));
31380 obj_conv.is_owned = false;
31381 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31382 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
31383 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31384 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31385 CVec_u8Z_free(ret_var);
31389 uint32_t __attribute__((export_name("TS_FundingLocked_read"))) TS_FundingLocked_read(int8_tArray ser) {
31390 LDKu8slice ser_ref;
31391 ser_ref.datalen = ser->arr_len;
31392 ser_ref.data = ser->elems /* XXX ser leaks */;
31393 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
31394 *ret_conv = FundingLocked_read(ser_ref);
31395 return (uint32_t)ret_conv;
31398 int8_tArray __attribute__((export_name("TS_Init_write"))) TS_Init_write(uint32_t obj) {
31400 obj_conv.inner = (void*)(obj & (~1));
31401 obj_conv.is_owned = false;
31402 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31403 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
31404 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31405 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31406 CVec_u8Z_free(ret_var);
31410 uint32_t __attribute__((export_name("TS_Init_read"))) TS_Init_read(int8_tArray ser) {
31411 LDKu8slice ser_ref;
31412 ser_ref.datalen = ser->arr_len;
31413 ser_ref.data = ser->elems /* XXX ser leaks */;
31414 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
31415 *ret_conv = Init_read(ser_ref);
31416 return (uint32_t)ret_conv;
31419 int8_tArray __attribute__((export_name("TS_OpenChannel_write"))) TS_OpenChannel_write(uint32_t obj) {
31420 LDKOpenChannel obj_conv;
31421 obj_conv.inner = (void*)(obj & (~1));
31422 obj_conv.is_owned = false;
31423 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31424 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
31425 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31426 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31427 CVec_u8Z_free(ret_var);
31431 uint32_t __attribute__((export_name("TS_OpenChannel_read"))) TS_OpenChannel_read(int8_tArray ser) {
31432 LDKu8slice ser_ref;
31433 ser_ref.datalen = ser->arr_len;
31434 ser_ref.data = ser->elems /* XXX ser leaks */;
31435 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
31436 *ret_conv = OpenChannel_read(ser_ref);
31437 return (uint32_t)ret_conv;
31440 int8_tArray __attribute__((export_name("TS_RevokeAndACK_write"))) TS_RevokeAndACK_write(uint32_t obj) {
31441 LDKRevokeAndACK obj_conv;
31442 obj_conv.inner = (void*)(obj & (~1));
31443 obj_conv.is_owned = false;
31444 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31445 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
31446 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31447 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31448 CVec_u8Z_free(ret_var);
31452 uint32_t __attribute__((export_name("TS_RevokeAndACK_read"))) TS_RevokeAndACK_read(int8_tArray ser) {
31453 LDKu8slice ser_ref;
31454 ser_ref.datalen = ser->arr_len;
31455 ser_ref.data = ser->elems /* XXX ser leaks */;
31456 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
31457 *ret_conv = RevokeAndACK_read(ser_ref);
31458 return (uint32_t)ret_conv;
31461 int8_tArray __attribute__((export_name("TS_Shutdown_write"))) TS_Shutdown_write(uint32_t obj) {
31462 LDKShutdown obj_conv;
31463 obj_conv.inner = (void*)(obj & (~1));
31464 obj_conv.is_owned = false;
31465 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31466 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
31467 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31468 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31469 CVec_u8Z_free(ret_var);
31473 uint32_t __attribute__((export_name("TS_Shutdown_read"))) TS_Shutdown_read(int8_tArray ser) {
31474 LDKu8slice ser_ref;
31475 ser_ref.datalen = ser->arr_len;
31476 ser_ref.data = ser->elems /* XXX ser leaks */;
31477 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
31478 *ret_conv = Shutdown_read(ser_ref);
31479 return (uint32_t)ret_conv;
31482 int8_tArray __attribute__((export_name("TS_UpdateFailHTLC_write"))) TS_UpdateFailHTLC_write(uint32_t obj) {
31483 LDKUpdateFailHTLC obj_conv;
31484 obj_conv.inner = (void*)(obj & (~1));
31485 obj_conv.is_owned = false;
31486 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31487 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
31488 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31489 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31490 CVec_u8Z_free(ret_var);
31494 uint32_t __attribute__((export_name("TS_UpdateFailHTLC_read"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
31495 LDKu8slice ser_ref;
31496 ser_ref.datalen = ser->arr_len;
31497 ser_ref.data = ser->elems /* XXX ser leaks */;
31498 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
31499 *ret_conv = UpdateFailHTLC_read(ser_ref);
31500 return (uint32_t)ret_conv;
31503 int8_tArray __attribute__((export_name("TS_UpdateFailMalformedHTLC_write"))) TS_UpdateFailMalformedHTLC_write(uint32_t obj) {
31504 LDKUpdateFailMalformedHTLC obj_conv;
31505 obj_conv.inner = (void*)(obj & (~1));
31506 obj_conv.is_owned = false;
31507 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31508 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
31509 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31510 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31511 CVec_u8Z_free(ret_var);
31515 uint32_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_read"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
31516 LDKu8slice ser_ref;
31517 ser_ref.datalen = ser->arr_len;
31518 ser_ref.data = ser->elems /* XXX ser leaks */;
31519 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
31520 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
31521 return (uint32_t)ret_conv;
31524 int8_tArray __attribute__((export_name("TS_UpdateFee_write"))) TS_UpdateFee_write(uint32_t obj) {
31525 LDKUpdateFee obj_conv;
31526 obj_conv.inner = (void*)(obj & (~1));
31527 obj_conv.is_owned = false;
31528 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31529 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
31530 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31531 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31532 CVec_u8Z_free(ret_var);
31536 uint32_t __attribute__((export_name("TS_UpdateFee_read"))) TS_UpdateFee_read(int8_tArray ser) {
31537 LDKu8slice ser_ref;
31538 ser_ref.datalen = ser->arr_len;
31539 ser_ref.data = ser->elems /* XXX ser leaks */;
31540 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
31541 *ret_conv = UpdateFee_read(ser_ref);
31542 return (uint32_t)ret_conv;
31545 int8_tArray __attribute__((export_name("TS_UpdateFulfillHTLC_write"))) TS_UpdateFulfillHTLC_write(uint32_t obj) {
31546 LDKUpdateFulfillHTLC obj_conv;
31547 obj_conv.inner = (void*)(obj & (~1));
31548 obj_conv.is_owned = false;
31549 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31550 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
31551 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31552 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31553 CVec_u8Z_free(ret_var);
31557 uint32_t __attribute__((export_name("TS_UpdateFulfillHTLC_read"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
31558 LDKu8slice ser_ref;
31559 ser_ref.datalen = ser->arr_len;
31560 ser_ref.data = ser->elems /* XXX ser leaks */;
31561 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
31562 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
31563 return (uint32_t)ret_conv;
31566 int8_tArray __attribute__((export_name("TS_UpdateAddHTLC_write"))) TS_UpdateAddHTLC_write(uint32_t obj) {
31567 LDKUpdateAddHTLC obj_conv;
31568 obj_conv.inner = (void*)(obj & (~1));
31569 obj_conv.is_owned = false;
31570 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31571 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
31572 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31573 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31574 CVec_u8Z_free(ret_var);
31578 uint32_t __attribute__((export_name("TS_UpdateAddHTLC_read"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
31579 LDKu8slice ser_ref;
31580 ser_ref.datalen = ser->arr_len;
31581 ser_ref.data = ser->elems /* XXX ser leaks */;
31582 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
31583 *ret_conv = UpdateAddHTLC_read(ser_ref);
31584 return (uint32_t)ret_conv;
31587 int8_tArray __attribute__((export_name("TS_Ping_write"))) TS_Ping_write(uint32_t obj) {
31589 obj_conv.inner = (void*)(obj & (~1));
31590 obj_conv.is_owned = false;
31591 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31592 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
31593 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31594 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31595 CVec_u8Z_free(ret_var);
31599 uint32_t __attribute__((export_name("TS_Ping_read"))) TS_Ping_read(int8_tArray ser) {
31600 LDKu8slice ser_ref;
31601 ser_ref.datalen = ser->arr_len;
31602 ser_ref.data = ser->elems /* XXX ser leaks */;
31603 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
31604 *ret_conv = Ping_read(ser_ref);
31605 return (uint32_t)ret_conv;
31608 int8_tArray __attribute__((export_name("TS_Pong_write"))) TS_Pong_write(uint32_t obj) {
31610 obj_conv.inner = (void*)(obj & (~1));
31611 obj_conv.is_owned = false;
31612 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31613 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
31614 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31615 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31616 CVec_u8Z_free(ret_var);
31620 uint32_t __attribute__((export_name("TS_Pong_read"))) TS_Pong_read(int8_tArray ser) {
31621 LDKu8slice ser_ref;
31622 ser_ref.datalen = ser->arr_len;
31623 ser_ref.data = ser->elems /* XXX ser leaks */;
31624 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
31625 *ret_conv = Pong_read(ser_ref);
31626 return (uint32_t)ret_conv;
31629 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_write"))) TS_UnsignedChannelAnnouncement_write(uint32_t obj) {
31630 LDKUnsignedChannelAnnouncement obj_conv;
31631 obj_conv.inner = (void*)(obj & (~1));
31632 obj_conv.is_owned = false;
31633 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31634 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
31635 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31636 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31637 CVec_u8Z_free(ret_var);
31641 uint32_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_read"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
31642 LDKu8slice ser_ref;
31643 ser_ref.datalen = ser->arr_len;
31644 ser_ref.data = ser->elems /* XXX ser leaks */;
31645 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
31646 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
31647 return (uint32_t)ret_conv;
31650 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_write"))) TS_ChannelAnnouncement_write(uint32_t obj) {
31651 LDKChannelAnnouncement obj_conv;
31652 obj_conv.inner = (void*)(obj & (~1));
31653 obj_conv.is_owned = false;
31654 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31655 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
31656 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31657 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31658 CVec_u8Z_free(ret_var);
31662 uint32_t __attribute__((export_name("TS_ChannelAnnouncement_read"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
31663 LDKu8slice ser_ref;
31664 ser_ref.datalen = ser->arr_len;
31665 ser_ref.data = ser->elems /* XXX ser leaks */;
31666 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
31667 *ret_conv = ChannelAnnouncement_read(ser_ref);
31668 return (uint32_t)ret_conv;
31671 int8_tArray __attribute__((export_name("TS_UnsignedChannelUpdate_write"))) TS_UnsignedChannelUpdate_write(uint32_t obj) {
31672 LDKUnsignedChannelUpdate obj_conv;
31673 obj_conv.inner = (void*)(obj & (~1));
31674 obj_conv.is_owned = false;
31675 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31676 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
31677 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31678 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31679 CVec_u8Z_free(ret_var);
31683 uint32_t __attribute__((export_name("TS_UnsignedChannelUpdate_read"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
31684 LDKu8slice ser_ref;
31685 ser_ref.datalen = ser->arr_len;
31686 ser_ref.data = ser->elems /* XXX ser leaks */;
31687 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
31688 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
31689 return (uint32_t)ret_conv;
31692 int8_tArray __attribute__((export_name("TS_ChannelUpdate_write"))) TS_ChannelUpdate_write(uint32_t obj) {
31693 LDKChannelUpdate obj_conv;
31694 obj_conv.inner = (void*)(obj & (~1));
31695 obj_conv.is_owned = false;
31696 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31697 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
31698 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31699 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31700 CVec_u8Z_free(ret_var);
31704 uint32_t __attribute__((export_name("TS_ChannelUpdate_read"))) TS_ChannelUpdate_read(int8_tArray ser) {
31705 LDKu8slice ser_ref;
31706 ser_ref.datalen = ser->arr_len;
31707 ser_ref.data = ser->elems /* XXX ser leaks */;
31708 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
31709 *ret_conv = ChannelUpdate_read(ser_ref);
31710 return (uint32_t)ret_conv;
31713 int8_tArray __attribute__((export_name("TS_ErrorMessage_write"))) TS_ErrorMessage_write(uint32_t obj) {
31714 LDKErrorMessage obj_conv;
31715 obj_conv.inner = (void*)(obj & (~1));
31716 obj_conv.is_owned = false;
31717 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31718 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
31719 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31720 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31721 CVec_u8Z_free(ret_var);
31725 uint32_t __attribute__((export_name("TS_ErrorMessage_read"))) TS_ErrorMessage_read(int8_tArray ser) {
31726 LDKu8slice ser_ref;
31727 ser_ref.datalen = ser->arr_len;
31728 ser_ref.data = ser->elems /* XXX ser leaks */;
31729 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
31730 *ret_conv = ErrorMessage_read(ser_ref);
31731 return (uint32_t)ret_conv;
31734 int8_tArray __attribute__((export_name("TS_WarningMessage_write"))) TS_WarningMessage_write(uint32_t obj) {
31735 LDKWarningMessage obj_conv;
31736 obj_conv.inner = (void*)(obj & (~1));
31737 obj_conv.is_owned = false;
31738 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31739 LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
31740 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31741 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31742 CVec_u8Z_free(ret_var);
31746 uint32_t __attribute__((export_name("TS_WarningMessage_read"))) TS_WarningMessage_read(int8_tArray ser) {
31747 LDKu8slice ser_ref;
31748 ser_ref.datalen = ser->arr_len;
31749 ser_ref.data = ser->elems /* XXX ser leaks */;
31750 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
31751 *ret_conv = WarningMessage_read(ser_ref);
31752 return (uint32_t)ret_conv;
31755 int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_write"))) TS_UnsignedNodeAnnouncement_write(uint32_t obj) {
31756 LDKUnsignedNodeAnnouncement obj_conv;
31757 obj_conv.inner = (void*)(obj & (~1));
31758 obj_conv.is_owned = false;
31759 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31760 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
31761 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31762 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31763 CVec_u8Z_free(ret_var);
31767 uint32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_read"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
31768 LDKu8slice ser_ref;
31769 ser_ref.datalen = ser->arr_len;
31770 ser_ref.data = ser->elems /* XXX ser leaks */;
31771 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
31772 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
31773 return (uint32_t)ret_conv;
31776 int8_tArray __attribute__((export_name("TS_NodeAnnouncement_write"))) TS_NodeAnnouncement_write(uint32_t obj) {
31777 LDKNodeAnnouncement obj_conv;
31778 obj_conv.inner = (void*)(obj & (~1));
31779 obj_conv.is_owned = false;
31780 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31781 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
31782 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31783 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31784 CVec_u8Z_free(ret_var);
31788 uint32_t __attribute__((export_name("TS_NodeAnnouncement_read"))) TS_NodeAnnouncement_read(int8_tArray ser) {
31789 LDKu8slice ser_ref;
31790 ser_ref.datalen = ser->arr_len;
31791 ser_ref.data = ser->elems /* XXX ser leaks */;
31792 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
31793 *ret_conv = NodeAnnouncement_read(ser_ref);
31794 return (uint32_t)ret_conv;
31797 uint32_t __attribute__((export_name("TS_QueryShortChannelIds_read"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
31798 LDKu8slice ser_ref;
31799 ser_ref.datalen = ser->arr_len;
31800 ser_ref.data = ser->elems /* XXX ser leaks */;
31801 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
31802 *ret_conv = QueryShortChannelIds_read(ser_ref);
31803 return (uint32_t)ret_conv;
31806 int8_tArray __attribute__((export_name("TS_QueryShortChannelIds_write"))) TS_QueryShortChannelIds_write(uint32_t obj) {
31807 LDKQueryShortChannelIds obj_conv;
31808 obj_conv.inner = (void*)(obj & (~1));
31809 obj_conv.is_owned = false;
31810 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31811 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
31812 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31813 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31814 CVec_u8Z_free(ret_var);
31818 int8_tArray __attribute__((export_name("TS_ReplyShortChannelIdsEnd_write"))) TS_ReplyShortChannelIdsEnd_write(uint32_t obj) {
31819 LDKReplyShortChannelIdsEnd obj_conv;
31820 obj_conv.inner = (void*)(obj & (~1));
31821 obj_conv.is_owned = false;
31822 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31823 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
31824 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31825 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31826 CVec_u8Z_free(ret_var);
31830 uint32_t __attribute__((export_name("TS_ReplyShortChannelIdsEnd_read"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
31831 LDKu8slice ser_ref;
31832 ser_ref.datalen = ser->arr_len;
31833 ser_ref.data = ser->elems /* XXX ser leaks */;
31834 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
31835 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
31836 return (uint32_t)ret_conv;
31839 int32_t __attribute__((export_name("TS_QueryChannelRange_end_blocknum"))) TS_QueryChannelRange_end_blocknum(uint32_t this_arg) {
31840 LDKQueryChannelRange this_arg_conv;
31841 this_arg_conv.inner = (void*)(this_arg & (~1));
31842 this_arg_conv.is_owned = false;
31843 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31844 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
31848 int8_tArray __attribute__((export_name("TS_QueryChannelRange_write"))) TS_QueryChannelRange_write(uint32_t obj) {
31849 LDKQueryChannelRange obj_conv;
31850 obj_conv.inner = (void*)(obj & (~1));
31851 obj_conv.is_owned = false;
31852 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31853 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
31854 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31855 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31856 CVec_u8Z_free(ret_var);
31860 uint32_t __attribute__((export_name("TS_QueryChannelRange_read"))) TS_QueryChannelRange_read(int8_tArray ser) {
31861 LDKu8slice ser_ref;
31862 ser_ref.datalen = ser->arr_len;
31863 ser_ref.data = ser->elems /* XXX ser leaks */;
31864 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
31865 *ret_conv = QueryChannelRange_read(ser_ref);
31866 return (uint32_t)ret_conv;
31869 uint32_t __attribute__((export_name("TS_ReplyChannelRange_read"))) TS_ReplyChannelRange_read(int8_tArray ser) {
31870 LDKu8slice ser_ref;
31871 ser_ref.datalen = ser->arr_len;
31872 ser_ref.data = ser->elems /* XXX ser leaks */;
31873 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
31874 *ret_conv = ReplyChannelRange_read(ser_ref);
31875 return (uint32_t)ret_conv;
31878 int8_tArray __attribute__((export_name("TS_ReplyChannelRange_write"))) TS_ReplyChannelRange_write(uint32_t obj) {
31879 LDKReplyChannelRange obj_conv;
31880 obj_conv.inner = (void*)(obj & (~1));
31881 obj_conv.is_owned = false;
31882 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31883 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
31884 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31885 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31886 CVec_u8Z_free(ret_var);
31890 int8_tArray __attribute__((export_name("TS_GossipTimestampFilter_write"))) TS_GossipTimestampFilter_write(uint32_t obj) {
31891 LDKGossipTimestampFilter obj_conv;
31892 obj_conv.inner = (void*)(obj & (~1));
31893 obj_conv.is_owned = false;
31894 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31895 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
31896 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31897 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31898 CVec_u8Z_free(ret_var);
31902 uint32_t __attribute__((export_name("TS_GossipTimestampFilter_read"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
31903 LDKu8slice ser_ref;
31904 ser_ref.datalen = ser->arr_len;
31905 ser_ref.data = ser->elems /* XXX ser leaks */;
31906 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
31907 *ret_conv = GossipTimestampFilter_read(ser_ref);
31908 return (uint32_t)ret_conv;
31911 void __attribute__((export_name("TS_CustomMessageHandler_free"))) TS_CustomMessageHandler_free(uint32_t this_ptr) {
31912 if ((this_ptr & 1) != 0) return;
31913 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
31914 CHECK_ACCESS(this_ptr_ptr);
31915 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
31916 FREE((void*)this_ptr);
31917 CustomMessageHandler_free(this_ptr_conv);
31920 void __attribute__((export_name("TS_IgnoringMessageHandler_free"))) TS_IgnoringMessageHandler_free(uint32_t this_obj) {
31921 LDKIgnoringMessageHandler this_obj_conv;
31922 this_obj_conv.inner = (void*)(this_obj & (~1));
31923 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31924 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31925 IgnoringMessageHandler_free(this_obj_conv);
31928 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_new"))) TS_IgnoringMessageHandler_new() {
31929 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
31930 uint32_t ret_ref = 0;
31931 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31932 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31933 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31934 ret_ref = (uintptr_t)ret_var.inner;
31935 if (ret_var.is_owned) {
31941 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_as_MessageSendEventsProvider"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
31942 LDKIgnoringMessageHandler this_arg_conv;
31943 this_arg_conv.inner = (void*)(this_arg & (~1));
31944 this_arg_conv.is_owned = false;
31945 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31946 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
31947 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
31948 return (uint32_t)ret_ret;
31951 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_as_RoutingMessageHandler"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint32_t this_arg) {
31952 LDKIgnoringMessageHandler this_arg_conv;
31953 this_arg_conv.inner = (void*)(this_arg & (~1));
31954 this_arg_conv.is_owned = false;
31955 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31956 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
31957 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
31958 return (uint32_t)ret_ret;
31961 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageReader"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint32_t this_arg) {
31962 LDKIgnoringMessageHandler this_arg_conv;
31963 this_arg_conv.inner = (void*)(this_arg & (~1));
31964 this_arg_conv.is_owned = false;
31965 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31966 LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
31967 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
31968 return (uint32_t)ret_ret;
31971 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageHandler"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint32_t this_arg) {
31972 LDKIgnoringMessageHandler this_arg_conv;
31973 this_arg_conv.inner = (void*)(this_arg & (~1));
31974 this_arg_conv.is_owned = false;
31975 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31976 LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
31977 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
31978 return (uint32_t)ret_ret;
31981 void __attribute__((export_name("TS_ErroringMessageHandler_free"))) TS_ErroringMessageHandler_free(uint32_t this_obj) {
31982 LDKErroringMessageHandler this_obj_conv;
31983 this_obj_conv.inner = (void*)(this_obj & (~1));
31984 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31985 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31986 ErroringMessageHandler_free(this_obj_conv);
31989 uint32_t __attribute__((export_name("TS_ErroringMessageHandler_new"))) TS_ErroringMessageHandler_new() {
31990 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
31991 uint32_t ret_ref = 0;
31992 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31993 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31994 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31995 ret_ref = (uintptr_t)ret_var.inner;
31996 if (ret_var.is_owned) {
32002 uint32_t __attribute__((export_name("TS_ErroringMessageHandler_as_MessageSendEventsProvider"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
32003 LDKErroringMessageHandler this_arg_conv;
32004 this_arg_conv.inner = (void*)(this_arg & (~1));
32005 this_arg_conv.is_owned = false;
32006 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32007 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
32008 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
32009 return (uint32_t)ret_ret;
32012 uint32_t __attribute__((export_name("TS_ErroringMessageHandler_as_ChannelMessageHandler"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint32_t this_arg) {
32013 LDKErroringMessageHandler this_arg_conv;
32014 this_arg_conv.inner = (void*)(this_arg & (~1));
32015 this_arg_conv.is_owned = false;
32016 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32017 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
32018 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
32019 return (uint32_t)ret_ret;
32022 void __attribute__((export_name("TS_MessageHandler_free"))) TS_MessageHandler_free(uint32_t this_obj) {
32023 LDKMessageHandler this_obj_conv;
32024 this_obj_conv.inner = (void*)(this_obj & (~1));
32025 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32026 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32027 MessageHandler_free(this_obj_conv);
32030 uint32_t __attribute__((export_name("TS_MessageHandler_get_chan_handler"))) TS_MessageHandler_get_chan_handler(uint32_t this_ptr) {
32031 LDKMessageHandler this_ptr_conv;
32032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32033 this_ptr_conv.is_owned = false;
32034 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32035 // WARNING: This object doesn't live past this scope, needs clone!
32036 uint32_t ret_ret = ((uintptr_t)MessageHandler_get_chan_handler(&this_ptr_conv)) | 1;
32040 void __attribute__((export_name("TS_MessageHandler_set_chan_handler"))) TS_MessageHandler_set_chan_handler(uint32_t this_ptr, uint32_t val) {
32041 LDKMessageHandler this_ptr_conv;
32042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32043 this_ptr_conv.is_owned = false;
32044 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32045 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
32046 CHECK_ACCESS(val_ptr);
32047 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
32048 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
32051 uint32_t __attribute__((export_name("TS_MessageHandler_get_route_handler"))) TS_MessageHandler_get_route_handler(uint32_t this_ptr) {
32052 LDKMessageHandler this_ptr_conv;
32053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32054 this_ptr_conv.is_owned = false;
32055 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32056 // WARNING: This object doesn't live past this scope, needs clone!
32057 uint32_t ret_ret = ((uintptr_t)MessageHandler_get_route_handler(&this_ptr_conv)) | 1;
32061 void __attribute__((export_name("TS_MessageHandler_set_route_handler"))) TS_MessageHandler_set_route_handler(uint32_t this_ptr, uint32_t val) {
32062 LDKMessageHandler 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 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
32067 CHECK_ACCESS(val_ptr);
32068 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
32069 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
32072 uint32_t __attribute__((export_name("TS_MessageHandler_new"))) TS_MessageHandler_new(uint32_t chan_handler_arg, uint32_t route_handler_arg) {
32073 void* chan_handler_arg_ptr = (void*)(((uintptr_t)chan_handler_arg) & ~1);
32074 CHECK_ACCESS(chan_handler_arg_ptr);
32075 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
32076 void* route_handler_arg_ptr = (void*)(((uintptr_t)route_handler_arg) & ~1);
32077 CHECK_ACCESS(route_handler_arg_ptr);
32078 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
32079 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
32080 uint32_t ret_ref = 0;
32081 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32082 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32083 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32084 ret_ref = (uintptr_t)ret_var.inner;
32085 if (ret_var.is_owned) {
32091 static inline uintptr_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
32092 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
32093 *ret_ret = SocketDescriptor_clone(arg);
32094 return (uint32_t)ret_ret;
32096 uint32_t __attribute__((export_name("TS_SocketDescriptor_clone_ptr"))) TS_SocketDescriptor_clone_ptr(uint32_t arg) {
32097 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
32098 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
32099 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
32100 uint32_t ret_val = SocketDescriptor_clone_ptr(arg_conv);
32104 uint32_t __attribute__((export_name("TS_SocketDescriptor_clone"))) TS_SocketDescriptor_clone(uint32_t orig) {
32105 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
32106 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
32107 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
32108 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
32109 *ret_ret = SocketDescriptor_clone(orig_conv);
32110 return (uint32_t)ret_ret;
32113 void __attribute__((export_name("TS_SocketDescriptor_free"))) TS_SocketDescriptor_free(uint32_t this_ptr) {
32114 if ((this_ptr & 1) != 0) return;
32115 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
32116 CHECK_ACCESS(this_ptr_ptr);
32117 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
32118 FREE((void*)this_ptr);
32119 SocketDescriptor_free(this_ptr_conv);
32122 void __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError_free(uint32_t this_obj) {
32123 LDKPeerHandleError this_obj_conv;
32124 this_obj_conv.inner = (void*)(this_obj & (~1));
32125 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32126 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32127 PeerHandleError_free(this_obj_conv);
32130 jboolean __attribute__((export_name("TS_PeerHandleError_get_no_connection_possible"))) TS_PeerHandleError_get_no_connection_possible(uint32_t this_ptr) {
32131 LDKPeerHandleError this_ptr_conv;
32132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32133 this_ptr_conv.is_owned = false;
32134 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32135 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
32139 void __attribute__((export_name("TS_PeerHandleError_set_no_connection_possible"))) TS_PeerHandleError_set_no_connection_possible(uint32_t this_ptr, jboolean val) {
32140 LDKPeerHandleError this_ptr_conv;
32141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32142 this_ptr_conv.is_owned = false;
32143 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32144 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
32147 uint32_t __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
32148 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
32149 uint32_t ret_ref = 0;
32150 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32151 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32152 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32153 ret_ref = (uintptr_t)ret_var.inner;
32154 if (ret_var.is_owned) {
32160 static inline uintptr_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
32161 LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
32162 uint32_t ret_ref = 0;
32163 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32164 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32165 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32166 ret_ref = (uintptr_t)ret_var.inner;
32167 if (ret_var.is_owned) {
32172 uint32_t __attribute__((export_name("TS_PeerHandleError_clone_ptr"))) TS_PeerHandleError_clone_ptr(uint32_t arg) {
32173 LDKPeerHandleError arg_conv;
32174 arg_conv.inner = (void*)(arg & (~1));
32175 arg_conv.is_owned = false;
32176 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32177 uint32_t ret_val = PeerHandleError_clone_ptr(&arg_conv);
32181 uint32_t __attribute__((export_name("TS_PeerHandleError_clone"))) TS_PeerHandleError_clone(uint32_t orig) {
32182 LDKPeerHandleError orig_conv;
32183 orig_conv.inner = (void*)(orig & (~1));
32184 orig_conv.is_owned = false;
32185 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32186 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
32187 uint32_t ret_ref = 0;
32188 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32189 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32190 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32191 ret_ref = (uintptr_t)ret_var.inner;
32192 if (ret_var.is_owned) {
32198 void __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(uint32_t this_obj) {
32199 LDKPeerManager this_obj_conv;
32200 this_obj_conv.inner = (void*)(this_obj & (~1));
32201 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32202 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32203 PeerManager_free(this_obj_conv);
32206 uint32_t __attribute__((export_name("TS_PeerManager_new"))) TS_PeerManager_new(uint32_t message_handler, int8_tArray our_node_secret, int8_tArray ephemeral_random_data, uint32_t logger, uint32_t custom_message_handler) {
32207 LDKMessageHandler message_handler_conv;
32208 message_handler_conv.inner = (void*)(message_handler & (~1));
32209 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
32210 CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
32211 // WARNING: we need a move here but no clone is available for LDKMessageHandler
32212 LDKSecretKey our_node_secret_ref;
32213 CHECK(our_node_secret->arr_len == 32);
32214 memcpy(our_node_secret_ref.bytes, our_node_secret->elems, 32); FREE(our_node_secret);
32215 unsigned char ephemeral_random_data_arr[32];
32216 CHECK(ephemeral_random_data->arr_len == 32);
32217 memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
32218 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
32219 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
32220 CHECK_ACCESS(logger_ptr);
32221 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
32222 void* custom_message_handler_ptr = (void*)(((uintptr_t)custom_message_handler) & ~1);
32223 CHECK_ACCESS(custom_message_handler_ptr);
32224 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
32225 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
32226 uint32_t ret_ref = 0;
32227 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32228 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32229 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32230 ret_ref = (uintptr_t)ret_var.inner;
32231 if (ret_var.is_owned) {
32237 ptrArray __attribute__((export_name("TS_PeerManager_get_peer_node_ids"))) TS_PeerManager_get_peer_node_ids(uint32_t this_arg) {
32238 LDKPeerManager this_arg_conv;
32239 this_arg_conv.inner = (void*)(this_arg & (~1));
32240 this_arg_conv.is_owned = false;
32241 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32242 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
32243 ptrArray ret_arr = NULL;
32244 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
32245 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
32246 for (size_t m = 0; m < ret_var.datalen; m++) {
32247 int8_tArray ret_conv_12_arr = init_int8_tArray(33, __LINE__);
32248 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compressed_form, 33);
32249 ret_arr_ptr[m] = ret_conv_12_arr;
32252 FREE(ret_var.data);
32256 uint32_t __attribute__((export_name("TS_PeerManager_new_outbound_connection"))) TS_PeerManager_new_outbound_connection(uint32_t this_arg, int8_tArray their_node_id, uint32_t descriptor) {
32257 LDKPeerManager this_arg_conv;
32258 this_arg_conv.inner = (void*)(this_arg & (~1));
32259 this_arg_conv.is_owned = false;
32260 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32261 LDKPublicKey their_node_id_ref;
32262 CHECK(their_node_id->arr_len == 33);
32263 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
32264 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
32265 CHECK_ACCESS(descriptor_ptr);
32266 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
32267 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
32268 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
32269 return (uint32_t)ret_conv;
32272 uint32_t __attribute__((export_name("TS_PeerManager_new_inbound_connection"))) TS_PeerManager_new_inbound_connection(uint32_t this_arg, uint32_t descriptor) {
32273 LDKPeerManager this_arg_conv;
32274 this_arg_conv.inner = (void*)(this_arg & (~1));
32275 this_arg_conv.is_owned = false;
32276 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32277 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
32278 CHECK_ACCESS(descriptor_ptr);
32279 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
32280 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
32281 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
32282 return (uint32_t)ret_conv;
32285 uint32_t __attribute__((export_name("TS_PeerManager_write_buffer_space_avail"))) TS_PeerManager_write_buffer_space_avail(uint32_t this_arg, uint32_t descriptor) {
32286 LDKPeerManager this_arg_conv;
32287 this_arg_conv.inner = (void*)(this_arg & (~1));
32288 this_arg_conv.is_owned = false;
32289 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32290 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
32291 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
32292 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
32293 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
32294 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
32295 return (uint32_t)ret_conv;
32298 uint32_t __attribute__((export_name("TS_PeerManager_read_event"))) TS_PeerManager_read_event(uint32_t this_arg, uint32_t peer_descriptor, int8_tArray data) {
32299 LDKPeerManager this_arg_conv;
32300 this_arg_conv.inner = (void*)(this_arg & (~1));
32301 this_arg_conv.is_owned = false;
32302 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32303 void* peer_descriptor_ptr = (void*)(((uintptr_t)peer_descriptor) & ~1);
32304 if (!(peer_descriptor & 1)) { CHECK_ACCESS(peer_descriptor_ptr); }
32305 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
32306 LDKu8slice data_ref;
32307 data_ref.datalen = data->arr_len;
32308 data_ref.data = data->elems /* XXX data leaks */;
32309 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
32310 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
32311 return (uint32_t)ret_conv;
32314 void __attribute__((export_name("TS_PeerManager_process_events"))) TS_PeerManager_process_events(uint32_t this_arg) {
32315 LDKPeerManager this_arg_conv;
32316 this_arg_conv.inner = (void*)(this_arg & (~1));
32317 this_arg_conv.is_owned = false;
32318 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32319 PeerManager_process_events(&this_arg_conv);
32322 void __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_PeerManager_socket_disconnected(uint32_t this_arg, uint32_t descriptor) {
32323 LDKPeerManager this_arg_conv;
32324 this_arg_conv.inner = (void*)(this_arg & (~1));
32325 this_arg_conv.is_owned = false;
32326 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32327 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
32328 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
32329 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
32330 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
32333 void __attribute__((export_name("TS_PeerManager_disconnect_by_node_id"))) TS_PeerManager_disconnect_by_node_id(uint32_t this_arg, int8_tArray node_id, jboolean no_connection_possible) {
32334 LDKPeerManager this_arg_conv;
32335 this_arg_conv.inner = (void*)(this_arg & (~1));
32336 this_arg_conv.is_owned = false;
32337 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32338 LDKPublicKey node_id_ref;
32339 CHECK(node_id->arr_len == 33);
32340 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
32341 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
32344 void __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint32_t this_arg) {
32345 LDKPeerManager this_arg_conv;
32346 this_arg_conv.inner = (void*)(this_arg & (~1));
32347 this_arg_conv.is_owned = false;
32348 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32349 PeerManager_disconnect_all_peers(&this_arg_conv);
32352 void __attribute__((export_name("TS_PeerManager_timer_tick_occurred"))) TS_PeerManager_timer_tick_occurred(uint32_t this_arg) {
32353 LDKPeerManager this_arg_conv;
32354 this_arg_conv.inner = (void*)(this_arg & (~1));
32355 this_arg_conv.is_owned = false;
32356 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32357 PeerManager_timer_tick_occurred(&this_arg_conv);
32360 int64_t __attribute__((export_name("TS_htlc_success_tx_weight"))) TS_htlc_success_tx_weight(jboolean opt_anchors) {
32361 int64_t ret_val = htlc_success_tx_weight(opt_anchors);
32365 int64_t __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeout_tx_weight(jboolean opt_anchors) {
32366 int64_t ret_val = htlc_timeout_tx_weight(opt_anchors);
32370 int8_tArray __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
32371 unsigned char commitment_seed_arr[32];
32372 CHECK(commitment_seed->arr_len == 32);
32373 memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
32374 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
32375 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32376 memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
32380 int8_tArray __attribute__((export_name("TS_build_closing_transaction"))) TS_build_closing_transaction(int64_t to_holder_value_sat, int64_t to_counterparty_value_sat, int8_tArray to_holder_script, int8_tArray to_counterparty_script, uint32_t funding_outpoint) {
32381 LDKCVec_u8Z to_holder_script_ref;
32382 to_holder_script_ref.datalen = to_holder_script->arr_len;
32383 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
32384 memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
32385 LDKCVec_u8Z to_counterparty_script_ref;
32386 to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
32387 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
32388 memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
32389 LDKOutPoint funding_outpoint_conv;
32390 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
32391 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
32392 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
32393 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
32394 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);
32395 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32396 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32397 Transaction_free(ret_var);
32401 void __attribute__((export_name("TS_CounterpartyCommitmentSecrets_free"))) TS_CounterpartyCommitmentSecrets_free(uint32_t this_obj) {
32402 LDKCounterpartyCommitmentSecrets this_obj_conv;
32403 this_obj_conv.inner = (void*)(this_obj & (~1));
32404 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32405 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32406 CounterpartyCommitmentSecrets_free(this_obj_conv);
32409 static inline uintptr_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
32410 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
32411 uint32_t ret_ref = 0;
32412 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32413 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32414 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32415 ret_ref = (uintptr_t)ret_var.inner;
32416 if (ret_var.is_owned) {
32421 uint32_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone_ptr"))) TS_CounterpartyCommitmentSecrets_clone_ptr(uint32_t arg) {
32422 LDKCounterpartyCommitmentSecrets arg_conv;
32423 arg_conv.inner = (void*)(arg & (~1));
32424 arg_conv.is_owned = false;
32425 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32426 uint32_t ret_val = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
32430 uint32_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone"))) TS_CounterpartyCommitmentSecrets_clone(uint32_t orig) {
32431 LDKCounterpartyCommitmentSecrets orig_conv;
32432 orig_conv.inner = (void*)(orig & (~1));
32433 orig_conv.is_owned = false;
32434 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32435 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
32436 uint32_t ret_ref = 0;
32437 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32438 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32439 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32440 ret_ref = (uintptr_t)ret_var.inner;
32441 if (ret_var.is_owned) {
32447 uint32_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_new"))) TS_CounterpartyCommitmentSecrets_new() {
32448 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
32449 uint32_t ret_ref = 0;
32450 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32451 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32452 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32453 ret_ref = (uintptr_t)ret_var.inner;
32454 if (ret_var.is_owned) {
32460 int64_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_min_seen_secret"))) TS_CounterpartyCommitmentSecrets_get_min_seen_secret(uint32_t this_arg) {
32461 LDKCounterpartyCommitmentSecrets this_arg_conv;
32462 this_arg_conv.inner = (void*)(this_arg & (~1));
32463 this_arg_conv.is_owned = false;
32464 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32465 int64_t ret_val = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
32469 uint32_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_provide_secret"))) TS_CounterpartyCommitmentSecrets_provide_secret(uint32_t this_arg, int64_t idx, int8_tArray secret) {
32470 LDKCounterpartyCommitmentSecrets this_arg_conv;
32471 this_arg_conv.inner = (void*)(this_arg & (~1));
32472 this_arg_conv.is_owned = false;
32473 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32474 LDKThirtyTwoBytes secret_ref;
32475 CHECK(secret->arr_len == 32);
32476 memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
32477 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
32478 *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
32479 return (uint32_t)ret_conv;
32482 int8_tArray __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_secret"))) TS_CounterpartyCommitmentSecrets_get_secret(uint32_t this_arg, int64_t idx) {
32483 LDKCounterpartyCommitmentSecrets this_arg_conv;
32484 this_arg_conv.inner = (void*)(this_arg & (~1));
32485 this_arg_conv.is_owned = false;
32486 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32487 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32488 memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
32492 int8_tArray __attribute__((export_name("TS_CounterpartyCommitmentSecrets_write"))) TS_CounterpartyCommitmentSecrets_write(uint32_t obj) {
32493 LDKCounterpartyCommitmentSecrets obj_conv;
32494 obj_conv.inner = (void*)(obj & (~1));
32495 obj_conv.is_owned = false;
32496 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32497 LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
32498 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32499 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32500 CVec_u8Z_free(ret_var);
32504 uint32_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_read"))) TS_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
32505 LDKu8slice ser_ref;
32506 ser_ref.datalen = ser->arr_len;
32507 ser_ref.data = ser->elems /* XXX ser leaks */;
32508 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
32509 *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
32510 return (uint32_t)ret_conv;
32513 uint32_t __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
32514 LDKPublicKey per_commitment_point_ref;
32515 CHECK(per_commitment_point->arr_len == 33);
32516 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
32517 unsigned char base_secret_arr[32];
32518 CHECK(base_secret->arr_len == 32);
32519 memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
32520 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
32521 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
32522 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
32523 return (uint32_t)ret_conv;
32526 uint32_t __attribute__((export_name("TS_derive_public_key"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
32527 LDKPublicKey per_commitment_point_ref;
32528 CHECK(per_commitment_point->arr_len == 33);
32529 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
32530 LDKPublicKey base_point_ref;
32531 CHECK(base_point->arr_len == 33);
32532 memcpy(base_point_ref.compressed_form, base_point->elems, 33); FREE(base_point);
32533 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
32534 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
32535 return (uint32_t)ret_conv;
32538 uint32_t __attribute__((export_name("TS_derive_private_revocation_key"))) TS_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
32539 unsigned char per_commitment_secret_arr[32];
32540 CHECK(per_commitment_secret->arr_len == 32);
32541 memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
32542 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
32543 unsigned char countersignatory_revocation_base_secret_arr[32];
32544 CHECK(countersignatory_revocation_base_secret->arr_len == 32);
32545 memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
32546 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
32547 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
32548 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
32549 return (uint32_t)ret_conv;
32552 uint32_t __attribute__((export_name("TS_derive_public_revocation_key"))) TS_derive_public_revocation_key(int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
32553 LDKPublicKey per_commitment_point_ref;
32554 CHECK(per_commitment_point->arr_len == 33);
32555 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
32556 LDKPublicKey countersignatory_revocation_base_point_ref;
32557 CHECK(countersignatory_revocation_base_point->arr_len == 33);
32558 memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point->elems, 33); FREE(countersignatory_revocation_base_point);
32559 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
32560 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
32561 return (uint32_t)ret_conv;
32564 void __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint32_t this_obj) {
32565 LDKTxCreationKeys this_obj_conv;
32566 this_obj_conv.inner = (void*)(this_obj & (~1));
32567 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32568 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32569 TxCreationKeys_free(this_obj_conv);
32572 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_per_commitment_point"))) TS_TxCreationKeys_get_per_commitment_point(uint32_t this_ptr) {
32573 LDKTxCreationKeys this_ptr_conv;
32574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32575 this_ptr_conv.is_owned = false;
32576 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32577 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32578 memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
32582 void __attribute__((export_name("TS_TxCreationKeys_set_per_commitment_point"))) TS_TxCreationKeys_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
32583 LDKTxCreationKeys this_ptr_conv;
32584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32585 this_ptr_conv.is_owned = false;
32586 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32587 LDKPublicKey val_ref;
32588 CHECK(val->arr_len == 33);
32589 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32590 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
32593 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_revocation_key"))) TS_TxCreationKeys_get_revocation_key(uint32_t this_ptr) {
32594 LDKTxCreationKeys this_ptr_conv;
32595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32596 this_ptr_conv.is_owned = false;
32597 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32598 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32599 memcpy(ret_arr->elems, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
32603 void __attribute__((export_name("TS_TxCreationKeys_set_revocation_key"))) TS_TxCreationKeys_set_revocation_key(uint32_t this_ptr, int8_tArray val) {
32604 LDKTxCreationKeys this_ptr_conv;
32605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32606 this_ptr_conv.is_owned = false;
32607 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32608 LDKPublicKey val_ref;
32609 CHECK(val->arr_len == 33);
32610 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32611 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
32614 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_htlc_key"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint32_t this_ptr) {
32615 LDKTxCreationKeys this_ptr_conv;
32616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32617 this_ptr_conv.is_owned = false;
32618 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32619 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32620 memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
32624 void __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_htlc_key"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint32_t this_ptr, int8_tArray val) {
32625 LDKTxCreationKeys 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 LDKPublicKey val_ref;
32630 CHECK(val->arr_len == 33);
32631 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32632 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
32635 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_countersignatory_htlc_key"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint32_t this_ptr) {
32636 LDKTxCreationKeys this_ptr_conv;
32637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32638 this_ptr_conv.is_owned = false;
32639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32640 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32641 memcpy(ret_arr->elems, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
32645 void __attribute__((export_name("TS_TxCreationKeys_set_countersignatory_htlc_key"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint32_t this_ptr, int8_tArray val) {
32646 LDKTxCreationKeys this_ptr_conv;
32647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32648 this_ptr_conv.is_owned = false;
32649 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32650 LDKPublicKey val_ref;
32651 CHECK(val->arr_len == 33);
32652 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32653 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
32656 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint32_t this_ptr) {
32657 LDKTxCreationKeys 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 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32662 memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
32666 void __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_set_broadcaster_delayed_payment_key(uint32_t this_ptr, int8_tArray val) {
32667 LDKTxCreationKeys this_ptr_conv;
32668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32669 this_ptr_conv.is_owned = false;
32670 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32671 LDKPublicKey val_ref;
32672 CHECK(val->arr_len == 33);
32673 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32674 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
32677 uint32_t __attribute__((export_name("TS_TxCreationKeys_new"))) TS_TxCreationKeys_new(int8_tArray per_commitment_point_arg, int8_tArray revocation_key_arg, int8_tArray broadcaster_htlc_key_arg, int8_tArray countersignatory_htlc_key_arg, int8_tArray broadcaster_delayed_payment_key_arg) {
32678 LDKPublicKey per_commitment_point_arg_ref;
32679 CHECK(per_commitment_point_arg->arr_len == 33);
32680 memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
32681 LDKPublicKey revocation_key_arg_ref;
32682 CHECK(revocation_key_arg->arr_len == 33);
32683 memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg->elems, 33); FREE(revocation_key_arg);
32684 LDKPublicKey broadcaster_htlc_key_arg_ref;
32685 CHECK(broadcaster_htlc_key_arg->arr_len == 33);
32686 memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg->elems, 33); FREE(broadcaster_htlc_key_arg);
32687 LDKPublicKey countersignatory_htlc_key_arg_ref;
32688 CHECK(countersignatory_htlc_key_arg->arr_len == 33);
32689 memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg->elems, 33); FREE(countersignatory_htlc_key_arg);
32690 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
32691 CHECK(broadcaster_delayed_payment_key_arg->arr_len == 33);
32692 memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg->elems, 33); FREE(broadcaster_delayed_payment_key_arg);
32693 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);
32694 uint32_t ret_ref = 0;
32695 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32696 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32697 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32698 ret_ref = (uintptr_t)ret_var.inner;
32699 if (ret_var.is_owned) {
32705 static inline uintptr_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
32706 LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
32707 uint32_t ret_ref = 0;
32708 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32709 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32710 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32711 ret_ref = (uintptr_t)ret_var.inner;
32712 if (ret_var.is_owned) {
32717 uint32_t __attribute__((export_name("TS_TxCreationKeys_clone_ptr"))) TS_TxCreationKeys_clone_ptr(uint32_t arg) {
32718 LDKTxCreationKeys arg_conv;
32719 arg_conv.inner = (void*)(arg & (~1));
32720 arg_conv.is_owned = false;
32721 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32722 uint32_t ret_val = TxCreationKeys_clone_ptr(&arg_conv);
32726 uint32_t __attribute__((export_name("TS_TxCreationKeys_clone"))) TS_TxCreationKeys_clone(uint32_t orig) {
32727 LDKTxCreationKeys orig_conv;
32728 orig_conv.inner = (void*)(orig & (~1));
32729 orig_conv.is_owned = false;
32730 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32731 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
32732 uint32_t ret_ref = 0;
32733 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32734 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32735 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32736 ret_ref = (uintptr_t)ret_var.inner;
32737 if (ret_var.is_owned) {
32743 int8_tArray __attribute__((export_name("TS_TxCreationKeys_write"))) TS_TxCreationKeys_write(uint32_t obj) {
32744 LDKTxCreationKeys obj_conv;
32745 obj_conv.inner = (void*)(obj & (~1));
32746 obj_conv.is_owned = false;
32747 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32748 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
32749 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32750 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32751 CVec_u8Z_free(ret_var);
32755 uint32_t __attribute__((export_name("TS_TxCreationKeys_read"))) TS_TxCreationKeys_read(int8_tArray ser) {
32756 LDKu8slice ser_ref;
32757 ser_ref.datalen = ser->arr_len;
32758 ser_ref.data = ser->elems /* XXX ser leaks */;
32759 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
32760 *ret_conv = TxCreationKeys_read(ser_ref);
32761 return (uint32_t)ret_conv;
32764 void __attribute__((export_name("TS_ChannelPublicKeys_free"))) TS_ChannelPublicKeys_free(uint32_t this_obj) {
32765 LDKChannelPublicKeys this_obj_conv;
32766 this_obj_conv.inner = (void*)(this_obj & (~1));
32767 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32768 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32769 ChannelPublicKeys_free(this_obj_conv);
32772 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_funding_pubkey"))) TS_ChannelPublicKeys_get_funding_pubkey(uint32_t this_ptr) {
32773 LDKChannelPublicKeys this_ptr_conv;
32774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32775 this_ptr_conv.is_owned = false;
32776 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32777 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32778 memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
32782 void __attribute__((export_name("TS_ChannelPublicKeys_set_funding_pubkey"))) TS_ChannelPublicKeys_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
32783 LDKChannelPublicKeys this_ptr_conv;
32784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32785 this_ptr_conv.is_owned = false;
32786 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32787 LDKPublicKey val_ref;
32788 CHECK(val->arr_len == 33);
32789 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32790 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
32793 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_revocation_basepoint"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint32_t this_ptr) {
32794 LDKChannelPublicKeys this_ptr_conv;
32795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32796 this_ptr_conv.is_owned = false;
32797 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32798 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32799 memcpy(ret_arr->elems, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
32803 void __attribute__((export_name("TS_ChannelPublicKeys_set_revocation_basepoint"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
32804 LDKChannelPublicKeys this_ptr_conv;
32805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32806 this_ptr_conv.is_owned = false;
32807 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32808 LDKPublicKey val_ref;
32809 CHECK(val->arr_len == 33);
32810 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32811 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
32814 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_payment_point"))) TS_ChannelPublicKeys_get_payment_point(uint32_t this_ptr) {
32815 LDKChannelPublicKeys this_ptr_conv;
32816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32817 this_ptr_conv.is_owned = false;
32818 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32819 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32820 memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
32824 void __attribute__((export_name("TS_ChannelPublicKeys_set_payment_point"))) TS_ChannelPublicKeys_set_payment_point(uint32_t this_ptr, int8_tArray val) {
32825 LDKChannelPublicKeys this_ptr_conv;
32826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32827 this_ptr_conv.is_owned = false;
32828 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32829 LDKPublicKey val_ref;
32830 CHECK(val->arr_len == 33);
32831 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32832 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
32835 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_delayed_payment_basepoint"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint32_t this_ptr) {
32836 LDKChannelPublicKeys this_ptr_conv;
32837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32838 this_ptr_conv.is_owned = false;
32839 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32840 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32841 memcpy(ret_arr->elems, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
32845 void __attribute__((export_name("TS_ChannelPublicKeys_set_delayed_payment_basepoint"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
32846 LDKChannelPublicKeys this_ptr_conv;
32847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32848 this_ptr_conv.is_owned = false;
32849 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32850 LDKPublicKey val_ref;
32851 CHECK(val->arr_len == 33);
32852 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32853 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
32856 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_htlc_basepoint"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint32_t this_ptr) {
32857 LDKChannelPublicKeys this_ptr_conv;
32858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32859 this_ptr_conv.is_owned = false;
32860 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32861 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32862 memcpy(ret_arr->elems, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
32866 void __attribute__((export_name("TS_ChannelPublicKeys_set_htlc_basepoint"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
32867 LDKChannelPublicKeys this_ptr_conv;
32868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32869 this_ptr_conv.is_owned = false;
32870 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32871 LDKPublicKey val_ref;
32872 CHECK(val->arr_len == 33);
32873 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32874 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
32877 uint32_t __attribute__((export_name("TS_ChannelPublicKeys_new"))) TS_ChannelPublicKeys_new(int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_point_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg) {
32878 LDKPublicKey funding_pubkey_arg_ref;
32879 CHECK(funding_pubkey_arg->arr_len == 33);
32880 memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
32881 LDKPublicKey revocation_basepoint_arg_ref;
32882 CHECK(revocation_basepoint_arg->arr_len == 33);
32883 memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
32884 LDKPublicKey payment_point_arg_ref;
32885 CHECK(payment_point_arg->arr_len == 33);
32886 memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
32887 LDKPublicKey delayed_payment_basepoint_arg_ref;
32888 CHECK(delayed_payment_basepoint_arg->arr_len == 33);
32889 memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
32890 LDKPublicKey htlc_basepoint_arg_ref;
32891 CHECK(htlc_basepoint_arg->arr_len == 33);
32892 memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
32893 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);
32894 uint32_t ret_ref = 0;
32895 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32896 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32897 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32898 ret_ref = (uintptr_t)ret_var.inner;
32899 if (ret_var.is_owned) {
32905 static inline uintptr_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
32906 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
32907 uint32_t ret_ref = 0;
32908 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32909 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32910 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32911 ret_ref = (uintptr_t)ret_var.inner;
32912 if (ret_var.is_owned) {
32917 uint32_t __attribute__((export_name("TS_ChannelPublicKeys_clone_ptr"))) TS_ChannelPublicKeys_clone_ptr(uint32_t arg) {
32918 LDKChannelPublicKeys arg_conv;
32919 arg_conv.inner = (void*)(arg & (~1));
32920 arg_conv.is_owned = false;
32921 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32922 uint32_t ret_val = ChannelPublicKeys_clone_ptr(&arg_conv);
32926 uint32_t __attribute__((export_name("TS_ChannelPublicKeys_clone"))) TS_ChannelPublicKeys_clone(uint32_t orig) {
32927 LDKChannelPublicKeys orig_conv;
32928 orig_conv.inner = (void*)(orig & (~1));
32929 orig_conv.is_owned = false;
32930 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32931 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
32932 uint32_t ret_ref = 0;
32933 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32934 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32935 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32936 ret_ref = (uintptr_t)ret_var.inner;
32937 if (ret_var.is_owned) {
32943 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_write"))) TS_ChannelPublicKeys_write(uint32_t obj) {
32944 LDKChannelPublicKeys obj_conv;
32945 obj_conv.inner = (void*)(obj & (~1));
32946 obj_conv.is_owned = false;
32947 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32948 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
32949 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32950 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32951 CVec_u8Z_free(ret_var);
32955 uint32_t __attribute__((export_name("TS_ChannelPublicKeys_read"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
32956 LDKu8slice ser_ref;
32957 ser_ref.datalen = ser->arr_len;
32958 ser_ref.data = ser->elems /* XXX ser leaks */;
32959 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
32960 *ret_conv = ChannelPublicKeys_read(ser_ref);
32961 return (uint32_t)ret_conv;
32964 uint32_t __attribute__((export_name("TS_TxCreationKeys_derive_new"))) TS_TxCreationKeys_derive_new(int8_tArray per_commitment_point, int8_tArray broadcaster_delayed_payment_base, int8_tArray broadcaster_htlc_base, int8_tArray countersignatory_revocation_base, int8_tArray countersignatory_htlc_base) {
32965 LDKPublicKey per_commitment_point_ref;
32966 CHECK(per_commitment_point->arr_len == 33);
32967 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
32968 LDKPublicKey broadcaster_delayed_payment_base_ref;
32969 CHECK(broadcaster_delayed_payment_base->arr_len == 33);
32970 memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base->elems, 33); FREE(broadcaster_delayed_payment_base);
32971 LDKPublicKey broadcaster_htlc_base_ref;
32972 CHECK(broadcaster_htlc_base->arr_len == 33);
32973 memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base->elems, 33); FREE(broadcaster_htlc_base);
32974 LDKPublicKey countersignatory_revocation_base_ref;
32975 CHECK(countersignatory_revocation_base->arr_len == 33);
32976 memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base->elems, 33); FREE(countersignatory_revocation_base);
32977 LDKPublicKey countersignatory_htlc_base_ref;
32978 CHECK(countersignatory_htlc_base->arr_len == 33);
32979 memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base->elems, 33); FREE(countersignatory_htlc_base);
32980 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
32981 *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);
32982 return (uint32_t)ret_conv;
32985 uint32_t __attribute__((export_name("TS_TxCreationKeys_from_channel_static_keys"))) TS_TxCreationKeys_from_channel_static_keys(int8_tArray per_commitment_point, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
32986 LDKPublicKey per_commitment_point_ref;
32987 CHECK(per_commitment_point->arr_len == 33);
32988 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
32989 LDKChannelPublicKeys broadcaster_keys_conv;
32990 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
32991 broadcaster_keys_conv.is_owned = false;
32992 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
32993 LDKChannelPublicKeys countersignatory_keys_conv;
32994 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
32995 countersignatory_keys_conv.is_owned = false;
32996 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
32997 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
32998 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
32999 return (uint32_t)ret_conv;
33002 int8_tArray __attribute__((export_name("TS_get_revokeable_redeemscript"))) TS_get_revokeable_redeemscript(int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
33003 LDKPublicKey revocation_key_ref;
33004 CHECK(revocation_key->arr_len == 33);
33005 memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
33006 LDKPublicKey broadcaster_delayed_payment_key_ref;
33007 CHECK(broadcaster_delayed_payment_key->arr_len == 33);
33008 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
33009 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
33010 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33011 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33012 CVec_u8Z_free(ret_var);
33016 void __attribute__((export_name("TS_HTLCOutputInCommitment_free"))) TS_HTLCOutputInCommitment_free(uint32_t this_obj) {
33017 LDKHTLCOutputInCommitment this_obj_conv;
33018 this_obj_conv.inner = (void*)(this_obj & (~1));
33019 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33020 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33021 HTLCOutputInCommitment_free(this_obj_conv);
33024 jboolean __attribute__((export_name("TS_HTLCOutputInCommitment_get_offered"))) TS_HTLCOutputInCommitment_get_offered(uint32_t this_ptr) {
33025 LDKHTLCOutputInCommitment this_ptr_conv;
33026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33027 this_ptr_conv.is_owned = false;
33028 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33029 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
33033 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_offered"))) TS_HTLCOutputInCommitment_set_offered(uint32_t this_ptr, jboolean val) {
33034 LDKHTLCOutputInCommitment 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 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
33041 int64_t __attribute__((export_name("TS_HTLCOutputInCommitment_get_amount_msat"))) TS_HTLCOutputInCommitment_get_amount_msat(uint32_t this_ptr) {
33042 LDKHTLCOutputInCommitment this_ptr_conv;
33043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33044 this_ptr_conv.is_owned = false;
33045 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33046 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
33050 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_amount_msat"))) TS_HTLCOutputInCommitment_set_amount_msat(uint32_t this_ptr, int64_t val) {
33051 LDKHTLCOutputInCommitment 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 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
33058 int32_t __attribute__((export_name("TS_HTLCOutputInCommitment_get_cltv_expiry"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint32_t this_ptr) {
33059 LDKHTLCOutputInCommitment this_ptr_conv;
33060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33061 this_ptr_conv.is_owned = false;
33062 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33063 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
33067 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_cltv_expiry"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
33068 LDKHTLCOutputInCommitment 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 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
33075 int8_tArray __attribute__((export_name("TS_HTLCOutputInCommitment_get_payment_hash"))) TS_HTLCOutputInCommitment_get_payment_hash(uint32_t this_ptr) {
33076 LDKHTLCOutputInCommitment this_ptr_conv;
33077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33078 this_ptr_conv.is_owned = false;
33079 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33080 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33081 memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
33085 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_payment_hash"))) TS_HTLCOutputInCommitment_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
33086 LDKHTLCOutputInCommitment this_ptr_conv;
33087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33088 this_ptr_conv.is_owned = false;
33089 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33090 LDKThirtyTwoBytes val_ref;
33091 CHECK(val->arr_len == 32);
33092 memcpy(val_ref.data, val->elems, 32); FREE(val);
33093 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
33096 uint32_t __attribute__((export_name("TS_HTLCOutputInCommitment_get_transaction_output_index"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint32_t this_ptr) {
33097 LDKHTLCOutputInCommitment this_ptr_conv;
33098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33099 this_ptr_conv.is_owned = false;
33100 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33101 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
33102 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
33103 uint32_t ret_ref = (uintptr_t)ret_copy;
33107 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_transaction_output_index"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint32_t this_ptr, uint32_t val) {
33108 LDKHTLCOutputInCommitment this_ptr_conv;
33109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33110 this_ptr_conv.is_owned = false;
33111 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33112 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
33113 CHECK_ACCESS(val_ptr);
33114 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
33115 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)val) & ~1));
33116 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
33119 uint32_t __attribute__((export_name("TS_HTLCOutputInCommitment_new"))) TS_HTLCOutputInCommitment_new(jboolean offered_arg, int64_t amount_msat_arg, int32_t cltv_expiry_arg, int8_tArray payment_hash_arg, uint32_t transaction_output_index_arg) {
33120 LDKThirtyTwoBytes payment_hash_arg_ref;
33121 CHECK(payment_hash_arg->arr_len == 32);
33122 memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
33123 void* transaction_output_index_arg_ptr = (void*)(((uintptr_t)transaction_output_index_arg) & ~1);
33124 CHECK_ACCESS(transaction_output_index_arg_ptr);
33125 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
33126 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)transaction_output_index_arg) & ~1));
33127 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
33128 uint32_t ret_ref = 0;
33129 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33130 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33131 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33132 ret_ref = (uintptr_t)ret_var.inner;
33133 if (ret_var.is_owned) {
33139 static inline uintptr_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
33140 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
33141 uint32_t ret_ref = 0;
33142 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33143 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33144 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33145 ret_ref = (uintptr_t)ret_var.inner;
33146 if (ret_var.is_owned) {
33151 uint32_t __attribute__((export_name("TS_HTLCOutputInCommitment_clone_ptr"))) TS_HTLCOutputInCommitment_clone_ptr(uint32_t arg) {
33152 LDKHTLCOutputInCommitment arg_conv;
33153 arg_conv.inner = (void*)(arg & (~1));
33154 arg_conv.is_owned = false;
33155 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33156 uint32_t ret_val = HTLCOutputInCommitment_clone_ptr(&arg_conv);
33160 uint32_t __attribute__((export_name("TS_HTLCOutputInCommitment_clone"))) TS_HTLCOutputInCommitment_clone(uint32_t orig) {
33161 LDKHTLCOutputInCommitment orig_conv;
33162 orig_conv.inner = (void*)(orig & (~1));
33163 orig_conv.is_owned = false;
33164 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33165 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
33166 uint32_t ret_ref = 0;
33167 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33168 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33169 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33170 ret_ref = (uintptr_t)ret_var.inner;
33171 if (ret_var.is_owned) {
33177 int8_tArray __attribute__((export_name("TS_HTLCOutputInCommitment_write"))) TS_HTLCOutputInCommitment_write(uint32_t obj) {
33178 LDKHTLCOutputInCommitment obj_conv;
33179 obj_conv.inner = (void*)(obj & (~1));
33180 obj_conv.is_owned = false;
33181 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33182 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
33183 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33184 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33185 CVec_u8Z_free(ret_var);
33189 uint32_t __attribute__((export_name("TS_HTLCOutputInCommitment_read"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
33190 LDKu8slice ser_ref;
33191 ser_ref.datalen = ser->arr_len;
33192 ser_ref.data = ser->elems /* XXX ser leaks */;
33193 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
33194 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
33195 return (uint32_t)ret_conv;
33198 int8_tArray __attribute__((export_name("TS_get_htlc_redeemscript"))) TS_get_htlc_redeemscript(uint32_t htlc, jboolean opt_anchors, uint32_t keys) {
33199 LDKHTLCOutputInCommitment htlc_conv;
33200 htlc_conv.inner = (void*)(htlc & (~1));
33201 htlc_conv.is_owned = false;
33202 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
33203 LDKTxCreationKeys keys_conv;
33204 keys_conv.inner = (void*)(keys & (~1));
33205 keys_conv.is_owned = false;
33206 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
33207 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
33208 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33209 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33210 CVec_u8Z_free(ret_var);
33214 int8_tArray __attribute__((export_name("TS_make_funding_redeemscript"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
33215 LDKPublicKey broadcaster_ref;
33216 CHECK(broadcaster->arr_len == 33);
33217 memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
33218 LDKPublicKey countersignatory_ref;
33219 CHECK(countersignatory->arr_len == 33);
33220 memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
33221 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
33222 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33223 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33224 CVec_u8Z_free(ret_var);
33228 int8_tArray __attribute__((export_name("TS_build_htlc_transaction"))) TS_build_htlc_transaction(int8_tArray commitment_txid, int32_t feerate_per_kw, int16_t contest_delay, uint32_t htlc, jboolean opt_anchors, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) {
33229 unsigned char commitment_txid_arr[32];
33230 CHECK(commitment_txid->arr_len == 32);
33231 memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
33232 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
33233 LDKHTLCOutputInCommitment htlc_conv;
33234 htlc_conv.inner = (void*)(htlc & (~1));
33235 htlc_conv.is_owned = false;
33236 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
33237 LDKPublicKey broadcaster_delayed_payment_key_ref;
33238 CHECK(broadcaster_delayed_payment_key->arr_len == 33);
33239 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
33240 LDKPublicKey revocation_key_ref;
33241 CHECK(revocation_key->arr_len == 33);
33242 memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
33243 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);
33244 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33245 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33246 Transaction_free(ret_var);
33250 int8_tArray __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
33251 LDKPublicKey funding_pubkey_ref;
33252 CHECK(funding_pubkey->arr_len == 33);
33253 memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
33254 LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
33255 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33256 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33257 CVec_u8Z_free(ret_var);
33261 void __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint32_t this_obj) {
33262 LDKChannelTransactionParameters this_obj_conv;
33263 this_obj_conv.inner = (void*)(this_obj & (~1));
33264 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33265 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33266 ChannelTransactionParameters_free(this_obj_conv);
33269 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_pubkeys"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint32_t this_ptr) {
33270 LDKChannelTransactionParameters this_ptr_conv;
33271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33272 this_ptr_conv.is_owned = false;
33273 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33274 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
33275 uint32_t ret_ref = 0;
33276 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33277 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33278 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33279 ret_ref = (uintptr_t)ret_var.inner;
33280 if (ret_var.is_owned) {
33286 void __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_pubkeys"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint32_t this_ptr, uint32_t val) {
33287 LDKChannelTransactionParameters this_ptr_conv;
33288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33289 this_ptr_conv.is_owned = false;
33290 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33291 LDKChannelPublicKeys val_conv;
33292 val_conv.inner = (void*)(val & (~1));
33293 val_conv.is_owned = (val & 1) || (val == 0);
33294 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33295 val_conv = ChannelPublicKeys_clone(&val_conv);
33296 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
33299 int16_t __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint32_t this_ptr) {
33300 LDKChannelTransactionParameters 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 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
33308 void __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_set_holder_selected_contest_delay(uint32_t this_ptr, int16_t val) {
33309 LDKChannelTransactionParameters this_ptr_conv;
33310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33311 this_ptr_conv.is_owned = false;
33312 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33313 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
33316 jboolean __attribute__((export_name("TS_ChannelTransactionParameters_get_is_outbound_from_holder"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint32_t this_ptr) {
33317 LDKChannelTransactionParameters this_ptr_conv;
33318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33319 this_ptr_conv.is_owned = false;
33320 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33321 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
33325 void __attribute__((export_name("TS_ChannelTransactionParameters_set_is_outbound_from_holder"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint32_t this_ptr, jboolean val) {
33326 LDKChannelTransactionParameters this_ptr_conv;
33327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33328 this_ptr_conv.is_owned = false;
33329 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33330 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
33333 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_get_counterparty_parameters"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint32_t this_ptr) {
33334 LDKChannelTransactionParameters this_ptr_conv;
33335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33336 this_ptr_conv.is_owned = false;
33337 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33338 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
33339 uint32_t ret_ref = 0;
33340 if ((uintptr_t)ret_var.inner > 4096) {
33341 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33342 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33343 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33344 ret_ref = (uintptr_t)ret_var.inner;
33345 if (ret_var.is_owned) {
33352 void __attribute__((export_name("TS_ChannelTransactionParameters_set_counterparty_parameters"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint32_t this_ptr, uint32_t val) {
33353 LDKChannelTransactionParameters this_ptr_conv;
33354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33355 this_ptr_conv.is_owned = false;
33356 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33357 LDKCounterpartyChannelTransactionParameters val_conv;
33358 val_conv.inner = (void*)(val & (~1));
33359 val_conv.is_owned = (val & 1) || (val == 0);
33360 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33361 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
33362 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
33365 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_get_funding_outpoint"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint32_t this_ptr) {
33366 LDKChannelTransactionParameters this_ptr_conv;
33367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33368 this_ptr_conv.is_owned = false;
33369 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33370 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
33371 uint32_t ret_ref = 0;
33372 if ((uintptr_t)ret_var.inner > 4096) {
33373 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33374 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33375 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33376 ret_ref = (uintptr_t)ret_var.inner;
33377 if (ret_var.is_owned) {
33384 void __attribute__((export_name("TS_ChannelTransactionParameters_set_funding_outpoint"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint32_t this_ptr, uint32_t val) {
33385 LDKChannelTransactionParameters this_ptr_conv;
33386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33387 this_ptr_conv.is_owned = false;
33388 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33389 LDKOutPoint val_conv;
33390 val_conv.inner = (void*)(val & (~1));
33391 val_conv.is_owned = (val & 1) || (val == 0);
33392 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33393 val_conv = OutPoint_clone(&val_conv);
33394 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
33397 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_get_opt_anchors"))) TS_ChannelTransactionParameters_get_opt_anchors(uint32_t this_ptr) {
33398 LDKChannelTransactionParameters this_ptr_conv;
33399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33400 this_ptr_conv.is_owned = false;
33401 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33402 uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
33406 void __attribute__((export_name("TS_ChannelTransactionParameters_set_opt_anchors"))) TS_ChannelTransactionParameters_set_opt_anchors(uint32_t this_ptr, uint32_t val) {
33407 LDKChannelTransactionParameters this_ptr_conv;
33408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33409 this_ptr_conv.is_owned = false;
33410 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33411 LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
33412 ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
33415 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_new"))) TS_ChannelTransactionParameters_new(uint32_t holder_pubkeys_arg, int16_t holder_selected_contest_delay_arg, jboolean is_outbound_from_holder_arg, uint32_t counterparty_parameters_arg, uint32_t funding_outpoint_arg, uint32_t opt_anchors_arg) {
33416 LDKChannelPublicKeys holder_pubkeys_arg_conv;
33417 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
33418 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
33419 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
33420 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
33421 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
33422 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
33423 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
33424 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
33425 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
33426 LDKOutPoint funding_outpoint_arg_conv;
33427 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
33428 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
33429 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
33430 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
33431 LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_anchors_arg);
33432 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);
33433 uint32_t ret_ref = 0;
33434 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33435 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33436 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33437 ret_ref = (uintptr_t)ret_var.inner;
33438 if (ret_var.is_owned) {
33444 static inline uintptr_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
33445 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
33446 uint32_t ret_ref = 0;
33447 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33448 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33449 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33450 ret_ref = (uintptr_t)ret_var.inner;
33451 if (ret_var.is_owned) {
33456 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_clone_ptr"))) TS_ChannelTransactionParameters_clone_ptr(uint32_t arg) {
33457 LDKChannelTransactionParameters arg_conv;
33458 arg_conv.inner = (void*)(arg & (~1));
33459 arg_conv.is_owned = false;
33460 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33461 uint32_t ret_val = ChannelTransactionParameters_clone_ptr(&arg_conv);
33465 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_clone"))) TS_ChannelTransactionParameters_clone(uint32_t orig) {
33466 LDKChannelTransactionParameters orig_conv;
33467 orig_conv.inner = (void*)(orig & (~1));
33468 orig_conv.is_owned = false;
33469 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33470 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
33471 uint32_t ret_ref = 0;
33472 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33473 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33474 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33475 ret_ref = (uintptr_t)ret_var.inner;
33476 if (ret_var.is_owned) {
33482 void __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_free"))) TS_CounterpartyChannelTransactionParameters_free(uint32_t this_obj) {
33483 LDKCounterpartyChannelTransactionParameters this_obj_conv;
33484 this_obj_conv.inner = (void*)(this_obj & (~1));
33485 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33486 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33487 CounterpartyChannelTransactionParameters_free(this_obj_conv);
33490 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_pubkeys"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint32_t this_ptr) {
33491 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
33492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33493 this_ptr_conv.is_owned = false;
33494 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33495 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
33496 uint32_t ret_ref = 0;
33497 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33498 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33499 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33500 ret_ref = (uintptr_t)ret_var.inner;
33501 if (ret_var.is_owned) {
33507 void __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_pubkeys"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint32_t this_ptr, uint32_t val) {
33508 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
33509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33510 this_ptr_conv.is_owned = false;
33511 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33512 LDKChannelPublicKeys val_conv;
33513 val_conv.inner = (void*)(val & (~1));
33514 val_conv.is_owned = (val & 1) || (val == 0);
33515 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33516 val_conv = ChannelPublicKeys_clone(&val_conv);
33517 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
33520 int16_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint32_t this_ptr) {
33521 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
33522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33523 this_ptr_conv.is_owned = false;
33524 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33525 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
33529 void __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint32_t this_ptr, int16_t val) {
33530 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
33531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33532 this_ptr_conv.is_owned = false;
33533 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33534 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
33537 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_new"))) TS_CounterpartyChannelTransactionParameters_new(uint32_t pubkeys_arg, int16_t selected_contest_delay_arg) {
33538 LDKChannelPublicKeys pubkeys_arg_conv;
33539 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
33540 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
33541 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
33542 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
33543 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
33544 uint32_t ret_ref = 0;
33545 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33546 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33547 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33548 ret_ref = (uintptr_t)ret_var.inner;
33549 if (ret_var.is_owned) {
33555 static inline uintptr_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
33556 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
33557 uint32_t ret_ref = 0;
33558 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33559 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33560 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33561 ret_ref = (uintptr_t)ret_var.inner;
33562 if (ret_var.is_owned) {
33567 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone_ptr"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint32_t arg) {
33568 LDKCounterpartyChannelTransactionParameters arg_conv;
33569 arg_conv.inner = (void*)(arg & (~1));
33570 arg_conv.is_owned = false;
33571 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33572 uint32_t ret_val = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
33576 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone"))) TS_CounterpartyChannelTransactionParameters_clone(uint32_t orig) {
33577 LDKCounterpartyChannelTransactionParameters orig_conv;
33578 orig_conv.inner = (void*)(orig & (~1));
33579 orig_conv.is_owned = false;
33580 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33581 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
33582 uint32_t ret_ref = 0;
33583 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33584 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33585 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33586 ret_ref = (uintptr_t)ret_var.inner;
33587 if (ret_var.is_owned) {
33593 jboolean __attribute__((export_name("TS_ChannelTransactionParameters_is_populated"))) TS_ChannelTransactionParameters_is_populated(uint32_t this_arg) {
33594 LDKChannelTransactionParameters this_arg_conv;
33595 this_arg_conv.inner = (void*)(this_arg & (~1));
33596 this_arg_conv.is_owned = false;
33597 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33598 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
33602 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_as_holder_broadcastable"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint32_t this_arg) {
33603 LDKChannelTransactionParameters this_arg_conv;
33604 this_arg_conv.inner = (void*)(this_arg & (~1));
33605 this_arg_conv.is_owned = false;
33606 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33607 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
33608 uint32_t ret_ref = 0;
33609 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33610 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33611 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33612 ret_ref = (uintptr_t)ret_var.inner;
33613 if (ret_var.is_owned) {
33619 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_as_counterparty_broadcastable"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint32_t this_arg) {
33620 LDKChannelTransactionParameters this_arg_conv;
33621 this_arg_conv.inner = (void*)(this_arg & (~1));
33622 this_arg_conv.is_owned = false;
33623 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33624 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
33625 uint32_t ret_ref = 0;
33626 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33627 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33628 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33629 ret_ref = (uintptr_t)ret_var.inner;
33630 if (ret_var.is_owned) {
33636 int8_tArray __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_write"))) TS_CounterpartyChannelTransactionParameters_write(uint32_t obj) {
33637 LDKCounterpartyChannelTransactionParameters obj_conv;
33638 obj_conv.inner = (void*)(obj & (~1));
33639 obj_conv.is_owned = false;
33640 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33641 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
33642 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33643 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33644 CVec_u8Z_free(ret_var);
33648 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_read"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
33649 LDKu8slice ser_ref;
33650 ser_ref.datalen = ser->arr_len;
33651 ser_ref.data = ser->elems /* XXX ser leaks */;
33652 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
33653 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
33654 return (uint32_t)ret_conv;
33657 int8_tArray __attribute__((export_name("TS_ChannelTransactionParameters_write"))) TS_ChannelTransactionParameters_write(uint32_t obj) {
33658 LDKChannelTransactionParameters obj_conv;
33659 obj_conv.inner = (void*)(obj & (~1));
33660 obj_conv.is_owned = false;
33661 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33662 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
33663 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33664 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33665 CVec_u8Z_free(ret_var);
33669 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_read"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
33670 LDKu8slice ser_ref;
33671 ser_ref.datalen = ser->arr_len;
33672 ser_ref.data = ser->elems /* XXX ser leaks */;
33673 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
33674 *ret_conv = ChannelTransactionParameters_read(ser_ref);
33675 return (uint32_t)ret_conv;
33678 void __attribute__((export_name("TS_DirectedChannelTransactionParameters_free"))) TS_DirectedChannelTransactionParameters_free(uint32_t this_obj) {
33679 LDKDirectedChannelTransactionParameters this_obj_conv;
33680 this_obj_conv.inner = (void*)(this_obj & (~1));
33681 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33682 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33683 DirectedChannelTransactionParameters_free(this_obj_conv);
33686 uint32_t __attribute__((export_name("TS_DirectedChannelTransactionParameters_broadcaster_pubkeys"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint32_t this_arg) {
33687 LDKDirectedChannelTransactionParameters this_arg_conv;
33688 this_arg_conv.inner = (void*)(this_arg & (~1));
33689 this_arg_conv.is_owned = false;
33690 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33691 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
33692 uint32_t ret_ref = 0;
33693 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33694 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33695 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33696 ret_ref = (uintptr_t)ret_var.inner;
33697 if (ret_var.is_owned) {
33703 uint32_t __attribute__((export_name("TS_DirectedChannelTransactionParameters_countersignatory_pubkeys"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint32_t this_arg) {
33704 LDKDirectedChannelTransactionParameters this_arg_conv;
33705 this_arg_conv.inner = (void*)(this_arg & (~1));
33706 this_arg_conv.is_owned = false;
33707 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33708 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
33709 uint32_t ret_ref = 0;
33710 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33711 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33712 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33713 ret_ref = (uintptr_t)ret_var.inner;
33714 if (ret_var.is_owned) {
33720 int16_t __attribute__((export_name("TS_DirectedChannelTransactionParameters_contest_delay"))) TS_DirectedChannelTransactionParameters_contest_delay(uint32_t this_arg) {
33721 LDKDirectedChannelTransactionParameters this_arg_conv;
33722 this_arg_conv.inner = (void*)(this_arg & (~1));
33723 this_arg_conv.is_owned = false;
33724 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33725 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
33729 jboolean __attribute__((export_name("TS_DirectedChannelTransactionParameters_is_outbound"))) TS_DirectedChannelTransactionParameters_is_outbound(uint32_t this_arg) {
33730 LDKDirectedChannelTransactionParameters this_arg_conv;
33731 this_arg_conv.inner = (void*)(this_arg & (~1));
33732 this_arg_conv.is_owned = false;
33733 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33734 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
33738 uint32_t __attribute__((export_name("TS_DirectedChannelTransactionParameters_funding_outpoint"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint32_t this_arg) {
33739 LDKDirectedChannelTransactionParameters this_arg_conv;
33740 this_arg_conv.inner = (void*)(this_arg & (~1));
33741 this_arg_conv.is_owned = false;
33742 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33743 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
33744 uint32_t ret_ref = 0;
33745 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33746 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33747 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33748 ret_ref = (uintptr_t)ret_var.inner;
33749 if (ret_var.is_owned) {
33755 jboolean __attribute__((export_name("TS_DirectedChannelTransactionParameters_opt_anchors"))) TS_DirectedChannelTransactionParameters_opt_anchors(uint32_t this_arg) {
33756 LDKDirectedChannelTransactionParameters this_arg_conv;
33757 this_arg_conv.inner = (void*)(this_arg & (~1));
33758 this_arg_conv.is_owned = false;
33759 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33760 jboolean ret_val = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
33764 void __attribute__((export_name("TS_HolderCommitmentTransaction_free"))) TS_HolderCommitmentTransaction_free(uint32_t this_obj) {
33765 LDKHolderCommitmentTransaction this_obj_conv;
33766 this_obj_conv.inner = (void*)(this_obj & (~1));
33767 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33768 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33769 HolderCommitmentTransaction_free(this_obj_conv);
33772 int8_tArray __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_sig"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint32_t this_ptr) {
33773 LDKHolderCommitmentTransaction this_ptr_conv;
33774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33775 this_ptr_conv.is_owned = false;
33776 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33777 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
33778 memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
33782 void __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_sig"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint32_t this_ptr, int8_tArray val) {
33783 LDKHolderCommitmentTransaction this_ptr_conv;
33784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33785 this_ptr_conv.is_owned = false;
33786 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33787 LDKSignature val_ref;
33788 CHECK(val->arr_len == 64);
33789 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
33790 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
33793 void __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint32_t this_ptr, ptrArray val) {
33794 LDKHolderCommitmentTransaction this_ptr_conv;
33795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33796 this_ptr_conv.is_owned = false;
33797 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33798 LDKCVec_SignatureZ val_constr;
33799 val_constr.datalen = val->arr_len;
33800 if (val_constr.datalen > 0)
33801 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
33803 val_constr.data = NULL;
33804 int8_tArray* val_vals = (void*) val->elems /* XXX val leaks */;
33805 for (size_t m = 0; m < val_constr.datalen; m++) {
33806 int8_tArray val_conv_12 = val_vals[m];
33807 LDKSignature val_conv_12_ref;
33808 CHECK(val_conv_12->arr_len == 64);
33809 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
33810 val_constr.data[m] = val_conv_12_ref;
33812 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
33815 static inline uintptr_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
33816 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
33817 uint32_t ret_ref = 0;
33818 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33819 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33820 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33821 ret_ref = (uintptr_t)ret_var.inner;
33822 if (ret_var.is_owned) {
33827 uint32_t __attribute__((export_name("TS_HolderCommitmentTransaction_clone_ptr"))) TS_HolderCommitmentTransaction_clone_ptr(uint32_t arg) {
33828 LDKHolderCommitmentTransaction arg_conv;
33829 arg_conv.inner = (void*)(arg & (~1));
33830 arg_conv.is_owned = false;
33831 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33832 uint32_t ret_val = HolderCommitmentTransaction_clone_ptr(&arg_conv);
33836 uint32_t __attribute__((export_name("TS_HolderCommitmentTransaction_clone"))) TS_HolderCommitmentTransaction_clone(uint32_t orig) {
33837 LDKHolderCommitmentTransaction orig_conv;
33838 orig_conv.inner = (void*)(orig & (~1));
33839 orig_conv.is_owned = false;
33840 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33841 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
33842 uint32_t ret_ref = 0;
33843 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33844 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33845 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33846 ret_ref = (uintptr_t)ret_var.inner;
33847 if (ret_var.is_owned) {
33853 int8_tArray __attribute__((export_name("TS_HolderCommitmentTransaction_write"))) TS_HolderCommitmentTransaction_write(uint32_t obj) {
33854 LDKHolderCommitmentTransaction obj_conv;
33855 obj_conv.inner = (void*)(obj & (~1));
33856 obj_conv.is_owned = false;
33857 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33858 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
33859 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33860 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33861 CVec_u8Z_free(ret_var);
33865 uint32_t __attribute__((export_name("TS_HolderCommitmentTransaction_read"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
33866 LDKu8slice ser_ref;
33867 ser_ref.datalen = ser->arr_len;
33868 ser_ref.data = ser->elems /* XXX ser leaks */;
33869 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
33870 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
33871 return (uint32_t)ret_conv;
33874 uint32_t __attribute__((export_name("TS_HolderCommitmentTransaction_new"))) TS_HolderCommitmentTransaction_new(uint32_t commitment_tx, int8_tArray counterparty_sig, ptrArray counterparty_htlc_sigs, int8_tArray holder_funding_key, int8_tArray counterparty_funding_key) {
33875 LDKCommitmentTransaction commitment_tx_conv;
33876 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
33877 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
33878 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
33879 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
33880 LDKSignature counterparty_sig_ref;
33881 CHECK(counterparty_sig->arr_len == 64);
33882 memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
33883 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
33884 counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
33885 if (counterparty_htlc_sigs_constr.datalen > 0)
33886 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
33888 counterparty_htlc_sigs_constr.data = NULL;
33889 int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems /* XXX counterparty_htlc_sigs leaks */;
33890 for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
33891 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
33892 LDKSignature counterparty_htlc_sigs_conv_12_ref;
33893 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
33894 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64); FREE(counterparty_htlc_sigs_conv_12);
33895 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
33897 LDKPublicKey holder_funding_key_ref;
33898 CHECK(holder_funding_key->arr_len == 33);
33899 memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
33900 LDKPublicKey counterparty_funding_key_ref;
33901 CHECK(counterparty_funding_key->arr_len == 33);
33902 memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
33903 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
33904 uint32_t ret_ref = 0;
33905 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33906 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33907 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33908 ret_ref = (uintptr_t)ret_var.inner;
33909 if (ret_var.is_owned) {
33915 void __attribute__((export_name("TS_BuiltCommitmentTransaction_free"))) TS_BuiltCommitmentTransaction_free(uint32_t this_obj) {
33916 LDKBuiltCommitmentTransaction this_obj_conv;
33917 this_obj_conv.inner = (void*)(this_obj & (~1));
33918 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33919 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33920 BuiltCommitmentTransaction_free(this_obj_conv);
33923 int8_tArray __attribute__((export_name("TS_BuiltCommitmentTransaction_get_transaction"))) TS_BuiltCommitmentTransaction_get_transaction(uint32_t this_ptr) {
33924 LDKBuiltCommitmentTransaction this_ptr_conv;
33925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33926 this_ptr_conv.is_owned = false;
33927 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33928 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
33929 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33930 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33931 Transaction_free(ret_var);
33935 void __attribute__((export_name("TS_BuiltCommitmentTransaction_set_transaction"))) TS_BuiltCommitmentTransaction_set_transaction(uint32_t this_ptr, int8_tArray val) {
33936 LDKBuiltCommitmentTransaction this_ptr_conv;
33937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33938 this_ptr_conv.is_owned = false;
33939 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33940 LDKTransaction val_ref;
33941 val_ref.datalen = val->arr_len;
33942 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
33943 memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
33944 val_ref.data_is_owned = true;
33945 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
33948 int8_tArray __attribute__((export_name("TS_BuiltCommitmentTransaction_get_txid"))) TS_BuiltCommitmentTransaction_get_txid(uint32_t this_ptr) {
33949 LDKBuiltCommitmentTransaction this_ptr_conv;
33950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33951 this_ptr_conv.is_owned = false;
33952 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33953 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33954 memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
33958 void __attribute__((export_name("TS_BuiltCommitmentTransaction_set_txid"))) TS_BuiltCommitmentTransaction_set_txid(uint32_t this_ptr, int8_tArray val) {
33959 LDKBuiltCommitmentTransaction this_ptr_conv;
33960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33961 this_ptr_conv.is_owned = false;
33962 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33963 LDKThirtyTwoBytes val_ref;
33964 CHECK(val->arr_len == 32);
33965 memcpy(val_ref.data, val->elems, 32); FREE(val);
33966 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
33969 uint32_t __attribute__((export_name("TS_BuiltCommitmentTransaction_new"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
33970 LDKTransaction transaction_arg_ref;
33971 transaction_arg_ref.datalen = transaction_arg->arr_len;
33972 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
33973 memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
33974 transaction_arg_ref.data_is_owned = true;
33975 LDKThirtyTwoBytes txid_arg_ref;
33976 CHECK(txid_arg->arr_len == 32);
33977 memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
33978 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
33979 uint32_t ret_ref = 0;
33980 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33981 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33982 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33983 ret_ref = (uintptr_t)ret_var.inner;
33984 if (ret_var.is_owned) {
33990 static inline uintptr_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
33991 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
33992 uint32_t ret_ref = 0;
33993 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33994 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33995 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33996 ret_ref = (uintptr_t)ret_var.inner;
33997 if (ret_var.is_owned) {
34002 uint32_t __attribute__((export_name("TS_BuiltCommitmentTransaction_clone_ptr"))) TS_BuiltCommitmentTransaction_clone_ptr(uint32_t arg) {
34003 LDKBuiltCommitmentTransaction arg_conv;
34004 arg_conv.inner = (void*)(arg & (~1));
34005 arg_conv.is_owned = false;
34006 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34007 uint32_t ret_val = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
34011 uint32_t __attribute__((export_name("TS_BuiltCommitmentTransaction_clone"))) TS_BuiltCommitmentTransaction_clone(uint32_t orig) {
34012 LDKBuiltCommitmentTransaction orig_conv;
34013 orig_conv.inner = (void*)(orig & (~1));
34014 orig_conv.is_owned = false;
34015 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34016 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
34017 uint32_t ret_ref = 0;
34018 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34019 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34020 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34021 ret_ref = (uintptr_t)ret_var.inner;
34022 if (ret_var.is_owned) {
34028 int8_tArray __attribute__((export_name("TS_BuiltCommitmentTransaction_write"))) TS_BuiltCommitmentTransaction_write(uint32_t obj) {
34029 LDKBuiltCommitmentTransaction obj_conv;
34030 obj_conv.inner = (void*)(obj & (~1));
34031 obj_conv.is_owned = false;
34032 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34033 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
34034 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34035 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34036 CVec_u8Z_free(ret_var);
34040 uint32_t __attribute__((export_name("TS_BuiltCommitmentTransaction_read"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
34041 LDKu8slice ser_ref;
34042 ser_ref.datalen = ser->arr_len;
34043 ser_ref.data = ser->elems /* XXX ser leaks */;
34044 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
34045 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
34046 return (uint32_t)ret_conv;
34049 int8_tArray __attribute__((export_name("TS_BuiltCommitmentTransaction_get_sighash_all"))) TS_BuiltCommitmentTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
34050 LDKBuiltCommitmentTransaction this_arg_conv;
34051 this_arg_conv.inner = (void*)(this_arg & (~1));
34052 this_arg_conv.is_owned = false;
34053 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34054 LDKu8slice funding_redeemscript_ref;
34055 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
34056 funding_redeemscript_ref.data = funding_redeemscript->elems /* XXX funding_redeemscript leaks */;
34057 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34058 memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
34062 int8_tArray __attribute__((export_name("TS_BuiltCommitmentTransaction_sign"))) TS_BuiltCommitmentTransaction_sign(uint32_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
34063 LDKBuiltCommitmentTransaction this_arg_conv;
34064 this_arg_conv.inner = (void*)(this_arg & (~1));
34065 this_arg_conv.is_owned = false;
34066 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34067 unsigned char funding_key_arr[32];
34068 CHECK(funding_key->arr_len == 32);
34069 memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
34070 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
34071 LDKu8slice funding_redeemscript_ref;
34072 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
34073 funding_redeemscript_ref.data = funding_redeemscript->elems /* XXX funding_redeemscript leaks */;
34074 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34075 memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
34079 void __attribute__((export_name("TS_ClosingTransaction_free"))) TS_ClosingTransaction_free(uint32_t this_obj) {
34080 LDKClosingTransaction this_obj_conv;
34081 this_obj_conv.inner = (void*)(this_obj & (~1));
34082 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34083 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34084 ClosingTransaction_free(this_obj_conv);
34087 static inline uintptr_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
34088 LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
34089 uint32_t ret_ref = 0;
34090 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34091 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34092 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34093 ret_ref = (uintptr_t)ret_var.inner;
34094 if (ret_var.is_owned) {
34099 uint32_t __attribute__((export_name("TS_ClosingTransaction_clone_ptr"))) TS_ClosingTransaction_clone_ptr(uint32_t arg) {
34100 LDKClosingTransaction arg_conv;
34101 arg_conv.inner = (void*)(arg & (~1));
34102 arg_conv.is_owned = false;
34103 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34104 uint32_t ret_val = ClosingTransaction_clone_ptr(&arg_conv);
34108 uint32_t __attribute__((export_name("TS_ClosingTransaction_clone"))) TS_ClosingTransaction_clone(uint32_t orig) {
34109 LDKClosingTransaction orig_conv;
34110 orig_conv.inner = (void*)(orig & (~1));
34111 orig_conv.is_owned = false;
34112 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34113 LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
34114 uint32_t ret_ref = 0;
34115 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34116 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34117 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34118 ret_ref = (uintptr_t)ret_var.inner;
34119 if (ret_var.is_owned) {
34125 int64_t __attribute__((export_name("TS_ClosingTransaction_hash"))) TS_ClosingTransaction_hash(uint32_t o) {
34126 LDKClosingTransaction o_conv;
34127 o_conv.inner = (void*)(o & (~1));
34128 o_conv.is_owned = false;
34129 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34130 int64_t ret_val = ClosingTransaction_hash(&o_conv);
34134 uint32_t __attribute__((export_name("TS_ClosingTransaction_new"))) TS_ClosingTransaction_new(int64_t to_holder_value_sat, int64_t to_counterparty_value_sat, int8_tArray to_holder_script, int8_tArray to_counterparty_script, uint32_t funding_outpoint) {
34135 LDKCVec_u8Z to_holder_script_ref;
34136 to_holder_script_ref.datalen = to_holder_script->arr_len;
34137 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
34138 memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
34139 LDKCVec_u8Z to_counterparty_script_ref;
34140 to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
34141 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
34142 memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
34143 LDKOutPoint funding_outpoint_conv;
34144 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
34145 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
34146 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
34147 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
34148 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
34149 uint32_t ret_ref = 0;
34150 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34151 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34152 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34153 ret_ref = (uintptr_t)ret_var.inner;
34154 if (ret_var.is_owned) {
34160 uint32_t __attribute__((export_name("TS_ClosingTransaction_trust"))) TS_ClosingTransaction_trust(uint32_t this_arg) {
34161 LDKClosingTransaction this_arg_conv;
34162 this_arg_conv.inner = (void*)(this_arg & (~1));
34163 this_arg_conv.is_owned = false;
34164 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34165 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
34166 uint32_t ret_ref = 0;
34167 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34168 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34169 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34170 ret_ref = (uintptr_t)ret_var.inner;
34171 if (ret_var.is_owned) {
34177 uint32_t __attribute__((export_name("TS_ClosingTransaction_verify"))) TS_ClosingTransaction_verify(uint32_t this_arg, uint32_t funding_outpoint) {
34178 LDKClosingTransaction this_arg_conv;
34179 this_arg_conv.inner = (void*)(this_arg & (~1));
34180 this_arg_conv.is_owned = false;
34181 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34182 LDKOutPoint funding_outpoint_conv;
34183 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
34184 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
34185 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
34186 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
34187 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
34188 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
34189 return (uint32_t)ret_conv;
34192 int64_t __attribute__((export_name("TS_ClosingTransaction_to_holder_value_sat"))) TS_ClosingTransaction_to_holder_value_sat(uint32_t this_arg) {
34193 LDKClosingTransaction this_arg_conv;
34194 this_arg_conv.inner = (void*)(this_arg & (~1));
34195 this_arg_conv.is_owned = false;
34196 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34197 int64_t ret_val = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
34201 int64_t __attribute__((export_name("TS_ClosingTransaction_to_counterparty_value_sat"))) TS_ClosingTransaction_to_counterparty_value_sat(uint32_t this_arg) {
34202 LDKClosingTransaction this_arg_conv;
34203 this_arg_conv.inner = (void*)(this_arg & (~1));
34204 this_arg_conv.is_owned = false;
34205 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34206 int64_t ret_val = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
34210 int8_tArray __attribute__((export_name("TS_ClosingTransaction_to_holder_script"))) TS_ClosingTransaction_to_holder_script(uint32_t this_arg) {
34211 LDKClosingTransaction this_arg_conv;
34212 this_arg_conv.inner = (void*)(this_arg & (~1));
34213 this_arg_conv.is_owned = false;
34214 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34215 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
34216 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34217 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34221 int8_tArray __attribute__((export_name("TS_ClosingTransaction_to_counterparty_script"))) TS_ClosingTransaction_to_counterparty_script(uint32_t this_arg) {
34222 LDKClosingTransaction this_arg_conv;
34223 this_arg_conv.inner = (void*)(this_arg & (~1));
34224 this_arg_conv.is_owned = false;
34225 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34226 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
34227 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34228 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34232 void __attribute__((export_name("TS_TrustedClosingTransaction_free"))) TS_TrustedClosingTransaction_free(uint32_t this_obj) {
34233 LDKTrustedClosingTransaction this_obj_conv;
34234 this_obj_conv.inner = (void*)(this_obj & (~1));
34235 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34236 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34237 TrustedClosingTransaction_free(this_obj_conv);
34240 int8_tArray __attribute__((export_name("TS_TrustedClosingTransaction_built_transaction"))) TS_TrustedClosingTransaction_built_transaction(uint32_t this_arg) {
34241 LDKTrustedClosingTransaction this_arg_conv;
34242 this_arg_conv.inner = (void*)(this_arg & (~1));
34243 this_arg_conv.is_owned = false;
34244 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34245 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
34246 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34247 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34248 Transaction_free(ret_var);
34252 int8_tArray __attribute__((export_name("TS_TrustedClosingTransaction_get_sighash_all"))) TS_TrustedClosingTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
34253 LDKTrustedClosingTransaction this_arg_conv;
34254 this_arg_conv.inner = (void*)(this_arg & (~1));
34255 this_arg_conv.is_owned = false;
34256 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34257 LDKu8slice funding_redeemscript_ref;
34258 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
34259 funding_redeemscript_ref.data = funding_redeemscript->elems /* XXX funding_redeemscript leaks */;
34260 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34261 memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
34265 int8_tArray __attribute__((export_name("TS_TrustedClosingTransaction_sign"))) TS_TrustedClosingTransaction_sign(uint32_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
34266 LDKTrustedClosingTransaction this_arg_conv;
34267 this_arg_conv.inner = (void*)(this_arg & (~1));
34268 this_arg_conv.is_owned = false;
34269 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34270 unsigned char funding_key_arr[32];
34271 CHECK(funding_key->arr_len == 32);
34272 memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
34273 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
34274 LDKu8slice funding_redeemscript_ref;
34275 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
34276 funding_redeemscript_ref.data = funding_redeemscript->elems /* XXX funding_redeemscript leaks */;
34277 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34278 memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
34282 void __attribute__((export_name("TS_CommitmentTransaction_free"))) TS_CommitmentTransaction_free(uint32_t this_obj) {
34283 LDKCommitmentTransaction this_obj_conv;
34284 this_obj_conv.inner = (void*)(this_obj & (~1));
34285 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34286 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34287 CommitmentTransaction_free(this_obj_conv);
34290 static inline uintptr_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
34291 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
34292 uint32_t ret_ref = 0;
34293 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34294 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34295 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34296 ret_ref = (uintptr_t)ret_var.inner;
34297 if (ret_var.is_owned) {
34302 uint32_t __attribute__((export_name("TS_CommitmentTransaction_clone_ptr"))) TS_CommitmentTransaction_clone_ptr(uint32_t arg) {
34303 LDKCommitmentTransaction arg_conv;
34304 arg_conv.inner = (void*)(arg & (~1));
34305 arg_conv.is_owned = false;
34306 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34307 uint32_t ret_val = CommitmentTransaction_clone_ptr(&arg_conv);
34311 uint32_t __attribute__((export_name("TS_CommitmentTransaction_clone"))) TS_CommitmentTransaction_clone(uint32_t orig) {
34312 LDKCommitmentTransaction orig_conv;
34313 orig_conv.inner = (void*)(orig & (~1));
34314 orig_conv.is_owned = false;
34315 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34316 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
34317 uint32_t ret_ref = 0;
34318 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34319 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34320 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34321 ret_ref = (uintptr_t)ret_var.inner;
34322 if (ret_var.is_owned) {
34328 int8_tArray __attribute__((export_name("TS_CommitmentTransaction_write"))) TS_CommitmentTransaction_write(uint32_t obj) {
34329 LDKCommitmentTransaction obj_conv;
34330 obj_conv.inner = (void*)(obj & (~1));
34331 obj_conv.is_owned = false;
34332 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34333 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
34334 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34335 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34336 CVec_u8Z_free(ret_var);
34340 uint32_t __attribute__((export_name("TS_CommitmentTransaction_read"))) TS_CommitmentTransaction_read(int8_tArray ser) {
34341 LDKu8slice ser_ref;
34342 ser_ref.datalen = ser->arr_len;
34343 ser_ref.data = ser->elems /* XXX ser leaks */;
34344 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
34345 *ret_conv = CommitmentTransaction_read(ser_ref);
34346 return (uint32_t)ret_conv;
34349 int64_t __attribute__((export_name("TS_CommitmentTransaction_commitment_number"))) TS_CommitmentTransaction_commitment_number(uint32_t this_arg) {
34350 LDKCommitmentTransaction this_arg_conv;
34351 this_arg_conv.inner = (void*)(this_arg & (~1));
34352 this_arg_conv.is_owned = false;
34353 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34354 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
34358 int64_t __attribute__((export_name("TS_CommitmentTransaction_to_broadcaster_value_sat"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint32_t this_arg) {
34359 LDKCommitmentTransaction this_arg_conv;
34360 this_arg_conv.inner = (void*)(this_arg & (~1));
34361 this_arg_conv.is_owned = false;
34362 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34363 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
34367 int64_t __attribute__((export_name("TS_CommitmentTransaction_to_countersignatory_value_sat"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint32_t this_arg) {
34368 LDKCommitmentTransaction this_arg_conv;
34369 this_arg_conv.inner = (void*)(this_arg & (~1));
34370 this_arg_conv.is_owned = false;
34371 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34372 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
34376 int32_t __attribute__((export_name("TS_CommitmentTransaction_feerate_per_kw"))) TS_CommitmentTransaction_feerate_per_kw(uint32_t this_arg) {
34377 LDKCommitmentTransaction this_arg_conv;
34378 this_arg_conv.inner = (void*)(this_arg & (~1));
34379 this_arg_conv.is_owned = false;
34380 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34381 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
34385 uint32_t __attribute__((export_name("TS_CommitmentTransaction_trust"))) TS_CommitmentTransaction_trust(uint32_t this_arg) {
34386 LDKCommitmentTransaction this_arg_conv;
34387 this_arg_conv.inner = (void*)(this_arg & (~1));
34388 this_arg_conv.is_owned = false;
34389 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34390 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
34391 uint32_t ret_ref = 0;
34392 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34393 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34394 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34395 ret_ref = (uintptr_t)ret_var.inner;
34396 if (ret_var.is_owned) {
34402 uint32_t __attribute__((export_name("TS_CommitmentTransaction_verify"))) TS_CommitmentTransaction_verify(uint32_t this_arg, uint32_t channel_parameters, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
34403 LDKCommitmentTransaction this_arg_conv;
34404 this_arg_conv.inner = (void*)(this_arg & (~1));
34405 this_arg_conv.is_owned = false;
34406 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34407 LDKDirectedChannelTransactionParameters channel_parameters_conv;
34408 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
34409 channel_parameters_conv.is_owned = false;
34410 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
34411 LDKChannelPublicKeys broadcaster_keys_conv;
34412 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
34413 broadcaster_keys_conv.is_owned = false;
34414 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
34415 LDKChannelPublicKeys countersignatory_keys_conv;
34416 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
34417 countersignatory_keys_conv.is_owned = false;
34418 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
34419 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
34420 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
34421 return (uint32_t)ret_conv;
34424 void __attribute__((export_name("TS_TrustedCommitmentTransaction_free"))) TS_TrustedCommitmentTransaction_free(uint32_t this_obj) {
34425 LDKTrustedCommitmentTransaction this_obj_conv;
34426 this_obj_conv.inner = (void*)(this_obj & (~1));
34427 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34428 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34429 TrustedCommitmentTransaction_free(this_obj_conv);
34432 int8_tArray __attribute__((export_name("TS_TrustedCommitmentTransaction_txid"))) TS_TrustedCommitmentTransaction_txid(uint32_t this_arg) {
34433 LDKTrustedCommitmentTransaction this_arg_conv;
34434 this_arg_conv.inner = (void*)(this_arg & (~1));
34435 this_arg_conv.is_owned = false;
34436 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34437 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34438 memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
34442 uint32_t __attribute__((export_name("TS_TrustedCommitmentTransaction_built_transaction"))) TS_TrustedCommitmentTransaction_built_transaction(uint32_t this_arg) {
34443 LDKTrustedCommitmentTransaction this_arg_conv;
34444 this_arg_conv.inner = (void*)(this_arg & (~1));
34445 this_arg_conv.is_owned = false;
34446 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34447 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
34448 uint32_t ret_ref = 0;
34449 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34450 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34451 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34452 ret_ref = (uintptr_t)ret_var.inner;
34453 if (ret_var.is_owned) {
34459 uint32_t __attribute__((export_name("TS_TrustedCommitmentTransaction_keys"))) TS_TrustedCommitmentTransaction_keys(uint32_t this_arg) {
34460 LDKTrustedCommitmentTransaction this_arg_conv;
34461 this_arg_conv.inner = (void*)(this_arg & (~1));
34462 this_arg_conv.is_owned = false;
34463 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34464 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
34465 uint32_t ret_ref = 0;
34466 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34467 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34468 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34469 ret_ref = (uintptr_t)ret_var.inner;
34470 if (ret_var.is_owned) {
34476 jboolean __attribute__((export_name("TS_TrustedCommitmentTransaction_opt_anchors"))) TS_TrustedCommitmentTransaction_opt_anchors(uint32_t this_arg) {
34477 LDKTrustedCommitmentTransaction this_arg_conv;
34478 this_arg_conv.inner = (void*)(this_arg & (~1));
34479 this_arg_conv.is_owned = false;
34480 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34481 jboolean ret_val = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
34485 uint32_t __attribute__((export_name("TS_TrustedCommitmentTransaction_get_htlc_sigs"))) TS_TrustedCommitmentTransaction_get_htlc_sigs(uint32_t this_arg, int8_tArray htlc_base_key, uint32_t channel_parameters) {
34486 LDKTrustedCommitmentTransaction this_arg_conv;
34487 this_arg_conv.inner = (void*)(this_arg & (~1));
34488 this_arg_conv.is_owned = false;
34489 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34490 unsigned char htlc_base_key_arr[32];
34491 CHECK(htlc_base_key->arr_len == 32);
34492 memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
34493 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
34494 LDKDirectedChannelTransactionParameters channel_parameters_conv;
34495 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
34496 channel_parameters_conv.is_owned = false;
34497 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
34498 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
34499 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
34500 return (uint32_t)ret_conv;
34503 int64_t __attribute__((export_name("TS_get_commitment_transaction_number_obscure_factor"))) TS_get_commitment_transaction_number_obscure_factor(int8_tArray broadcaster_payment_basepoint, int8_tArray countersignatory_payment_basepoint, jboolean outbound_from_broadcaster) {
34504 LDKPublicKey broadcaster_payment_basepoint_ref;
34505 CHECK(broadcaster_payment_basepoint->arr_len == 33);
34506 memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
34507 LDKPublicKey countersignatory_payment_basepoint_ref;
34508 CHECK(countersignatory_payment_basepoint->arr_len == 33);
34509 memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
34510 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
34514 jboolean __attribute__((export_name("TS_InitFeatures_eq"))) TS_InitFeatures_eq(uint32_t a, uint32_t b) {
34515 LDKInitFeatures a_conv;
34516 a_conv.inner = (void*)(a & (~1));
34517 a_conv.is_owned = false;
34518 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34519 LDKInitFeatures b_conv;
34520 b_conv.inner = (void*)(b & (~1));
34521 b_conv.is_owned = false;
34522 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34523 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
34527 jboolean __attribute__((export_name("TS_NodeFeatures_eq"))) TS_NodeFeatures_eq(uint32_t a, uint32_t b) {
34528 LDKNodeFeatures a_conv;
34529 a_conv.inner = (void*)(a & (~1));
34530 a_conv.is_owned = false;
34531 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34532 LDKNodeFeatures b_conv;
34533 b_conv.inner = (void*)(b & (~1));
34534 b_conv.is_owned = false;
34535 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34536 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
34540 jboolean __attribute__((export_name("TS_ChannelFeatures_eq"))) TS_ChannelFeatures_eq(uint32_t a, uint32_t b) {
34541 LDKChannelFeatures a_conv;
34542 a_conv.inner = (void*)(a & (~1));
34543 a_conv.is_owned = false;
34544 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34545 LDKChannelFeatures b_conv;
34546 b_conv.inner = (void*)(b & (~1));
34547 b_conv.is_owned = false;
34548 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34549 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
34553 jboolean __attribute__((export_name("TS_InvoiceFeatures_eq"))) TS_InvoiceFeatures_eq(uint32_t a, uint32_t b) {
34554 LDKInvoiceFeatures a_conv;
34555 a_conv.inner = (void*)(a & (~1));
34556 a_conv.is_owned = false;
34557 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34558 LDKInvoiceFeatures b_conv;
34559 b_conv.inner = (void*)(b & (~1));
34560 b_conv.is_owned = false;
34561 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34562 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
34566 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint32_t a, uint32_t b) {
34567 LDKChannelTypeFeatures a_conv;
34568 a_conv.inner = (void*)(a & (~1));
34569 a_conv.is_owned = false;
34570 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34571 LDKChannelTypeFeatures b_conv;
34572 b_conv.inner = (void*)(b & (~1));
34573 b_conv.is_owned = false;
34574 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34575 jboolean ret_val = ChannelTypeFeatures_eq(&a_conv, &b_conv);
34579 static inline uintptr_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
34580 LDKInitFeatures ret_var = InitFeatures_clone(arg);
34581 uint32_t ret_ref = 0;
34582 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34583 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34584 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34585 ret_ref = (uintptr_t)ret_var.inner;
34586 if (ret_var.is_owned) {
34591 uint32_t __attribute__((export_name("TS_InitFeatures_clone_ptr"))) TS_InitFeatures_clone_ptr(uint32_t arg) {
34592 LDKInitFeatures arg_conv;
34593 arg_conv.inner = (void*)(arg & (~1));
34594 arg_conv.is_owned = false;
34595 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34596 uint32_t ret_val = InitFeatures_clone_ptr(&arg_conv);
34600 uint32_t __attribute__((export_name("TS_InitFeatures_clone"))) TS_InitFeatures_clone(uint32_t orig) {
34601 LDKInitFeatures orig_conv;
34602 orig_conv.inner = (void*)(orig & (~1));
34603 orig_conv.is_owned = false;
34604 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34605 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
34606 uint32_t ret_ref = 0;
34607 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34608 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34609 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34610 ret_ref = (uintptr_t)ret_var.inner;
34611 if (ret_var.is_owned) {
34617 static inline uintptr_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
34618 LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
34619 uint32_t ret_ref = 0;
34620 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34621 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34622 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34623 ret_ref = (uintptr_t)ret_var.inner;
34624 if (ret_var.is_owned) {
34629 uint32_t __attribute__((export_name("TS_NodeFeatures_clone_ptr"))) TS_NodeFeatures_clone_ptr(uint32_t arg) {
34630 LDKNodeFeatures arg_conv;
34631 arg_conv.inner = (void*)(arg & (~1));
34632 arg_conv.is_owned = false;
34633 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34634 uint32_t ret_val = NodeFeatures_clone_ptr(&arg_conv);
34638 uint32_t __attribute__((export_name("TS_NodeFeatures_clone"))) TS_NodeFeatures_clone(uint32_t orig) {
34639 LDKNodeFeatures orig_conv;
34640 orig_conv.inner = (void*)(orig & (~1));
34641 orig_conv.is_owned = false;
34642 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34643 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
34644 uint32_t ret_ref = 0;
34645 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34646 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34647 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34648 ret_ref = (uintptr_t)ret_var.inner;
34649 if (ret_var.is_owned) {
34655 static inline uintptr_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
34656 LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
34657 uint32_t ret_ref = 0;
34658 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34659 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34660 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34661 ret_ref = (uintptr_t)ret_var.inner;
34662 if (ret_var.is_owned) {
34667 uint32_t __attribute__((export_name("TS_ChannelFeatures_clone_ptr"))) TS_ChannelFeatures_clone_ptr(uint32_t arg) {
34668 LDKChannelFeatures arg_conv;
34669 arg_conv.inner = (void*)(arg & (~1));
34670 arg_conv.is_owned = false;
34671 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34672 uint32_t ret_val = ChannelFeatures_clone_ptr(&arg_conv);
34676 uint32_t __attribute__((export_name("TS_ChannelFeatures_clone"))) TS_ChannelFeatures_clone(uint32_t orig) {
34677 LDKChannelFeatures orig_conv;
34678 orig_conv.inner = (void*)(orig & (~1));
34679 orig_conv.is_owned = false;
34680 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34681 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
34682 uint32_t ret_ref = 0;
34683 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34684 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34685 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34686 ret_ref = (uintptr_t)ret_var.inner;
34687 if (ret_var.is_owned) {
34693 static inline uintptr_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
34694 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
34695 uint32_t ret_ref = 0;
34696 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34697 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34698 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34699 ret_ref = (uintptr_t)ret_var.inner;
34700 if (ret_var.is_owned) {
34705 uint32_t __attribute__((export_name("TS_InvoiceFeatures_clone_ptr"))) TS_InvoiceFeatures_clone_ptr(uint32_t arg) {
34706 LDKInvoiceFeatures arg_conv;
34707 arg_conv.inner = (void*)(arg & (~1));
34708 arg_conv.is_owned = false;
34709 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34710 uint32_t ret_val = InvoiceFeatures_clone_ptr(&arg_conv);
34714 uint32_t __attribute__((export_name("TS_InvoiceFeatures_clone"))) TS_InvoiceFeatures_clone(uint32_t orig) {
34715 LDKInvoiceFeatures orig_conv;
34716 orig_conv.inner = (void*)(orig & (~1));
34717 orig_conv.is_owned = false;
34718 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34719 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
34720 uint32_t ret_ref = 0;
34721 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34722 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34723 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34724 ret_ref = (uintptr_t)ret_var.inner;
34725 if (ret_var.is_owned) {
34731 static inline uintptr_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
34732 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
34733 uint32_t ret_ref = 0;
34734 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34735 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34736 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34737 ret_ref = (uintptr_t)ret_var.inner;
34738 if (ret_var.is_owned) {
34743 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_clone_ptr"))) TS_ChannelTypeFeatures_clone_ptr(uint32_t arg) {
34744 LDKChannelTypeFeatures arg_conv;
34745 arg_conv.inner = (void*)(arg & (~1));
34746 arg_conv.is_owned = false;
34747 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34748 uint32_t ret_val = ChannelTypeFeatures_clone_ptr(&arg_conv);
34752 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_clone"))) TS_ChannelTypeFeatures_clone(uint32_t orig) {
34753 LDKChannelTypeFeatures orig_conv;
34754 orig_conv.inner = (void*)(orig & (~1));
34755 orig_conv.is_owned = false;
34756 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34757 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
34758 uint32_t ret_ref = 0;
34759 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34760 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34761 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34762 ret_ref = (uintptr_t)ret_var.inner;
34763 if (ret_var.is_owned) {
34769 void __attribute__((export_name("TS_InitFeatures_free"))) TS_InitFeatures_free(uint32_t this_obj) {
34770 LDKInitFeatures this_obj_conv;
34771 this_obj_conv.inner = (void*)(this_obj & (~1));
34772 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34773 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34774 InitFeatures_free(this_obj_conv);
34777 void __attribute__((export_name("TS_NodeFeatures_free"))) TS_NodeFeatures_free(uint32_t this_obj) {
34778 LDKNodeFeatures this_obj_conv;
34779 this_obj_conv.inner = (void*)(this_obj & (~1));
34780 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34781 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34782 NodeFeatures_free(this_obj_conv);
34785 void __attribute__((export_name("TS_ChannelFeatures_free"))) TS_ChannelFeatures_free(uint32_t this_obj) {
34786 LDKChannelFeatures this_obj_conv;
34787 this_obj_conv.inner = (void*)(this_obj & (~1));
34788 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34789 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34790 ChannelFeatures_free(this_obj_conv);
34793 void __attribute__((export_name("TS_InvoiceFeatures_free"))) TS_InvoiceFeatures_free(uint32_t this_obj) {
34794 LDKInvoiceFeatures this_obj_conv;
34795 this_obj_conv.inner = (void*)(this_obj & (~1));
34796 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34797 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34798 InvoiceFeatures_free(this_obj_conv);
34801 void __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint32_t this_obj) {
34802 LDKChannelTypeFeatures this_obj_conv;
34803 this_obj_conv.inner = (void*)(this_obj & (~1));
34804 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34805 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34806 ChannelTypeFeatures_free(this_obj_conv);
34809 uint32_t __attribute__((export_name("TS_InitFeatures_empty"))) TS_InitFeatures_empty() {
34810 LDKInitFeatures ret_var = InitFeatures_empty();
34811 uint32_t ret_ref = 0;
34812 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34813 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34814 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34815 ret_ref = (uintptr_t)ret_var.inner;
34816 if (ret_var.is_owned) {
34822 uint32_t __attribute__((export_name("TS_InitFeatures_known"))) TS_InitFeatures_known() {
34823 LDKInitFeatures ret_var = InitFeatures_known();
34824 uint32_t ret_ref = 0;
34825 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34826 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34827 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34828 ret_ref = (uintptr_t)ret_var.inner;
34829 if (ret_var.is_owned) {
34835 jboolean __attribute__((export_name("TS_InitFeatures_requires_unknown_bits"))) TS_InitFeatures_requires_unknown_bits(uint32_t this_arg) {
34836 LDKInitFeatures this_arg_conv;
34837 this_arg_conv.inner = (void*)(this_arg & (~1));
34838 this_arg_conv.is_owned = false;
34839 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34840 jboolean ret_val = InitFeatures_requires_unknown_bits(&this_arg_conv);
34844 uint32_t __attribute__((export_name("TS_NodeFeatures_empty"))) TS_NodeFeatures_empty() {
34845 LDKNodeFeatures ret_var = NodeFeatures_empty();
34846 uint32_t ret_ref = 0;
34847 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34848 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34849 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34850 ret_ref = (uintptr_t)ret_var.inner;
34851 if (ret_var.is_owned) {
34857 uint32_t __attribute__((export_name("TS_NodeFeatures_known"))) TS_NodeFeatures_known() {
34858 LDKNodeFeatures ret_var = NodeFeatures_known();
34859 uint32_t ret_ref = 0;
34860 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34861 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34862 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34863 ret_ref = (uintptr_t)ret_var.inner;
34864 if (ret_var.is_owned) {
34870 jboolean __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits"))) TS_NodeFeatures_requires_unknown_bits(uint32_t this_arg) {
34871 LDKNodeFeatures this_arg_conv;
34872 this_arg_conv.inner = (void*)(this_arg & (~1));
34873 this_arg_conv.is_owned = false;
34874 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34875 jboolean ret_val = NodeFeatures_requires_unknown_bits(&this_arg_conv);
34879 uint32_t __attribute__((export_name("TS_ChannelFeatures_empty"))) TS_ChannelFeatures_empty() {
34880 LDKChannelFeatures ret_var = ChannelFeatures_empty();
34881 uint32_t ret_ref = 0;
34882 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34883 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34884 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34885 ret_ref = (uintptr_t)ret_var.inner;
34886 if (ret_var.is_owned) {
34892 uint32_t __attribute__((export_name("TS_ChannelFeatures_known"))) TS_ChannelFeatures_known() {
34893 LDKChannelFeatures ret_var = ChannelFeatures_known();
34894 uint32_t ret_ref = 0;
34895 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34896 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34897 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34898 ret_ref = (uintptr_t)ret_var.inner;
34899 if (ret_var.is_owned) {
34905 jboolean __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits"))) TS_ChannelFeatures_requires_unknown_bits(uint32_t this_arg) {
34906 LDKChannelFeatures this_arg_conv;
34907 this_arg_conv.inner = (void*)(this_arg & (~1));
34908 this_arg_conv.is_owned = false;
34909 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34910 jboolean ret_val = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
34914 uint32_t __attribute__((export_name("TS_InvoiceFeatures_empty"))) TS_InvoiceFeatures_empty() {
34915 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
34916 uint32_t ret_ref = 0;
34917 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34918 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34919 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34920 ret_ref = (uintptr_t)ret_var.inner;
34921 if (ret_var.is_owned) {
34927 uint32_t __attribute__((export_name("TS_InvoiceFeatures_known"))) TS_InvoiceFeatures_known() {
34928 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
34929 uint32_t ret_ref = 0;
34930 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34931 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34932 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34933 ret_ref = (uintptr_t)ret_var.inner;
34934 if (ret_var.is_owned) {
34940 jboolean __attribute__((export_name("TS_InvoiceFeatures_requires_unknown_bits"))) TS_InvoiceFeatures_requires_unknown_bits(uint32_t this_arg) {
34941 LDKInvoiceFeatures this_arg_conv;
34942 this_arg_conv.inner = (void*)(this_arg & (~1));
34943 this_arg_conv.is_owned = false;
34944 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34945 jboolean ret_val = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
34949 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() {
34950 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
34951 uint32_t ret_ref = 0;
34952 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34953 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34954 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34955 ret_ref = (uintptr_t)ret_var.inner;
34956 if (ret_var.is_owned) {
34962 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_known"))) TS_ChannelTypeFeatures_known() {
34963 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_known();
34964 uint32_t ret_ref = 0;
34965 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34966 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34967 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34968 ret_ref = (uintptr_t)ret_var.inner;
34969 if (ret_var.is_owned) {
34975 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint32_t this_arg) {
34976 LDKChannelTypeFeatures this_arg_conv;
34977 this_arg_conv.inner = (void*)(this_arg & (~1));
34978 this_arg_conv.is_owned = false;
34979 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34980 jboolean ret_val = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
34984 int8_tArray __attribute__((export_name("TS_InitFeatures_write"))) TS_InitFeatures_write(uint32_t obj) {
34985 LDKInitFeatures obj_conv;
34986 obj_conv.inner = (void*)(obj & (~1));
34987 obj_conv.is_owned = false;
34988 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34989 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
34990 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34991 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34992 CVec_u8Z_free(ret_var);
34996 uint32_t __attribute__((export_name("TS_InitFeatures_read"))) TS_InitFeatures_read(int8_tArray ser) {
34997 LDKu8slice ser_ref;
34998 ser_ref.datalen = ser->arr_len;
34999 ser_ref.data = ser->elems /* XXX ser leaks */;
35000 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
35001 *ret_conv = InitFeatures_read(ser_ref);
35002 return (uint32_t)ret_conv;
35005 int8_tArray __attribute__((export_name("TS_ChannelFeatures_write"))) TS_ChannelFeatures_write(uint32_t obj) {
35006 LDKChannelFeatures obj_conv;
35007 obj_conv.inner = (void*)(obj & (~1));
35008 obj_conv.is_owned = false;
35009 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35010 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
35011 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35012 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35013 CVec_u8Z_free(ret_var);
35017 uint32_t __attribute__((export_name("TS_ChannelFeatures_read"))) TS_ChannelFeatures_read(int8_tArray ser) {
35018 LDKu8slice ser_ref;
35019 ser_ref.datalen = ser->arr_len;
35020 ser_ref.data = ser->elems /* XXX ser leaks */;
35021 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
35022 *ret_conv = ChannelFeatures_read(ser_ref);
35023 return (uint32_t)ret_conv;
35026 int8_tArray __attribute__((export_name("TS_NodeFeatures_write"))) TS_NodeFeatures_write(uint32_t obj) {
35027 LDKNodeFeatures obj_conv;
35028 obj_conv.inner = (void*)(obj & (~1));
35029 obj_conv.is_owned = false;
35030 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35031 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
35032 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35033 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35034 CVec_u8Z_free(ret_var);
35038 uint32_t __attribute__((export_name("TS_NodeFeatures_read"))) TS_NodeFeatures_read(int8_tArray ser) {
35039 LDKu8slice ser_ref;
35040 ser_ref.datalen = ser->arr_len;
35041 ser_ref.data = ser->elems /* XXX ser leaks */;
35042 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
35043 *ret_conv = NodeFeatures_read(ser_ref);
35044 return (uint32_t)ret_conv;
35047 int8_tArray __attribute__((export_name("TS_InvoiceFeatures_write"))) TS_InvoiceFeatures_write(uint32_t obj) {
35048 LDKInvoiceFeatures obj_conv;
35049 obj_conv.inner = (void*)(obj & (~1));
35050 obj_conv.is_owned = false;
35051 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35052 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
35053 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35054 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35055 CVec_u8Z_free(ret_var);
35059 uint32_t __attribute__((export_name("TS_InvoiceFeatures_read"))) TS_InvoiceFeatures_read(int8_tArray ser) {
35060 LDKu8slice ser_ref;
35061 ser_ref.datalen = ser->arr_len;
35062 ser_ref.data = ser->elems /* XXX ser leaks */;
35063 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
35064 *ret_conv = InvoiceFeatures_read(ser_ref);
35065 return (uint32_t)ret_conv;
35068 int8_tArray __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint32_t obj) {
35069 LDKChannelTypeFeatures obj_conv;
35070 obj_conv.inner = (void*)(obj & (~1));
35071 obj_conv.is_owned = false;
35072 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35073 LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
35074 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35075 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35076 CVec_u8Z_free(ret_var);
35080 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
35081 LDKu8slice ser_ref;
35082 ser_ref.datalen = ser->arr_len;
35083 ser_ref.data = ser->elems /* XXX ser leaks */;
35084 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
35085 *ret_conv = ChannelTypeFeatures_read(ser_ref);
35086 return (uint32_t)ret_conv;
35089 void __attribute__((export_name("TS_ShutdownScript_free"))) TS_ShutdownScript_free(uint32_t this_obj) {
35090 LDKShutdownScript this_obj_conv;
35091 this_obj_conv.inner = (void*)(this_obj & (~1));
35092 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35093 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35094 ShutdownScript_free(this_obj_conv);
35097 static inline uintptr_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
35098 LDKShutdownScript ret_var = ShutdownScript_clone(arg);
35099 uint32_t ret_ref = 0;
35100 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35101 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35102 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35103 ret_ref = (uintptr_t)ret_var.inner;
35104 if (ret_var.is_owned) {
35109 uint32_t __attribute__((export_name("TS_ShutdownScript_clone_ptr"))) TS_ShutdownScript_clone_ptr(uint32_t arg) {
35110 LDKShutdownScript arg_conv;
35111 arg_conv.inner = (void*)(arg & (~1));
35112 arg_conv.is_owned = false;
35113 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35114 uint32_t ret_val = ShutdownScript_clone_ptr(&arg_conv);
35118 uint32_t __attribute__((export_name("TS_ShutdownScript_clone"))) TS_ShutdownScript_clone(uint32_t orig) {
35119 LDKShutdownScript orig_conv;
35120 orig_conv.inner = (void*)(orig & (~1));
35121 orig_conv.is_owned = false;
35122 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35123 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
35124 uint32_t ret_ref = 0;
35125 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35126 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35127 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35128 ret_ref = (uintptr_t)ret_var.inner;
35129 if (ret_var.is_owned) {
35135 void __attribute__((export_name("TS_InvalidShutdownScript_free"))) TS_InvalidShutdownScript_free(uint32_t this_obj) {
35136 LDKInvalidShutdownScript this_obj_conv;
35137 this_obj_conv.inner = (void*)(this_obj & (~1));
35138 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35139 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35140 InvalidShutdownScript_free(this_obj_conv);
35143 int8_tArray __attribute__((export_name("TS_InvalidShutdownScript_get_script"))) TS_InvalidShutdownScript_get_script(uint32_t this_ptr) {
35144 LDKInvalidShutdownScript this_ptr_conv;
35145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35146 this_ptr_conv.is_owned = false;
35147 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35148 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
35149 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35150 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35154 void __attribute__((export_name("TS_InvalidShutdownScript_set_script"))) TS_InvalidShutdownScript_set_script(uint32_t this_ptr, int8_tArray val) {
35155 LDKInvalidShutdownScript this_ptr_conv;
35156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35157 this_ptr_conv.is_owned = false;
35158 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35159 LDKCVec_u8Z val_ref;
35160 val_ref.datalen = val->arr_len;
35161 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
35162 memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
35163 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
35166 uint32_t __attribute__((export_name("TS_InvalidShutdownScript_new"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
35167 LDKCVec_u8Z script_arg_ref;
35168 script_arg_ref.datalen = script_arg->arr_len;
35169 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
35170 memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
35171 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
35172 uint32_t ret_ref = 0;
35173 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35174 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35175 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35176 ret_ref = (uintptr_t)ret_var.inner;
35177 if (ret_var.is_owned) {
35183 static inline uintptr_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
35184 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
35185 uint32_t ret_ref = 0;
35186 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35187 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35188 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35189 ret_ref = (uintptr_t)ret_var.inner;
35190 if (ret_var.is_owned) {
35195 uint32_t __attribute__((export_name("TS_InvalidShutdownScript_clone_ptr"))) TS_InvalidShutdownScript_clone_ptr(uint32_t arg) {
35196 LDKInvalidShutdownScript arg_conv;
35197 arg_conv.inner = (void*)(arg & (~1));
35198 arg_conv.is_owned = false;
35199 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35200 uint32_t ret_val = InvalidShutdownScript_clone_ptr(&arg_conv);
35204 uint32_t __attribute__((export_name("TS_InvalidShutdownScript_clone"))) TS_InvalidShutdownScript_clone(uint32_t orig) {
35205 LDKInvalidShutdownScript orig_conv;
35206 orig_conv.inner = (void*)(orig & (~1));
35207 orig_conv.is_owned = false;
35208 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35209 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
35210 uint32_t ret_ref = 0;
35211 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35212 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35213 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35214 ret_ref = (uintptr_t)ret_var.inner;
35215 if (ret_var.is_owned) {
35221 int8_tArray __attribute__((export_name("TS_ShutdownScript_write"))) TS_ShutdownScript_write(uint32_t obj) {
35222 LDKShutdownScript obj_conv;
35223 obj_conv.inner = (void*)(obj & (~1));
35224 obj_conv.is_owned = false;
35225 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35226 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
35227 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35228 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35229 CVec_u8Z_free(ret_var);
35233 uint32_t __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScript_read(int8_tArray ser) {
35234 LDKu8slice ser_ref;
35235 ser_ref.datalen = ser->arr_len;
35236 ser_ref.data = ser->elems /* XXX ser leaks */;
35237 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
35238 *ret_conv = ShutdownScript_read(ser_ref);
35239 return (uint32_t)ret_conv;
35242 uint32_t __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
35243 unsigned char pubkey_hash_arr[20];
35244 CHECK(pubkey_hash->arr_len == 20);
35245 memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
35246 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
35247 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
35248 uint32_t ret_ref = 0;
35249 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35250 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35251 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35252 ret_ref = (uintptr_t)ret_var.inner;
35253 if (ret_var.is_owned) {
35259 uint32_t __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
35260 unsigned char script_hash_arr[32];
35261 CHECK(script_hash->arr_len == 32);
35262 memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
35263 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
35264 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
35265 uint32_t ret_ref = 0;
35266 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35267 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35268 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35269 ret_ref = (uintptr_t)ret_var.inner;
35270 if (ret_var.is_owned) {
35276 uint32_t __attribute__((export_name("TS_ShutdownScript_new_witness_program"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
35277 LDKu8slice program_ref;
35278 program_ref.datalen = program->arr_len;
35279 program_ref.data = program->elems /* XXX program leaks */;
35280 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
35281 *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
35282 return (uint32_t)ret_conv;
35285 int8_tArray __attribute__((export_name("TS_ShutdownScript_into_inner"))) TS_ShutdownScript_into_inner(uint32_t this_arg) {
35286 LDKShutdownScript this_arg_conv;
35287 this_arg_conv.inner = (void*)(this_arg & (~1));
35288 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
35289 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35290 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
35291 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
35292 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35293 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35294 CVec_u8Z_free(ret_var);
35298 int8_tArray __attribute__((export_name("TS_ShutdownScript_as_legacy_pubkey"))) TS_ShutdownScript_as_legacy_pubkey(uint32_t this_arg) {
35299 LDKShutdownScript this_arg_conv;
35300 this_arg_conv.inner = (void*)(this_arg & (~1));
35301 this_arg_conv.is_owned = false;
35302 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35303 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35304 memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
35308 jboolean __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_ShutdownScript_is_compatible(uint32_t this_arg, uint32_t features) {
35309 LDKShutdownScript this_arg_conv;
35310 this_arg_conv.inner = (void*)(this_arg & (~1));
35311 this_arg_conv.is_owned = false;
35312 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35313 LDKInitFeatures features_conv;
35314 features_conv.inner = (void*)(features & (~1));
35315 features_conv.is_owned = false;
35316 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
35317 jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
35321 void __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint32_t this_ptr) {
35322 if ((this_ptr & 1) != 0) return;
35323 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
35324 CHECK_ACCESS(this_ptr_ptr);
35325 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
35326 FREE((void*)this_ptr);
35327 CustomMessageReader_free(this_ptr_conv);
35330 static inline uintptr_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
35331 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
35332 *ret_ret = Type_clone(arg);
35333 return (uint32_t)ret_ret;
35335 uint32_t __attribute__((export_name("TS_Type_clone_ptr"))) TS_Type_clone_ptr(uint32_t arg) {
35336 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
35337 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
35338 LDKType* arg_conv = (LDKType*)arg_ptr;
35339 uint32_t ret_val = Type_clone_ptr(arg_conv);
35343 uint32_t __attribute__((export_name("TS_Type_clone"))) TS_Type_clone(uint32_t orig) {
35344 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
35345 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
35346 LDKType* orig_conv = (LDKType*)orig_ptr;
35347 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
35348 *ret_ret = Type_clone(orig_conv);
35349 return (uint32_t)ret_ret;
35352 void __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint32_t this_ptr) {
35353 if ((this_ptr & 1) != 0) return;
35354 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
35355 CHECK_ACCESS(this_ptr_ptr);
35356 LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
35357 FREE((void*)this_ptr);
35358 Type_free(this_ptr_conv);
35361 void __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint32_t this_obj) {
35362 LDKNodeId this_obj_conv;
35363 this_obj_conv.inner = (void*)(this_obj & (~1));
35364 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35365 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35366 NodeId_free(this_obj_conv);
35369 static inline uintptr_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
35370 LDKNodeId ret_var = NodeId_clone(arg);
35371 uint32_t ret_ref = 0;
35372 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35373 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35374 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35375 ret_ref = (uintptr_t)ret_var.inner;
35376 if (ret_var.is_owned) {
35381 uint32_t __attribute__((export_name("TS_NodeId_clone_ptr"))) TS_NodeId_clone_ptr(uint32_t arg) {
35382 LDKNodeId arg_conv;
35383 arg_conv.inner = (void*)(arg & (~1));
35384 arg_conv.is_owned = false;
35385 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35386 uint32_t ret_val = NodeId_clone_ptr(&arg_conv);
35390 uint32_t __attribute__((export_name("TS_NodeId_clone"))) TS_NodeId_clone(uint32_t orig) {
35391 LDKNodeId orig_conv;
35392 orig_conv.inner = (void*)(orig & (~1));
35393 orig_conv.is_owned = false;
35394 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35395 LDKNodeId ret_var = NodeId_clone(&orig_conv);
35396 uint32_t ret_ref = 0;
35397 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35398 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35399 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35400 ret_ref = (uintptr_t)ret_var.inner;
35401 if (ret_var.is_owned) {
35407 uint32_t __attribute__((export_name("TS_NodeId_from_pubkey"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
35408 LDKPublicKey pubkey_ref;
35409 CHECK(pubkey->arr_len == 33);
35410 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
35411 LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
35412 uint32_t ret_ref = 0;
35413 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35414 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35415 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35416 ret_ref = (uintptr_t)ret_var.inner;
35417 if (ret_var.is_owned) {
35423 int8_tArray __attribute__((export_name("TS_NodeId_as_slice"))) TS_NodeId_as_slice(uint32_t this_arg) {
35424 LDKNodeId this_arg_conv;
35425 this_arg_conv.inner = (void*)(this_arg & (~1));
35426 this_arg_conv.is_owned = false;
35427 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35428 LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
35429 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35430 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35434 int64_t __attribute__((export_name("TS_NodeId_hash"))) TS_NodeId_hash(uint32_t o) {
35436 o_conv.inner = (void*)(o & (~1));
35437 o_conv.is_owned = false;
35438 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35439 int64_t ret_val = NodeId_hash(&o_conv);
35443 int8_tArray __attribute__((export_name("TS_NodeId_write"))) TS_NodeId_write(uint32_t obj) {
35444 LDKNodeId obj_conv;
35445 obj_conv.inner = (void*)(obj & (~1));
35446 obj_conv.is_owned = false;
35447 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35448 LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
35449 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35450 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35451 CVec_u8Z_free(ret_var);
35455 uint32_t __attribute__((export_name("TS_NodeId_read"))) TS_NodeId_read(int8_tArray ser) {
35456 LDKu8slice ser_ref;
35457 ser_ref.datalen = ser->arr_len;
35458 ser_ref.data = ser->elems /* XXX ser leaks */;
35459 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
35460 *ret_conv = NodeId_read(ser_ref);
35461 return (uint32_t)ret_conv;
35464 void __attribute__((export_name("TS_NetworkGraph_free"))) TS_NetworkGraph_free(uint32_t this_obj) {
35465 LDKNetworkGraph this_obj_conv;
35466 this_obj_conv.inner = (void*)(this_obj & (~1));
35467 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35468 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35469 NetworkGraph_free(this_obj_conv);
35472 static inline uintptr_t NetworkGraph_clone_ptr(LDKNetworkGraph *NONNULL_PTR arg) {
35473 LDKNetworkGraph ret_var = NetworkGraph_clone(arg);
35474 uint32_t ret_ref = 0;
35475 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35476 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35477 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35478 ret_ref = (uintptr_t)ret_var.inner;
35479 if (ret_var.is_owned) {
35484 uint32_t __attribute__((export_name("TS_NetworkGraph_clone_ptr"))) TS_NetworkGraph_clone_ptr(uint32_t arg) {
35485 LDKNetworkGraph arg_conv;
35486 arg_conv.inner = (void*)(arg & (~1));
35487 arg_conv.is_owned = false;
35488 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35489 uint32_t ret_val = NetworkGraph_clone_ptr(&arg_conv);
35493 uint32_t __attribute__((export_name("TS_NetworkGraph_clone"))) TS_NetworkGraph_clone(uint32_t orig) {
35494 LDKNetworkGraph orig_conv;
35495 orig_conv.inner = (void*)(orig & (~1));
35496 orig_conv.is_owned = false;
35497 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35498 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
35499 uint32_t ret_ref = 0;
35500 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35501 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35502 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35503 ret_ref = (uintptr_t)ret_var.inner;
35504 if (ret_var.is_owned) {
35510 void __attribute__((export_name("TS_ReadOnlyNetworkGraph_free"))) TS_ReadOnlyNetworkGraph_free(uint32_t this_obj) {
35511 LDKReadOnlyNetworkGraph this_obj_conv;
35512 this_obj_conv.inner = (void*)(this_obj & (~1));
35513 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35514 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35515 ReadOnlyNetworkGraph_free(this_obj_conv);
35518 void __attribute__((export_name("TS_NetworkUpdate_free"))) TS_NetworkUpdate_free(uint32_t this_ptr) {
35519 if ((this_ptr & 1) != 0) return;
35520 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
35521 CHECK_ACCESS(this_ptr_ptr);
35522 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
35523 FREE((void*)this_ptr);
35524 NetworkUpdate_free(this_ptr_conv);
35527 static inline uintptr_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
35528 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
35529 *ret_copy = NetworkUpdate_clone(arg);
35530 uint32_t ret_ref = (uintptr_t)ret_copy;
35533 uint32_t __attribute__((export_name("TS_NetworkUpdate_clone_ptr"))) TS_NetworkUpdate_clone_ptr(uint32_t arg) {
35534 LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)arg;
35535 uint32_t ret_val = NetworkUpdate_clone_ptr(arg_conv);
35539 uint32_t __attribute__((export_name("TS_NetworkUpdate_clone"))) TS_NetworkUpdate_clone(uint32_t orig) {
35540 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
35541 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
35542 *ret_copy = NetworkUpdate_clone(orig_conv);
35543 uint32_t ret_ref = (uintptr_t)ret_copy;
35547 uint32_t __attribute__((export_name("TS_NetworkUpdate_channel_update_message"))) TS_NetworkUpdate_channel_update_message(uint32_t msg) {
35548 LDKChannelUpdate msg_conv;
35549 msg_conv.inner = (void*)(msg & (~1));
35550 msg_conv.is_owned = (msg & 1) || (msg == 0);
35551 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35552 msg_conv = ChannelUpdate_clone(&msg_conv);
35553 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
35554 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
35555 uint32_t ret_ref = (uintptr_t)ret_copy;
35559 uint32_t __attribute__((export_name("TS_NetworkUpdate_channel_closed"))) TS_NetworkUpdate_channel_closed(int64_t short_channel_id, jboolean is_permanent) {
35560 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
35561 *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent);
35562 uint32_t ret_ref = (uintptr_t)ret_copy;
35566 uint32_t __attribute__((export_name("TS_NetworkUpdate_node_failure"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
35567 LDKPublicKey node_id_ref;
35568 CHECK(node_id->arr_len == 33);
35569 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
35570 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
35571 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
35572 uint32_t ret_ref = (uintptr_t)ret_copy;
35576 int8_tArray __attribute__((export_name("TS_NetworkUpdate_write"))) TS_NetworkUpdate_write(uint32_t obj) {
35577 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
35578 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
35579 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35580 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35581 CVec_u8Z_free(ret_var);
35585 uint32_t __attribute__((export_name("TS_NetworkUpdate_read"))) TS_NetworkUpdate_read(int8_tArray ser) {
35586 LDKu8slice ser_ref;
35587 ser_ref.datalen = ser->arr_len;
35588 ser_ref.data = ser->elems /* XXX ser leaks */;
35589 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
35590 *ret_conv = NetworkUpdate_read(ser_ref);
35591 return (uint32_t)ret_conv;
35594 uint32_t __attribute__((export_name("TS_NetGraphMsgHandler_as_EventHandler"))) TS_NetGraphMsgHandler_as_EventHandler(uint32_t this_arg) {
35595 LDKNetGraphMsgHandler this_arg_conv;
35596 this_arg_conv.inner = (void*)(this_arg & (~1));
35597 this_arg_conv.is_owned = false;
35598 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35599 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
35600 *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv);
35601 return (uint32_t)ret_ret;
35604 void __attribute__((export_name("TS_NetGraphMsgHandler_free"))) TS_NetGraphMsgHandler_free(uint32_t this_obj) {
35605 LDKNetGraphMsgHandler this_obj_conv;
35606 this_obj_conv.inner = (void*)(this_obj & (~1));
35607 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35608 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35609 NetGraphMsgHandler_free(this_obj_conv);
35612 uint32_t __attribute__((export_name("TS_NetGraphMsgHandler_new"))) TS_NetGraphMsgHandler_new(uint32_t network_graph, uint32_t chain_access, uint32_t logger) {
35613 LDKNetworkGraph network_graph_conv;
35614 network_graph_conv.inner = (void*)(network_graph & (~1));
35615 network_graph_conv.is_owned = false;
35616 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
35617 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
35618 CHECK_ACCESS(chain_access_ptr);
35619 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
35620 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
35621 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
35622 // Manually implement clone for Java trait instances
35624 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
35625 CHECK_ACCESS(logger_ptr);
35626 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
35627 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(&network_graph_conv, chain_access_conv, logger_conv);
35628 uint32_t ret_ref = 0;
35629 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35630 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35631 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35632 ret_ref = (uintptr_t)ret_var.inner;
35633 if (ret_var.is_owned) {
35639 void __attribute__((export_name("TS_NetGraphMsgHandler_add_chain_access"))) TS_NetGraphMsgHandler_add_chain_access(uint32_t this_arg, uint32_t chain_access) {
35640 LDKNetGraphMsgHandler this_arg_conv;
35641 this_arg_conv.inner = (void*)(this_arg & (~1));
35642 this_arg_conv.is_owned = false;
35643 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35644 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
35645 CHECK_ACCESS(chain_access_ptr);
35646 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
35647 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
35648 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
35649 // Manually implement clone for Java trait instances
35651 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
35654 uint32_t __attribute__((export_name("TS_NetGraphMsgHandler_as_RoutingMessageHandler"))) TS_NetGraphMsgHandler_as_RoutingMessageHandler(uint32_t this_arg) {
35655 LDKNetGraphMsgHandler this_arg_conv;
35656 this_arg_conv.inner = (void*)(this_arg & (~1));
35657 this_arg_conv.is_owned = false;
35658 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35659 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
35660 *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
35661 return (uint32_t)ret_ret;
35664 uint32_t __attribute__((export_name("TS_NetGraphMsgHandler_as_MessageSendEventsProvider"))) TS_NetGraphMsgHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
35665 LDKNetGraphMsgHandler this_arg_conv;
35666 this_arg_conv.inner = (void*)(this_arg & (~1));
35667 this_arg_conv.is_owned = false;
35668 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35669 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
35670 *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
35671 return (uint32_t)ret_ret;
35674 void __attribute__((export_name("TS_ChannelUpdateInfo_free"))) TS_ChannelUpdateInfo_free(uint32_t this_obj) {
35675 LDKChannelUpdateInfo this_obj_conv;
35676 this_obj_conv.inner = (void*)(this_obj & (~1));
35677 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35678 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35679 ChannelUpdateInfo_free(this_obj_conv);
35682 int32_t __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update"))) TS_ChannelUpdateInfo_get_last_update(uint32_t this_ptr) {
35683 LDKChannelUpdateInfo this_ptr_conv;
35684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35685 this_ptr_conv.is_owned = false;
35686 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35687 int32_t ret_val = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
35691 void __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update"))) TS_ChannelUpdateInfo_set_last_update(uint32_t this_ptr, int32_t val) {
35692 LDKChannelUpdateInfo this_ptr_conv;
35693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35694 this_ptr_conv.is_owned = false;
35695 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35696 ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
35699 jboolean __attribute__((export_name("TS_ChannelUpdateInfo_get_enabled"))) TS_ChannelUpdateInfo_get_enabled(uint32_t this_ptr) {
35700 LDKChannelUpdateInfo this_ptr_conv;
35701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35702 this_ptr_conv.is_owned = false;
35703 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35704 jboolean ret_val = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
35708 void __attribute__((export_name("TS_ChannelUpdateInfo_set_enabled"))) TS_ChannelUpdateInfo_set_enabled(uint32_t this_ptr, jboolean val) {
35709 LDKChannelUpdateInfo this_ptr_conv;
35710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35711 this_ptr_conv.is_owned = false;
35712 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35713 ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
35716 int16_t __attribute__((export_name("TS_ChannelUpdateInfo_get_cltv_expiry_delta"))) TS_ChannelUpdateInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
35717 LDKChannelUpdateInfo this_ptr_conv;
35718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35719 this_ptr_conv.is_owned = false;
35720 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35721 int16_t ret_val = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
35725 void __attribute__((export_name("TS_ChannelUpdateInfo_set_cltv_expiry_delta"))) TS_ChannelUpdateInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
35726 LDKChannelUpdateInfo this_ptr_conv;
35727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35728 this_ptr_conv.is_owned = false;
35729 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35730 ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
35733 int64_t __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_minimum_msat"))) TS_ChannelUpdateInfo_get_htlc_minimum_msat(uint32_t this_ptr) {
35734 LDKChannelUpdateInfo this_ptr_conv;
35735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35736 this_ptr_conv.is_owned = false;
35737 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35738 int64_t ret_val = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
35742 void __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_minimum_msat"))) TS_ChannelUpdateInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
35743 LDKChannelUpdateInfo this_ptr_conv;
35744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35745 this_ptr_conv.is_owned = false;
35746 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35747 ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
35750 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_maximum_msat"))) TS_ChannelUpdateInfo_get_htlc_maximum_msat(uint32_t this_ptr) {
35751 LDKChannelUpdateInfo this_ptr_conv;
35752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35753 this_ptr_conv.is_owned = false;
35754 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35755 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
35756 *ret_copy = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
35757 uint32_t ret_ref = (uintptr_t)ret_copy;
35761 void __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_maximum_msat"))) TS_ChannelUpdateInfo_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
35762 LDKChannelUpdateInfo this_ptr_conv;
35763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35764 this_ptr_conv.is_owned = false;
35765 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35766 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
35767 CHECK_ACCESS(val_ptr);
35768 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
35769 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
35770 ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
35773 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_get_fees"))) TS_ChannelUpdateInfo_get_fees(uint32_t this_ptr) {
35774 LDKChannelUpdateInfo this_ptr_conv;
35775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35776 this_ptr_conv.is_owned = false;
35777 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35778 LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
35779 uint32_t ret_ref = 0;
35780 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35781 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35782 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35783 ret_ref = (uintptr_t)ret_var.inner;
35784 if (ret_var.is_owned) {
35790 void __attribute__((export_name("TS_ChannelUpdateInfo_set_fees"))) TS_ChannelUpdateInfo_set_fees(uint32_t this_ptr, uint32_t val) {
35791 LDKChannelUpdateInfo this_ptr_conv;
35792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35793 this_ptr_conv.is_owned = false;
35794 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35795 LDKRoutingFees val_conv;
35796 val_conv.inner = (void*)(val & (~1));
35797 val_conv.is_owned = (val & 1) || (val == 0);
35798 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35799 val_conv = RoutingFees_clone(&val_conv);
35800 ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
35803 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update_message"))) TS_ChannelUpdateInfo_get_last_update_message(uint32_t this_ptr) {
35804 LDKChannelUpdateInfo this_ptr_conv;
35805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35806 this_ptr_conv.is_owned = false;
35807 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35808 LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
35809 uint32_t ret_ref = 0;
35810 if ((uintptr_t)ret_var.inner > 4096) {
35811 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35812 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35813 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35814 ret_ref = (uintptr_t)ret_var.inner;
35815 if (ret_var.is_owned) {
35822 void __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update_message"))) TS_ChannelUpdateInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) {
35823 LDKChannelUpdateInfo this_ptr_conv;
35824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35825 this_ptr_conv.is_owned = false;
35826 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35827 LDKChannelUpdate val_conv;
35828 val_conv.inner = (void*)(val & (~1));
35829 val_conv.is_owned = (val & 1) || (val == 0);
35830 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35831 val_conv = ChannelUpdate_clone(&val_conv);
35832 ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
35835 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_new"))) TS_ChannelUpdateInfo_new(int32_t last_update_arg, jboolean enabled_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, uint32_t htlc_maximum_msat_arg, uint32_t fees_arg, uint32_t last_update_message_arg) {
35836 void* htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)htlc_maximum_msat_arg) & ~1);
35837 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
35838 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
35839 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_maximum_msat_arg) & ~1));
35840 LDKRoutingFees fees_arg_conv;
35841 fees_arg_conv.inner = (void*)(fees_arg & (~1));
35842 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
35843 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
35844 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
35845 LDKChannelUpdate last_update_message_arg_conv;
35846 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
35847 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
35848 CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
35849 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
35850 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_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);
35851 uint32_t ret_ref = 0;
35852 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35853 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35854 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35855 ret_ref = (uintptr_t)ret_var.inner;
35856 if (ret_var.is_owned) {
35862 static inline uintptr_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
35863 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
35864 uint32_t ret_ref = 0;
35865 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35866 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35867 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35868 ret_ref = (uintptr_t)ret_var.inner;
35869 if (ret_var.is_owned) {
35874 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_clone_ptr"))) TS_ChannelUpdateInfo_clone_ptr(uint32_t arg) {
35875 LDKChannelUpdateInfo arg_conv;
35876 arg_conv.inner = (void*)(arg & (~1));
35877 arg_conv.is_owned = false;
35878 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35879 uint32_t ret_val = ChannelUpdateInfo_clone_ptr(&arg_conv);
35883 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_clone"))) TS_ChannelUpdateInfo_clone(uint32_t orig) {
35884 LDKChannelUpdateInfo orig_conv;
35885 orig_conv.inner = (void*)(orig & (~1));
35886 orig_conv.is_owned = false;
35887 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35888 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
35889 uint32_t ret_ref = 0;
35890 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35891 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35892 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35893 ret_ref = (uintptr_t)ret_var.inner;
35894 if (ret_var.is_owned) {
35900 int8_tArray __attribute__((export_name("TS_ChannelUpdateInfo_write"))) TS_ChannelUpdateInfo_write(uint32_t obj) {
35901 LDKChannelUpdateInfo obj_conv;
35902 obj_conv.inner = (void*)(obj & (~1));
35903 obj_conv.is_owned = false;
35904 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35905 LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
35906 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35907 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35908 CVec_u8Z_free(ret_var);
35912 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_read"))) TS_ChannelUpdateInfo_read(int8_tArray ser) {
35913 LDKu8slice ser_ref;
35914 ser_ref.datalen = ser->arr_len;
35915 ser_ref.data = ser->elems /* XXX ser leaks */;
35916 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
35917 *ret_conv = ChannelUpdateInfo_read(ser_ref);
35918 return (uint32_t)ret_conv;
35921 void __attribute__((export_name("TS_ChannelInfo_free"))) TS_ChannelInfo_free(uint32_t this_obj) {
35922 LDKChannelInfo this_obj_conv;
35923 this_obj_conv.inner = (void*)(this_obj & (~1));
35924 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35925 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35926 ChannelInfo_free(this_obj_conv);
35929 uint32_t __attribute__((export_name("TS_ChannelInfo_get_features"))) TS_ChannelInfo_get_features(uint32_t this_ptr) {
35930 LDKChannelInfo this_ptr_conv;
35931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35932 this_ptr_conv.is_owned = false;
35933 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35934 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
35935 uint32_t ret_ref = 0;
35936 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35937 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35938 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35939 ret_ref = (uintptr_t)ret_var.inner;
35940 if (ret_var.is_owned) {
35946 void __attribute__((export_name("TS_ChannelInfo_set_features"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) {
35947 LDKChannelInfo this_ptr_conv;
35948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35949 this_ptr_conv.is_owned = false;
35950 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35951 LDKChannelFeatures val_conv;
35952 val_conv.inner = (void*)(val & (~1));
35953 val_conv.is_owned = (val & 1) || (val == 0);
35954 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35955 val_conv = ChannelFeatures_clone(&val_conv);
35956 ChannelInfo_set_features(&this_ptr_conv, val_conv);
35959 uint32_t __attribute__((export_name("TS_ChannelInfo_get_node_one"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) {
35960 LDKChannelInfo this_ptr_conv;
35961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35962 this_ptr_conv.is_owned = false;
35963 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35964 LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
35965 uint32_t ret_ref = 0;
35966 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35967 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35968 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35969 ret_ref = (uintptr_t)ret_var.inner;
35970 if (ret_var.is_owned) {
35976 void __attribute__((export_name("TS_ChannelInfo_set_node_one"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, uint32_t val) {
35977 LDKChannelInfo this_ptr_conv;
35978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35979 this_ptr_conv.is_owned = false;
35980 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35981 LDKNodeId val_conv;
35982 val_conv.inner = (void*)(val & (~1));
35983 val_conv.is_owned = (val & 1) || (val == 0);
35984 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35985 val_conv = NodeId_clone(&val_conv);
35986 ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
35989 uint32_t __attribute__((export_name("TS_ChannelInfo_get_one_to_two"))) TS_ChannelInfo_get_one_to_two(uint32_t this_ptr) {
35990 LDKChannelInfo this_ptr_conv;
35991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35992 this_ptr_conv.is_owned = false;
35993 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35994 LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
35995 uint32_t ret_ref = 0;
35996 if ((uintptr_t)ret_var.inner > 4096) {
35997 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35998 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35999 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36000 ret_ref = (uintptr_t)ret_var.inner;
36001 if (ret_var.is_owned) {
36008 void __attribute__((export_name("TS_ChannelInfo_set_one_to_two"))) TS_ChannelInfo_set_one_to_two(uint32_t this_ptr, uint32_t val) {
36009 LDKChannelInfo this_ptr_conv;
36010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36011 this_ptr_conv.is_owned = false;
36012 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36013 LDKChannelUpdateInfo val_conv;
36014 val_conv.inner = (void*)(val & (~1));
36015 val_conv.is_owned = (val & 1) || (val == 0);
36016 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36017 val_conv = ChannelUpdateInfo_clone(&val_conv);
36018 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
36021 uint32_t __attribute__((export_name("TS_ChannelInfo_get_node_two"))) TS_ChannelInfo_get_node_two(uint32_t this_ptr) {
36022 LDKChannelInfo this_ptr_conv;
36023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36024 this_ptr_conv.is_owned = false;
36025 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36026 LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
36027 uint32_t ret_ref = 0;
36028 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36029 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36030 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36031 ret_ref = (uintptr_t)ret_var.inner;
36032 if (ret_var.is_owned) {
36038 void __attribute__((export_name("TS_ChannelInfo_set_node_two"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, uint32_t val) {
36039 LDKChannelInfo this_ptr_conv;
36040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36041 this_ptr_conv.is_owned = false;
36042 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36043 LDKNodeId val_conv;
36044 val_conv.inner = (void*)(val & (~1));
36045 val_conv.is_owned = (val & 1) || (val == 0);
36046 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36047 val_conv = NodeId_clone(&val_conv);
36048 ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
36051 uint32_t __attribute__((export_name("TS_ChannelInfo_get_two_to_one"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) {
36052 LDKChannelInfo this_ptr_conv;
36053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36054 this_ptr_conv.is_owned = false;
36055 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36056 LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
36057 uint32_t ret_ref = 0;
36058 if ((uintptr_t)ret_var.inner > 4096) {
36059 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36060 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36061 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36062 ret_ref = (uintptr_t)ret_var.inner;
36063 if (ret_var.is_owned) {
36070 void __attribute__((export_name("TS_ChannelInfo_set_two_to_one"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) {
36071 LDKChannelInfo this_ptr_conv;
36072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36073 this_ptr_conv.is_owned = false;
36074 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36075 LDKChannelUpdateInfo val_conv;
36076 val_conv.inner = (void*)(val & (~1));
36077 val_conv.is_owned = (val & 1) || (val == 0);
36078 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36079 val_conv = ChannelUpdateInfo_clone(&val_conv);
36080 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
36083 uint32_t __attribute__((export_name("TS_ChannelInfo_get_capacity_sats"))) TS_ChannelInfo_get_capacity_sats(uint32_t this_ptr) {
36084 LDKChannelInfo this_ptr_conv;
36085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36086 this_ptr_conv.is_owned = false;
36087 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36088 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
36089 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
36090 uint32_t ret_ref = (uintptr_t)ret_copy;
36094 void __attribute__((export_name("TS_ChannelInfo_set_capacity_sats"))) TS_ChannelInfo_set_capacity_sats(uint32_t this_ptr, uint32_t val) {
36095 LDKChannelInfo this_ptr_conv;
36096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36097 this_ptr_conv.is_owned = false;
36098 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36099 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
36100 CHECK_ACCESS(val_ptr);
36101 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
36102 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
36103 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
36106 uint32_t __attribute__((export_name("TS_ChannelInfo_get_announcement_message"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) {
36107 LDKChannelInfo this_ptr_conv;
36108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36109 this_ptr_conv.is_owned = false;
36110 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36111 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
36112 uint32_t ret_ref = 0;
36113 if ((uintptr_t)ret_var.inner > 4096) {
36114 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36115 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36116 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36117 ret_ref = (uintptr_t)ret_var.inner;
36118 if (ret_var.is_owned) {
36125 void __attribute__((export_name("TS_ChannelInfo_set_announcement_message"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
36126 LDKChannelInfo this_ptr_conv;
36127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36128 this_ptr_conv.is_owned = false;
36129 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36130 LDKChannelAnnouncement val_conv;
36131 val_conv.inner = (void*)(val & (~1));
36132 val_conv.is_owned = (val & 1) || (val == 0);
36133 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36134 val_conv = ChannelAnnouncement_clone(&val_conv);
36135 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
36138 static inline uintptr_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
36139 LDKChannelInfo ret_var = ChannelInfo_clone(arg);
36140 uint32_t ret_ref = 0;
36141 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36142 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36143 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36144 ret_ref = (uintptr_t)ret_var.inner;
36145 if (ret_var.is_owned) {
36150 uint32_t __attribute__((export_name("TS_ChannelInfo_clone_ptr"))) TS_ChannelInfo_clone_ptr(uint32_t arg) {
36151 LDKChannelInfo arg_conv;
36152 arg_conv.inner = (void*)(arg & (~1));
36153 arg_conv.is_owned = false;
36154 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36155 uint32_t ret_val = ChannelInfo_clone_ptr(&arg_conv);
36159 uint32_t __attribute__((export_name("TS_ChannelInfo_clone"))) TS_ChannelInfo_clone(uint32_t orig) {
36160 LDKChannelInfo orig_conv;
36161 orig_conv.inner = (void*)(orig & (~1));
36162 orig_conv.is_owned = false;
36163 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36164 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
36165 uint32_t ret_ref = 0;
36166 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36167 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36168 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36169 ret_ref = (uintptr_t)ret_var.inner;
36170 if (ret_var.is_owned) {
36176 int8_tArray __attribute__((export_name("TS_ChannelInfo_write"))) TS_ChannelInfo_write(uint32_t obj) {
36177 LDKChannelInfo obj_conv;
36178 obj_conv.inner = (void*)(obj & (~1));
36179 obj_conv.is_owned = false;
36180 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36181 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
36182 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36183 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36184 CVec_u8Z_free(ret_var);
36188 uint32_t __attribute__((export_name("TS_ChannelInfo_read"))) TS_ChannelInfo_read(int8_tArray ser) {
36189 LDKu8slice ser_ref;
36190 ser_ref.datalen = ser->arr_len;
36191 ser_ref.data = ser->elems /* XXX ser leaks */;
36192 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
36193 *ret_conv = ChannelInfo_read(ser_ref);
36194 return (uint32_t)ret_conv;
36197 void __attribute__((export_name("TS_DirectedChannelInfo_free"))) TS_DirectedChannelInfo_free(uint32_t this_obj) {
36198 LDKDirectedChannelInfo this_obj_conv;
36199 this_obj_conv.inner = (void*)(this_obj & (~1));
36200 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36201 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36202 DirectedChannelInfo_free(this_obj_conv);
36205 static inline uintptr_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
36206 LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
36207 uint32_t ret_ref = 0;
36208 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36209 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36210 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36211 ret_ref = (uintptr_t)ret_var.inner;
36212 if (ret_var.is_owned) {
36217 uint32_t __attribute__((export_name("TS_DirectedChannelInfo_clone_ptr"))) TS_DirectedChannelInfo_clone_ptr(uint32_t arg) {
36218 LDKDirectedChannelInfo arg_conv;
36219 arg_conv.inner = (void*)(arg & (~1));
36220 arg_conv.is_owned = false;
36221 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36222 uint32_t ret_val = DirectedChannelInfo_clone_ptr(&arg_conv);
36226 uint32_t __attribute__((export_name("TS_DirectedChannelInfo_clone"))) TS_DirectedChannelInfo_clone(uint32_t orig) {
36227 LDKDirectedChannelInfo orig_conv;
36228 orig_conv.inner = (void*)(orig & (~1));
36229 orig_conv.is_owned = false;
36230 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36231 LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
36232 uint32_t ret_ref = 0;
36233 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36234 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36235 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36236 ret_ref = (uintptr_t)ret_var.inner;
36237 if (ret_var.is_owned) {
36243 uint32_t __attribute__((export_name("TS_DirectedChannelInfo_channel"))) TS_DirectedChannelInfo_channel(uint32_t this_arg) {
36244 LDKDirectedChannelInfo this_arg_conv;
36245 this_arg_conv.inner = (void*)(this_arg & (~1));
36246 this_arg_conv.is_owned = false;
36247 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36248 LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
36249 uint32_t ret_ref = 0;
36250 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36251 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36252 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36253 ret_ref = (uintptr_t)ret_var.inner;
36254 if (ret_var.is_owned) {
36260 uint32_t __attribute__((export_name("TS_DirectedChannelInfo_direction"))) TS_DirectedChannelInfo_direction(uint32_t this_arg) {
36261 LDKDirectedChannelInfo this_arg_conv;
36262 this_arg_conv.inner = (void*)(this_arg & (~1));
36263 this_arg_conv.is_owned = false;
36264 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36265 LDKChannelUpdateInfo ret_var = DirectedChannelInfo_direction(&this_arg_conv);
36266 uint32_t ret_ref = 0;
36267 if ((uintptr_t)ret_var.inner > 4096) {
36268 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36269 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36270 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36271 ret_ref = (uintptr_t)ret_var.inner;
36272 if (ret_var.is_owned) {
36279 uint32_t __attribute__((export_name("TS_DirectedChannelInfo_effective_capacity"))) TS_DirectedChannelInfo_effective_capacity(uint32_t this_arg) {
36280 LDKDirectedChannelInfo this_arg_conv;
36281 this_arg_conv.inner = (void*)(this_arg & (~1));
36282 this_arg_conv.is_owned = false;
36283 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36284 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
36285 *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
36286 uint32_t ret_ref = (uintptr_t)ret_copy;
36290 void __attribute__((export_name("TS_EffectiveCapacity_free"))) TS_EffectiveCapacity_free(uint32_t this_ptr) {
36291 if ((this_ptr & 1) != 0) return;
36292 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
36293 CHECK_ACCESS(this_ptr_ptr);
36294 LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
36295 FREE((void*)this_ptr);
36296 EffectiveCapacity_free(this_ptr_conv);
36299 static inline uintptr_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
36300 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
36301 *ret_copy = EffectiveCapacity_clone(arg);
36302 uint32_t ret_ref = (uintptr_t)ret_copy;
36305 uint32_t __attribute__((export_name("TS_EffectiveCapacity_clone_ptr"))) TS_EffectiveCapacity_clone_ptr(uint32_t arg) {
36306 LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)arg;
36307 uint32_t ret_val = EffectiveCapacity_clone_ptr(arg_conv);
36311 uint32_t __attribute__((export_name("TS_EffectiveCapacity_clone"))) TS_EffectiveCapacity_clone(uint32_t orig) {
36312 LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)orig;
36313 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
36314 *ret_copy = EffectiveCapacity_clone(orig_conv);
36315 uint32_t ret_ref = (uintptr_t)ret_copy;
36319 uint32_t __attribute__((export_name("TS_EffectiveCapacity_exact_liquidity"))) TS_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
36320 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
36321 *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
36322 uint32_t ret_ref = (uintptr_t)ret_copy;
36326 uint32_t __attribute__((export_name("TS_EffectiveCapacity_maximum_htlc"))) TS_EffectiveCapacity_maximum_htlc(int64_t amount_msat) {
36327 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
36328 *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat);
36329 uint32_t ret_ref = (uintptr_t)ret_copy;
36333 uint32_t __attribute__((export_name("TS_EffectiveCapacity_total"))) TS_EffectiveCapacity_total(int64_t capacity_msat) {
36334 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
36335 *ret_copy = EffectiveCapacity_total(capacity_msat);
36336 uint32_t ret_ref = (uintptr_t)ret_copy;
36340 uint32_t __attribute__((export_name("TS_EffectiveCapacity_infinite"))) TS_EffectiveCapacity_infinite() {
36341 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
36342 *ret_copy = EffectiveCapacity_infinite();
36343 uint32_t ret_ref = (uintptr_t)ret_copy;
36347 uint32_t __attribute__((export_name("TS_EffectiveCapacity_unknown"))) TS_EffectiveCapacity_unknown() {
36348 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
36349 *ret_copy = EffectiveCapacity_unknown();
36350 uint32_t ret_ref = (uintptr_t)ret_copy;
36354 int64_t __attribute__((export_name("TS_EffectiveCapacity_as_msat"))) TS_EffectiveCapacity_as_msat(uint32_t this_arg) {
36355 LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)this_arg;
36356 int64_t ret_val = EffectiveCapacity_as_msat(this_arg_conv);
36360 void __attribute__((export_name("TS_RoutingFees_free"))) TS_RoutingFees_free(uint32_t this_obj) {
36361 LDKRoutingFees this_obj_conv;
36362 this_obj_conv.inner = (void*)(this_obj & (~1));
36363 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36364 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36365 RoutingFees_free(this_obj_conv);
36368 int32_t __attribute__((export_name("TS_RoutingFees_get_base_msat"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) {
36369 LDKRoutingFees this_ptr_conv;
36370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36371 this_ptr_conv.is_owned = false;
36372 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36373 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
36377 void __attribute__((export_name("TS_RoutingFees_set_base_msat"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) {
36378 LDKRoutingFees this_ptr_conv;
36379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36380 this_ptr_conv.is_owned = false;
36381 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36382 RoutingFees_set_base_msat(&this_ptr_conv, val);
36385 int32_t __attribute__((export_name("TS_RoutingFees_get_proportional_millionths"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) {
36386 LDKRoutingFees this_ptr_conv;
36387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36388 this_ptr_conv.is_owned = false;
36389 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36390 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
36394 void __attribute__((export_name("TS_RoutingFees_set_proportional_millionths"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) {
36395 LDKRoutingFees this_ptr_conv;
36396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36397 this_ptr_conv.is_owned = false;
36398 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36399 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
36402 uint32_t __attribute__((export_name("TS_RoutingFees_new"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
36403 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
36404 uint32_t ret_ref = 0;
36405 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36406 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36407 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36408 ret_ref = (uintptr_t)ret_var.inner;
36409 if (ret_var.is_owned) {
36415 jboolean __attribute__((export_name("TS_RoutingFees_eq"))) TS_RoutingFees_eq(uint32_t a, uint32_t b) {
36416 LDKRoutingFees a_conv;
36417 a_conv.inner = (void*)(a & (~1));
36418 a_conv.is_owned = false;
36419 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36420 LDKRoutingFees b_conv;
36421 b_conv.inner = (void*)(b & (~1));
36422 b_conv.is_owned = false;
36423 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36424 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
36428 static inline uintptr_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
36429 LDKRoutingFees ret_var = RoutingFees_clone(arg);
36430 uint32_t ret_ref = 0;
36431 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36432 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36433 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36434 ret_ref = (uintptr_t)ret_var.inner;
36435 if (ret_var.is_owned) {
36440 uint32_t __attribute__((export_name("TS_RoutingFees_clone_ptr"))) TS_RoutingFees_clone_ptr(uint32_t arg) {
36441 LDKRoutingFees arg_conv;
36442 arg_conv.inner = (void*)(arg & (~1));
36443 arg_conv.is_owned = false;
36444 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36445 uint32_t ret_val = RoutingFees_clone_ptr(&arg_conv);
36449 uint32_t __attribute__((export_name("TS_RoutingFees_clone"))) TS_RoutingFees_clone(uint32_t orig) {
36450 LDKRoutingFees orig_conv;
36451 orig_conv.inner = (void*)(orig & (~1));
36452 orig_conv.is_owned = false;
36453 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36454 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
36455 uint32_t ret_ref = 0;
36456 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36457 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36458 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36459 ret_ref = (uintptr_t)ret_var.inner;
36460 if (ret_var.is_owned) {
36466 int64_t __attribute__((export_name("TS_RoutingFees_hash"))) TS_RoutingFees_hash(uint32_t o) {
36467 LDKRoutingFees o_conv;
36468 o_conv.inner = (void*)(o & (~1));
36469 o_conv.is_owned = false;
36470 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36471 int64_t ret_val = RoutingFees_hash(&o_conv);
36475 int8_tArray __attribute__((export_name("TS_RoutingFees_write"))) TS_RoutingFees_write(uint32_t obj) {
36476 LDKRoutingFees obj_conv;
36477 obj_conv.inner = (void*)(obj & (~1));
36478 obj_conv.is_owned = false;
36479 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36480 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
36481 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36482 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36483 CVec_u8Z_free(ret_var);
36487 uint32_t __attribute__((export_name("TS_RoutingFees_read"))) TS_RoutingFees_read(int8_tArray ser) {
36488 LDKu8slice ser_ref;
36489 ser_ref.datalen = ser->arr_len;
36490 ser_ref.data = ser->elems /* XXX ser leaks */;
36491 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
36492 *ret_conv = RoutingFees_read(ser_ref);
36493 return (uint32_t)ret_conv;
36496 void __attribute__((export_name("TS_NodeAnnouncementInfo_free"))) TS_NodeAnnouncementInfo_free(uint32_t this_obj) {
36497 LDKNodeAnnouncementInfo this_obj_conv;
36498 this_obj_conv.inner = (void*)(this_obj & (~1));
36499 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36500 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36501 NodeAnnouncementInfo_free(this_obj_conv);
36504 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_get_features"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) {
36505 LDKNodeAnnouncementInfo this_ptr_conv;
36506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36507 this_ptr_conv.is_owned = false;
36508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36509 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
36510 uint32_t ret_ref = 0;
36511 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36512 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36513 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36514 ret_ref = (uintptr_t)ret_var.inner;
36515 if (ret_var.is_owned) {
36521 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_features"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) {
36522 LDKNodeAnnouncementInfo this_ptr_conv;
36523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36524 this_ptr_conv.is_owned = false;
36525 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36526 LDKNodeFeatures val_conv;
36527 val_conv.inner = (void*)(val & (~1));
36528 val_conv.is_owned = (val & 1) || (val == 0);
36529 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36530 val_conv = NodeFeatures_clone(&val_conv);
36531 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
36534 int32_t __attribute__((export_name("TS_NodeAnnouncementInfo_get_last_update"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) {
36535 LDKNodeAnnouncementInfo this_ptr_conv;
36536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36537 this_ptr_conv.is_owned = false;
36538 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36539 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
36543 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_last_update"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) {
36544 LDKNodeAnnouncementInfo this_ptr_conv;
36545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36546 this_ptr_conv.is_owned = false;
36547 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36548 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
36551 int8_tArray __attribute__((export_name("TS_NodeAnnouncementInfo_get_rgb"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) {
36552 LDKNodeAnnouncementInfo this_ptr_conv;
36553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36554 this_ptr_conv.is_owned = false;
36555 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36556 int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
36557 memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
36561 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_rgb"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) {
36562 LDKNodeAnnouncementInfo this_ptr_conv;
36563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36564 this_ptr_conv.is_owned = false;
36565 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36566 LDKThreeBytes val_ref;
36567 CHECK(val->arr_len == 3);
36568 memcpy(val_ref.data, val->elems, 3); FREE(val);
36569 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
36572 int8_tArray __attribute__((export_name("TS_NodeAnnouncementInfo_get_alias"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) {
36573 LDKNodeAnnouncementInfo this_ptr_conv;
36574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36575 this_ptr_conv.is_owned = false;
36576 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36577 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36578 memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
36582 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_alias"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, int8_tArray val) {
36583 LDKNodeAnnouncementInfo this_ptr_conv;
36584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36585 this_ptr_conv.is_owned = false;
36586 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36587 LDKThirtyTwoBytes val_ref;
36588 CHECK(val->arr_len == 32);
36589 memcpy(val_ref.data, val->elems, 32); FREE(val);
36590 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
36593 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_addresses"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) {
36594 LDKNodeAnnouncementInfo this_ptr_conv;
36595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36596 this_ptr_conv.is_owned = false;
36597 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36598 LDKCVec_NetAddressZ val_constr;
36599 val_constr.datalen = val->arr_len;
36600 if (val_constr.datalen > 0)
36601 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
36603 val_constr.data = NULL;
36604 uint32_t* val_vals = val->elems /* XXX val leaks */;
36605 for (size_t m = 0; m < val_constr.datalen; m++) {
36606 uint32_t val_conv_12 = val_vals[m];
36607 void* val_conv_12_ptr = (void*)(((uintptr_t)val_conv_12) & ~1);
36608 CHECK_ACCESS(val_conv_12_ptr);
36609 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
36610 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)val_conv_12) & ~1));
36611 val_constr.data[m] = val_conv_12_conv;
36613 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
36616 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_get_announcement_message"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) {
36617 LDKNodeAnnouncementInfo this_ptr_conv;
36618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36619 this_ptr_conv.is_owned = false;
36620 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36621 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
36622 uint32_t ret_ref = 0;
36623 if ((uintptr_t)ret_var.inner > 4096) {
36624 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36625 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36626 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36627 ret_ref = (uintptr_t)ret_var.inner;
36628 if (ret_var.is_owned) {
36635 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_announcement_message"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
36636 LDKNodeAnnouncementInfo this_ptr_conv;
36637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36638 this_ptr_conv.is_owned = false;
36639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36640 LDKNodeAnnouncement val_conv;
36641 val_conv.inner = (void*)(val & (~1));
36642 val_conv.is_owned = (val & 1) || (val == 0);
36643 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36644 val_conv = NodeAnnouncement_clone(&val_conv);
36645 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
36648 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_new"))) TS_NodeAnnouncementInfo_new(uint32_t features_arg, int32_t last_update_arg, int8_tArray rgb_arg, int8_tArray alias_arg, uint32_tArray addresses_arg, uint32_t announcement_message_arg) {
36649 LDKNodeFeatures features_arg_conv;
36650 features_arg_conv.inner = (void*)(features_arg & (~1));
36651 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
36652 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
36653 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
36654 LDKThreeBytes rgb_arg_ref;
36655 CHECK(rgb_arg->arr_len == 3);
36656 memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
36657 LDKThirtyTwoBytes alias_arg_ref;
36658 CHECK(alias_arg->arr_len == 32);
36659 memcpy(alias_arg_ref.data, alias_arg->elems, 32); FREE(alias_arg);
36660 LDKCVec_NetAddressZ addresses_arg_constr;
36661 addresses_arg_constr.datalen = addresses_arg->arr_len;
36662 if (addresses_arg_constr.datalen > 0)
36663 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
36665 addresses_arg_constr.data = NULL;
36666 uint32_t* addresses_arg_vals = addresses_arg->elems /* XXX addresses_arg leaks */;
36667 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
36668 uint32_t addresses_arg_conv_12 = addresses_arg_vals[m];
36669 void* addresses_arg_conv_12_ptr = (void*)(((uintptr_t)addresses_arg_conv_12) & ~1);
36670 CHECK_ACCESS(addresses_arg_conv_12_ptr);
36671 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
36672 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
36674 LDKNodeAnnouncement announcement_message_arg_conv;
36675 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
36676 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
36677 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
36678 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
36679 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
36680 uint32_t ret_ref = 0;
36681 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36682 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36683 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36684 ret_ref = (uintptr_t)ret_var.inner;
36685 if (ret_var.is_owned) {
36691 static inline uintptr_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
36692 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
36693 uint32_t ret_ref = 0;
36694 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36695 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36696 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36697 ret_ref = (uintptr_t)ret_var.inner;
36698 if (ret_var.is_owned) {
36703 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_clone_ptr"))) TS_NodeAnnouncementInfo_clone_ptr(uint32_t arg) {
36704 LDKNodeAnnouncementInfo arg_conv;
36705 arg_conv.inner = (void*)(arg & (~1));
36706 arg_conv.is_owned = false;
36707 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36708 uint32_t ret_val = NodeAnnouncementInfo_clone_ptr(&arg_conv);
36712 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_clone"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) {
36713 LDKNodeAnnouncementInfo orig_conv;
36714 orig_conv.inner = (void*)(orig & (~1));
36715 orig_conv.is_owned = false;
36716 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36717 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
36718 uint32_t ret_ref = 0;
36719 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36720 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36721 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36722 ret_ref = (uintptr_t)ret_var.inner;
36723 if (ret_var.is_owned) {
36729 int8_tArray __attribute__((export_name("TS_NodeAnnouncementInfo_write"))) TS_NodeAnnouncementInfo_write(uint32_t obj) {
36730 LDKNodeAnnouncementInfo obj_conv;
36731 obj_conv.inner = (void*)(obj & (~1));
36732 obj_conv.is_owned = false;
36733 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36734 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
36735 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36736 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36737 CVec_u8Z_free(ret_var);
36741 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_read"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
36742 LDKu8slice ser_ref;
36743 ser_ref.datalen = ser->arr_len;
36744 ser_ref.data = ser->elems /* XXX ser leaks */;
36745 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
36746 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
36747 return (uint32_t)ret_conv;
36750 void __attribute__((export_name("TS_NodeInfo_free"))) TS_NodeInfo_free(uint32_t this_obj) {
36751 LDKNodeInfo this_obj_conv;
36752 this_obj_conv.inner = (void*)(this_obj & (~1));
36753 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36754 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36755 NodeInfo_free(this_obj_conv);
36758 void __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) {
36759 LDKNodeInfo this_ptr_conv;
36760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36761 this_ptr_conv.is_owned = false;
36762 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36763 LDKCVec_u64Z val_constr;
36764 val_constr.datalen = val->arr_len;
36765 if (val_constr.datalen > 0)
36766 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
36768 val_constr.data = NULL;
36769 int64_t* val_vals = val->elems /* XXX val leaks */;
36770 for (size_t i = 0; i < val_constr.datalen; i++) {
36771 int64_t val_conv_8 = val_vals[i];
36772 val_constr.data[i] = val_conv_8;
36774 NodeInfo_set_channels(&this_ptr_conv, val_constr);
36777 uint32_t __attribute__((export_name("TS_NodeInfo_get_lowest_inbound_channel_fees"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) {
36778 LDKNodeInfo this_ptr_conv;
36779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36780 this_ptr_conv.is_owned = false;
36781 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36782 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
36783 uint32_t ret_ref = 0;
36784 if ((uintptr_t)ret_var.inner > 4096) {
36785 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36786 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36787 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36788 ret_ref = (uintptr_t)ret_var.inner;
36789 if (ret_var.is_owned) {
36796 void __attribute__((export_name("TS_NodeInfo_set_lowest_inbound_channel_fees"))) TS_NodeInfo_set_lowest_inbound_channel_fees(uint32_t this_ptr, uint32_t val) {
36797 LDKNodeInfo this_ptr_conv;
36798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36799 this_ptr_conv.is_owned = false;
36800 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36801 LDKRoutingFees val_conv;
36802 val_conv.inner = (void*)(val & (~1));
36803 val_conv.is_owned = (val & 1) || (val == 0);
36804 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36805 val_conv = RoutingFees_clone(&val_conv);
36806 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
36809 uint32_t __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) {
36810 LDKNodeInfo this_ptr_conv;
36811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36812 this_ptr_conv.is_owned = false;
36813 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36814 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
36815 uint32_t ret_ref = 0;
36816 if ((uintptr_t)ret_var.inner > 4096) {
36817 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36818 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36819 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36820 ret_ref = (uintptr_t)ret_var.inner;
36821 if (ret_var.is_owned) {
36828 void __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) {
36829 LDKNodeInfo this_ptr_conv;
36830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36831 this_ptr_conv.is_owned = false;
36832 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36833 LDKNodeAnnouncementInfo val_conv;
36834 val_conv.inner = (void*)(val & (~1));
36835 val_conv.is_owned = (val & 1) || (val == 0);
36836 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36837 val_conv = NodeAnnouncementInfo_clone(&val_conv);
36838 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
36841 uint32_t __attribute__((export_name("TS_NodeInfo_new"))) TS_NodeInfo_new(int64_tArray channels_arg, uint32_t lowest_inbound_channel_fees_arg, uint32_t announcement_info_arg) {
36842 LDKCVec_u64Z channels_arg_constr;
36843 channels_arg_constr.datalen = channels_arg->arr_len;
36844 if (channels_arg_constr.datalen > 0)
36845 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
36847 channels_arg_constr.data = NULL;
36848 int64_t* channels_arg_vals = channels_arg->elems /* XXX channels_arg leaks */;
36849 for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
36850 int64_t channels_arg_conv_8 = channels_arg_vals[i];
36851 channels_arg_constr.data[i] = channels_arg_conv_8;
36853 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
36854 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
36855 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
36856 CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
36857 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
36858 LDKNodeAnnouncementInfo announcement_info_arg_conv;
36859 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
36860 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
36861 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
36862 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
36863 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
36864 uint32_t ret_ref = 0;
36865 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36866 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36867 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36868 ret_ref = (uintptr_t)ret_var.inner;
36869 if (ret_var.is_owned) {
36875 static inline uintptr_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
36876 LDKNodeInfo ret_var = NodeInfo_clone(arg);
36877 uint32_t ret_ref = 0;
36878 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36879 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36880 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36881 ret_ref = (uintptr_t)ret_var.inner;
36882 if (ret_var.is_owned) {
36887 uint32_t __attribute__((export_name("TS_NodeInfo_clone_ptr"))) TS_NodeInfo_clone_ptr(uint32_t arg) {
36888 LDKNodeInfo arg_conv;
36889 arg_conv.inner = (void*)(arg & (~1));
36890 arg_conv.is_owned = false;
36891 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36892 uint32_t ret_val = NodeInfo_clone_ptr(&arg_conv);
36896 uint32_t __attribute__((export_name("TS_NodeInfo_clone"))) TS_NodeInfo_clone(uint32_t orig) {
36897 LDKNodeInfo orig_conv;
36898 orig_conv.inner = (void*)(orig & (~1));
36899 orig_conv.is_owned = false;
36900 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36901 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
36902 uint32_t ret_ref = 0;
36903 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36904 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36905 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36906 ret_ref = (uintptr_t)ret_var.inner;
36907 if (ret_var.is_owned) {
36913 int8_tArray __attribute__((export_name("TS_NodeInfo_write"))) TS_NodeInfo_write(uint32_t obj) {
36914 LDKNodeInfo obj_conv;
36915 obj_conv.inner = (void*)(obj & (~1));
36916 obj_conv.is_owned = false;
36917 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36918 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
36919 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36920 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36921 CVec_u8Z_free(ret_var);
36925 uint32_t __attribute__((export_name("TS_NodeInfo_read"))) TS_NodeInfo_read(int8_tArray ser) {
36926 LDKu8slice ser_ref;
36927 ser_ref.datalen = ser->arr_len;
36928 ser_ref.data = ser->elems /* XXX ser leaks */;
36929 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
36930 *ret_conv = NodeInfo_read(ser_ref);
36931 return (uint32_t)ret_conv;
36934 int8_tArray __attribute__((export_name("TS_NetworkGraph_write"))) TS_NetworkGraph_write(uint32_t obj) {
36935 LDKNetworkGraph obj_conv;
36936 obj_conv.inner = (void*)(obj & (~1));
36937 obj_conv.is_owned = false;
36938 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36939 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
36940 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36941 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36942 CVec_u8Z_free(ret_var);
36946 uint32_t __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_read(int8_tArray ser) {
36947 LDKu8slice ser_ref;
36948 ser_ref.datalen = ser->arr_len;
36949 ser_ref.data = ser->elems /* XXX ser leaks */;
36950 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
36951 *ret_conv = NetworkGraph_read(ser_ref);
36952 return (uint32_t)ret_conv;
36955 uint32_t __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(int8_tArray genesis_hash) {
36956 LDKThirtyTwoBytes genesis_hash_ref;
36957 CHECK(genesis_hash->arr_len == 32);
36958 memcpy(genesis_hash_ref.data, genesis_hash->elems, 32); FREE(genesis_hash);
36959 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
36960 uint32_t ret_ref = 0;
36961 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36962 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36963 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36964 ret_ref = (uintptr_t)ret_var.inner;
36965 if (ret_var.is_owned) {
36971 uint32_t __attribute__((export_name("TS_NetworkGraph_read_only"))) TS_NetworkGraph_read_only(uint32_t this_arg) {
36972 LDKNetworkGraph this_arg_conv;
36973 this_arg_conv.inner = (void*)(this_arg & (~1));
36974 this_arg_conv.is_owned = false;
36975 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36976 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
36977 uint32_t ret_ref = 0;
36978 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36979 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36980 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36981 ret_ref = (uintptr_t)ret_var.inner;
36982 if (ret_var.is_owned) {
36988 uint32_t __attribute__((export_name("TS_NetworkGraph_update_node_from_announcement"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) {
36989 LDKNetworkGraph this_arg_conv;
36990 this_arg_conv.inner = (void*)(this_arg & (~1));
36991 this_arg_conv.is_owned = false;
36992 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36993 LDKNodeAnnouncement msg_conv;
36994 msg_conv.inner = (void*)(msg & (~1));
36995 msg_conv.is_owned = false;
36996 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
36997 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
36998 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
36999 return (uint32_t)ret_conv;
37002 uint32_t __attribute__((export_name("TS_NetworkGraph_update_node_from_unsigned_announcement"))) TS_NetworkGraph_update_node_from_unsigned_announcement(uint32_t this_arg, uint32_t msg) {
37003 LDKNetworkGraph this_arg_conv;
37004 this_arg_conv.inner = (void*)(this_arg & (~1));
37005 this_arg_conv.is_owned = false;
37006 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37007 LDKUnsignedNodeAnnouncement msg_conv;
37008 msg_conv.inner = (void*)(msg & (~1));
37009 msg_conv.is_owned = false;
37010 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
37011 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
37012 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
37013 return (uint32_t)ret_conv;
37016 uint32_t __attribute__((export_name("TS_NetworkGraph_update_channel_from_announcement"))) TS_NetworkGraph_update_channel_from_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
37017 LDKNetworkGraph this_arg_conv;
37018 this_arg_conv.inner = (void*)(this_arg & (~1));
37019 this_arg_conv.is_owned = false;
37020 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37021 LDKChannelAnnouncement msg_conv;
37022 msg_conv.inner = (void*)(msg & (~1));
37023 msg_conv.is_owned = false;
37024 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
37025 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
37026 CHECK_ACCESS(chain_access_ptr);
37027 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
37028 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
37029 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
37030 // Manually implement clone for Java trait instances
37032 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
37033 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
37034 return (uint32_t)ret_conv;
37037 uint32_t __attribute__((export_name("TS_NetworkGraph_update_channel_from_unsigned_announcement"))) TS_NetworkGraph_update_channel_from_unsigned_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
37038 LDKNetworkGraph this_arg_conv;
37039 this_arg_conv.inner = (void*)(this_arg & (~1));
37040 this_arg_conv.is_owned = false;
37041 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37042 LDKUnsignedChannelAnnouncement msg_conv;
37043 msg_conv.inner = (void*)(msg & (~1));
37044 msg_conv.is_owned = false;
37045 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
37046 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
37047 CHECK_ACCESS(chain_access_ptr);
37048 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
37049 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
37050 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
37051 // Manually implement clone for Java trait instances
37053 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
37054 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
37055 return (uint32_t)ret_conv;
37058 void __attribute__((export_name("TS_NetworkGraph_close_channel_from_update"))) TS_NetworkGraph_close_channel_from_update(uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
37059 LDKNetworkGraph this_arg_conv;
37060 this_arg_conv.inner = (void*)(this_arg & (~1));
37061 this_arg_conv.is_owned = false;
37062 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37063 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
37066 void __attribute__((export_name("TS_NetworkGraph_fail_node"))) TS_NetworkGraph_fail_node(uint32_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
37067 LDKNetworkGraph this_arg_conv;
37068 this_arg_conv.inner = (void*)(this_arg & (~1));
37069 this_arg_conv.is_owned = false;
37070 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37071 LDKPublicKey _node_id_ref;
37072 CHECK(_node_id->arr_len == 33);
37073 memcpy(_node_id_ref.compressed_form, _node_id->elems, 33); FREE(_node_id);
37074 NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent);
37077 void __attribute__((export_name("TS_NetworkGraph_remove_stale_channels_with_time"))) TS_NetworkGraph_remove_stale_channels_with_time(uint32_t this_arg, int64_t current_time_unix) {
37078 LDKNetworkGraph this_arg_conv;
37079 this_arg_conv.inner = (void*)(this_arg & (~1));
37080 this_arg_conv.is_owned = false;
37081 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37082 NetworkGraph_remove_stale_channels_with_time(&this_arg_conv, current_time_unix);
37085 uint32_t __attribute__((export_name("TS_NetworkGraph_update_channel"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) {
37086 LDKNetworkGraph this_arg_conv;
37087 this_arg_conv.inner = (void*)(this_arg & (~1));
37088 this_arg_conv.is_owned = false;
37089 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37090 LDKChannelUpdate msg_conv;
37091 msg_conv.inner = (void*)(msg & (~1));
37092 msg_conv.is_owned = false;
37093 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
37094 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
37095 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
37096 return (uint32_t)ret_conv;
37099 uint32_t __attribute__((export_name("TS_NetworkGraph_update_channel_unsigned"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) {
37100 LDKNetworkGraph this_arg_conv;
37101 this_arg_conv.inner = (void*)(this_arg & (~1));
37102 this_arg_conv.is_owned = false;
37103 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37104 LDKUnsignedChannelUpdate msg_conv;
37105 msg_conv.inner = (void*)(msg & (~1));
37106 msg_conv.is_owned = false;
37107 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
37108 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
37109 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
37110 return (uint32_t)ret_conv;
37113 uint32_t __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) TS_ReadOnlyNetworkGraph_get_addresses(uint32_t this_arg, int8_tArray pubkey) {
37114 LDKReadOnlyNetworkGraph this_arg_conv;
37115 this_arg_conv.inner = (void*)(this_arg & (~1));
37116 this_arg_conv.is_owned = false;
37117 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37118 LDKPublicKey pubkey_ref;
37119 CHECK(pubkey->arr_len == 33);
37120 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
37121 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
37122 *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
37123 uint32_t ret_ref = (uintptr_t)ret_copy;
37127 void __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint32_t this_obj) {
37128 LDKRouteHop this_obj_conv;
37129 this_obj_conv.inner = (void*)(this_obj & (~1));
37130 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37131 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37132 RouteHop_free(this_obj_conv);
37135 int8_tArray __attribute__((export_name("TS_RouteHop_get_pubkey"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) {
37136 LDKRouteHop this_ptr_conv;
37137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37138 this_ptr_conv.is_owned = false;
37139 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37140 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37141 memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
37145 void __attribute__((export_name("TS_RouteHop_set_pubkey"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) {
37146 LDKRouteHop this_ptr_conv;
37147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37148 this_ptr_conv.is_owned = false;
37149 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37150 LDKPublicKey val_ref;
37151 CHECK(val->arr_len == 33);
37152 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37153 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
37156 uint32_t __attribute__((export_name("TS_RouteHop_get_node_features"))) TS_RouteHop_get_node_features(uint32_t this_ptr) {
37157 LDKRouteHop this_ptr_conv;
37158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37159 this_ptr_conv.is_owned = false;
37160 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37161 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
37162 uint32_t ret_ref = 0;
37163 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37164 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37165 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37166 ret_ref = (uintptr_t)ret_var.inner;
37167 if (ret_var.is_owned) {
37173 void __attribute__((export_name("TS_RouteHop_set_node_features"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) {
37174 LDKRouteHop this_ptr_conv;
37175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37176 this_ptr_conv.is_owned = false;
37177 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37178 LDKNodeFeatures val_conv;
37179 val_conv.inner = (void*)(val & (~1));
37180 val_conv.is_owned = (val & 1) || (val == 0);
37181 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37182 val_conv = NodeFeatures_clone(&val_conv);
37183 RouteHop_set_node_features(&this_ptr_conv, val_conv);
37186 int64_t __attribute__((export_name("TS_RouteHop_get_short_channel_id"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) {
37187 LDKRouteHop this_ptr_conv;
37188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37189 this_ptr_conv.is_owned = false;
37190 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37191 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
37195 void __attribute__((export_name("TS_RouteHop_set_short_channel_id"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
37196 LDKRouteHop this_ptr_conv;
37197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37198 this_ptr_conv.is_owned = false;
37199 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37200 RouteHop_set_short_channel_id(&this_ptr_conv, val);
37203 uint32_t __attribute__((export_name("TS_RouteHop_get_channel_features"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) {
37204 LDKRouteHop this_ptr_conv;
37205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37206 this_ptr_conv.is_owned = false;
37207 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37208 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
37209 uint32_t ret_ref = 0;
37210 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37211 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37212 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37213 ret_ref = (uintptr_t)ret_var.inner;
37214 if (ret_var.is_owned) {
37220 void __attribute__((export_name("TS_RouteHop_set_channel_features"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) {
37221 LDKRouteHop this_ptr_conv;
37222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37223 this_ptr_conv.is_owned = false;
37224 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37225 LDKChannelFeatures val_conv;
37226 val_conv.inner = (void*)(val & (~1));
37227 val_conv.is_owned = (val & 1) || (val == 0);
37228 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37229 val_conv = ChannelFeatures_clone(&val_conv);
37230 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
37233 int64_t __attribute__((export_name("TS_RouteHop_get_fee_msat"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) {
37234 LDKRouteHop this_ptr_conv;
37235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37236 this_ptr_conv.is_owned = false;
37237 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37238 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
37242 void __attribute__((export_name("TS_RouteHop_set_fee_msat"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) {
37243 LDKRouteHop this_ptr_conv;
37244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37245 this_ptr_conv.is_owned = false;
37246 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37247 RouteHop_set_fee_msat(&this_ptr_conv, val);
37250 int32_t __attribute__((export_name("TS_RouteHop_get_cltv_expiry_delta"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) {
37251 LDKRouteHop this_ptr_conv;
37252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37253 this_ptr_conv.is_owned = false;
37254 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37255 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
37259 void __attribute__((export_name("TS_RouteHop_set_cltv_expiry_delta"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
37260 LDKRouteHop this_ptr_conv;
37261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37262 this_ptr_conv.is_owned = false;
37263 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37264 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
37267 uint32_t __attribute__((export_name("TS_RouteHop_new"))) TS_RouteHop_new(int8_tArray pubkey_arg, uint32_t node_features_arg, int64_t short_channel_id_arg, uint32_t channel_features_arg, int64_t fee_msat_arg, int32_t cltv_expiry_delta_arg) {
37268 LDKPublicKey pubkey_arg_ref;
37269 CHECK(pubkey_arg->arr_len == 33);
37270 memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
37271 LDKNodeFeatures node_features_arg_conv;
37272 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
37273 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
37274 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
37275 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
37276 LDKChannelFeatures channel_features_arg_conv;
37277 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
37278 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
37279 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
37280 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
37281 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);
37282 uint32_t ret_ref = 0;
37283 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37284 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37285 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37286 ret_ref = (uintptr_t)ret_var.inner;
37287 if (ret_var.is_owned) {
37293 static inline uintptr_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
37294 LDKRouteHop ret_var = RouteHop_clone(arg);
37295 uint32_t ret_ref = 0;
37296 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37297 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37298 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37299 ret_ref = (uintptr_t)ret_var.inner;
37300 if (ret_var.is_owned) {
37305 uint32_t __attribute__((export_name("TS_RouteHop_clone_ptr"))) TS_RouteHop_clone_ptr(uint32_t arg) {
37306 LDKRouteHop arg_conv;
37307 arg_conv.inner = (void*)(arg & (~1));
37308 arg_conv.is_owned = false;
37309 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37310 uint32_t ret_val = RouteHop_clone_ptr(&arg_conv);
37314 uint32_t __attribute__((export_name("TS_RouteHop_clone"))) TS_RouteHop_clone(uint32_t orig) {
37315 LDKRouteHop orig_conv;
37316 orig_conv.inner = (void*)(orig & (~1));
37317 orig_conv.is_owned = false;
37318 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37319 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
37320 uint32_t ret_ref = 0;
37321 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37322 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37323 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37324 ret_ref = (uintptr_t)ret_var.inner;
37325 if (ret_var.is_owned) {
37331 int64_t __attribute__((export_name("TS_RouteHop_hash"))) TS_RouteHop_hash(uint32_t o) {
37332 LDKRouteHop o_conv;
37333 o_conv.inner = (void*)(o & (~1));
37334 o_conv.is_owned = false;
37335 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37336 int64_t ret_val = RouteHop_hash(&o_conv);
37340 jboolean __attribute__((export_name("TS_RouteHop_eq"))) TS_RouteHop_eq(uint32_t a, uint32_t b) {
37341 LDKRouteHop a_conv;
37342 a_conv.inner = (void*)(a & (~1));
37343 a_conv.is_owned = false;
37344 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37345 LDKRouteHop b_conv;
37346 b_conv.inner = (void*)(b & (~1));
37347 b_conv.is_owned = false;
37348 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37349 jboolean ret_val = RouteHop_eq(&a_conv, &b_conv);
37353 int8_tArray __attribute__((export_name("TS_RouteHop_write"))) TS_RouteHop_write(uint32_t obj) {
37354 LDKRouteHop obj_conv;
37355 obj_conv.inner = (void*)(obj & (~1));
37356 obj_conv.is_owned = false;
37357 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37358 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
37359 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37360 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37361 CVec_u8Z_free(ret_var);
37365 uint32_t __attribute__((export_name("TS_RouteHop_read"))) TS_RouteHop_read(int8_tArray ser) {
37366 LDKu8slice ser_ref;
37367 ser_ref.datalen = ser->arr_len;
37368 ser_ref.data = ser->elems /* XXX ser leaks */;
37369 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
37370 *ret_conv = RouteHop_read(ser_ref);
37371 return (uint32_t)ret_conv;
37374 void __attribute__((export_name("TS_Route_free"))) TS_Route_free(uint32_t this_obj) {
37375 LDKRoute this_obj_conv;
37376 this_obj_conv.inner = (void*)(this_obj & (~1));
37377 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37378 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37379 Route_free(this_obj_conv);
37382 ptrArray __attribute__((export_name("TS_Route_get_paths"))) TS_Route_get_paths(uint32_t this_ptr) {
37383 LDKRoute this_ptr_conv;
37384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37385 this_ptr_conv.is_owned = false;
37386 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37387 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
37388 ptrArray ret_arr = NULL;
37389 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
37390 uint32_tArray *ret_arr_ptr = (uint32_tArray*)(((uint8_t*)ret_arr) + 4);
37391 for (size_t m = 0; m < ret_var.datalen; m++) {
37392 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
37393 uint32_tArray ret_conv_12_arr = NULL;
37394 ret_conv_12_arr = init_uint32_tArray(ret_conv_12_var.datalen, __LINE__);
37395 uint32_t *ret_conv_12_arr_ptr = (uint32_t*)(((uint8_t*)ret_conv_12_arr) + 4);
37396 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
37397 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
37398 uint32_t ret_conv_12_conv_10_ref = 0;
37399 CHECK((((uintptr_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37400 CHECK((((uintptr_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37401 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
37402 ret_conv_12_conv_10_ref = (uintptr_t)ret_conv_12_conv_10_var.inner;
37403 if (ret_conv_12_conv_10_var.is_owned) {
37404 ret_conv_12_conv_10_ref |= 1;
37406 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
37409 FREE(ret_conv_12_var.data);
37410 ret_arr_ptr[m] = ret_conv_12_arr;
37413 FREE(ret_var.data);
37417 void __attribute__((export_name("TS_Route_set_paths"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) {
37418 LDKRoute this_ptr_conv;
37419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37420 this_ptr_conv.is_owned = false;
37421 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37422 LDKCVec_CVec_RouteHopZZ val_constr;
37423 val_constr.datalen = val->arr_len;
37424 if (val_constr.datalen > 0)
37425 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
37427 val_constr.data = NULL;
37428 uint32_tArray* val_vals = (void*) val->elems /* XXX val leaks */;
37429 for (size_t m = 0; m < val_constr.datalen; m++) {
37430 uint32_tArray val_conv_12 = val_vals[m];
37431 LDKCVec_RouteHopZ val_conv_12_constr;
37432 val_conv_12_constr.datalen = val_conv_12->arr_len;
37433 if (val_conv_12_constr.datalen > 0)
37434 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
37436 val_conv_12_constr.data = NULL;
37437 uint32_t* val_conv_12_vals = val_conv_12->elems /* XXX val_conv_12 leaks */;
37438 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
37439 uint32_t val_conv_12_conv_10 = val_conv_12_vals[k];
37440 LDKRouteHop val_conv_12_conv_10_conv;
37441 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
37442 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
37443 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
37444 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
37445 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
37447 val_constr.data[m] = val_conv_12_constr;
37449 Route_set_paths(&this_ptr_conv, val_constr);
37452 uint32_t __attribute__((export_name("TS_Route_get_payment_params"))) TS_Route_get_payment_params(uint32_t this_ptr) {
37453 LDKRoute this_ptr_conv;
37454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37455 this_ptr_conv.is_owned = false;
37456 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37457 LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
37458 uint32_t ret_ref = 0;
37459 if ((uintptr_t)ret_var.inner > 4096) {
37460 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37461 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37462 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37463 ret_ref = (uintptr_t)ret_var.inner;
37464 if (ret_var.is_owned) {
37471 void __attribute__((export_name("TS_Route_set_payment_params"))) TS_Route_set_payment_params(uint32_t this_ptr, uint32_t val) {
37472 LDKRoute this_ptr_conv;
37473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37474 this_ptr_conv.is_owned = false;
37475 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37476 LDKPaymentParameters val_conv;
37477 val_conv.inner = (void*)(val & (~1));
37478 val_conv.is_owned = (val & 1) || (val == 0);
37479 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37480 val_conv = PaymentParameters_clone(&val_conv);
37481 Route_set_payment_params(&this_ptr_conv, val_conv);
37484 uint32_t __attribute__((export_name("TS_Route_new"))) TS_Route_new(ptrArray paths_arg, uint32_t payment_params_arg) {
37485 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
37486 paths_arg_constr.datalen = paths_arg->arr_len;
37487 if (paths_arg_constr.datalen > 0)
37488 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
37490 paths_arg_constr.data = NULL;
37491 uint32_tArray* paths_arg_vals = (void*) paths_arg->elems /* XXX paths_arg leaks */;
37492 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
37493 uint32_tArray paths_arg_conv_12 = paths_arg_vals[m];
37494 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
37495 paths_arg_conv_12_constr.datalen = paths_arg_conv_12->arr_len;
37496 if (paths_arg_conv_12_constr.datalen > 0)
37497 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
37499 paths_arg_conv_12_constr.data = NULL;
37500 uint32_t* paths_arg_conv_12_vals = paths_arg_conv_12->elems /* XXX paths_arg_conv_12 leaks */;
37501 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
37502 uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
37503 LDKRouteHop paths_arg_conv_12_conv_10_conv;
37504 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
37505 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
37506 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
37507 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
37508 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
37510 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
37512 LDKPaymentParameters payment_params_arg_conv;
37513 payment_params_arg_conv.inner = (void*)(payment_params_arg & (~1));
37514 payment_params_arg_conv.is_owned = (payment_params_arg & 1) || (payment_params_arg == 0);
37515 CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
37516 payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
37517 LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
37518 uint32_t ret_ref = 0;
37519 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37520 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37521 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37522 ret_ref = (uintptr_t)ret_var.inner;
37523 if (ret_var.is_owned) {
37529 static inline uintptr_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
37530 LDKRoute ret_var = Route_clone(arg);
37531 uint32_t ret_ref = 0;
37532 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37533 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37534 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37535 ret_ref = (uintptr_t)ret_var.inner;
37536 if (ret_var.is_owned) {
37541 uint32_t __attribute__((export_name("TS_Route_clone_ptr"))) TS_Route_clone_ptr(uint32_t arg) {
37543 arg_conv.inner = (void*)(arg & (~1));
37544 arg_conv.is_owned = false;
37545 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37546 uint32_t ret_val = Route_clone_ptr(&arg_conv);
37550 uint32_t __attribute__((export_name("TS_Route_clone"))) TS_Route_clone(uint32_t orig) {
37551 LDKRoute orig_conv;
37552 orig_conv.inner = (void*)(orig & (~1));
37553 orig_conv.is_owned = false;
37554 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37555 LDKRoute ret_var = Route_clone(&orig_conv);
37556 uint32_t ret_ref = 0;
37557 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37558 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37559 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37560 ret_ref = (uintptr_t)ret_var.inner;
37561 if (ret_var.is_owned) {
37567 int64_t __attribute__((export_name("TS_Route_hash"))) TS_Route_hash(uint32_t o) {
37569 o_conv.inner = (void*)(o & (~1));
37570 o_conv.is_owned = false;
37571 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37572 int64_t ret_val = Route_hash(&o_conv);
37576 jboolean __attribute__((export_name("TS_Route_eq"))) TS_Route_eq(uint32_t a, uint32_t b) {
37578 a_conv.inner = (void*)(a & (~1));
37579 a_conv.is_owned = false;
37580 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37582 b_conv.inner = (void*)(b & (~1));
37583 b_conv.is_owned = false;
37584 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37585 jboolean ret_val = Route_eq(&a_conv, &b_conv);
37589 int64_t __attribute__((export_name("TS_Route_get_total_fees"))) TS_Route_get_total_fees(uint32_t this_arg) {
37590 LDKRoute this_arg_conv;
37591 this_arg_conv.inner = (void*)(this_arg & (~1));
37592 this_arg_conv.is_owned = false;
37593 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37594 int64_t ret_val = Route_get_total_fees(&this_arg_conv);
37598 int64_t __attribute__((export_name("TS_Route_get_total_amount"))) TS_Route_get_total_amount(uint32_t this_arg) {
37599 LDKRoute this_arg_conv;
37600 this_arg_conv.inner = (void*)(this_arg & (~1));
37601 this_arg_conv.is_owned = false;
37602 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37603 int64_t ret_val = Route_get_total_amount(&this_arg_conv);
37607 int8_tArray __attribute__((export_name("TS_Route_write"))) TS_Route_write(uint32_t obj) {
37609 obj_conv.inner = (void*)(obj & (~1));
37610 obj_conv.is_owned = false;
37611 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37612 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
37613 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37614 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37615 CVec_u8Z_free(ret_var);
37619 uint32_t __attribute__((export_name("TS_Route_read"))) TS_Route_read(int8_tArray ser) {
37620 LDKu8slice ser_ref;
37621 ser_ref.datalen = ser->arr_len;
37622 ser_ref.data = ser->elems /* XXX ser leaks */;
37623 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
37624 *ret_conv = Route_read(ser_ref);
37625 return (uint32_t)ret_conv;
37628 void __attribute__((export_name("TS_RouteParameters_free"))) TS_RouteParameters_free(uint32_t this_obj) {
37629 LDKRouteParameters this_obj_conv;
37630 this_obj_conv.inner = (void*)(this_obj & (~1));
37631 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37632 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37633 RouteParameters_free(this_obj_conv);
37636 uint32_t __attribute__((export_name("TS_RouteParameters_get_payment_params"))) TS_RouteParameters_get_payment_params(uint32_t this_ptr) {
37637 LDKRouteParameters this_ptr_conv;
37638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37639 this_ptr_conv.is_owned = false;
37640 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37641 LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
37642 uint32_t ret_ref = 0;
37643 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37644 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37645 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37646 ret_ref = (uintptr_t)ret_var.inner;
37647 if (ret_var.is_owned) {
37653 void __attribute__((export_name("TS_RouteParameters_set_payment_params"))) TS_RouteParameters_set_payment_params(uint32_t this_ptr, uint32_t val) {
37654 LDKRouteParameters this_ptr_conv;
37655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37656 this_ptr_conv.is_owned = false;
37657 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37658 LDKPaymentParameters val_conv;
37659 val_conv.inner = (void*)(val & (~1));
37660 val_conv.is_owned = (val & 1) || (val == 0);
37661 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37662 val_conv = PaymentParameters_clone(&val_conv);
37663 RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
37666 int64_t __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint32_t this_ptr) {
37667 LDKRouteParameters this_ptr_conv;
37668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37669 this_ptr_conv.is_owned = false;
37670 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37671 int64_t ret_val = RouteParameters_get_final_value_msat(&this_ptr_conv);
37675 void __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint32_t this_ptr, int64_t val) {
37676 LDKRouteParameters this_ptr_conv;
37677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37678 this_ptr_conv.is_owned = false;
37679 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37680 RouteParameters_set_final_value_msat(&this_ptr_conv, val);
37683 int32_t __attribute__((export_name("TS_RouteParameters_get_final_cltv_expiry_delta"))) TS_RouteParameters_get_final_cltv_expiry_delta(uint32_t this_ptr) {
37684 LDKRouteParameters this_ptr_conv;
37685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37686 this_ptr_conv.is_owned = false;
37687 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37688 int32_t ret_val = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
37692 void __attribute__((export_name("TS_RouteParameters_set_final_cltv_expiry_delta"))) TS_RouteParameters_set_final_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
37693 LDKRouteParameters this_ptr_conv;
37694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37695 this_ptr_conv.is_owned = false;
37696 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37697 RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
37700 uint32_t __attribute__((export_name("TS_RouteParameters_new"))) TS_RouteParameters_new(uint32_t payment_params_arg, int64_t final_value_msat_arg, int32_t final_cltv_expiry_delta_arg) {
37701 LDKPaymentParameters payment_params_arg_conv;
37702 payment_params_arg_conv.inner = (void*)(payment_params_arg & (~1));
37703 payment_params_arg_conv.is_owned = (payment_params_arg & 1) || (payment_params_arg == 0);
37704 CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
37705 payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
37706 LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
37707 uint32_t ret_ref = 0;
37708 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37709 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37710 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37711 ret_ref = (uintptr_t)ret_var.inner;
37712 if (ret_var.is_owned) {
37718 static inline uintptr_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
37719 LDKRouteParameters ret_var = RouteParameters_clone(arg);
37720 uint32_t ret_ref = 0;
37721 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37722 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37723 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37724 ret_ref = (uintptr_t)ret_var.inner;
37725 if (ret_var.is_owned) {
37730 uint32_t __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint32_t arg) {
37731 LDKRouteParameters arg_conv;
37732 arg_conv.inner = (void*)(arg & (~1));
37733 arg_conv.is_owned = false;
37734 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37735 uint32_t ret_val = RouteParameters_clone_ptr(&arg_conv);
37739 uint32_t __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint32_t orig) {
37740 LDKRouteParameters orig_conv;
37741 orig_conv.inner = (void*)(orig & (~1));
37742 orig_conv.is_owned = false;
37743 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37744 LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
37745 uint32_t ret_ref = 0;
37746 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37747 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37748 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37749 ret_ref = (uintptr_t)ret_var.inner;
37750 if (ret_var.is_owned) {
37756 int8_tArray __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint32_t obj) {
37757 LDKRouteParameters obj_conv;
37758 obj_conv.inner = (void*)(obj & (~1));
37759 obj_conv.is_owned = false;
37760 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37761 LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
37762 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37763 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37764 CVec_u8Z_free(ret_var);
37768 uint32_t __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
37769 LDKu8slice ser_ref;
37770 ser_ref.datalen = ser->arr_len;
37771 ser_ref.data = ser->elems /* XXX ser leaks */;
37772 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
37773 *ret_conv = RouteParameters_read(ser_ref);
37774 return (uint32_t)ret_conv;
37777 void __attribute__((export_name("TS_PaymentParameters_free"))) TS_PaymentParameters_free(uint32_t this_obj) {
37778 LDKPaymentParameters this_obj_conv;
37779 this_obj_conv.inner = (void*)(this_obj & (~1));
37780 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37781 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37782 PaymentParameters_free(this_obj_conv);
37785 int8_tArray __attribute__((export_name("TS_PaymentParameters_get_payee_pubkey"))) TS_PaymentParameters_get_payee_pubkey(uint32_t this_ptr) {
37786 LDKPaymentParameters this_ptr_conv;
37787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37788 this_ptr_conv.is_owned = false;
37789 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37790 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37791 memcpy(ret_arr->elems, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form, 33);
37795 void __attribute__((export_name("TS_PaymentParameters_set_payee_pubkey"))) TS_PaymentParameters_set_payee_pubkey(uint32_t this_ptr, int8_tArray val) {
37796 LDKPaymentParameters this_ptr_conv;
37797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37798 this_ptr_conv.is_owned = false;
37799 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37800 LDKPublicKey val_ref;
37801 CHECK(val->arr_len == 33);
37802 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37803 PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
37806 uint32_t __attribute__((export_name("TS_PaymentParameters_get_features"))) TS_PaymentParameters_get_features(uint32_t this_ptr) {
37807 LDKPaymentParameters this_ptr_conv;
37808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37809 this_ptr_conv.is_owned = false;
37810 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37811 LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv);
37812 uint32_t ret_ref = 0;
37813 if ((uintptr_t)ret_var.inner > 4096) {
37814 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37815 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37816 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37817 ret_ref = (uintptr_t)ret_var.inner;
37818 if (ret_var.is_owned) {
37825 void __attribute__((export_name("TS_PaymentParameters_set_features"))) TS_PaymentParameters_set_features(uint32_t this_ptr, uint32_t val) {
37826 LDKPaymentParameters this_ptr_conv;
37827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37828 this_ptr_conv.is_owned = false;
37829 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37830 LDKInvoiceFeatures val_conv;
37831 val_conv.inner = (void*)(val & (~1));
37832 val_conv.is_owned = (val & 1) || (val == 0);
37833 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37834 val_conv = InvoiceFeatures_clone(&val_conv);
37835 PaymentParameters_set_features(&this_ptr_conv, val_conv);
37838 uint32_tArray __attribute__((export_name("TS_PaymentParameters_get_route_hints"))) TS_PaymentParameters_get_route_hints(uint32_t this_ptr) {
37839 LDKPaymentParameters this_ptr_conv;
37840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37841 this_ptr_conv.is_owned = false;
37842 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37843 LDKCVec_RouteHintZ ret_var = PaymentParameters_get_route_hints(&this_ptr_conv);
37844 uint32_tArray ret_arr = NULL;
37845 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
37846 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
37847 for (size_t l = 0; l < ret_var.datalen; l++) {
37848 LDKRouteHint ret_conv_11_var = ret_var.data[l];
37849 uint32_t ret_conv_11_ref = 0;
37850 CHECK((((uintptr_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37851 CHECK((((uintptr_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37852 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
37853 ret_conv_11_ref = (uintptr_t)ret_conv_11_var.inner;
37854 if (ret_conv_11_var.is_owned) {
37855 ret_conv_11_ref |= 1;
37857 ret_arr_ptr[l] = ret_conv_11_ref;
37860 FREE(ret_var.data);
37864 void __attribute__((export_name("TS_PaymentParameters_set_route_hints"))) TS_PaymentParameters_set_route_hints(uint32_t this_ptr, uint32_tArray val) {
37865 LDKPaymentParameters this_ptr_conv;
37866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37867 this_ptr_conv.is_owned = false;
37868 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37869 LDKCVec_RouteHintZ val_constr;
37870 val_constr.datalen = val->arr_len;
37871 if (val_constr.datalen > 0)
37872 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
37874 val_constr.data = NULL;
37875 uint32_t* val_vals = val->elems /* XXX val leaks */;
37876 for (size_t l = 0; l < val_constr.datalen; l++) {
37877 uint32_t val_conv_11 = val_vals[l];
37878 LDKRouteHint val_conv_11_conv;
37879 val_conv_11_conv.inner = (void*)(val_conv_11 & (~1));
37880 val_conv_11_conv.is_owned = (val_conv_11 & 1) || (val_conv_11 == 0);
37881 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
37882 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
37883 val_constr.data[l] = val_conv_11_conv;
37885 PaymentParameters_set_route_hints(&this_ptr_conv, val_constr);
37888 uint32_t __attribute__((export_name("TS_PaymentParameters_get_expiry_time"))) TS_PaymentParameters_get_expiry_time(uint32_t this_ptr) {
37889 LDKPaymentParameters this_ptr_conv;
37890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37891 this_ptr_conv.is_owned = false;
37892 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37893 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37894 *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
37895 uint32_t ret_ref = (uintptr_t)ret_copy;
37899 void __attribute__((export_name("TS_PaymentParameters_set_expiry_time"))) TS_PaymentParameters_set_expiry_time(uint32_t this_ptr, uint32_t val) {
37900 LDKPaymentParameters this_ptr_conv;
37901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37902 this_ptr_conv.is_owned = false;
37903 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37904 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
37905 CHECK_ACCESS(val_ptr);
37906 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37907 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
37908 PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
37911 int32_t __attribute__((export_name("TS_PaymentParameters_get_max_total_cltv_expiry_delta"))) TS_PaymentParameters_get_max_total_cltv_expiry_delta(uint32_t this_ptr) {
37912 LDKPaymentParameters this_ptr_conv;
37913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37914 this_ptr_conv.is_owned = false;
37915 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37916 int32_t ret_val = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
37920 void __attribute__((export_name("TS_PaymentParameters_set_max_total_cltv_expiry_delta"))) TS_PaymentParameters_set_max_total_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
37921 LDKPaymentParameters this_ptr_conv;
37922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37923 this_ptr_conv.is_owned = false;
37924 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37925 PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
37928 uint32_t __attribute__((export_name("TS_PaymentParameters_new"))) TS_PaymentParameters_new(int8_tArray payee_pubkey_arg, uint32_t features_arg, uint32_tArray route_hints_arg, uint32_t expiry_time_arg, int32_t max_total_cltv_expiry_delta_arg) {
37929 LDKPublicKey payee_pubkey_arg_ref;
37930 CHECK(payee_pubkey_arg->arr_len == 33);
37931 memcpy(payee_pubkey_arg_ref.compressed_form, payee_pubkey_arg->elems, 33); FREE(payee_pubkey_arg);
37932 LDKInvoiceFeatures features_arg_conv;
37933 features_arg_conv.inner = (void*)(features_arg & (~1));
37934 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
37935 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
37936 features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
37937 LDKCVec_RouteHintZ route_hints_arg_constr;
37938 route_hints_arg_constr.datalen = route_hints_arg->arr_len;
37939 if (route_hints_arg_constr.datalen > 0)
37940 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
37942 route_hints_arg_constr.data = NULL;
37943 uint32_t* route_hints_arg_vals = route_hints_arg->elems /* XXX route_hints_arg leaks */;
37944 for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
37945 uint32_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
37946 LDKRouteHint route_hints_arg_conv_11_conv;
37947 route_hints_arg_conv_11_conv.inner = (void*)(route_hints_arg_conv_11 & (~1));
37948 route_hints_arg_conv_11_conv.is_owned = (route_hints_arg_conv_11 & 1) || (route_hints_arg_conv_11 == 0);
37949 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
37950 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
37951 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
37953 void* expiry_time_arg_ptr = (void*)(((uintptr_t)expiry_time_arg) & ~1);
37954 CHECK_ACCESS(expiry_time_arg_ptr);
37955 LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
37956 expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)expiry_time_arg) & ~1));
37957 LDKPaymentParameters ret_var = PaymentParameters_new(payee_pubkey_arg_ref, features_arg_conv, route_hints_arg_constr, expiry_time_arg_conv, max_total_cltv_expiry_delta_arg);
37958 uint32_t ret_ref = 0;
37959 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37960 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37961 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37962 ret_ref = (uintptr_t)ret_var.inner;
37963 if (ret_var.is_owned) {
37969 static inline uintptr_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
37970 LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
37971 uint32_t ret_ref = 0;
37972 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37973 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37974 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37975 ret_ref = (uintptr_t)ret_var.inner;
37976 if (ret_var.is_owned) {
37981 uint32_t __attribute__((export_name("TS_PaymentParameters_clone_ptr"))) TS_PaymentParameters_clone_ptr(uint32_t arg) {
37982 LDKPaymentParameters arg_conv;
37983 arg_conv.inner = (void*)(arg & (~1));
37984 arg_conv.is_owned = false;
37985 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37986 uint32_t ret_val = PaymentParameters_clone_ptr(&arg_conv);
37990 uint32_t __attribute__((export_name("TS_PaymentParameters_clone"))) TS_PaymentParameters_clone(uint32_t orig) {
37991 LDKPaymentParameters orig_conv;
37992 orig_conv.inner = (void*)(orig & (~1));
37993 orig_conv.is_owned = false;
37994 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37995 LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
37996 uint32_t ret_ref = 0;
37997 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37998 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37999 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38000 ret_ref = (uintptr_t)ret_var.inner;
38001 if (ret_var.is_owned) {
38007 int64_t __attribute__((export_name("TS_PaymentParameters_hash"))) TS_PaymentParameters_hash(uint32_t o) {
38008 LDKPaymentParameters o_conv;
38009 o_conv.inner = (void*)(o & (~1));
38010 o_conv.is_owned = false;
38011 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38012 int64_t ret_val = PaymentParameters_hash(&o_conv);
38016 jboolean __attribute__((export_name("TS_PaymentParameters_eq"))) TS_PaymentParameters_eq(uint32_t a, uint32_t b) {
38017 LDKPaymentParameters a_conv;
38018 a_conv.inner = (void*)(a & (~1));
38019 a_conv.is_owned = false;
38020 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38021 LDKPaymentParameters b_conv;
38022 b_conv.inner = (void*)(b & (~1));
38023 b_conv.is_owned = false;
38024 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38025 jboolean ret_val = PaymentParameters_eq(&a_conv, &b_conv);
38029 int8_tArray __attribute__((export_name("TS_PaymentParameters_write"))) TS_PaymentParameters_write(uint32_t obj) {
38030 LDKPaymentParameters obj_conv;
38031 obj_conv.inner = (void*)(obj & (~1));
38032 obj_conv.is_owned = false;
38033 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38034 LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
38035 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38036 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38037 CVec_u8Z_free(ret_var);
38041 uint32_t __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser) {
38042 LDKu8slice ser_ref;
38043 ser_ref.datalen = ser->arr_len;
38044 ser_ref.data = ser->elems /* XXX ser leaks */;
38045 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
38046 *ret_conv = PaymentParameters_read(ser_ref);
38047 return (uint32_t)ret_conv;
38050 uint32_t __attribute__((export_name("TS_PaymentParameters_from_node_id"))) TS_PaymentParameters_from_node_id(int8_tArray payee_pubkey) {
38051 LDKPublicKey payee_pubkey_ref;
38052 CHECK(payee_pubkey->arr_len == 33);
38053 memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
38054 LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref);
38055 uint32_t ret_ref = 0;
38056 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38057 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38058 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38059 ret_ref = (uintptr_t)ret_var.inner;
38060 if (ret_var.is_owned) {
38066 uint32_t __attribute__((export_name("TS_PaymentParameters_for_keysend"))) TS_PaymentParameters_for_keysend(int8_tArray payee_pubkey) {
38067 LDKPublicKey payee_pubkey_ref;
38068 CHECK(payee_pubkey->arr_len == 33);
38069 memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
38070 LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref);
38071 uint32_t ret_ref = 0;
38072 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38073 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38074 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38075 ret_ref = (uintptr_t)ret_var.inner;
38076 if (ret_var.is_owned) {
38082 void __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint32_t this_obj) {
38083 LDKRouteHint this_obj_conv;
38084 this_obj_conv.inner = (void*)(this_obj & (~1));
38085 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38086 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38087 RouteHint_free(this_obj_conv);
38090 uint32_tArray __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint32_t this_ptr) {
38091 LDKRouteHint this_ptr_conv;
38092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38093 this_ptr_conv.is_owned = false;
38094 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38095 LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
38096 uint32_tArray ret_arr = NULL;
38097 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
38098 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
38099 for (size_t o = 0; o < ret_var.datalen; o++) {
38100 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
38101 uint32_t ret_conv_14_ref = 0;
38102 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38103 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38104 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
38105 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
38106 if (ret_conv_14_var.is_owned) {
38107 ret_conv_14_ref |= 1;
38109 ret_arr_ptr[o] = ret_conv_14_ref;
38112 FREE(ret_var.data);
38116 void __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint32_t this_ptr, uint32_tArray val) {
38117 LDKRouteHint this_ptr_conv;
38118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38119 this_ptr_conv.is_owned = false;
38120 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38121 LDKCVec_RouteHintHopZ val_constr;
38122 val_constr.datalen = val->arr_len;
38123 if (val_constr.datalen > 0)
38124 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
38126 val_constr.data = NULL;
38127 uint32_t* val_vals = val->elems /* XXX val leaks */;
38128 for (size_t o = 0; o < val_constr.datalen; o++) {
38129 uint32_t val_conv_14 = val_vals[o];
38130 LDKRouteHintHop val_conv_14_conv;
38131 val_conv_14_conv.inner = (void*)(val_conv_14 & (~1));
38132 val_conv_14_conv.is_owned = (val_conv_14 & 1) || (val_conv_14 == 0);
38133 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
38134 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
38135 val_constr.data[o] = val_conv_14_conv;
38137 RouteHint_set_a(&this_ptr_conv, val_constr);
38140 uint32_t __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint32_tArray a_arg) {
38141 LDKCVec_RouteHintHopZ a_arg_constr;
38142 a_arg_constr.datalen = a_arg->arr_len;
38143 if (a_arg_constr.datalen > 0)
38144 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
38146 a_arg_constr.data = NULL;
38147 uint32_t* a_arg_vals = a_arg->elems /* XXX a_arg leaks */;
38148 for (size_t o = 0; o < a_arg_constr.datalen; o++) {
38149 uint32_t a_arg_conv_14 = a_arg_vals[o];
38150 LDKRouteHintHop a_arg_conv_14_conv;
38151 a_arg_conv_14_conv.inner = (void*)(a_arg_conv_14 & (~1));
38152 a_arg_conv_14_conv.is_owned = (a_arg_conv_14 & 1) || (a_arg_conv_14 == 0);
38153 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
38154 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
38155 a_arg_constr.data[o] = a_arg_conv_14_conv;
38157 LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
38158 uint32_t ret_ref = 0;
38159 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38160 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38161 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38162 ret_ref = (uintptr_t)ret_var.inner;
38163 if (ret_var.is_owned) {
38169 static inline uintptr_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
38170 LDKRouteHint ret_var = RouteHint_clone(arg);
38171 uint32_t ret_ref = 0;
38172 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38173 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38174 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38175 ret_ref = (uintptr_t)ret_var.inner;
38176 if (ret_var.is_owned) {
38181 uint32_t __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint32_t arg) {
38182 LDKRouteHint arg_conv;
38183 arg_conv.inner = (void*)(arg & (~1));
38184 arg_conv.is_owned = false;
38185 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38186 uint32_t ret_val = RouteHint_clone_ptr(&arg_conv);
38190 uint32_t __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint32_t orig) {
38191 LDKRouteHint orig_conv;
38192 orig_conv.inner = (void*)(orig & (~1));
38193 orig_conv.is_owned = false;
38194 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38195 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
38196 uint32_t ret_ref = 0;
38197 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38198 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38199 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38200 ret_ref = (uintptr_t)ret_var.inner;
38201 if (ret_var.is_owned) {
38207 int64_t __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint32_t o) {
38208 LDKRouteHint o_conv;
38209 o_conv.inner = (void*)(o & (~1));
38210 o_conv.is_owned = false;
38211 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38212 int64_t ret_val = RouteHint_hash(&o_conv);
38216 jboolean __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint32_t a, uint32_t b) {
38217 LDKRouteHint a_conv;
38218 a_conv.inner = (void*)(a & (~1));
38219 a_conv.is_owned = false;
38220 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38221 LDKRouteHint b_conv;
38222 b_conv.inner = (void*)(b & (~1));
38223 b_conv.is_owned = false;
38224 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38225 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
38229 int8_tArray __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint32_t obj) {
38230 LDKRouteHint obj_conv;
38231 obj_conv.inner = (void*)(obj & (~1));
38232 obj_conv.is_owned = false;
38233 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38234 LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
38235 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38236 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38237 CVec_u8Z_free(ret_var);
38241 uint32_t __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
38242 LDKu8slice ser_ref;
38243 ser_ref.datalen = ser->arr_len;
38244 ser_ref.data = ser->elems /* XXX ser leaks */;
38245 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
38246 *ret_conv = RouteHint_read(ser_ref);
38247 return (uint32_t)ret_conv;
38250 void __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint32_t this_obj) {
38251 LDKRouteHintHop this_obj_conv;
38252 this_obj_conv.inner = (void*)(this_obj & (~1));
38253 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38254 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38255 RouteHintHop_free(this_obj_conv);
38258 int8_tArray __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint32_t this_ptr) {
38259 LDKRouteHintHop this_ptr_conv;
38260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38261 this_ptr_conv.is_owned = false;
38262 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38263 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38264 memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
38268 void __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint32_t this_ptr, int8_tArray val) {
38269 LDKRouteHintHop this_ptr_conv;
38270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38271 this_ptr_conv.is_owned = false;
38272 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38273 LDKPublicKey val_ref;
38274 CHECK(val->arr_len == 33);
38275 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38276 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
38279 int64_t __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint32_t this_ptr) {
38280 LDKRouteHintHop this_ptr_conv;
38281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38282 this_ptr_conv.is_owned = false;
38283 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38284 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
38288 void __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
38289 LDKRouteHintHop this_ptr_conv;
38290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38291 this_ptr_conv.is_owned = false;
38292 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38293 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
38296 uint32_t __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint32_t this_ptr) {
38297 LDKRouteHintHop this_ptr_conv;
38298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38299 this_ptr_conv.is_owned = false;
38300 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38301 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
38302 uint32_t ret_ref = 0;
38303 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38304 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38305 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38306 ret_ref = (uintptr_t)ret_var.inner;
38307 if (ret_var.is_owned) {
38313 void __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint32_t this_ptr, uint32_t val) {
38314 LDKRouteHintHop this_ptr_conv;
38315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38316 this_ptr_conv.is_owned = false;
38317 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38318 LDKRoutingFees val_conv;
38319 val_conv.inner = (void*)(val & (~1));
38320 val_conv.is_owned = (val & 1) || (val == 0);
38321 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38322 val_conv = RoutingFees_clone(&val_conv);
38323 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
38326 int16_t __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint32_t this_ptr) {
38327 LDKRouteHintHop this_ptr_conv;
38328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38329 this_ptr_conv.is_owned = false;
38330 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38331 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
38335 void __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
38336 LDKRouteHintHop this_ptr_conv;
38337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38338 this_ptr_conv.is_owned = false;
38339 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38340 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
38343 uint32_t __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint32_t this_ptr) {
38344 LDKRouteHintHop this_ptr_conv;
38345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38346 this_ptr_conv.is_owned = false;
38347 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38348 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
38349 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
38350 uint32_t ret_ref = (uintptr_t)ret_copy;
38354 void __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint32_t this_ptr, uint32_t val) {
38355 LDKRouteHintHop this_ptr_conv;
38356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38357 this_ptr_conv.is_owned = false;
38358 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38359 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
38360 CHECK_ACCESS(val_ptr);
38361 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
38362 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
38363 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
38366 uint32_t __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint32_t this_ptr) {
38367 LDKRouteHintHop this_ptr_conv;
38368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38369 this_ptr_conv.is_owned = false;
38370 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38371 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
38372 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
38373 uint32_t ret_ref = (uintptr_t)ret_copy;
38377 void __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
38378 LDKRouteHintHop this_ptr_conv;
38379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38380 this_ptr_conv.is_owned = false;
38381 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38382 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
38383 CHECK_ACCESS(val_ptr);
38384 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
38385 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
38386 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
38389 uint32_t __attribute__((export_name("TS_RouteHintHop_new"))) TS_RouteHintHop_new(int8_tArray src_node_id_arg, int64_t short_channel_id_arg, uint32_t fees_arg, int16_t cltv_expiry_delta_arg, uint32_t htlc_minimum_msat_arg, uint32_t htlc_maximum_msat_arg) {
38390 LDKPublicKey src_node_id_arg_ref;
38391 CHECK(src_node_id_arg->arr_len == 33);
38392 memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
38393 LDKRoutingFees fees_arg_conv;
38394 fees_arg_conv.inner = (void*)(fees_arg & (~1));
38395 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
38396 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
38397 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
38398 void* htlc_minimum_msat_arg_ptr = (void*)(((uintptr_t)htlc_minimum_msat_arg) & ~1);
38399 CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
38400 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
38401 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_minimum_msat_arg) & ~1));
38402 void* htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)htlc_maximum_msat_arg) & ~1);
38403 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
38404 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
38405 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_maximum_msat_arg) & ~1));
38406 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);
38407 uint32_t ret_ref = 0;
38408 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38409 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38410 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38411 ret_ref = (uintptr_t)ret_var.inner;
38412 if (ret_var.is_owned) {
38418 static inline uintptr_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
38419 LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
38420 uint32_t ret_ref = 0;
38421 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38422 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38423 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38424 ret_ref = (uintptr_t)ret_var.inner;
38425 if (ret_var.is_owned) {
38430 uint32_t __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint32_t arg) {
38431 LDKRouteHintHop arg_conv;
38432 arg_conv.inner = (void*)(arg & (~1));
38433 arg_conv.is_owned = false;
38434 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38435 uint32_t ret_val = RouteHintHop_clone_ptr(&arg_conv);
38439 uint32_t __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint32_t orig) {
38440 LDKRouteHintHop orig_conv;
38441 orig_conv.inner = (void*)(orig & (~1));
38442 orig_conv.is_owned = false;
38443 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38444 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
38445 uint32_t ret_ref = 0;
38446 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38447 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38448 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38449 ret_ref = (uintptr_t)ret_var.inner;
38450 if (ret_var.is_owned) {
38456 int64_t __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint32_t o) {
38457 LDKRouteHintHop o_conv;
38458 o_conv.inner = (void*)(o & (~1));
38459 o_conv.is_owned = false;
38460 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38461 int64_t ret_val = RouteHintHop_hash(&o_conv);
38465 jboolean __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint32_t a, uint32_t b) {
38466 LDKRouteHintHop a_conv;
38467 a_conv.inner = (void*)(a & (~1));
38468 a_conv.is_owned = false;
38469 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38470 LDKRouteHintHop b_conv;
38471 b_conv.inner = (void*)(b & (~1));
38472 b_conv.is_owned = false;
38473 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38474 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
38478 int8_tArray __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint32_t obj) {
38479 LDKRouteHintHop obj_conv;
38480 obj_conv.inner = (void*)(obj & (~1));
38481 obj_conv.is_owned = false;
38482 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38483 LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
38484 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38485 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38486 CVec_u8Z_free(ret_var);
38490 uint32_t __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
38491 LDKu8slice ser_ref;
38492 ser_ref.datalen = ser->arr_len;
38493 ser_ref.data = ser->elems /* XXX ser leaks */;
38494 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
38495 *ret_conv = RouteHintHop_read(ser_ref);
38496 return (uint32_t)ret_conv;
38499 uint32_t __attribute__((export_name("TS_find_route"))) TS_find_route(int8_tArray our_node_pubkey, uint32_t route_params, uint32_t network, uint32_tArray first_hops, uint32_t logger, uint32_t scorer) {
38500 LDKPublicKey our_node_pubkey_ref;
38501 CHECK(our_node_pubkey->arr_len == 33);
38502 memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
38503 LDKRouteParameters route_params_conv;
38504 route_params_conv.inner = (void*)(route_params & (~1));
38505 route_params_conv.is_owned = false;
38506 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
38507 LDKNetworkGraph network_conv;
38508 network_conv.inner = (void*)(network & (~1));
38509 network_conv.is_owned = false;
38510 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_conv);
38511 LDKCVec_ChannelDetailsZ first_hops_constr;
38512 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
38513 if (first_hops != 0) {
38514 first_hops_constr.datalen = first_hops->arr_len;
38515 if (first_hops_constr.datalen > 0)
38516 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
38518 first_hops_constr.data = NULL;
38519 uint32_t* first_hops_vals = first_hops->elems /* XXX first_hops leaks */;
38520 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
38521 uint32_t first_hops_conv_16 = first_hops_vals[q];
38522 LDKChannelDetails first_hops_conv_16_conv;
38523 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
38524 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
38525 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
38526 first_hops_constr.data[q] = first_hops_conv_16_conv;
38528 first_hops_ptr = &first_hops_constr;
38530 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
38531 CHECK_ACCESS(logger_ptr);
38532 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38533 void* scorer_ptr = (void*)(((uintptr_t)scorer) & ~1);
38534 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
38535 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
38536 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
38537 *ret_conv = find_route(our_node_pubkey_ref, &route_params_conv, &network_conv, first_hops_ptr, logger_conv, scorer_conv);
38538 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
38539 return (uint32_t)ret_conv;
38542 void __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint32_t this_ptr) {
38543 if ((this_ptr & 1) != 0) return;
38544 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
38545 CHECK_ACCESS(this_ptr_ptr);
38546 LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
38547 FREE((void*)this_ptr);
38548 Score_free(this_ptr_conv);
38551 void __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint32_t this_ptr) {
38552 if ((this_ptr & 1) != 0) return;
38553 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
38554 CHECK_ACCESS(this_ptr_ptr);
38555 LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
38556 FREE((void*)this_ptr);
38557 LockableScore_free(this_ptr_conv);
38560 void __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint32_t this_obj) {
38561 LDKMultiThreadedLockableScore this_obj_conv;
38562 this_obj_conv.inner = (void*)(this_obj & (~1));
38563 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38564 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38565 MultiThreadedLockableScore_free(this_obj_conv);
38568 uint32_t __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint32_t score) {
38569 void* score_ptr = (void*)(((uintptr_t)score) & ~1);
38570 CHECK_ACCESS(score_ptr);
38571 LDKScore score_conv = *(LDKScore*)(score_ptr);
38572 LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
38573 uint32_t ret_ref = 0;
38574 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38575 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38576 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38577 ret_ref = (uintptr_t)ret_var.inner;
38578 if (ret_var.is_owned) {
38584 void __attribute__((export_name("TS_FixedPenaltyScorer_free"))) TS_FixedPenaltyScorer_free(uint32_t this_obj) {
38585 LDKFixedPenaltyScorer this_obj_conv;
38586 this_obj_conv.inner = (void*)(this_obj & (~1));
38587 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38588 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38589 FixedPenaltyScorer_free(this_obj_conv);
38592 static inline uintptr_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
38593 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
38594 uint32_t ret_ref = 0;
38595 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38596 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38597 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38598 ret_ref = (uintptr_t)ret_var.inner;
38599 if (ret_var.is_owned) {
38604 uint32_t __attribute__((export_name("TS_FixedPenaltyScorer_clone_ptr"))) TS_FixedPenaltyScorer_clone_ptr(uint32_t arg) {
38605 LDKFixedPenaltyScorer arg_conv;
38606 arg_conv.inner = (void*)(arg & (~1));
38607 arg_conv.is_owned = false;
38608 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38609 uint32_t ret_val = FixedPenaltyScorer_clone_ptr(&arg_conv);
38613 uint32_t __attribute__((export_name("TS_FixedPenaltyScorer_clone"))) TS_FixedPenaltyScorer_clone(uint32_t orig) {
38614 LDKFixedPenaltyScorer orig_conv;
38615 orig_conv.inner = (void*)(orig & (~1));
38616 orig_conv.is_owned = false;
38617 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38618 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
38619 uint32_t ret_ref = 0;
38620 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38621 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38622 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38623 ret_ref = (uintptr_t)ret_var.inner;
38624 if (ret_var.is_owned) {
38630 int8_tArray __attribute__((export_name("TS_FixedPenaltyScorer_write"))) TS_FixedPenaltyScorer_write(uint32_t obj) {
38631 LDKFixedPenaltyScorer obj_conv;
38632 obj_conv.inner = (void*)(obj & (~1));
38633 obj_conv.is_owned = false;
38634 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38635 LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
38636 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38637 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38638 CVec_u8Z_free(ret_var);
38642 uint32_t __attribute__((export_name("TS_FixedPenaltyScorer_read"))) TS_FixedPenaltyScorer_read(int8_tArray ser) {
38643 LDKu8slice ser_ref;
38644 ser_ref.datalen = ser->arr_len;
38645 ser_ref.data = ser->elems /* XXX ser leaks */;
38646 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
38647 *ret_conv = FixedPenaltyScorer_read(ser_ref);
38648 return (uint32_t)ret_conv;
38651 uint32_t __attribute__((export_name("TS_FixedPenaltyScorer_with_penalty"))) TS_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
38652 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
38653 uint32_t ret_ref = 0;
38654 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38655 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38656 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38657 ret_ref = (uintptr_t)ret_var.inner;
38658 if (ret_var.is_owned) {
38664 uint32_t __attribute__((export_name("TS_FixedPenaltyScorer_as_Score"))) TS_FixedPenaltyScorer_as_Score(uint32_t this_arg) {
38665 LDKFixedPenaltyScorer this_arg_conv;
38666 this_arg_conv.inner = (void*)(this_arg & (~1));
38667 this_arg_conv.is_owned = false;
38668 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38669 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
38670 *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
38671 return (uint32_t)ret_ret;
38674 void __attribute__((export_name("TS_Scorer_free"))) TS_Scorer_free(uint32_t this_obj) {
38675 LDKScorer this_obj_conv;
38676 this_obj_conv.inner = (void*)(this_obj & (~1));
38677 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38678 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38679 Scorer_free(this_obj_conv);
38682 void __attribute__((export_name("TS_ScoringParameters_free"))) TS_ScoringParameters_free(uint32_t this_obj) {
38683 LDKScoringParameters this_obj_conv;
38684 this_obj_conv.inner = (void*)(this_obj & (~1));
38685 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38686 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38687 ScoringParameters_free(this_obj_conv);
38690 int64_t __attribute__((export_name("TS_ScoringParameters_get_base_penalty_msat"))) TS_ScoringParameters_get_base_penalty_msat(uint32_t this_ptr) {
38691 LDKScoringParameters this_ptr_conv;
38692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38693 this_ptr_conv.is_owned = false;
38694 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38695 int64_t ret_val = ScoringParameters_get_base_penalty_msat(&this_ptr_conv);
38699 void __attribute__((export_name("TS_ScoringParameters_set_base_penalty_msat"))) TS_ScoringParameters_set_base_penalty_msat(uint32_t this_ptr, int64_t val) {
38700 LDKScoringParameters this_ptr_conv;
38701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38702 this_ptr_conv.is_owned = false;
38703 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38704 ScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
38707 int64_t __attribute__((export_name("TS_ScoringParameters_get_failure_penalty_msat"))) TS_ScoringParameters_get_failure_penalty_msat(uint32_t this_ptr) {
38708 LDKScoringParameters this_ptr_conv;
38709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38710 this_ptr_conv.is_owned = false;
38711 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38712 int64_t ret_val = ScoringParameters_get_failure_penalty_msat(&this_ptr_conv);
38716 void __attribute__((export_name("TS_ScoringParameters_set_failure_penalty_msat"))) TS_ScoringParameters_set_failure_penalty_msat(uint32_t this_ptr, int64_t val) {
38717 LDKScoringParameters this_ptr_conv;
38718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38719 this_ptr_conv.is_owned = false;
38720 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38721 ScoringParameters_set_failure_penalty_msat(&this_ptr_conv, val);
38724 int16_t __attribute__((export_name("TS_ScoringParameters_get_overuse_penalty_start_1024th"))) TS_ScoringParameters_get_overuse_penalty_start_1024th(uint32_t this_ptr) {
38725 LDKScoringParameters this_ptr_conv;
38726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38727 this_ptr_conv.is_owned = false;
38728 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38729 int16_t ret_val = ScoringParameters_get_overuse_penalty_start_1024th(&this_ptr_conv);
38733 void __attribute__((export_name("TS_ScoringParameters_set_overuse_penalty_start_1024th"))) TS_ScoringParameters_set_overuse_penalty_start_1024th(uint32_t this_ptr, int16_t val) {
38734 LDKScoringParameters this_ptr_conv;
38735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38736 this_ptr_conv.is_owned = false;
38737 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38738 ScoringParameters_set_overuse_penalty_start_1024th(&this_ptr_conv, val);
38741 int64_t __attribute__((export_name("TS_ScoringParameters_get_overuse_penalty_msat_per_1024th"))) TS_ScoringParameters_get_overuse_penalty_msat_per_1024th(uint32_t this_ptr) {
38742 LDKScoringParameters this_ptr_conv;
38743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38744 this_ptr_conv.is_owned = false;
38745 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38746 int64_t ret_val = ScoringParameters_get_overuse_penalty_msat_per_1024th(&this_ptr_conv);
38750 void __attribute__((export_name("TS_ScoringParameters_set_overuse_penalty_msat_per_1024th"))) TS_ScoringParameters_set_overuse_penalty_msat_per_1024th(uint32_t this_ptr, int64_t val) {
38751 LDKScoringParameters this_ptr_conv;
38752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38753 this_ptr_conv.is_owned = false;
38754 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38755 ScoringParameters_set_overuse_penalty_msat_per_1024th(&this_ptr_conv, val);
38758 int64_t __attribute__((export_name("TS_ScoringParameters_get_failure_penalty_half_life"))) TS_ScoringParameters_get_failure_penalty_half_life(uint32_t this_ptr) {
38759 LDKScoringParameters this_ptr_conv;
38760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38761 this_ptr_conv.is_owned = false;
38762 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38763 int64_t ret_val = ScoringParameters_get_failure_penalty_half_life(&this_ptr_conv);
38767 void __attribute__((export_name("TS_ScoringParameters_set_failure_penalty_half_life"))) TS_ScoringParameters_set_failure_penalty_half_life(uint32_t this_ptr, int64_t val) {
38768 LDKScoringParameters this_ptr_conv;
38769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38770 this_ptr_conv.is_owned = false;
38771 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38772 ScoringParameters_set_failure_penalty_half_life(&this_ptr_conv, val);
38775 uint32_t __attribute__((export_name("TS_ScoringParameters_new"))) TS_ScoringParameters_new(int64_t base_penalty_msat_arg, int64_t failure_penalty_msat_arg, int16_t overuse_penalty_start_1024th_arg, int64_t overuse_penalty_msat_per_1024th_arg, int64_t failure_penalty_half_life_arg) {
38776 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);
38777 uint32_t ret_ref = 0;
38778 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38779 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38780 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38781 ret_ref = (uintptr_t)ret_var.inner;
38782 if (ret_var.is_owned) {
38788 static inline uintptr_t ScoringParameters_clone_ptr(LDKScoringParameters *NONNULL_PTR arg) {
38789 LDKScoringParameters ret_var = ScoringParameters_clone(arg);
38790 uint32_t ret_ref = 0;
38791 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38792 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38793 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38794 ret_ref = (uintptr_t)ret_var.inner;
38795 if (ret_var.is_owned) {
38800 uint32_t __attribute__((export_name("TS_ScoringParameters_clone_ptr"))) TS_ScoringParameters_clone_ptr(uint32_t arg) {
38801 LDKScoringParameters arg_conv;
38802 arg_conv.inner = (void*)(arg & (~1));
38803 arg_conv.is_owned = false;
38804 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38805 uint32_t ret_val = ScoringParameters_clone_ptr(&arg_conv);
38809 uint32_t __attribute__((export_name("TS_ScoringParameters_clone"))) TS_ScoringParameters_clone(uint32_t orig) {
38810 LDKScoringParameters orig_conv;
38811 orig_conv.inner = (void*)(orig & (~1));
38812 orig_conv.is_owned = false;
38813 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38814 LDKScoringParameters ret_var = ScoringParameters_clone(&orig_conv);
38815 uint32_t ret_ref = 0;
38816 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38817 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38818 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38819 ret_ref = (uintptr_t)ret_var.inner;
38820 if (ret_var.is_owned) {
38826 int8_tArray __attribute__((export_name("TS_ScoringParameters_write"))) TS_ScoringParameters_write(uint32_t obj) {
38827 LDKScoringParameters obj_conv;
38828 obj_conv.inner = (void*)(obj & (~1));
38829 obj_conv.is_owned = false;
38830 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38831 LDKCVec_u8Z ret_var = ScoringParameters_write(&obj_conv);
38832 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38833 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38834 CVec_u8Z_free(ret_var);
38838 uint32_t __attribute__((export_name("TS_ScoringParameters_read"))) TS_ScoringParameters_read(int8_tArray ser) {
38839 LDKu8slice ser_ref;
38840 ser_ref.datalen = ser->arr_len;
38841 ser_ref.data = ser->elems /* XXX ser leaks */;
38842 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
38843 *ret_conv = ScoringParameters_read(ser_ref);
38844 return (uint32_t)ret_conv;
38847 uint32_t __attribute__((export_name("TS_Scorer_new"))) TS_Scorer_new(uint32_t params) {
38848 LDKScoringParameters params_conv;
38849 params_conv.inner = (void*)(params & (~1));
38850 params_conv.is_owned = (params & 1) || (params == 0);
38851 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
38852 params_conv = ScoringParameters_clone(¶ms_conv);
38853 LDKScorer ret_var = Scorer_new(params_conv);
38854 uint32_t ret_ref = 0;
38855 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38856 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38857 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38858 ret_ref = (uintptr_t)ret_var.inner;
38859 if (ret_var.is_owned) {
38865 uint32_t __attribute__((export_name("TS_Scorer_default"))) TS_Scorer_default() {
38866 LDKScorer ret_var = Scorer_default();
38867 uint32_t ret_ref = 0;
38868 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38869 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38870 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38871 ret_ref = (uintptr_t)ret_var.inner;
38872 if (ret_var.is_owned) {
38878 uint32_t __attribute__((export_name("TS_ScoringParameters_default"))) TS_ScoringParameters_default() {
38879 LDKScoringParameters ret_var = ScoringParameters_default();
38880 uint32_t ret_ref = 0;
38881 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38882 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38883 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38884 ret_ref = (uintptr_t)ret_var.inner;
38885 if (ret_var.is_owned) {
38891 uint32_t __attribute__((export_name("TS_Scorer_as_Score"))) TS_Scorer_as_Score(uint32_t this_arg) {
38892 LDKScorer this_arg_conv;
38893 this_arg_conv.inner = (void*)(this_arg & (~1));
38894 this_arg_conv.is_owned = false;
38895 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38896 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
38897 *ret_ret = Scorer_as_Score(&this_arg_conv);
38898 return (uint32_t)ret_ret;
38901 int8_tArray __attribute__((export_name("TS_Scorer_write"))) TS_Scorer_write(uint32_t obj) {
38902 LDKScorer obj_conv;
38903 obj_conv.inner = (void*)(obj & (~1));
38904 obj_conv.is_owned = false;
38905 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38906 LDKCVec_u8Z ret_var = Scorer_write(&obj_conv);
38907 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38908 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38909 CVec_u8Z_free(ret_var);
38913 uint32_t __attribute__((export_name("TS_Scorer_read"))) TS_Scorer_read(int8_tArray ser) {
38914 LDKu8slice ser_ref;
38915 ser_ref.datalen = ser->arr_len;
38916 ser_ref.data = ser->elems /* XXX ser leaks */;
38917 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
38918 *ret_conv = Scorer_read(ser_ref);
38919 return (uint32_t)ret_conv;
38922 void __attribute__((export_name("TS_ProbabilisticScorer_free"))) TS_ProbabilisticScorer_free(uint32_t this_obj) {
38923 LDKProbabilisticScorer this_obj_conv;
38924 this_obj_conv.inner = (void*)(this_obj & (~1));
38925 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38926 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38927 ProbabilisticScorer_free(this_obj_conv);
38930 void __attribute__((export_name("TS_ProbabilisticScoringParameters_free"))) TS_ProbabilisticScoringParameters_free(uint32_t this_obj) {
38931 LDKProbabilisticScoringParameters this_obj_conv;
38932 this_obj_conv.inner = (void*)(this_obj & (~1));
38933 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38934 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38935 ProbabilisticScoringParameters_free(this_obj_conv);
38938 int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(uint32_t this_ptr) {
38939 LDKProbabilisticScoringParameters this_ptr_conv;
38940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38941 this_ptr_conv.is_owned = false;
38942 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38943 int64_t ret_val = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
38947 void __attribute__((export_name("TS_ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(uint32_t this_ptr, int64_t val) {
38948 LDKProbabilisticScoringParameters this_ptr_conv;
38949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38950 this_ptr_conv.is_owned = false;
38951 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38952 ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
38955 int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life"))) TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life(uint32_t this_ptr) {
38956 LDKProbabilisticScoringParameters this_ptr_conv;
38957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38958 this_ptr_conv.is_owned = false;
38959 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38960 int64_t ret_val = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
38964 void __attribute__((export_name("TS_ProbabilisticScoringParameters_set_liquidity_offset_half_life"))) TS_ProbabilisticScoringParameters_set_liquidity_offset_half_life(uint32_t this_ptr, int64_t val) {
38965 LDKProbabilisticScoringParameters this_ptr_conv;
38966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38967 this_ptr_conv.is_owned = false;
38968 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38969 ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
38972 uint32_t __attribute__((export_name("TS_ProbabilisticScoringParameters_new"))) TS_ProbabilisticScoringParameters_new(int64_t liquidity_penalty_multiplier_msat_arg, int64_t liquidity_offset_half_life_arg) {
38973 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_new(liquidity_penalty_multiplier_msat_arg, liquidity_offset_half_life_arg);
38974 uint32_t ret_ref = 0;
38975 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38976 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38977 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38978 ret_ref = (uintptr_t)ret_var.inner;
38979 if (ret_var.is_owned) {
38985 static inline uintptr_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
38986 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
38987 uint32_t ret_ref = 0;
38988 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38989 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38990 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38991 ret_ref = (uintptr_t)ret_var.inner;
38992 if (ret_var.is_owned) {
38997 uint32_t __attribute__((export_name("TS_ProbabilisticScoringParameters_clone_ptr"))) TS_ProbabilisticScoringParameters_clone_ptr(uint32_t arg) {
38998 LDKProbabilisticScoringParameters arg_conv;
38999 arg_conv.inner = (void*)(arg & (~1));
39000 arg_conv.is_owned = false;
39001 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39002 uint32_t ret_val = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
39006 uint32_t __attribute__((export_name("TS_ProbabilisticScoringParameters_clone"))) TS_ProbabilisticScoringParameters_clone(uint32_t orig) {
39007 LDKProbabilisticScoringParameters orig_conv;
39008 orig_conv.inner = (void*)(orig & (~1));
39009 orig_conv.is_owned = false;
39010 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39011 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
39012 uint32_t ret_ref = 0;
39013 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39014 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39015 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39016 ret_ref = (uintptr_t)ret_var.inner;
39017 if (ret_var.is_owned) {
39023 int8_tArray __attribute__((export_name("TS_ProbabilisticScoringParameters_write"))) TS_ProbabilisticScoringParameters_write(uint32_t obj) {
39024 LDKProbabilisticScoringParameters obj_conv;
39025 obj_conv.inner = (void*)(obj & (~1));
39026 obj_conv.is_owned = false;
39027 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39028 LDKCVec_u8Z ret_var = ProbabilisticScoringParameters_write(&obj_conv);
39029 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39030 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39031 CVec_u8Z_free(ret_var);
39035 uint32_t __attribute__((export_name("TS_ProbabilisticScoringParameters_read"))) TS_ProbabilisticScoringParameters_read(int8_tArray ser) {
39036 LDKu8slice ser_ref;
39037 ser_ref.datalen = ser->arr_len;
39038 ser_ref.data = ser->elems /* XXX ser leaks */;
39039 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ");
39040 *ret_conv = ProbabilisticScoringParameters_read(ser_ref);
39041 return (uint32_t)ret_conv;
39044 uint32_t __attribute__((export_name("TS_ProbabilisticScorer_new"))) TS_ProbabilisticScorer_new(uint32_t params, uint32_t network_graph) {
39045 LDKProbabilisticScoringParameters params_conv;
39046 params_conv.inner = (void*)(params & (~1));
39047 params_conv.is_owned = (params & 1) || (params == 0);
39048 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
39049 params_conv = ProbabilisticScoringParameters_clone(¶ms_conv);
39050 LDKNetworkGraph network_graph_conv;
39051 network_graph_conv.inner = (void*)(network_graph & (~1));
39052 network_graph_conv.is_owned = false;
39053 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
39054 LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv);
39055 uint32_t ret_ref = 0;
39056 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39057 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39058 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39059 ret_ref = (uintptr_t)ret_var.inner;
39060 if (ret_var.is_owned) {
39066 uint32_t __attribute__((export_name("TS_ProbabilisticScoringParameters_default"))) TS_ProbabilisticScoringParameters_default() {
39067 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
39068 uint32_t ret_ref = 0;
39069 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39070 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39071 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39072 ret_ref = (uintptr_t)ret_var.inner;
39073 if (ret_var.is_owned) {
39079 uint32_t __attribute__((export_name("TS_ProbabilisticScorer_as_Score"))) TS_ProbabilisticScorer_as_Score(uint32_t this_arg) {
39080 LDKProbabilisticScorer this_arg_conv;
39081 this_arg_conv.inner = (void*)(this_arg & (~1));
39082 this_arg_conv.is_owned = false;
39083 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39084 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
39085 *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
39086 return (uint32_t)ret_ret;
39089 int8_tArray __attribute__((export_name("TS_ProbabilisticScorer_write"))) TS_ProbabilisticScorer_write(uint32_t obj) {
39090 LDKProbabilisticScorer obj_conv;
39091 obj_conv.inner = (void*)(obj & (~1));
39092 obj_conv.is_owned = false;
39093 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39094 LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
39095 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39096 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39097 CVec_u8Z_free(ret_var);
39101 uint32_t __attribute__((export_name("TS_ProbabilisticScorer_read"))) TS_ProbabilisticScorer_read(int8_tArray ser, uint32_t arg) {
39102 LDKu8slice ser_ref;
39103 ser_ref.datalen = ser->arr_len;
39104 ser_ref.data = ser->elems /* XXX ser leaks */;
39105 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
39106 CHECK_ACCESS(arg_ptr);
39107 LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ arg_conv = *(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(arg_ptr);
39108 arg_conv = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone((LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(((uintptr_t)arg) & ~1));
39109 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
39110 *ret_conv = ProbabilisticScorer_read(ser_ref, arg_conv);
39111 return (uint32_t)ret_conv;
39114 void __attribute__((export_name("TS_Invoice_free"))) TS_Invoice_free(uint32_t this_obj) {
39115 LDKInvoice this_obj_conv;
39116 this_obj_conv.inner = (void*)(this_obj & (~1));
39117 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39118 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39119 Invoice_free(this_obj_conv);
39122 jboolean __attribute__((export_name("TS_Invoice_eq"))) TS_Invoice_eq(uint32_t a, uint32_t b) {
39124 a_conv.inner = (void*)(a & (~1));
39125 a_conv.is_owned = false;
39126 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39128 b_conv.inner = (void*)(b & (~1));
39129 b_conv.is_owned = false;
39130 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39131 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
39135 static inline uintptr_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
39136 LDKInvoice ret_var = Invoice_clone(arg);
39137 uint32_t ret_ref = 0;
39138 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39139 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39140 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39141 ret_ref = (uintptr_t)ret_var.inner;
39142 if (ret_var.is_owned) {
39147 uint32_t __attribute__((export_name("TS_Invoice_clone_ptr"))) TS_Invoice_clone_ptr(uint32_t arg) {
39148 LDKInvoice arg_conv;
39149 arg_conv.inner = (void*)(arg & (~1));
39150 arg_conv.is_owned = false;
39151 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39152 uint32_t ret_val = Invoice_clone_ptr(&arg_conv);
39156 uint32_t __attribute__((export_name("TS_Invoice_clone"))) TS_Invoice_clone(uint32_t orig) {
39157 LDKInvoice orig_conv;
39158 orig_conv.inner = (void*)(orig & (~1));
39159 orig_conv.is_owned = false;
39160 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39161 LDKInvoice ret_var = Invoice_clone(&orig_conv);
39162 uint32_t ret_ref = 0;
39163 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39164 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39165 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39166 ret_ref = (uintptr_t)ret_var.inner;
39167 if (ret_var.is_owned) {
39173 void __attribute__((export_name("TS_SignedRawInvoice_free"))) TS_SignedRawInvoice_free(uint32_t this_obj) {
39174 LDKSignedRawInvoice this_obj_conv;
39175 this_obj_conv.inner = (void*)(this_obj & (~1));
39176 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39177 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39178 SignedRawInvoice_free(this_obj_conv);
39181 jboolean __attribute__((export_name("TS_SignedRawInvoice_eq"))) TS_SignedRawInvoice_eq(uint32_t a, uint32_t b) {
39182 LDKSignedRawInvoice a_conv;
39183 a_conv.inner = (void*)(a & (~1));
39184 a_conv.is_owned = false;
39185 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39186 LDKSignedRawInvoice b_conv;
39187 b_conv.inner = (void*)(b & (~1));
39188 b_conv.is_owned = false;
39189 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39190 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
39194 static inline uintptr_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
39195 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
39196 uint32_t ret_ref = 0;
39197 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39198 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39199 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39200 ret_ref = (uintptr_t)ret_var.inner;
39201 if (ret_var.is_owned) {
39206 uint32_t __attribute__((export_name("TS_SignedRawInvoice_clone_ptr"))) TS_SignedRawInvoice_clone_ptr(uint32_t arg) {
39207 LDKSignedRawInvoice arg_conv;
39208 arg_conv.inner = (void*)(arg & (~1));
39209 arg_conv.is_owned = false;
39210 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39211 uint32_t ret_val = SignedRawInvoice_clone_ptr(&arg_conv);
39215 uint32_t __attribute__((export_name("TS_SignedRawInvoice_clone"))) TS_SignedRawInvoice_clone(uint32_t orig) {
39216 LDKSignedRawInvoice orig_conv;
39217 orig_conv.inner = (void*)(orig & (~1));
39218 orig_conv.is_owned = false;
39219 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39220 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
39221 uint32_t ret_ref = 0;
39222 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39223 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39224 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39225 ret_ref = (uintptr_t)ret_var.inner;
39226 if (ret_var.is_owned) {
39232 void __attribute__((export_name("TS_RawInvoice_free"))) TS_RawInvoice_free(uint32_t this_obj) {
39233 LDKRawInvoice this_obj_conv;
39234 this_obj_conv.inner = (void*)(this_obj & (~1));
39235 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39236 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39237 RawInvoice_free(this_obj_conv);
39240 uint32_t __attribute__((export_name("TS_RawInvoice_get_data"))) TS_RawInvoice_get_data(uint32_t this_ptr) {
39241 LDKRawInvoice this_ptr_conv;
39242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39243 this_ptr_conv.is_owned = false;
39244 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39245 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
39246 uint32_t ret_ref = 0;
39247 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39248 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39249 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39250 ret_ref = (uintptr_t)ret_var.inner;
39251 if (ret_var.is_owned) {
39257 void __attribute__((export_name("TS_RawInvoice_set_data"))) TS_RawInvoice_set_data(uint32_t this_ptr, uint32_t val) {
39258 LDKRawInvoice this_ptr_conv;
39259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39260 this_ptr_conv.is_owned = false;
39261 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39262 LDKRawDataPart val_conv;
39263 val_conv.inner = (void*)(val & (~1));
39264 val_conv.is_owned = (val & 1) || (val == 0);
39265 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39266 val_conv = RawDataPart_clone(&val_conv);
39267 RawInvoice_set_data(&this_ptr_conv, val_conv);
39270 jboolean __attribute__((export_name("TS_RawInvoice_eq"))) TS_RawInvoice_eq(uint32_t a, uint32_t b) {
39271 LDKRawInvoice a_conv;
39272 a_conv.inner = (void*)(a & (~1));
39273 a_conv.is_owned = false;
39274 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39275 LDKRawInvoice b_conv;
39276 b_conv.inner = (void*)(b & (~1));
39277 b_conv.is_owned = false;
39278 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39279 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
39283 static inline uintptr_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
39284 LDKRawInvoice ret_var = RawInvoice_clone(arg);
39285 uint32_t ret_ref = 0;
39286 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39287 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39288 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39289 ret_ref = (uintptr_t)ret_var.inner;
39290 if (ret_var.is_owned) {
39295 uint32_t __attribute__((export_name("TS_RawInvoice_clone_ptr"))) TS_RawInvoice_clone_ptr(uint32_t arg) {
39296 LDKRawInvoice arg_conv;
39297 arg_conv.inner = (void*)(arg & (~1));
39298 arg_conv.is_owned = false;
39299 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39300 uint32_t ret_val = RawInvoice_clone_ptr(&arg_conv);
39304 uint32_t __attribute__((export_name("TS_RawInvoice_clone"))) TS_RawInvoice_clone(uint32_t orig) {
39305 LDKRawInvoice orig_conv;
39306 orig_conv.inner = (void*)(orig & (~1));
39307 orig_conv.is_owned = false;
39308 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39309 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
39310 uint32_t ret_ref = 0;
39311 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39312 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39313 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39314 ret_ref = (uintptr_t)ret_var.inner;
39315 if (ret_var.is_owned) {
39321 void __attribute__((export_name("TS_RawDataPart_free"))) TS_RawDataPart_free(uint32_t this_obj) {
39322 LDKRawDataPart this_obj_conv;
39323 this_obj_conv.inner = (void*)(this_obj & (~1));
39324 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39325 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39326 RawDataPart_free(this_obj_conv);
39329 uint32_t __attribute__((export_name("TS_RawDataPart_get_timestamp"))) TS_RawDataPart_get_timestamp(uint32_t this_ptr) {
39330 LDKRawDataPart this_ptr_conv;
39331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39332 this_ptr_conv.is_owned = false;
39333 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39334 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
39335 uint32_t ret_ref = 0;
39336 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39337 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39338 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39339 ret_ref = (uintptr_t)ret_var.inner;
39340 if (ret_var.is_owned) {
39346 void __attribute__((export_name("TS_RawDataPart_set_timestamp"))) TS_RawDataPart_set_timestamp(uint32_t this_ptr, uint32_t val) {
39347 LDKRawDataPart this_ptr_conv;
39348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39349 this_ptr_conv.is_owned = false;
39350 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39351 LDKPositiveTimestamp val_conv;
39352 val_conv.inner = (void*)(val & (~1));
39353 val_conv.is_owned = (val & 1) || (val == 0);
39354 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39355 val_conv = PositiveTimestamp_clone(&val_conv);
39356 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
39359 jboolean __attribute__((export_name("TS_RawDataPart_eq"))) TS_RawDataPart_eq(uint32_t a, uint32_t b) {
39360 LDKRawDataPart a_conv;
39361 a_conv.inner = (void*)(a & (~1));
39362 a_conv.is_owned = false;
39363 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39364 LDKRawDataPart b_conv;
39365 b_conv.inner = (void*)(b & (~1));
39366 b_conv.is_owned = false;
39367 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39368 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
39372 static inline uintptr_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
39373 LDKRawDataPart ret_var = RawDataPart_clone(arg);
39374 uint32_t ret_ref = 0;
39375 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39376 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39377 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39378 ret_ref = (uintptr_t)ret_var.inner;
39379 if (ret_var.is_owned) {
39384 uint32_t __attribute__((export_name("TS_RawDataPart_clone_ptr"))) TS_RawDataPart_clone_ptr(uint32_t arg) {
39385 LDKRawDataPart arg_conv;
39386 arg_conv.inner = (void*)(arg & (~1));
39387 arg_conv.is_owned = false;
39388 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39389 uint32_t ret_val = RawDataPart_clone_ptr(&arg_conv);
39393 uint32_t __attribute__((export_name("TS_RawDataPart_clone"))) TS_RawDataPart_clone(uint32_t orig) {
39394 LDKRawDataPart orig_conv;
39395 orig_conv.inner = (void*)(orig & (~1));
39396 orig_conv.is_owned = false;
39397 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39398 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
39399 uint32_t ret_ref = 0;
39400 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39401 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39402 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39403 ret_ref = (uintptr_t)ret_var.inner;
39404 if (ret_var.is_owned) {
39410 void __attribute__((export_name("TS_PositiveTimestamp_free"))) TS_PositiveTimestamp_free(uint32_t this_obj) {
39411 LDKPositiveTimestamp this_obj_conv;
39412 this_obj_conv.inner = (void*)(this_obj & (~1));
39413 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39414 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39415 PositiveTimestamp_free(this_obj_conv);
39418 jboolean __attribute__((export_name("TS_PositiveTimestamp_eq"))) TS_PositiveTimestamp_eq(uint32_t a, uint32_t b) {
39419 LDKPositiveTimestamp a_conv;
39420 a_conv.inner = (void*)(a & (~1));
39421 a_conv.is_owned = false;
39422 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39423 LDKPositiveTimestamp b_conv;
39424 b_conv.inner = (void*)(b & (~1));
39425 b_conv.is_owned = false;
39426 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39427 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
39431 static inline uintptr_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
39432 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
39433 uint32_t ret_ref = 0;
39434 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39435 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39436 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39437 ret_ref = (uintptr_t)ret_var.inner;
39438 if (ret_var.is_owned) {
39443 uint32_t __attribute__((export_name("TS_PositiveTimestamp_clone_ptr"))) TS_PositiveTimestamp_clone_ptr(uint32_t arg) {
39444 LDKPositiveTimestamp arg_conv;
39445 arg_conv.inner = (void*)(arg & (~1));
39446 arg_conv.is_owned = false;
39447 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39448 uint32_t ret_val = PositiveTimestamp_clone_ptr(&arg_conv);
39452 uint32_t __attribute__((export_name("TS_PositiveTimestamp_clone"))) TS_PositiveTimestamp_clone(uint32_t orig) {
39453 LDKPositiveTimestamp orig_conv;
39454 orig_conv.inner = (void*)(orig & (~1));
39455 orig_conv.is_owned = false;
39456 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39457 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
39458 uint32_t ret_ref = 0;
39459 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39460 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39461 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39462 ret_ref = (uintptr_t)ret_var.inner;
39463 if (ret_var.is_owned) {
39469 uint32_t __attribute__((export_name("TS_SiPrefix_clone"))) TS_SiPrefix_clone(uint32_t orig) {
39470 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
39471 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
39475 uint32_t __attribute__((export_name("TS_SiPrefix_milli"))) TS_SiPrefix_milli() {
39476 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
39480 uint32_t __attribute__((export_name("TS_SiPrefix_micro"))) TS_SiPrefix_micro() {
39481 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
39485 uint32_t __attribute__((export_name("TS_SiPrefix_nano"))) TS_SiPrefix_nano() {
39486 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
39490 uint32_t __attribute__((export_name("TS_SiPrefix_pico"))) TS_SiPrefix_pico() {
39491 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
39495 jboolean __attribute__((export_name("TS_SiPrefix_eq"))) TS_SiPrefix_eq(uint32_t a, uint32_t b) {
39496 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
39497 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
39498 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
39502 int64_t __attribute__((export_name("TS_SiPrefix_multiplier"))) TS_SiPrefix_multiplier(uint32_t this_arg) {
39503 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
39504 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
39508 uint32_t __attribute__((export_name("TS_Currency_clone"))) TS_Currency_clone(uint32_t orig) {
39509 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
39510 uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
39514 uint32_t __attribute__((export_name("TS_Currency_bitcoin"))) TS_Currency_bitcoin() {
39515 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
39519 uint32_t __attribute__((export_name("TS_Currency_bitcoin_testnet"))) TS_Currency_bitcoin_testnet() {
39520 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
39524 uint32_t __attribute__((export_name("TS_Currency_regtest"))) TS_Currency_regtest() {
39525 uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
39529 uint32_t __attribute__((export_name("TS_Currency_simnet"))) TS_Currency_simnet() {
39530 uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
39534 uint32_t __attribute__((export_name("TS_Currency_signet"))) TS_Currency_signet() {
39535 uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
39539 int64_t __attribute__((export_name("TS_Currency_hash"))) TS_Currency_hash(uint32_t o) {
39540 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
39541 int64_t ret_val = Currency_hash(o_conv);
39545 jboolean __attribute__((export_name("TS_Currency_eq"))) TS_Currency_eq(uint32_t a, uint32_t b) {
39546 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
39547 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
39548 jboolean ret_val = Currency_eq(a_conv, b_conv);
39552 void __attribute__((export_name("TS_Sha256_free"))) TS_Sha256_free(uint32_t this_obj) {
39553 LDKSha256 this_obj_conv;
39554 this_obj_conv.inner = (void*)(this_obj & (~1));
39555 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39556 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39557 Sha256_free(this_obj_conv);
39560 static inline uintptr_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
39561 LDKSha256 ret_var = Sha256_clone(arg);
39562 uint32_t ret_ref = 0;
39563 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39564 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39565 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39566 ret_ref = (uintptr_t)ret_var.inner;
39567 if (ret_var.is_owned) {
39572 uint32_t __attribute__((export_name("TS_Sha256_clone_ptr"))) TS_Sha256_clone_ptr(uint32_t arg) {
39573 LDKSha256 arg_conv;
39574 arg_conv.inner = (void*)(arg & (~1));
39575 arg_conv.is_owned = false;
39576 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39577 uint32_t ret_val = Sha256_clone_ptr(&arg_conv);
39581 uint32_t __attribute__((export_name("TS_Sha256_clone"))) TS_Sha256_clone(uint32_t orig) {
39582 LDKSha256 orig_conv;
39583 orig_conv.inner = (void*)(orig & (~1));
39584 orig_conv.is_owned = false;
39585 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39586 LDKSha256 ret_var = Sha256_clone(&orig_conv);
39587 uint32_t ret_ref = 0;
39588 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39589 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39590 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39591 ret_ref = (uintptr_t)ret_var.inner;
39592 if (ret_var.is_owned) {
39598 int64_t __attribute__((export_name("TS_Sha256_hash"))) TS_Sha256_hash(uint32_t o) {
39600 o_conv.inner = (void*)(o & (~1));
39601 o_conv.is_owned = false;
39602 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39603 int64_t ret_val = Sha256_hash(&o_conv);
39607 jboolean __attribute__((export_name("TS_Sha256_eq"))) TS_Sha256_eq(uint32_t a, uint32_t b) {
39609 a_conv.inner = (void*)(a & (~1));
39610 a_conv.is_owned = false;
39611 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39613 b_conv.inner = (void*)(b & (~1));
39614 b_conv.is_owned = false;
39615 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39616 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
39620 void __attribute__((export_name("TS_Description_free"))) TS_Description_free(uint32_t this_obj) {
39621 LDKDescription this_obj_conv;
39622 this_obj_conv.inner = (void*)(this_obj & (~1));
39623 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39624 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39625 Description_free(this_obj_conv);
39628 static inline uintptr_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
39629 LDKDescription ret_var = Description_clone(arg);
39630 uint32_t ret_ref = 0;
39631 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39632 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39633 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39634 ret_ref = (uintptr_t)ret_var.inner;
39635 if (ret_var.is_owned) {
39640 uint32_t __attribute__((export_name("TS_Description_clone_ptr"))) TS_Description_clone_ptr(uint32_t arg) {
39641 LDKDescription arg_conv;
39642 arg_conv.inner = (void*)(arg & (~1));
39643 arg_conv.is_owned = false;
39644 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39645 uint32_t ret_val = Description_clone_ptr(&arg_conv);
39649 uint32_t __attribute__((export_name("TS_Description_clone"))) TS_Description_clone(uint32_t orig) {
39650 LDKDescription orig_conv;
39651 orig_conv.inner = (void*)(orig & (~1));
39652 orig_conv.is_owned = false;
39653 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39654 LDKDescription ret_var = Description_clone(&orig_conv);
39655 uint32_t ret_ref = 0;
39656 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39657 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39658 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39659 ret_ref = (uintptr_t)ret_var.inner;
39660 if (ret_var.is_owned) {
39666 int64_t __attribute__((export_name("TS_Description_hash"))) TS_Description_hash(uint32_t o) {
39667 LDKDescription o_conv;
39668 o_conv.inner = (void*)(o & (~1));
39669 o_conv.is_owned = false;
39670 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39671 int64_t ret_val = Description_hash(&o_conv);
39675 jboolean __attribute__((export_name("TS_Description_eq"))) TS_Description_eq(uint32_t a, uint32_t b) {
39676 LDKDescription a_conv;
39677 a_conv.inner = (void*)(a & (~1));
39678 a_conv.is_owned = false;
39679 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39680 LDKDescription b_conv;
39681 b_conv.inner = (void*)(b & (~1));
39682 b_conv.is_owned = false;
39683 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39684 jboolean ret_val = Description_eq(&a_conv, &b_conv);
39688 void __attribute__((export_name("TS_PayeePubKey_free"))) TS_PayeePubKey_free(uint32_t this_obj) {
39689 LDKPayeePubKey this_obj_conv;
39690 this_obj_conv.inner = (void*)(this_obj & (~1));
39691 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39692 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39693 PayeePubKey_free(this_obj_conv);
39696 int8_tArray __attribute__((export_name("TS_PayeePubKey_get_a"))) TS_PayeePubKey_get_a(uint32_t this_ptr) {
39697 LDKPayeePubKey this_ptr_conv;
39698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39699 this_ptr_conv.is_owned = false;
39700 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39701 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39702 memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
39706 void __attribute__((export_name("TS_PayeePubKey_set_a"))) TS_PayeePubKey_set_a(uint32_t this_ptr, int8_tArray val) {
39707 LDKPayeePubKey this_ptr_conv;
39708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39709 this_ptr_conv.is_owned = false;
39710 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39711 LDKPublicKey val_ref;
39712 CHECK(val->arr_len == 33);
39713 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39714 PayeePubKey_set_a(&this_ptr_conv, val_ref);
39717 uint32_t __attribute__((export_name("TS_PayeePubKey_new"))) TS_PayeePubKey_new(int8_tArray a_arg) {
39718 LDKPublicKey a_arg_ref;
39719 CHECK(a_arg->arr_len == 33);
39720 memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
39721 LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
39722 uint32_t ret_ref = 0;
39723 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39724 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39725 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39726 ret_ref = (uintptr_t)ret_var.inner;
39727 if (ret_var.is_owned) {
39733 static inline uintptr_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
39734 LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
39735 uint32_t ret_ref = 0;
39736 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39737 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39738 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39739 ret_ref = (uintptr_t)ret_var.inner;
39740 if (ret_var.is_owned) {
39745 uint32_t __attribute__((export_name("TS_PayeePubKey_clone_ptr"))) TS_PayeePubKey_clone_ptr(uint32_t arg) {
39746 LDKPayeePubKey arg_conv;
39747 arg_conv.inner = (void*)(arg & (~1));
39748 arg_conv.is_owned = false;
39749 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39750 uint32_t ret_val = PayeePubKey_clone_ptr(&arg_conv);
39754 uint32_t __attribute__((export_name("TS_PayeePubKey_clone"))) TS_PayeePubKey_clone(uint32_t orig) {
39755 LDKPayeePubKey orig_conv;
39756 orig_conv.inner = (void*)(orig & (~1));
39757 orig_conv.is_owned = false;
39758 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39759 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
39760 uint32_t ret_ref = 0;
39761 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39762 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39763 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39764 ret_ref = (uintptr_t)ret_var.inner;
39765 if (ret_var.is_owned) {
39771 int64_t __attribute__((export_name("TS_PayeePubKey_hash"))) TS_PayeePubKey_hash(uint32_t o) {
39772 LDKPayeePubKey o_conv;
39773 o_conv.inner = (void*)(o & (~1));
39774 o_conv.is_owned = false;
39775 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39776 int64_t ret_val = PayeePubKey_hash(&o_conv);
39780 jboolean __attribute__((export_name("TS_PayeePubKey_eq"))) TS_PayeePubKey_eq(uint32_t a, uint32_t b) {
39781 LDKPayeePubKey a_conv;
39782 a_conv.inner = (void*)(a & (~1));
39783 a_conv.is_owned = false;
39784 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39785 LDKPayeePubKey b_conv;
39786 b_conv.inner = (void*)(b & (~1));
39787 b_conv.is_owned = false;
39788 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39789 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
39793 void __attribute__((export_name("TS_ExpiryTime_free"))) TS_ExpiryTime_free(uint32_t this_obj) {
39794 LDKExpiryTime this_obj_conv;
39795 this_obj_conv.inner = (void*)(this_obj & (~1));
39796 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39797 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39798 ExpiryTime_free(this_obj_conv);
39801 static inline uintptr_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
39802 LDKExpiryTime ret_var = ExpiryTime_clone(arg);
39803 uint32_t ret_ref = 0;
39804 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39805 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39806 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39807 ret_ref = (uintptr_t)ret_var.inner;
39808 if (ret_var.is_owned) {
39813 uint32_t __attribute__((export_name("TS_ExpiryTime_clone_ptr"))) TS_ExpiryTime_clone_ptr(uint32_t arg) {
39814 LDKExpiryTime arg_conv;
39815 arg_conv.inner = (void*)(arg & (~1));
39816 arg_conv.is_owned = false;
39817 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39818 uint32_t ret_val = ExpiryTime_clone_ptr(&arg_conv);
39822 uint32_t __attribute__((export_name("TS_ExpiryTime_clone"))) TS_ExpiryTime_clone(uint32_t orig) {
39823 LDKExpiryTime orig_conv;
39824 orig_conv.inner = (void*)(orig & (~1));
39825 orig_conv.is_owned = false;
39826 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39827 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
39828 uint32_t ret_ref = 0;
39829 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39830 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39831 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39832 ret_ref = (uintptr_t)ret_var.inner;
39833 if (ret_var.is_owned) {
39839 int64_t __attribute__((export_name("TS_ExpiryTime_hash"))) TS_ExpiryTime_hash(uint32_t o) {
39840 LDKExpiryTime o_conv;
39841 o_conv.inner = (void*)(o & (~1));
39842 o_conv.is_owned = false;
39843 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39844 int64_t ret_val = ExpiryTime_hash(&o_conv);
39848 jboolean __attribute__((export_name("TS_ExpiryTime_eq"))) TS_ExpiryTime_eq(uint32_t a, uint32_t b) {
39849 LDKExpiryTime a_conv;
39850 a_conv.inner = (void*)(a & (~1));
39851 a_conv.is_owned = false;
39852 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39853 LDKExpiryTime b_conv;
39854 b_conv.inner = (void*)(b & (~1));
39855 b_conv.is_owned = false;
39856 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39857 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
39861 void __attribute__((export_name("TS_MinFinalCltvExpiry_free"))) TS_MinFinalCltvExpiry_free(uint32_t this_obj) {
39862 LDKMinFinalCltvExpiry this_obj_conv;
39863 this_obj_conv.inner = (void*)(this_obj & (~1));
39864 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39865 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39866 MinFinalCltvExpiry_free(this_obj_conv);
39869 int64_t __attribute__((export_name("TS_MinFinalCltvExpiry_get_a"))) TS_MinFinalCltvExpiry_get_a(uint32_t this_ptr) {
39870 LDKMinFinalCltvExpiry this_ptr_conv;
39871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39872 this_ptr_conv.is_owned = false;
39873 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39874 int64_t ret_val = MinFinalCltvExpiry_get_a(&this_ptr_conv);
39878 void __attribute__((export_name("TS_MinFinalCltvExpiry_set_a"))) TS_MinFinalCltvExpiry_set_a(uint32_t this_ptr, int64_t val) {
39879 LDKMinFinalCltvExpiry this_ptr_conv;
39880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39881 this_ptr_conv.is_owned = false;
39882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39883 MinFinalCltvExpiry_set_a(&this_ptr_conv, val);
39886 uint32_t __attribute__((export_name("TS_MinFinalCltvExpiry_new"))) TS_MinFinalCltvExpiry_new(int64_t a_arg) {
39887 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg);
39888 uint32_t ret_ref = 0;
39889 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39890 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39891 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39892 ret_ref = (uintptr_t)ret_var.inner;
39893 if (ret_var.is_owned) {
39899 static inline uintptr_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) {
39900 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(arg);
39901 uint32_t ret_ref = 0;
39902 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39903 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39904 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39905 ret_ref = (uintptr_t)ret_var.inner;
39906 if (ret_var.is_owned) {
39911 uint32_t __attribute__((export_name("TS_MinFinalCltvExpiry_clone_ptr"))) TS_MinFinalCltvExpiry_clone_ptr(uint32_t arg) {
39912 LDKMinFinalCltvExpiry arg_conv;
39913 arg_conv.inner = (void*)(arg & (~1));
39914 arg_conv.is_owned = false;
39915 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39916 uint32_t ret_val = MinFinalCltvExpiry_clone_ptr(&arg_conv);
39920 uint32_t __attribute__((export_name("TS_MinFinalCltvExpiry_clone"))) TS_MinFinalCltvExpiry_clone(uint32_t orig) {
39921 LDKMinFinalCltvExpiry orig_conv;
39922 orig_conv.inner = (void*)(orig & (~1));
39923 orig_conv.is_owned = false;
39924 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39925 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
39926 uint32_t ret_ref = 0;
39927 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39928 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39929 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39930 ret_ref = (uintptr_t)ret_var.inner;
39931 if (ret_var.is_owned) {
39937 int64_t __attribute__((export_name("TS_MinFinalCltvExpiry_hash"))) TS_MinFinalCltvExpiry_hash(uint32_t o) {
39938 LDKMinFinalCltvExpiry o_conv;
39939 o_conv.inner = (void*)(o & (~1));
39940 o_conv.is_owned = false;
39941 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39942 int64_t ret_val = MinFinalCltvExpiry_hash(&o_conv);
39946 jboolean __attribute__((export_name("TS_MinFinalCltvExpiry_eq"))) TS_MinFinalCltvExpiry_eq(uint32_t a, uint32_t b) {
39947 LDKMinFinalCltvExpiry a_conv;
39948 a_conv.inner = (void*)(a & (~1));
39949 a_conv.is_owned = false;
39950 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39951 LDKMinFinalCltvExpiry b_conv;
39952 b_conv.inner = (void*)(b & (~1));
39953 b_conv.is_owned = false;
39954 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39955 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
39959 void __attribute__((export_name("TS_Fallback_free"))) TS_Fallback_free(uint32_t this_ptr) {
39960 if ((this_ptr & 1) != 0) return;
39961 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
39962 CHECK_ACCESS(this_ptr_ptr);
39963 LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
39964 FREE((void*)this_ptr);
39965 Fallback_free(this_ptr_conv);
39968 static inline uintptr_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
39969 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
39970 *ret_copy = Fallback_clone(arg);
39971 uint32_t ret_ref = (uintptr_t)ret_copy;
39974 uint32_t __attribute__((export_name("TS_Fallback_clone_ptr"))) TS_Fallback_clone_ptr(uint32_t arg) {
39975 LDKFallback* arg_conv = (LDKFallback*)arg;
39976 uint32_t ret_val = Fallback_clone_ptr(arg_conv);
39980 uint32_t __attribute__((export_name("TS_Fallback_clone"))) TS_Fallback_clone(uint32_t orig) {
39981 LDKFallback* orig_conv = (LDKFallback*)orig;
39982 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
39983 *ret_copy = Fallback_clone(orig_conv);
39984 uint32_t ret_ref = (uintptr_t)ret_copy;
39988 uint32_t __attribute__((export_name("TS_Fallback_seg_wit_program"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
39990 LDKCVec_u8Z program_ref;
39991 program_ref.datalen = program->arr_len;
39992 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
39993 memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
39994 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
39995 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
39996 uint32_t ret_ref = (uintptr_t)ret_copy;
40000 uint32_t __attribute__((export_name("TS_Fallback_pub_key_hash"))) TS_Fallback_pub_key_hash(int8_tArray a) {
40001 LDKTwentyBytes a_ref;
40002 CHECK(a->arr_len == 20);
40003 memcpy(a_ref.data, a->elems, 20); FREE(a);
40004 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
40005 *ret_copy = Fallback_pub_key_hash(a_ref);
40006 uint32_t ret_ref = (uintptr_t)ret_copy;
40010 uint32_t __attribute__((export_name("TS_Fallback_script_hash"))) TS_Fallback_script_hash(int8_tArray a) {
40011 LDKTwentyBytes a_ref;
40012 CHECK(a->arr_len == 20);
40013 memcpy(a_ref.data, a->elems, 20); FREE(a);
40014 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
40015 *ret_copy = Fallback_script_hash(a_ref);
40016 uint32_t ret_ref = (uintptr_t)ret_copy;
40020 int64_t __attribute__((export_name("TS_Fallback_hash"))) TS_Fallback_hash(uint32_t o) {
40021 LDKFallback* o_conv = (LDKFallback*)o;
40022 int64_t ret_val = Fallback_hash(o_conv);
40026 jboolean __attribute__((export_name("TS_Fallback_eq"))) TS_Fallback_eq(uint32_t a, uint32_t b) {
40027 LDKFallback* a_conv = (LDKFallback*)a;
40028 LDKFallback* b_conv = (LDKFallback*)b;
40029 jboolean ret_val = Fallback_eq(a_conv, b_conv);
40033 void __attribute__((export_name("TS_InvoiceSignature_free"))) TS_InvoiceSignature_free(uint32_t this_obj) {
40034 LDKInvoiceSignature this_obj_conv;
40035 this_obj_conv.inner = (void*)(this_obj & (~1));
40036 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40037 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40038 InvoiceSignature_free(this_obj_conv);
40041 static inline uintptr_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
40042 LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
40043 uint32_t ret_ref = 0;
40044 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40045 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40046 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40047 ret_ref = (uintptr_t)ret_var.inner;
40048 if (ret_var.is_owned) {
40053 uint32_t __attribute__((export_name("TS_InvoiceSignature_clone_ptr"))) TS_InvoiceSignature_clone_ptr(uint32_t arg) {
40054 LDKInvoiceSignature arg_conv;
40055 arg_conv.inner = (void*)(arg & (~1));
40056 arg_conv.is_owned = false;
40057 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40058 uint32_t ret_val = InvoiceSignature_clone_ptr(&arg_conv);
40062 uint32_t __attribute__((export_name("TS_InvoiceSignature_clone"))) TS_InvoiceSignature_clone(uint32_t orig) {
40063 LDKInvoiceSignature orig_conv;
40064 orig_conv.inner = (void*)(orig & (~1));
40065 orig_conv.is_owned = false;
40066 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40067 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
40068 uint32_t ret_ref = 0;
40069 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40070 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40071 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40072 ret_ref = (uintptr_t)ret_var.inner;
40073 if (ret_var.is_owned) {
40079 jboolean __attribute__((export_name("TS_InvoiceSignature_eq"))) TS_InvoiceSignature_eq(uint32_t a, uint32_t b) {
40080 LDKInvoiceSignature a_conv;
40081 a_conv.inner = (void*)(a & (~1));
40082 a_conv.is_owned = false;
40083 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40084 LDKInvoiceSignature b_conv;
40085 b_conv.inner = (void*)(b & (~1));
40086 b_conv.is_owned = false;
40087 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40088 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
40092 void __attribute__((export_name("TS_PrivateRoute_free"))) TS_PrivateRoute_free(uint32_t this_obj) {
40093 LDKPrivateRoute this_obj_conv;
40094 this_obj_conv.inner = (void*)(this_obj & (~1));
40095 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40096 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40097 PrivateRoute_free(this_obj_conv);
40100 static inline uintptr_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
40101 LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
40102 uint32_t ret_ref = 0;
40103 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40104 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40105 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40106 ret_ref = (uintptr_t)ret_var.inner;
40107 if (ret_var.is_owned) {
40112 uint32_t __attribute__((export_name("TS_PrivateRoute_clone_ptr"))) TS_PrivateRoute_clone_ptr(uint32_t arg) {
40113 LDKPrivateRoute arg_conv;
40114 arg_conv.inner = (void*)(arg & (~1));
40115 arg_conv.is_owned = false;
40116 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40117 uint32_t ret_val = PrivateRoute_clone_ptr(&arg_conv);
40121 uint32_t __attribute__((export_name("TS_PrivateRoute_clone"))) TS_PrivateRoute_clone(uint32_t orig) {
40122 LDKPrivateRoute orig_conv;
40123 orig_conv.inner = (void*)(orig & (~1));
40124 orig_conv.is_owned = false;
40125 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40126 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
40127 uint32_t ret_ref = 0;
40128 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40129 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40130 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40131 ret_ref = (uintptr_t)ret_var.inner;
40132 if (ret_var.is_owned) {
40138 int64_t __attribute__((export_name("TS_PrivateRoute_hash"))) TS_PrivateRoute_hash(uint32_t o) {
40139 LDKPrivateRoute o_conv;
40140 o_conv.inner = (void*)(o & (~1));
40141 o_conv.is_owned = false;
40142 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40143 int64_t ret_val = PrivateRoute_hash(&o_conv);
40147 jboolean __attribute__((export_name("TS_PrivateRoute_eq"))) TS_PrivateRoute_eq(uint32_t a, uint32_t b) {
40148 LDKPrivateRoute a_conv;
40149 a_conv.inner = (void*)(a & (~1));
40150 a_conv.is_owned = false;
40151 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40152 LDKPrivateRoute b_conv;
40153 b_conv.inner = (void*)(b & (~1));
40154 b_conv.is_owned = false;
40155 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40156 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
40160 uint32_t __attribute__((export_name("TS_SignedRawInvoice_into_parts"))) TS_SignedRawInvoice_into_parts(uint32_t this_arg) {
40161 LDKSignedRawInvoice this_arg_conv;
40162 this_arg_conv.inner = (void*)(this_arg & (~1));
40163 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
40164 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40165 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
40166 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
40167 *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
40168 return ((uint32_t)ret_conv);
40171 uint32_t __attribute__((export_name("TS_SignedRawInvoice_raw_invoice"))) TS_SignedRawInvoice_raw_invoice(uint32_t this_arg) {
40172 LDKSignedRawInvoice this_arg_conv;
40173 this_arg_conv.inner = (void*)(this_arg & (~1));
40174 this_arg_conv.is_owned = false;
40175 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40176 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
40177 uint32_t ret_ref = 0;
40178 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40179 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40180 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40181 ret_ref = (uintptr_t)ret_var.inner;
40182 if (ret_var.is_owned) {
40188 int8_tArray __attribute__((export_name("TS_SignedRawInvoice_hash"))) TS_SignedRawInvoice_hash(uint32_t this_arg) {
40189 LDKSignedRawInvoice this_arg_conv;
40190 this_arg_conv.inner = (void*)(this_arg & (~1));
40191 this_arg_conv.is_owned = false;
40192 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40193 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40194 memcpy(ret_arr->elems, *SignedRawInvoice_hash(&this_arg_conv), 32);
40198 uint32_t __attribute__((export_name("TS_SignedRawInvoice_signature"))) TS_SignedRawInvoice_signature(uint32_t this_arg) {
40199 LDKSignedRawInvoice this_arg_conv;
40200 this_arg_conv.inner = (void*)(this_arg & (~1));
40201 this_arg_conv.is_owned = false;
40202 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40203 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
40204 uint32_t ret_ref = 0;
40205 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40206 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40207 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40208 ret_ref = (uintptr_t)ret_var.inner;
40209 if (ret_var.is_owned) {
40215 uint32_t __attribute__((export_name("TS_SignedRawInvoice_recover_payee_pub_key"))) TS_SignedRawInvoice_recover_payee_pub_key(uint32_t this_arg) {
40216 LDKSignedRawInvoice this_arg_conv;
40217 this_arg_conv.inner = (void*)(this_arg & (~1));
40218 this_arg_conv.is_owned = false;
40219 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40220 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
40221 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
40222 return (uint32_t)ret_conv;
40225 jboolean __attribute__((export_name("TS_SignedRawInvoice_check_signature"))) TS_SignedRawInvoice_check_signature(uint32_t this_arg) {
40226 LDKSignedRawInvoice this_arg_conv;
40227 this_arg_conv.inner = (void*)(this_arg & (~1));
40228 this_arg_conv.is_owned = false;
40229 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40230 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
40234 int8_tArray __attribute__((export_name("TS_RawInvoice_hash"))) TS_RawInvoice_hash(uint32_t this_arg) {
40235 LDKRawInvoice this_arg_conv;
40236 this_arg_conv.inner = (void*)(this_arg & (~1));
40237 this_arg_conv.is_owned = false;
40238 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40239 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40240 memcpy(ret_arr->elems, RawInvoice_hash(&this_arg_conv).data, 32);
40244 uint32_t __attribute__((export_name("TS_RawInvoice_payment_hash"))) TS_RawInvoice_payment_hash(uint32_t this_arg) {
40245 LDKRawInvoice this_arg_conv;
40246 this_arg_conv.inner = (void*)(this_arg & (~1));
40247 this_arg_conv.is_owned = false;
40248 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40249 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
40250 uint32_t ret_ref = 0;
40251 if ((uintptr_t)ret_var.inner > 4096) {
40252 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40253 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40254 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40255 ret_ref = (uintptr_t)ret_var.inner;
40256 if (ret_var.is_owned) {
40263 uint32_t __attribute__((export_name("TS_RawInvoice_description"))) TS_RawInvoice_description(uint32_t this_arg) {
40264 LDKRawInvoice this_arg_conv;
40265 this_arg_conv.inner = (void*)(this_arg & (~1));
40266 this_arg_conv.is_owned = false;
40267 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40268 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
40269 uint32_t ret_ref = 0;
40270 if ((uintptr_t)ret_var.inner > 4096) {
40271 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40272 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40273 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40274 ret_ref = (uintptr_t)ret_var.inner;
40275 if (ret_var.is_owned) {
40282 uint32_t __attribute__((export_name("TS_RawInvoice_payee_pub_key"))) TS_RawInvoice_payee_pub_key(uint32_t this_arg) {
40283 LDKRawInvoice this_arg_conv;
40284 this_arg_conv.inner = (void*)(this_arg & (~1));
40285 this_arg_conv.is_owned = false;
40286 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40287 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
40288 uint32_t ret_ref = 0;
40289 if ((uintptr_t)ret_var.inner > 4096) {
40290 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40291 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40292 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40293 ret_ref = (uintptr_t)ret_var.inner;
40294 if (ret_var.is_owned) {
40301 uint32_t __attribute__((export_name("TS_RawInvoice_description_hash"))) TS_RawInvoice_description_hash(uint32_t this_arg) {
40302 LDKRawInvoice this_arg_conv;
40303 this_arg_conv.inner = (void*)(this_arg & (~1));
40304 this_arg_conv.is_owned = false;
40305 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40306 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
40307 uint32_t ret_ref = 0;
40308 if ((uintptr_t)ret_var.inner > 4096) {
40309 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40310 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40311 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40312 ret_ref = (uintptr_t)ret_var.inner;
40313 if (ret_var.is_owned) {
40320 uint32_t __attribute__((export_name("TS_RawInvoice_expiry_time"))) TS_RawInvoice_expiry_time(uint32_t this_arg) {
40321 LDKRawInvoice this_arg_conv;
40322 this_arg_conv.inner = (void*)(this_arg & (~1));
40323 this_arg_conv.is_owned = false;
40324 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40325 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
40326 uint32_t ret_ref = 0;
40327 if ((uintptr_t)ret_var.inner > 4096) {
40328 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40329 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40330 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40331 ret_ref = (uintptr_t)ret_var.inner;
40332 if (ret_var.is_owned) {
40339 uint32_t __attribute__((export_name("TS_RawInvoice_min_final_cltv_expiry"))) TS_RawInvoice_min_final_cltv_expiry(uint32_t this_arg) {
40340 LDKRawInvoice this_arg_conv;
40341 this_arg_conv.inner = (void*)(this_arg & (~1));
40342 this_arg_conv.is_owned = false;
40343 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40344 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
40345 uint32_t ret_ref = 0;
40346 if ((uintptr_t)ret_var.inner > 4096) {
40347 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40348 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40349 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40350 ret_ref = (uintptr_t)ret_var.inner;
40351 if (ret_var.is_owned) {
40358 int8_tArray __attribute__((export_name("TS_RawInvoice_payment_secret"))) TS_RawInvoice_payment_secret(uint32_t this_arg) {
40359 LDKRawInvoice this_arg_conv;
40360 this_arg_conv.inner = (void*)(this_arg & (~1));
40361 this_arg_conv.is_owned = false;
40362 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40363 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40364 memcpy(ret_arr->elems, RawInvoice_payment_secret(&this_arg_conv).data, 32);
40368 uint32_t __attribute__((export_name("TS_RawInvoice_features"))) TS_RawInvoice_features(uint32_t this_arg) {
40369 LDKRawInvoice this_arg_conv;
40370 this_arg_conv.inner = (void*)(this_arg & (~1));
40371 this_arg_conv.is_owned = false;
40372 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40373 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
40374 uint32_t ret_ref = 0;
40375 if ((uintptr_t)ret_var.inner > 4096) {
40376 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40377 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40378 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40379 ret_ref = (uintptr_t)ret_var.inner;
40380 if (ret_var.is_owned) {
40387 uint32_tArray __attribute__((export_name("TS_RawInvoice_private_routes"))) TS_RawInvoice_private_routes(uint32_t this_arg) {
40388 LDKRawInvoice this_arg_conv;
40389 this_arg_conv.inner = (void*)(this_arg & (~1));
40390 this_arg_conv.is_owned = false;
40391 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40392 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
40393 uint32_tArray ret_arr = NULL;
40394 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
40395 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
40396 for (size_t o = 0; o < ret_var.datalen; o++) {
40397 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
40398 uint32_t ret_conv_14_ref = 0;
40399 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40400 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40401 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
40402 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
40403 if (ret_conv_14_var.is_owned) {
40404 ret_conv_14_ref |= 1;
40406 ret_arr_ptr[o] = ret_conv_14_ref;
40409 FREE(ret_var.data);
40413 uint32_t __attribute__((export_name("TS_RawInvoice_amount_pico_btc"))) TS_RawInvoice_amount_pico_btc(uint32_t this_arg) {
40414 LDKRawInvoice this_arg_conv;
40415 this_arg_conv.inner = (void*)(this_arg & (~1));
40416 this_arg_conv.is_owned = false;
40417 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40418 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40419 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
40420 uint32_t ret_ref = (uintptr_t)ret_copy;
40424 uint32_t __attribute__((export_name("TS_RawInvoice_currency"))) TS_RawInvoice_currency(uint32_t this_arg) {
40425 LDKRawInvoice this_arg_conv;
40426 this_arg_conv.inner = (void*)(this_arg & (~1));
40427 this_arg_conv.is_owned = false;
40428 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40429 uint32_t ret_conv = LDKCurrency_to_js(RawInvoice_currency(&this_arg_conv));
40433 uint32_t __attribute__((export_name("TS_PositiveTimestamp_from_unix_timestamp"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
40434 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
40435 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
40436 return (uint32_t)ret_conv;
40439 uint32_t __attribute__((export_name("TS_PositiveTimestamp_from_duration_since_epoch"))) TS_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
40440 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
40441 *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
40442 return (uint32_t)ret_conv;
40445 int64_t __attribute__((export_name("TS_PositiveTimestamp_as_unix_timestamp"))) TS_PositiveTimestamp_as_unix_timestamp(uint32_t this_arg) {
40446 LDKPositiveTimestamp this_arg_conv;
40447 this_arg_conv.inner = (void*)(this_arg & (~1));
40448 this_arg_conv.is_owned = false;
40449 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40450 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
40454 int64_t __attribute__((export_name("TS_PositiveTimestamp_as_duration_since_epoch"))) TS_PositiveTimestamp_as_duration_since_epoch(uint32_t this_arg) {
40455 LDKPositiveTimestamp this_arg_conv;
40456 this_arg_conv.inner = (void*)(this_arg & (~1));
40457 this_arg_conv.is_owned = false;
40458 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40459 int64_t ret_val = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
40463 uint32_t __attribute__((export_name("TS_Invoice_into_signed_raw"))) TS_Invoice_into_signed_raw(uint32_t this_arg) {
40464 LDKInvoice this_arg_conv;
40465 this_arg_conv.inner = (void*)(this_arg & (~1));
40466 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
40467 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40468 this_arg_conv = Invoice_clone(&this_arg_conv);
40469 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
40470 uint32_t ret_ref = 0;
40471 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40472 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40473 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40474 ret_ref = (uintptr_t)ret_var.inner;
40475 if (ret_var.is_owned) {
40481 uint32_t __attribute__((export_name("TS_Invoice_check_signature"))) TS_Invoice_check_signature(uint32_t this_arg) {
40482 LDKInvoice this_arg_conv;
40483 this_arg_conv.inner = (void*)(this_arg & (~1));
40484 this_arg_conv.is_owned = false;
40485 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40486 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
40487 *ret_conv = Invoice_check_signature(&this_arg_conv);
40488 return (uint32_t)ret_conv;
40491 uint32_t __attribute__((export_name("TS_Invoice_from_signed"))) TS_Invoice_from_signed(uint32_t signed_invoice) {
40492 LDKSignedRawInvoice signed_invoice_conv;
40493 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
40494 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
40495 CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
40496 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
40497 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
40498 *ret_conv = Invoice_from_signed(signed_invoice_conv);
40499 return (uint32_t)ret_conv;
40502 int64_t __attribute__((export_name("TS_Invoice_duration_since_epoch"))) TS_Invoice_duration_since_epoch(uint32_t this_arg) {
40503 LDKInvoice this_arg_conv;
40504 this_arg_conv.inner = (void*)(this_arg & (~1));
40505 this_arg_conv.is_owned = false;
40506 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40507 int64_t ret_val = Invoice_duration_since_epoch(&this_arg_conv);
40511 int8_tArray __attribute__((export_name("TS_Invoice_payment_hash"))) TS_Invoice_payment_hash(uint32_t this_arg) {
40512 LDKInvoice this_arg_conv;
40513 this_arg_conv.inner = (void*)(this_arg & (~1));
40514 this_arg_conv.is_owned = false;
40515 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40516 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40517 memcpy(ret_arr->elems, *Invoice_payment_hash(&this_arg_conv), 32);
40521 int8_tArray __attribute__((export_name("TS_Invoice_payee_pub_key"))) TS_Invoice_payee_pub_key(uint32_t this_arg) {
40522 LDKInvoice this_arg_conv;
40523 this_arg_conv.inner = (void*)(this_arg & (~1));
40524 this_arg_conv.is_owned = false;
40525 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40526 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40527 memcpy(ret_arr->elems, Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
40531 int8_tArray __attribute__((export_name("TS_Invoice_payment_secret"))) TS_Invoice_payment_secret(uint32_t this_arg) {
40532 LDKInvoice this_arg_conv;
40533 this_arg_conv.inner = (void*)(this_arg & (~1));
40534 this_arg_conv.is_owned = false;
40535 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40536 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40537 memcpy(ret_arr->elems, *Invoice_payment_secret(&this_arg_conv), 32);
40541 uint32_t __attribute__((export_name("TS_Invoice_features"))) TS_Invoice_features(uint32_t this_arg) {
40542 LDKInvoice this_arg_conv;
40543 this_arg_conv.inner = (void*)(this_arg & (~1));
40544 this_arg_conv.is_owned = false;
40545 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40546 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
40547 uint32_t ret_ref = 0;
40548 if ((uintptr_t)ret_var.inner > 4096) {
40549 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40550 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40551 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40552 ret_ref = (uintptr_t)ret_var.inner;
40553 if (ret_var.is_owned) {
40560 int8_tArray __attribute__((export_name("TS_Invoice_recover_payee_pub_key"))) TS_Invoice_recover_payee_pub_key(uint32_t this_arg) {
40561 LDKInvoice this_arg_conv;
40562 this_arg_conv.inner = (void*)(this_arg & (~1));
40563 this_arg_conv.is_owned = false;
40564 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40565 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40566 memcpy(ret_arr->elems, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
40570 int64_t __attribute__((export_name("TS_Invoice_expiry_time"))) TS_Invoice_expiry_time(uint32_t this_arg) {
40571 LDKInvoice this_arg_conv;
40572 this_arg_conv.inner = (void*)(this_arg & (~1));
40573 this_arg_conv.is_owned = false;
40574 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40575 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
40579 jboolean __attribute__((export_name("TS_Invoice_would_expire"))) TS_Invoice_would_expire(uint32_t this_arg, int64_t at_time) {
40580 LDKInvoice this_arg_conv;
40581 this_arg_conv.inner = (void*)(this_arg & (~1));
40582 this_arg_conv.is_owned = false;
40583 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40584 jboolean ret_val = Invoice_would_expire(&this_arg_conv, at_time);
40588 int64_t __attribute__((export_name("TS_Invoice_min_final_cltv_expiry"))) TS_Invoice_min_final_cltv_expiry(uint32_t this_arg) {
40589 LDKInvoice this_arg_conv;
40590 this_arg_conv.inner = (void*)(this_arg & (~1));
40591 this_arg_conv.is_owned = false;
40592 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40593 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
40597 uint32_tArray __attribute__((export_name("TS_Invoice_private_routes"))) TS_Invoice_private_routes(uint32_t this_arg) {
40598 LDKInvoice this_arg_conv;
40599 this_arg_conv.inner = (void*)(this_arg & (~1));
40600 this_arg_conv.is_owned = false;
40601 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40602 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
40603 uint32_tArray ret_arr = NULL;
40604 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
40605 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
40606 for (size_t o = 0; o < ret_var.datalen; o++) {
40607 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
40608 uint32_t ret_conv_14_ref = 0;
40609 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40610 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40611 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
40612 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
40613 if (ret_conv_14_var.is_owned) {
40614 ret_conv_14_ref |= 1;
40616 ret_arr_ptr[o] = ret_conv_14_ref;
40619 FREE(ret_var.data);
40623 uint32_tArray __attribute__((export_name("TS_Invoice_route_hints"))) TS_Invoice_route_hints(uint32_t this_arg) {
40624 LDKInvoice this_arg_conv;
40625 this_arg_conv.inner = (void*)(this_arg & (~1));
40626 this_arg_conv.is_owned = false;
40627 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40628 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
40629 uint32_tArray ret_arr = NULL;
40630 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
40631 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
40632 for (size_t l = 0; l < ret_var.datalen; l++) {
40633 LDKRouteHint ret_conv_11_var = ret_var.data[l];
40634 uint32_t ret_conv_11_ref = 0;
40635 CHECK((((uintptr_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40636 CHECK((((uintptr_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40637 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
40638 ret_conv_11_ref = (uintptr_t)ret_conv_11_var.inner;
40639 if (ret_conv_11_var.is_owned) {
40640 ret_conv_11_ref |= 1;
40642 ret_arr_ptr[l] = ret_conv_11_ref;
40645 FREE(ret_var.data);
40649 uint32_t __attribute__((export_name("TS_Invoice_currency"))) TS_Invoice_currency(uint32_t this_arg) {
40650 LDKInvoice this_arg_conv;
40651 this_arg_conv.inner = (void*)(this_arg & (~1));
40652 this_arg_conv.is_owned = false;
40653 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40654 uint32_t ret_conv = LDKCurrency_to_js(Invoice_currency(&this_arg_conv));
40658 uint32_t __attribute__((export_name("TS_Invoice_amount_milli_satoshis"))) TS_Invoice_amount_milli_satoshis(uint32_t this_arg) {
40659 LDKInvoice this_arg_conv;
40660 this_arg_conv.inner = (void*)(this_arg & (~1));
40661 this_arg_conv.is_owned = false;
40662 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40663 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40664 *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
40665 uint32_t ret_ref = (uintptr_t)ret_copy;
40669 uint32_t __attribute__((export_name("TS_Description_new"))) TS_Description_new(jstring description) {
40670 LDKStr description_conv = str_ref_to_owned_c(description);
40671 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
40672 *ret_conv = Description_new(description_conv);
40673 return (uint32_t)ret_conv;
40676 jstring __attribute__((export_name("TS_Description_into_inner"))) TS_Description_into_inner(uint32_t this_arg) {
40677 LDKDescription this_arg_conv;
40678 this_arg_conv.inner = (void*)(this_arg & (~1));
40679 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
40680 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40681 this_arg_conv = Description_clone(&this_arg_conv);
40682 LDKStr ret_str = Description_into_inner(this_arg_conv);
40683 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
40688 uint32_t __attribute__((export_name("TS_ExpiryTime_from_seconds"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
40689 LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
40690 uint32_t ret_ref = 0;
40691 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40692 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40693 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40694 ret_ref = (uintptr_t)ret_var.inner;
40695 if (ret_var.is_owned) {
40701 uint32_t __attribute__((export_name("TS_ExpiryTime_from_duration"))) TS_ExpiryTime_from_duration(int64_t duration) {
40702 LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
40703 uint32_t ret_ref = 0;
40704 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40705 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40706 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40707 ret_ref = (uintptr_t)ret_var.inner;
40708 if (ret_var.is_owned) {
40714 int64_t __attribute__((export_name("TS_ExpiryTime_as_seconds"))) TS_ExpiryTime_as_seconds(uint32_t this_arg) {
40715 LDKExpiryTime this_arg_conv;
40716 this_arg_conv.inner = (void*)(this_arg & (~1));
40717 this_arg_conv.is_owned = false;
40718 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40719 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
40723 int64_t __attribute__((export_name("TS_ExpiryTime_as_duration"))) TS_ExpiryTime_as_duration(uint32_t this_arg) {
40724 LDKExpiryTime this_arg_conv;
40725 this_arg_conv.inner = (void*)(this_arg & (~1));
40726 this_arg_conv.is_owned = false;
40727 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40728 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
40732 uint32_t __attribute__((export_name("TS_PrivateRoute_new"))) TS_PrivateRoute_new(uint32_t hops) {
40733 LDKRouteHint hops_conv;
40734 hops_conv.inner = (void*)(hops & (~1));
40735 hops_conv.is_owned = (hops & 1) || (hops == 0);
40736 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
40737 hops_conv = RouteHint_clone(&hops_conv);
40738 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
40739 *ret_conv = PrivateRoute_new(hops_conv);
40740 return (uint32_t)ret_conv;
40743 uint32_t __attribute__((export_name("TS_PrivateRoute_into_inner"))) TS_PrivateRoute_into_inner(uint32_t this_arg) {
40744 LDKPrivateRoute this_arg_conv;
40745 this_arg_conv.inner = (void*)(this_arg & (~1));
40746 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
40747 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40748 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
40749 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
40750 uint32_t ret_ref = 0;
40751 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40752 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40753 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40754 ret_ref = (uintptr_t)ret_var.inner;
40755 if (ret_var.is_owned) {
40761 uint32_t __attribute__((export_name("TS_CreationError_clone"))) TS_CreationError_clone(uint32_t orig) {
40762 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
40763 uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
40767 uint32_t __attribute__((export_name("TS_CreationError_description_too_long"))) TS_CreationError_description_too_long() {
40768 uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
40772 uint32_t __attribute__((export_name("TS_CreationError_route_too_long"))) TS_CreationError_route_too_long() {
40773 uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
40777 uint32_t __attribute__((export_name("TS_CreationError_timestamp_out_of_bounds"))) TS_CreationError_timestamp_out_of_bounds() {
40778 uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
40782 uint32_t __attribute__((export_name("TS_CreationError_invalid_amount"))) TS_CreationError_invalid_amount() {
40783 uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount());
40787 uint32_t __attribute__((export_name("TS_CreationError_missing_route_hints"))) TS_CreationError_missing_route_hints() {
40788 uint32_t ret_conv = LDKCreationError_to_js(CreationError_missing_route_hints());
40792 jboolean __attribute__((export_name("TS_CreationError_eq"))) TS_CreationError_eq(uint32_t a, uint32_t b) {
40793 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
40794 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
40795 jboolean ret_val = CreationError_eq(a_conv, b_conv);
40799 jstring __attribute__((export_name("TS_CreationError_to_str"))) TS_CreationError_to_str(uint32_t o) {
40800 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
40801 LDKStr ret_str = CreationError_to_str(o_conv);
40802 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
40807 uint32_t __attribute__((export_name("TS_SemanticError_clone"))) TS_SemanticError_clone(uint32_t orig) {
40808 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
40809 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_clone(orig_conv));
40813 uint32_t __attribute__((export_name("TS_SemanticError_no_payment_hash"))) TS_SemanticError_no_payment_hash() {
40814 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_hash());
40818 uint32_t __attribute__((export_name("TS_SemanticError_multiple_payment_hashes"))) TS_SemanticError_multiple_payment_hashes() {
40819 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_hashes());
40823 uint32_t __attribute__((export_name("TS_SemanticError_no_description"))) TS_SemanticError_no_description() {
40824 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_description());
40828 uint32_t __attribute__((export_name("TS_SemanticError_multiple_descriptions"))) TS_SemanticError_multiple_descriptions() {
40829 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_descriptions());
40833 uint32_t __attribute__((export_name("TS_SemanticError_no_payment_secret"))) TS_SemanticError_no_payment_secret() {
40834 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_secret());
40838 uint32_t __attribute__((export_name("TS_SemanticError_multiple_payment_secrets"))) TS_SemanticError_multiple_payment_secrets() {
40839 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
40843 uint32_t __attribute__((export_name("TS_SemanticError_invalid_features"))) TS_SemanticError_invalid_features() {
40844 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_features());
40848 uint32_t __attribute__((export_name("TS_SemanticError_invalid_recovery_id"))) TS_SemanticError_invalid_recovery_id() {
40849 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_recovery_id());
40853 uint32_t __attribute__((export_name("TS_SemanticError_invalid_signature"))) TS_SemanticError_invalid_signature() {
40854 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_signature());
40858 uint32_t __attribute__((export_name("TS_SemanticError_imprecise_amount"))) TS_SemanticError_imprecise_amount() {
40859 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_imprecise_amount());
40863 jboolean __attribute__((export_name("TS_SemanticError_eq"))) TS_SemanticError_eq(uint32_t a, uint32_t b) {
40864 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
40865 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
40866 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
40870 jstring __attribute__((export_name("TS_SemanticError_to_str"))) TS_SemanticError_to_str(uint32_t o) {
40871 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
40872 LDKStr ret_str = SemanticError_to_str(o_conv);
40873 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
40878 void __attribute__((export_name("TS_SignOrCreationError_free"))) TS_SignOrCreationError_free(uint32_t this_ptr) {
40879 if ((this_ptr & 1) != 0) return;
40880 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
40881 CHECK_ACCESS(this_ptr_ptr);
40882 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
40883 FREE((void*)this_ptr);
40884 SignOrCreationError_free(this_ptr_conv);
40887 static inline uintptr_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
40888 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
40889 *ret_copy = SignOrCreationError_clone(arg);
40890 uint32_t ret_ref = (uintptr_t)ret_copy;
40893 uint32_t __attribute__((export_name("TS_SignOrCreationError_clone_ptr"))) TS_SignOrCreationError_clone_ptr(uint32_t arg) {
40894 LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)arg;
40895 uint32_t ret_val = SignOrCreationError_clone_ptr(arg_conv);
40899 uint32_t __attribute__((export_name("TS_SignOrCreationError_clone"))) TS_SignOrCreationError_clone(uint32_t orig) {
40900 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
40901 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
40902 *ret_copy = SignOrCreationError_clone(orig_conv);
40903 uint32_t ret_ref = (uintptr_t)ret_copy;
40907 uint32_t __attribute__((export_name("TS_SignOrCreationError_sign_error"))) TS_SignOrCreationError_sign_error() {
40908 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
40909 *ret_copy = SignOrCreationError_sign_error();
40910 uint32_t ret_ref = (uintptr_t)ret_copy;
40914 uint32_t __attribute__((export_name("TS_SignOrCreationError_creation_error"))) TS_SignOrCreationError_creation_error(uint32_t a) {
40915 LDKCreationError a_conv = LDKCreationError_from_js(a);
40916 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
40917 *ret_copy = SignOrCreationError_creation_error(a_conv);
40918 uint32_t ret_ref = (uintptr_t)ret_copy;
40922 jboolean __attribute__((export_name("TS_SignOrCreationError_eq"))) TS_SignOrCreationError_eq(uint32_t a, uint32_t b) {
40923 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
40924 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
40925 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
40929 jstring __attribute__((export_name("TS_SignOrCreationError_to_str"))) TS_SignOrCreationError_to_str(uint32_t o) {
40930 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
40931 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
40932 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
40937 void __attribute__((export_name("TS_InvoicePayer_free"))) TS_InvoicePayer_free(uint32_t this_obj) {
40938 LDKInvoicePayer this_obj_conv;
40939 this_obj_conv.inner = (void*)(this_obj & (~1));
40940 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40941 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40942 InvoicePayer_free(this_obj_conv);
40945 void __attribute__((export_name("TS_Payer_free"))) TS_Payer_free(uint32_t this_ptr) {
40946 if ((this_ptr & 1) != 0) return;
40947 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
40948 CHECK_ACCESS(this_ptr_ptr);
40949 LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr);
40950 FREE((void*)this_ptr);
40951 Payer_free(this_ptr_conv);
40954 void __attribute__((export_name("TS_Router_free"))) TS_Router_free(uint32_t this_ptr) {
40955 if ((this_ptr & 1) != 0) return;
40956 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
40957 CHECK_ACCESS(this_ptr_ptr);
40958 LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
40959 FREE((void*)this_ptr);
40960 Router_free(this_ptr_conv);
40963 void __attribute__((export_name("TS_RetryAttempts_free"))) TS_RetryAttempts_free(uint32_t this_obj) {
40964 LDKRetryAttempts this_obj_conv;
40965 this_obj_conv.inner = (void*)(this_obj & (~1));
40966 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40967 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40968 RetryAttempts_free(this_obj_conv);
40971 uint32_t __attribute__((export_name("TS_RetryAttempts_get_a"))) TS_RetryAttempts_get_a(uint32_t this_ptr) {
40972 LDKRetryAttempts this_ptr_conv;
40973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40974 this_ptr_conv.is_owned = false;
40975 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40976 uint32_t ret_val = RetryAttempts_get_a(&this_ptr_conv);
40980 void __attribute__((export_name("TS_RetryAttempts_set_a"))) TS_RetryAttempts_set_a(uint32_t this_ptr, uint32_t val) {
40981 LDKRetryAttempts this_ptr_conv;
40982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40983 this_ptr_conv.is_owned = false;
40984 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40985 RetryAttempts_set_a(&this_ptr_conv, val);
40988 uint32_t __attribute__((export_name("TS_RetryAttempts_new"))) TS_RetryAttempts_new(uint32_t a_arg) {
40989 LDKRetryAttempts ret_var = RetryAttempts_new(a_arg);
40990 uint32_t ret_ref = 0;
40991 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40992 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40993 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40994 ret_ref = (uintptr_t)ret_var.inner;
40995 if (ret_var.is_owned) {
41001 static inline uintptr_t RetryAttempts_clone_ptr(LDKRetryAttempts *NONNULL_PTR arg) {
41002 LDKRetryAttempts ret_var = RetryAttempts_clone(arg);
41003 uint32_t ret_ref = 0;
41004 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41005 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41006 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41007 ret_ref = (uintptr_t)ret_var.inner;
41008 if (ret_var.is_owned) {
41013 uint32_t __attribute__((export_name("TS_RetryAttempts_clone_ptr"))) TS_RetryAttempts_clone_ptr(uint32_t arg) {
41014 LDKRetryAttempts arg_conv;
41015 arg_conv.inner = (void*)(arg & (~1));
41016 arg_conv.is_owned = false;
41017 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41018 uint32_t ret_val = RetryAttempts_clone_ptr(&arg_conv);
41022 uint32_t __attribute__((export_name("TS_RetryAttempts_clone"))) TS_RetryAttempts_clone(uint32_t orig) {
41023 LDKRetryAttempts orig_conv;
41024 orig_conv.inner = (void*)(orig & (~1));
41025 orig_conv.is_owned = false;
41026 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41027 LDKRetryAttempts ret_var = RetryAttempts_clone(&orig_conv);
41028 uint32_t ret_ref = 0;
41029 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41030 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41031 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41032 ret_ref = (uintptr_t)ret_var.inner;
41033 if (ret_var.is_owned) {
41039 jboolean __attribute__((export_name("TS_RetryAttempts_eq"))) TS_RetryAttempts_eq(uint32_t a, uint32_t b) {
41040 LDKRetryAttempts a_conv;
41041 a_conv.inner = (void*)(a & (~1));
41042 a_conv.is_owned = false;
41043 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41044 LDKRetryAttempts b_conv;
41045 b_conv.inner = (void*)(b & (~1));
41046 b_conv.is_owned = false;
41047 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41048 jboolean ret_val = RetryAttempts_eq(&a_conv, &b_conv);
41052 int64_t __attribute__((export_name("TS_RetryAttempts_hash"))) TS_RetryAttempts_hash(uint32_t o) {
41053 LDKRetryAttempts o_conv;
41054 o_conv.inner = (void*)(o & (~1));
41055 o_conv.is_owned = false;
41056 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41057 int64_t ret_val = RetryAttempts_hash(&o_conv);
41061 void __attribute__((export_name("TS_PaymentError_free"))) TS_PaymentError_free(uint32_t this_ptr) {
41062 if ((this_ptr & 1) != 0) return;
41063 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
41064 CHECK_ACCESS(this_ptr_ptr);
41065 LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
41066 FREE((void*)this_ptr);
41067 PaymentError_free(this_ptr_conv);
41070 static inline uintptr_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
41071 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
41072 *ret_copy = PaymentError_clone(arg);
41073 uint32_t ret_ref = (uintptr_t)ret_copy;
41076 uint32_t __attribute__((export_name("TS_PaymentError_clone_ptr"))) TS_PaymentError_clone_ptr(uint32_t arg) {
41077 LDKPaymentError* arg_conv = (LDKPaymentError*)arg;
41078 uint32_t ret_val = PaymentError_clone_ptr(arg_conv);
41082 uint32_t __attribute__((export_name("TS_PaymentError_clone"))) TS_PaymentError_clone(uint32_t orig) {
41083 LDKPaymentError* orig_conv = (LDKPaymentError*)orig;
41084 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
41085 *ret_copy = PaymentError_clone(orig_conv);
41086 uint32_t ret_ref = (uintptr_t)ret_copy;
41090 uint32_t __attribute__((export_name("TS_PaymentError_invoice"))) TS_PaymentError_invoice(jstring a) {
41091 LDKStr a_conv = str_ref_to_owned_c(a);
41092 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
41093 *ret_copy = PaymentError_invoice(a_conv);
41094 uint32_t ret_ref = (uintptr_t)ret_copy;
41098 uint32_t __attribute__((export_name("TS_PaymentError_routing"))) TS_PaymentError_routing(uint32_t a) {
41099 LDKLightningError a_conv;
41100 a_conv.inner = (void*)(a & (~1));
41101 a_conv.is_owned = (a & 1) || (a == 0);
41102 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41103 a_conv = LightningError_clone(&a_conv);
41104 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
41105 *ret_copy = PaymentError_routing(a_conv);
41106 uint32_t ret_ref = (uintptr_t)ret_copy;
41110 uint32_t __attribute__((export_name("TS_PaymentError_sending"))) TS_PaymentError_sending(uint32_t a) {
41111 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
41112 CHECK_ACCESS(a_ptr);
41113 LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
41114 a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)a) & ~1));
41115 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
41116 *ret_copy = PaymentError_sending(a_conv);
41117 uint32_t ret_ref = (uintptr_t)ret_copy;
41121 uint32_t __attribute__((export_name("TS_InvoicePayer_new"))) TS_InvoicePayer_new(uint32_t payer, uint32_t router, uint32_t scorer, uint32_t logger, uint32_t event_handler, uint32_t retry_attempts) {
41122 void* payer_ptr = (void*)(((uintptr_t)payer) & ~1);
41123 CHECK_ACCESS(payer_ptr);
41124 LDKPayer payer_conv = *(LDKPayer*)(payer_ptr);
41125 void* router_ptr = (void*)(((uintptr_t)router) & ~1);
41126 CHECK_ACCESS(router_ptr);
41127 LDKRouter router_conv = *(LDKRouter*)(router_ptr);
41128 LDKMultiThreadedLockableScore scorer_conv;
41129 scorer_conv.inner = (void*)(scorer & (~1));
41130 scorer_conv.is_owned = false;
41131 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
41132 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
41133 CHECK_ACCESS(logger_ptr);
41134 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41135 void* event_handler_ptr = (void*)(((uintptr_t)event_handler) & ~1);
41136 CHECK_ACCESS(event_handler_ptr);
41137 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
41138 LDKRetryAttempts retry_attempts_conv;
41139 retry_attempts_conv.inner = (void*)(retry_attempts & (~1));
41140 retry_attempts_conv.is_owned = (retry_attempts & 1) || (retry_attempts == 0);
41141 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_attempts_conv);
41142 retry_attempts_conv = RetryAttempts_clone(&retry_attempts_conv);
41143 LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, &scorer_conv, logger_conv, event_handler_conv, retry_attempts_conv);
41144 uint32_t ret_ref = 0;
41145 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41146 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41147 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41148 ret_ref = (uintptr_t)ret_var.inner;
41149 if (ret_var.is_owned) {
41155 uint32_t __attribute__((export_name("TS_InvoicePayer_pay_invoice"))) TS_InvoicePayer_pay_invoice(uint32_t this_arg, uint32_t invoice) {
41156 LDKInvoicePayer this_arg_conv;
41157 this_arg_conv.inner = (void*)(this_arg & (~1));
41158 this_arg_conv.is_owned = false;
41159 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41160 LDKInvoice invoice_conv;
41161 invoice_conv.inner = (void*)(invoice & (~1));
41162 invoice_conv.is_owned = false;
41163 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
41164 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
41165 *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv);
41166 return (uint32_t)ret_conv;
41169 uint32_t __attribute__((export_name("TS_InvoicePayer_pay_zero_value_invoice"))) TS_InvoicePayer_pay_zero_value_invoice(uint32_t this_arg, uint32_t invoice, int64_t amount_msats) {
41170 LDKInvoicePayer this_arg_conv;
41171 this_arg_conv.inner = (void*)(this_arg & (~1));
41172 this_arg_conv.is_owned = false;
41173 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41174 LDKInvoice invoice_conv;
41175 invoice_conv.inner = (void*)(invoice & (~1));
41176 invoice_conv.is_owned = false;
41177 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
41178 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
41179 *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats);
41180 return (uint32_t)ret_conv;
41183 uint32_t __attribute__((export_name("TS_InvoicePayer_pay_pubkey"))) TS_InvoicePayer_pay_pubkey(uint32_t this_arg, int8_tArray pubkey, int8_tArray payment_preimage, int64_t amount_msats, int32_t final_cltv_expiry_delta) {
41184 LDKInvoicePayer this_arg_conv;
41185 this_arg_conv.inner = (void*)(this_arg & (~1));
41186 this_arg_conv.is_owned = false;
41187 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41188 LDKPublicKey pubkey_ref;
41189 CHECK(pubkey->arr_len == 33);
41190 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
41191 LDKThirtyTwoBytes payment_preimage_ref;
41192 CHECK(payment_preimage->arr_len == 32);
41193 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
41194 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
41195 *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta);
41196 return (uint32_t)ret_conv;
41199 void __attribute__((export_name("TS_InvoicePayer_remove_cached_payment"))) TS_InvoicePayer_remove_cached_payment(uint32_t this_arg, int8_tArray payment_hash) {
41200 LDKInvoicePayer this_arg_conv;
41201 this_arg_conv.inner = (void*)(this_arg & (~1));
41202 this_arg_conv.is_owned = false;
41203 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41204 unsigned char payment_hash_arr[32];
41205 CHECK(payment_hash->arr_len == 32);
41206 memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
41207 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
41208 InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref);
41211 uint32_t __attribute__((export_name("TS_InvoicePayer_as_EventHandler"))) TS_InvoicePayer_as_EventHandler(uint32_t this_arg) {
41212 LDKInvoicePayer this_arg_conv;
41213 this_arg_conv.inner = (void*)(this_arg & (~1));
41214 this_arg_conv.is_owned = false;
41215 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41216 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
41217 *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv);
41218 return (uint32_t)ret_ret;
41221 uint32_t __attribute__((export_name("TS_create_invoice_from_channelmanager_and_duration_since_epoch"))) TS_create_invoice_from_channelmanager_and_duration_since_epoch(uint32_t channelmanager, uint32_t keys_manager, uint32_t network, uint32_t amt_msat, jstring description, int64_t duration_since_epoch) {
41222 LDKChannelManager channelmanager_conv;
41223 channelmanager_conv.inner = (void*)(channelmanager & (~1));
41224 channelmanager_conv.is_owned = false;
41225 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
41226 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
41227 CHECK_ACCESS(keys_manager_ptr);
41228 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
41229 LDKCurrency network_conv = LDKCurrency_from_js(network);
41230 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
41231 CHECK_ACCESS(amt_msat_ptr);
41232 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
41233 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
41234 LDKStr description_conv = str_ref_to_owned_c(description);
41235 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
41236 *ret_conv = create_invoice_from_channelmanager_and_duration_since_epoch(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv, duration_since_epoch);
41237 return (uint32_t)ret_conv;
41240 void __attribute__((export_name("TS_DefaultRouter_free"))) TS_DefaultRouter_free(uint32_t this_obj) {
41241 LDKDefaultRouter this_obj_conv;
41242 this_obj_conv.inner = (void*)(this_obj & (~1));
41243 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41244 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41245 DefaultRouter_free(this_obj_conv);
41248 uint32_t __attribute__((export_name("TS_DefaultRouter_new"))) TS_DefaultRouter_new(uint32_t network_graph, uint32_t logger) {
41249 LDKNetworkGraph network_graph_conv;
41250 network_graph_conv.inner = (void*)(network_graph & (~1));
41251 network_graph_conv.is_owned = false;
41252 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
41253 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
41254 CHECK_ACCESS(logger_ptr);
41255 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41256 LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv);
41257 uint32_t ret_ref = 0;
41258 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41259 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41260 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41261 ret_ref = (uintptr_t)ret_var.inner;
41262 if (ret_var.is_owned) {
41268 uint32_t __attribute__((export_name("TS_DefaultRouter_as_Router"))) TS_DefaultRouter_as_Router(uint32_t this_arg) {
41269 LDKDefaultRouter this_arg_conv;
41270 this_arg_conv.inner = (void*)(this_arg & (~1));
41271 this_arg_conv.is_owned = false;
41272 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41273 LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
41274 *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
41275 return (uint32_t)ret_ret;
41278 uint32_t __attribute__((export_name("TS_ChannelManager_as_Payer"))) TS_ChannelManager_as_Payer(uint32_t this_arg) {
41279 LDKChannelManager this_arg_conv;
41280 this_arg_conv.inner = (void*)(this_arg & (~1));
41281 this_arg_conv.is_owned = false;
41282 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41283 LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer");
41284 *ret_ret = ChannelManager_as_Payer(&this_arg_conv);
41285 return (uint32_t)ret_ret;
41288 uint32_t __attribute__((export_name("TS_SiPrefix_from_str"))) TS_SiPrefix_from_str(jstring s) {
41289 LDKStr s_conv = str_ref_to_owned_c(s);
41290 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
41291 *ret_conv = SiPrefix_from_str(s_conv);
41292 return (uint32_t)ret_conv;
41295 uint32_t __attribute__((export_name("TS_Invoice_from_str"))) TS_Invoice_from_str(jstring s) {
41296 LDKStr s_conv = str_ref_to_owned_c(s);
41297 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
41298 *ret_conv = Invoice_from_str(s_conv);
41299 return (uint32_t)ret_conv;
41302 uint32_t __attribute__((export_name("TS_SignedRawInvoice_from_str"))) TS_SignedRawInvoice_from_str(jstring s) {
41303 LDKStr s_conv = str_ref_to_owned_c(s);
41304 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
41305 *ret_conv = SignedRawInvoice_from_str(s_conv);
41306 return (uint32_t)ret_conv;
41309 jstring __attribute__((export_name("TS_Invoice_to_str"))) TS_Invoice_to_str(uint32_t o) {
41311 o_conv.inner = (void*)(o & (~1));
41312 o_conv.is_owned = false;
41313 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41314 LDKStr ret_str = Invoice_to_str(&o_conv);
41315 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
41320 jstring __attribute__((export_name("TS_SignedRawInvoice_to_str"))) TS_SignedRawInvoice_to_str(uint32_t o) {
41321 LDKSignedRawInvoice o_conv;
41322 o_conv.inner = (void*)(o & (~1));
41323 o_conv.is_owned = false;
41324 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41325 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
41326 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
41331 jstring __attribute__((export_name("TS_Currency_to_str"))) TS_Currency_to_str(uint32_t o) {
41332 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
41333 LDKStr ret_str = Currency_to_str(o_conv);
41334 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
41339 jstring __attribute__((export_name("TS_SiPrefix_to_str"))) TS_SiPrefix_to_str(uint32_t o) {
41340 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
41341 LDKStr ret_str = SiPrefix_to_str(o_conv);
41342 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);