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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 (uintptr_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 intptr_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 intptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 ((uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_t output_ref = ((uintptr_t)&obj->static_output.output) | 1;
1526 return (uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 uintptr_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 LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
2480 CHECK(owner->result_ok);
2481 return InitFeatures_clone(&*owner->contents.result);
2483 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
2484 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
2485 LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
2486 uintptr_t ret_ref = 0;
2487 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2488 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2489 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2490 ret_ref = (uintptr_t)ret_var.inner;
2491 if (ret_var.is_owned) {
2497 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
2498 CHECK(!owner->result_ok);
2499 return DecodeError_clone(&*owner->contents.err);
2501 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_err"))) TS_CResult_InitFeaturesDecodeErrorZ_get_err(uint32_t owner) {
2502 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
2503 LDKDecodeError ret_var = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
2504 uintptr_t ret_ref = 0;
2505 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2506 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2507 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2508 ret_ref = (uintptr_t)ret_var.inner;
2509 if (ret_var.is_owned) {
2515 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
2516 CHECK(owner->result_ok);
2517 return ChannelFeatures_clone(&*owner->contents.result);
2519 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
2520 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
2521 LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
2522 uintptr_t ret_ref = 0;
2523 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2524 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2525 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2526 ret_ref = (uintptr_t)ret_var.inner;
2527 if (ret_var.is_owned) {
2533 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
2534 CHECK(!owner->result_ok);
2535 return DecodeError_clone(&*owner->contents.err);
2537 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_err(uint32_t owner) {
2538 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
2539 LDKDecodeError ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
2540 uintptr_t ret_ref = 0;
2541 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2542 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2543 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2544 ret_ref = (uintptr_t)ret_var.inner;
2545 if (ret_var.is_owned) {
2551 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2552 CHECK(owner->result_ok);
2553 return NodeFeatures_clone(&*owner->contents.result);
2555 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
2556 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
2557 LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
2558 uintptr_t ret_ref = 0;
2559 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2560 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2561 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2562 ret_ref = (uintptr_t)ret_var.inner;
2563 if (ret_var.is_owned) {
2569 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2570 CHECK(!owner->result_ok);
2571 return DecodeError_clone(&*owner->contents.err);
2573 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_err(uint32_t owner) {
2574 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
2575 LDKDecodeError ret_var = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
2576 uintptr_t ret_ref = 0;
2577 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2578 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2579 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2580 ret_ref = (uintptr_t)ret_var.inner;
2581 if (ret_var.is_owned) {
2587 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
2588 CHECK(owner->result_ok);
2589 return InvoiceFeatures_clone(&*owner->contents.result);
2591 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
2592 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
2593 LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
2594 uintptr_t ret_ref = 0;
2595 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2596 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2597 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2598 ret_ref = (uintptr_t)ret_var.inner;
2599 if (ret_var.is_owned) {
2605 static inline struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
2606 CHECK(!owner->result_ok);
2607 return DecodeError_clone(&*owner->contents.err);
2609 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err(uint32_t owner) {
2610 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
2611 LDKDecodeError ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
2612 uintptr_t ret_ref = 0;
2613 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2614 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2615 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2616 ret_ref = (uintptr_t)ret_var.inner;
2617 if (ret_var.is_owned) {
2623 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2624 CHECK(owner->result_ok);
2625 return ChannelTypeFeatures_clone(&*owner->contents.result);
2627 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint32_t owner) {
2628 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
2629 LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
2630 uintptr_t ret_ref = 0;
2631 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2632 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2633 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2634 ret_ref = (uintptr_t)ret_var.inner;
2635 if (ret_var.is_owned) {
2641 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2642 CHECK(!owner->result_ok);
2643 return DecodeError_clone(&*owner->contents.err);
2645 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint32_t owner) {
2646 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
2647 LDKDecodeError ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
2648 uintptr_t ret_ref = 0;
2649 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2650 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2651 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2652 ret_ref = (uintptr_t)ret_var.inner;
2653 if (ret_var.is_owned) {
2659 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2660 CHECK(owner->result_ok);
2661 return DelayedPaymentOutputDescriptor_clone(&*owner->contents.result);
2663 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t owner) {
2664 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
2665 LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
2666 uintptr_t ret_ref = 0;
2667 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2668 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2669 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2670 ret_ref = (uintptr_t)ret_var.inner;
2671 if (ret_var.is_owned) {
2677 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2678 CHECK(!owner->result_ok);
2679 return DecodeError_clone(&*owner->contents.err);
2681 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t owner) {
2682 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
2683 LDKDecodeError ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
2684 uintptr_t ret_ref = 0;
2685 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2686 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2687 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2688 ret_ref = (uintptr_t)ret_var.inner;
2689 if (ret_var.is_owned) {
2695 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2696 CHECK(owner->result_ok);
2697 return StaticPaymentOutputDescriptor_clone(&*owner->contents.result);
2699 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint32_t owner) {
2700 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
2701 LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
2702 uintptr_t ret_ref = 0;
2703 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2704 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2705 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2706 ret_ref = (uintptr_t)ret_var.inner;
2707 if (ret_var.is_owned) {
2713 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2714 CHECK(!owner->result_ok);
2715 return DecodeError_clone(&*owner->contents.err);
2717 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint32_t owner) {
2718 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
2719 LDKDecodeError ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
2720 uintptr_t ret_ref = 0;
2721 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2722 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2723 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2724 ret_ref = (uintptr_t)ret_var.inner;
2725 if (ret_var.is_owned) {
2731 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2732 CHECK(owner->result_ok);
2733 return SpendableOutputDescriptor_clone(&*owner->contents.result);
2735 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint32_t owner) {
2736 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
2737 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
2738 *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
2739 uintptr_t ret_ref = (uintptr_t)ret_copy;
2743 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2744 CHECK(!owner->result_ok);
2745 return DecodeError_clone(&*owner->contents.err);
2747 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint32_t owner) {
2748 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
2749 LDKDecodeError ret_var = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
2750 uintptr_t ret_ref = 0;
2751 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2752 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2753 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2754 ret_ref = (uintptr_t)ret_var.inner;
2755 if (ret_var.is_owned) {
2761 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
2762 LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
2763 for (size_t i = 0; i < ret.datalen; i++) {
2764 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
2768 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
2771 int8_tArray __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_a"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_a(uint32_t owner) {
2772 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
2773 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
2774 memcpy(ret_arr->elems, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form, 64);
2778 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
2781 ptrArray __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_b"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_b(uint32_t owner) {
2782 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
2783 LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
2784 ptrArray ret_arr = NULL;
2785 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
2786 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
2787 for (size_t m = 0; m < ret_var.datalen; m++) {
2788 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
2789 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
2790 ret_arr_ptr[m] = ret_conv_12_arr;
2796 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
2797 CHECK(owner->result_ok);
2798 return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
2800 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint32_t owner) {
2801 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
2802 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
2803 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
2804 return ((uintptr_t)ret_conv);
2807 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
2808 CHECK(!owner->result_ok);
2809 return *owner->contents.err;
2811 void __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint32_t owner) {
2812 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
2813 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
2816 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
2817 CHECK(owner->result_ok);
2818 return *owner->contents.result;
2820 int8_tArray __attribute__((export_name("TS_CResult_SignatureNoneZ_get_ok"))) TS_CResult_SignatureNoneZ_get_ok(uint32_t owner) {
2821 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
2822 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
2823 memcpy(ret_arr->elems, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form, 64);
2827 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
2828 CHECK(!owner->result_ok);
2829 return *owner->contents.err;
2831 void __attribute__((export_name("TS_CResult_SignatureNoneZ_get_err"))) TS_CResult_SignatureNoneZ_get_err(uint32_t owner) {
2832 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
2833 CResult_SignatureNoneZ_get_err(owner_conv);
2836 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_a(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
2839 int8_tArray __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_get_a"))) TS_C2Tuple_SignatureSignatureZ_get_a(uint32_t owner) {
2840 LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)(owner & ~1);
2841 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
2842 memcpy(ret_arr->elems, C2Tuple_SignatureSignatureZ_get_a(owner_conv).compact_form, 64);
2846 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_b(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
2849 int8_tArray __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_get_b"))) TS_C2Tuple_SignatureSignatureZ_get_b(uint32_t owner) {
2850 LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)(owner & ~1);
2851 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
2852 memcpy(ret_arr->elems, C2Tuple_SignatureSignatureZ_get_b(owner_conv).compact_form, 64);
2856 static inline struct LDKC2Tuple_SignatureSignatureZ CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
2857 CHECK(owner->result_ok);
2858 return C2Tuple_SignatureSignatureZ_clone(&*owner->contents.result);
2860 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(uint32_t owner) {
2861 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(owner & ~1);
2862 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
2863 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(owner_conv);
2864 return ((uintptr_t)ret_conv);
2867 static inline void CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
2868 CHECK(!owner->result_ok);
2869 return *owner->contents.err;
2871 void __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(uint32_t owner) {
2872 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(owner & ~1);
2873 CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(owner_conv);
2876 static inline struct LDKSecretKey CResult_SecretKeyNoneZ_get_ok(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
2877 CHECK(owner->result_ok);
2878 return *owner->contents.result;
2880 int8_tArray __attribute__((export_name("TS_CResult_SecretKeyNoneZ_get_ok"))) TS_CResult_SecretKeyNoneZ_get_ok(uint32_t owner) {
2881 LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)(owner & ~1);
2882 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
2883 memcpy(ret_arr->elems, CResult_SecretKeyNoneZ_get_ok(owner_conv).bytes, 32);
2887 static inline void CResult_SecretKeyNoneZ_get_err(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
2888 CHECK(!owner->result_ok);
2889 return *owner->contents.err;
2891 void __attribute__((export_name("TS_CResult_SecretKeyNoneZ_get_err"))) TS_CResult_SecretKeyNoneZ_get_err(uint32_t owner) {
2892 LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)(owner & ~1);
2893 CResult_SecretKeyNoneZ_get_err(owner_conv);
2896 typedef struct LDKBaseSign_JCalls {
2897 atomic_size_t refcnt;
2898 uint32_t instance_ptr;
2899 } LDKBaseSign_JCalls;
2900 static void LDKBaseSign_JCalls_free(void* this_arg) {
2901 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2902 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2906 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2907 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2908 int8_tArray ret = (int8_tArray)js_invoke_function_1(j_calls->instance_ptr, 0, (uint32_t)idx);
2909 LDKPublicKey ret_ref;
2910 CHECK(ret->arr_len == 33);
2911 memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
2914 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2915 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2916 int8_tArray ret = (int8_tArray)js_invoke_function_1(j_calls->instance_ptr, 1, (uint32_t)idx);
2917 LDKThirtyTwoBytes ret_ref;
2918 CHECK(ret->arr_len == 32);
2919 memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
2922 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
2923 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2924 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
2925 uintptr_t holder_tx_ref = 0;
2926 holder_tx_var = HolderCommitmentTransaction_clone(holder_tx);
2927 CHECK((((uintptr_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2928 CHECK((((uintptr_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2929 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
2930 holder_tx_ref = (uintptr_t)holder_tx_var.inner;
2931 if (holder_tx_var.is_owned) {
2934 LDKCVec_PaymentPreimageZ preimages_var = preimages;
2935 ptrArray preimages_arr = NULL;
2936 preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
2937 int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 4);
2938 for (size_t m = 0; m < preimages_var.datalen; m++) {
2939 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
2940 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
2941 preimages_arr_ptr[m] = preimages_conv_12_arr;
2944 FREE(preimages_var.data);
2945 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 2, (uint32_t)holder_tx_ref, (uint32_t)preimages_arr);
2946 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
2947 CHECK_ACCESS(ret_ptr);
2948 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
2952 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
2953 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2954 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 3);
2955 LDKThirtyTwoBytes ret_ref;
2956 CHECK(ret->arr_len == 32);
2957 memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
2960 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
2961 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2962 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
2963 uintptr_t commitment_tx_ref = 0;
2964 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
2965 CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2966 CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2967 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
2968 commitment_tx_ref = (uintptr_t)commitment_tx_var.inner;
2969 if (commitment_tx_var.is_owned) {
2970 commitment_tx_ref |= 1;
2972 LDKCVec_PaymentPreimageZ preimages_var = preimages;
2973 ptrArray preimages_arr = NULL;
2974 preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
2975 int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 4);
2976 for (size_t m = 0; m < preimages_var.datalen; m++) {
2977 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
2978 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
2979 preimages_arr_ptr[m] = preimages_conv_12_arr;
2982 FREE(preimages_var.data);
2983 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 4, (uint32_t)commitment_tx_ref, (uint32_t)preimages_arr);
2984 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
2985 CHECK_ACCESS(ret_ptr);
2986 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
2990 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
2991 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2992 int8_tArray secret_arr = init_int8_tArray(32, __LINE__);
2993 memcpy(secret_arr->elems, *secret, 32);
2994 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 5, (uint32_t)idx, (uint32_t)secret_arr);
2995 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
2996 CHECK_ACCESS(ret_ptr);
2997 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3001 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
3002 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3003 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
3004 uintptr_t commitment_tx_ref = 0;
3005 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
3006 CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3007 CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3008 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3009 commitment_tx_ref = (uintptr_t)commitment_tx_var.inner;
3010 if (commitment_tx_var.is_owned) {
3011 commitment_tx_ref |= 1;
3013 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 6, (uint32_t)commitment_tx_ref);
3014 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3015 CHECK_ACCESS(ret_ptr);
3016 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3020 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]) {
3021 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3022 LDKTransaction justice_tx_var = justice_tx;
3023 int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
3024 memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
3025 Transaction_free(justice_tx_var);
3026 int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
3027 memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
3028 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);
3029 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3030 CHECK_ACCESS(ret_ptr);
3031 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3035 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) {
3036 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3037 LDKTransaction justice_tx_var = justice_tx;
3038 int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
3039 memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
3040 Transaction_free(justice_tx_var);
3041 int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
3042 memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
3043 LDKHTLCOutputInCommitment htlc_var = *htlc;
3044 uintptr_t htlc_ref = 0;
3045 htlc_var = HTLCOutputInCommitment_clone(htlc);
3046 CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3047 CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3048 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3049 htlc_ref = (uintptr_t)htlc_var.inner;
3050 if (htlc_var.is_owned) {
3053 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);
3054 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3055 CHECK_ACCESS(ret_ptr);
3056 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3060 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) {
3061 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3062 LDKTransaction htlc_tx_var = htlc_tx;
3063 int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
3064 memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
3065 Transaction_free(htlc_tx_var);
3066 int8_tArray per_commitment_point_arr = init_int8_tArray(33, __LINE__);
3067 memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
3068 LDKHTLCOutputInCommitment htlc_var = *htlc;
3069 uintptr_t htlc_ref = 0;
3070 htlc_var = HTLCOutputInCommitment_clone(htlc);
3071 CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3072 CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3073 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3074 htlc_ref = (uintptr_t)htlc_var.inner;
3075 if (htlc_var.is_owned) {
3078 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);
3079 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3080 CHECK_ACCESS(ret_ptr);
3081 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3085 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
3086 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3087 LDKClosingTransaction closing_tx_var = *closing_tx;
3088 uintptr_t closing_tx_ref = 0;
3089 closing_tx_var = ClosingTransaction_clone(closing_tx);
3090 CHECK((((uintptr_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3091 CHECK((((uintptr_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3092 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
3093 closing_tx_ref = (uintptr_t)closing_tx_var.inner;
3094 if (closing_tx_var.is_owned) {
3095 closing_tx_ref |= 1;
3097 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 10, (uint32_t)closing_tx_ref);
3098 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3099 CHECK_ACCESS(ret_ptr);
3100 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3104 LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
3105 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3106 LDKUnsignedChannelAnnouncement msg_var = *msg;
3107 uintptr_t msg_ref = 0;
3108 msg_var = UnsignedChannelAnnouncement_clone(msg);
3109 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3110 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3111 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3112 msg_ref = (uintptr_t)msg_var.inner;
3113 if (msg_var.is_owned) {
3116 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 11, (uint32_t)msg_ref);
3117 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3118 CHECK_ACCESS(ret_ptr);
3119 LDKCResult_C2Tuple_SignatureSignatureZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(ret_ptr);
3123 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
3124 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3125 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
3126 uintptr_t channel_parameters_ref = 0;
3127 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
3128 CHECK((((uintptr_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3129 CHECK((((uintptr_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3130 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
3131 channel_parameters_ref = (uintptr_t)channel_parameters_var.inner;
3132 if (channel_parameters_var.is_owned) {
3133 channel_parameters_ref |= 1;
3135 js_invoke_function_1(j_calls->instance_ptr, 12, (uint32_t)channel_parameters_ref);
3137 static void LDKBaseSign_JCalls_cloned(LDKBaseSign* new_obj) {
3138 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) new_obj->this_arg;
3139 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3141 static inline LDKBaseSign LDKBaseSign_init (JSValue o, uint32_t pubkeys) {
3142 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
3143 atomic_init(&calls->refcnt, 1);
3144 calls->instance_ptr = o;
3146 LDKChannelPublicKeys pubkeys_conv;
3147 pubkeys_conv.inner = (void*)(pubkeys & (~1));
3148 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
3149 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3152 .this_arg = (void*) calls,
3153 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
3154 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
3155 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
3156 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
3157 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
3158 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
3159 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
3160 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
3161 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
3162 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
3163 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
3164 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
3165 .ready_channel = ready_channel_LDKBaseSign_jcall,
3166 .free = LDKBaseSign_JCalls_free,
3167 .pubkeys = pubkeys_conv,
3168 .set_pubkeys = NULL,
3172 long __attribute__((export_name("TS_LDKBaseSign_new"))) TS_LDKBaseSign_new(JSValue o, uint32_t pubkeys) {
3173 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
3174 *res_ptr = LDKBaseSign_init(o, pubkeys);
3175 return (long)res_ptr;
3177 int8_tArray __attribute__((export_name("TS_BaseSign_get_per_commitment_point"))) TS_BaseSign_get_per_commitment_point(uint32_t this_arg, int64_t idx) {
3178 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3179 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3180 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3181 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3182 memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
3186 int8_tArray __attribute__((export_name("TS_BaseSign_release_commitment_secret"))) TS_BaseSign_release_commitment_secret(uint32_t this_arg, int64_t idx) {
3187 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3188 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3189 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3190 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3191 memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
3195 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) {
3196 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3197 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3198 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3199 LDKHolderCommitmentTransaction holder_tx_conv;
3200 holder_tx_conv.inner = (void*)(holder_tx & (~1));
3201 holder_tx_conv.is_owned = false;
3202 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
3203 LDKCVec_PaymentPreimageZ preimages_constr;
3204 preimages_constr.datalen = preimages->arr_len;
3205 if (preimages_constr.datalen > 0)
3206 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
3208 preimages_constr.data = NULL;
3209 int8_tArray* preimages_vals = (void*) preimages->elems /* XXX preimages leaks */;
3210 for (size_t m = 0; m < preimages_constr.datalen; m++) {
3211 int8_tArray preimages_conv_12 = preimages_vals[m];
3212 LDKThirtyTwoBytes preimages_conv_12_ref;
3213 CHECK(preimages_conv_12->arr_len == 32);
3214 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
3215 preimages_constr.data[m] = preimages_conv_12_ref;
3217 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
3218 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
3219 return (uintptr_t)ret_conv;
3222 int8_tArray __attribute__((export_name("TS_BaseSign_channel_keys_id"))) TS_BaseSign_channel_keys_id(uint32_t this_arg) {
3223 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3224 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3225 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3226 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3227 memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
3231 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) {
3232 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3233 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3234 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3235 LDKCommitmentTransaction commitment_tx_conv;
3236 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
3237 commitment_tx_conv.is_owned = false;
3238 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
3239 LDKCVec_PaymentPreimageZ preimages_constr;
3240 preimages_constr.datalen = preimages->arr_len;
3241 if (preimages_constr.datalen > 0)
3242 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
3244 preimages_constr.data = NULL;
3245 int8_tArray* preimages_vals = (void*) preimages->elems /* XXX preimages leaks */;
3246 for (size_t m = 0; m < preimages_constr.datalen; m++) {
3247 int8_tArray preimages_conv_12 = preimages_vals[m];
3248 LDKThirtyTwoBytes preimages_conv_12_ref;
3249 CHECK(preimages_conv_12->arr_len == 32);
3250 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
3251 preimages_constr.data[m] = preimages_conv_12_ref;
3253 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
3254 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
3255 return (uintptr_t)ret_conv;
3258 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) {
3259 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3260 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3261 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3262 unsigned char secret_arr[32];
3263 CHECK(secret->arr_len == 32);
3264 memcpy(secret_arr, secret->elems, 32); FREE(secret);
3265 unsigned char (*secret_ref)[32] = &secret_arr;
3266 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
3267 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
3268 return (uintptr_t)ret_conv;
3271 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) {
3272 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3273 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3274 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3275 LDKHolderCommitmentTransaction commitment_tx_conv;
3276 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
3277 commitment_tx_conv.is_owned = false;
3278 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
3279 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
3280 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
3281 return (uintptr_t)ret_conv;
3284 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, intptr_t input, int64_t amount, int8_tArray per_commitment_key) {
3285 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3286 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3287 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3288 LDKTransaction justice_tx_ref;
3289 justice_tx_ref.datalen = justice_tx->arr_len;
3290 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3291 memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
3292 justice_tx_ref.data_is_owned = true;
3293 unsigned char per_commitment_key_arr[32];
3294 CHECK(per_commitment_key->arr_len == 32);
3295 memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
3296 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3297 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3298 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
3299 return (uintptr_t)ret_conv;
3302 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, intptr_t input, int64_t amount, int8_tArray per_commitment_key, uint32_t htlc) {
3303 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3304 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3305 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3306 LDKTransaction justice_tx_ref;
3307 justice_tx_ref.datalen = justice_tx->arr_len;
3308 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3309 memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
3310 justice_tx_ref.data_is_owned = true;
3311 unsigned char per_commitment_key_arr[32];
3312 CHECK(per_commitment_key->arr_len == 32);
3313 memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
3314 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3315 LDKHTLCOutputInCommitment htlc_conv;
3316 htlc_conv.inner = (void*)(htlc & (~1));
3317 htlc_conv.is_owned = false;
3318 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
3319 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3320 *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);
3321 return (uintptr_t)ret_conv;
3324 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, intptr_t input, int64_t amount, int8_tArray per_commitment_point, uint32_t htlc) {
3325 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3326 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3327 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3328 LDKTransaction htlc_tx_ref;
3329 htlc_tx_ref.datalen = htlc_tx->arr_len;
3330 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
3331 memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
3332 htlc_tx_ref.data_is_owned = true;
3333 LDKPublicKey per_commitment_point_ref;
3334 CHECK(per_commitment_point->arr_len == 33);
3335 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
3336 LDKHTLCOutputInCommitment htlc_conv;
3337 htlc_conv.inner = (void*)(htlc & (~1));
3338 htlc_conv.is_owned = false;
3339 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
3340 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3341 *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);
3342 return (uintptr_t)ret_conv;
3345 uint32_t __attribute__((export_name("TS_BaseSign_sign_closing_transaction"))) TS_BaseSign_sign_closing_transaction(uint32_t this_arg, uint32_t closing_tx) {
3346 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3347 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3348 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3349 LDKClosingTransaction closing_tx_conv;
3350 closing_tx_conv.inner = (void*)(closing_tx & (~1));
3351 closing_tx_conv.is_owned = false;
3352 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
3353 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3354 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
3355 return (uintptr_t)ret_conv;
3358 uint32_t __attribute__((export_name("TS_BaseSign_sign_channel_announcement"))) TS_BaseSign_sign_channel_announcement(uint32_t this_arg, uint32_t msg) {
3359 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3360 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3361 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3362 LDKUnsignedChannelAnnouncement msg_conv;
3363 msg_conv.inner = (void*)(msg & (~1));
3364 msg_conv.is_owned = false;
3365 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
3366 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
3367 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
3368 return (uintptr_t)ret_conv;
3371 void __attribute__((export_name("TS_BaseSign_ready_channel"))) TS_BaseSign_ready_channel(uint32_t this_arg, uint32_t channel_parameters) {
3372 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3373 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3374 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3375 LDKChannelTransactionParameters channel_parameters_conv;
3376 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
3377 channel_parameters_conv.is_owned = false;
3378 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
3379 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
3382 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
3383 if (this_arg->set_pubkeys != NULL)
3384 this_arg->set_pubkeys(this_arg);
3385 return this_arg->pubkeys;
3387 uint32_t __attribute__((export_name("TS_BaseSign_get_pubkeys"))) TS_BaseSign_get_pubkeys(uint32_t this_arg) {
3388 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3389 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3390 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3391 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
3392 uintptr_t ret_ref = 0;
3393 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3394 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3395 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3396 ret_ref = (uintptr_t)ret_var.inner;
3397 if (ret_var.is_owned) {
3403 typedef struct LDKSign_JCalls {
3404 atomic_size_t refcnt;
3405 uint32_t instance_ptr;
3406 LDKBaseSign_JCalls* BaseSign;
3408 static void LDKSign_JCalls_free(void* this_arg) {
3409 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
3410 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3414 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
3415 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
3416 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 13);
3417 LDKCVec_u8Z ret_ref;
3418 ret_ref.datalen = ret->arr_len;
3419 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3420 memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
3423 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
3424 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
3425 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3426 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
3428 static inline LDKSign LDKSign_init (JSValue o, JSValue BaseSign, uint32_t pubkeys) {
3429 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
3430 atomic_init(&calls->refcnt, 1);
3431 calls->instance_ptr = o;
3433 LDKChannelPublicKeys pubkeys_conv;
3434 pubkeys_conv.inner = (void*)(pubkeys & (~1));
3435 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
3436 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3439 .this_arg = (void*) calls,
3440 .write = write_LDKSign_jcall,
3441 .cloned = LDKSign_JCalls_cloned,
3442 .free = LDKSign_JCalls_free,
3443 .BaseSign = LDKBaseSign_init(BaseSign, pubkeys),
3445 calls->BaseSign = ret.BaseSign.this_arg;
3448 long __attribute__((export_name("TS_LDKSign_new"))) TS_LDKSign_new(JSValue o, JSValue BaseSign, uint32_t pubkeys) {
3449 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
3450 *res_ptr = LDKSign_init(o, BaseSign, pubkeys);
3451 return (long)res_ptr;
3453 int8_tArray __attribute__((export_name("TS_Sign_write"))) TS_Sign_write(uint32_t this_arg) {
3454 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3455 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3456 LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
3457 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
3458 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
3459 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
3460 CVec_u8Z_free(ret_var);
3464 static inline struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
3465 CHECK(owner->result_ok);
3466 return Sign_clone(&*owner->contents.result);
3468 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_get_ok"))) TS_CResult_SignDecodeErrorZ_get_ok(uint32_t owner) {
3469 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
3470 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
3471 *ret_ret = CResult_SignDecodeErrorZ_get_ok(owner_conv);
3472 return (uintptr_t)ret_ret;
3475 static inline struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
3476 CHECK(!owner->result_ok);
3477 return DecodeError_clone(&*owner->contents.err);
3479 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_get_err"))) TS_CResult_SignDecodeErrorZ_get_err(uint32_t owner) {
3480 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
3481 LDKDecodeError ret_var = CResult_SignDecodeErrorZ_get_err(owner_conv);
3482 uintptr_t ret_ref = 0;
3483 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3484 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3485 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3486 ret_ref = (uintptr_t)ret_var.inner;
3487 if (ret_var.is_owned) {
3493 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
3494 CHECK(owner->result_ok);
3495 return *owner->contents.result;
3497 int8_tArray __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_ok"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint32_t owner) {
3498 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
3499 int8_tArray ret_arr = init_int8_tArray(68, __LINE__);
3500 memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
3504 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
3505 CHECK(!owner->result_ok);
3506 return *owner->contents.err;
3508 void __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_err"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint32_t owner) {
3509 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
3510 CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
3513 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
3514 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
3515 for (size_t i = 0; i < ret.datalen; i++) {
3516 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
3520 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
3521 CHECK(owner->result_ok);
3522 return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
3524 ptrArray __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok(uint32_t owner) {
3525 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
3526 LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
3527 ptrArray ret_arr = NULL;
3528 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
3529 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
3530 for (size_t m = 0; m < ret_var.datalen; m++) {
3531 LDKCVec_u8Z ret_conv_12_var = ret_var.data[m];
3532 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
3533 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
3534 CVec_u8Z_free(ret_conv_12_var);
3535 ret_arr_ptr[m] = ret_conv_12_arr;
3542 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
3543 CHECK(!owner->result_ok);
3544 return *owner->contents.err;
3546 void __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_err(uint32_t owner) {
3547 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
3548 CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
3551 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
3552 CHECK(owner->result_ok);
3553 return InMemorySigner_clone(&*owner->contents.result);
3555 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_get_ok(uint32_t owner) {
3556 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
3557 LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
3558 uintptr_t ret_ref = 0;
3559 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3560 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3561 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3562 ret_ref = (uintptr_t)ret_var.inner;
3563 if (ret_var.is_owned) {
3569 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
3570 CHECK(!owner->result_ok);
3571 return DecodeError_clone(&*owner->contents.err);
3573 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_err"))) TS_CResult_InMemorySignerDecodeErrorZ_get_err(uint32_t owner) {
3574 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
3575 LDKDecodeError ret_var = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
3576 uintptr_t ret_ref = 0;
3577 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3578 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3579 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3580 ret_ref = (uintptr_t)ret_var.inner;
3581 if (ret_var.is_owned) {
3587 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
3588 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
3589 for (size_t i = 0; i < ret.datalen; i++) {
3590 ret.data[i] = TxOut_clone(&orig->data[i]);
3594 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
3595 CHECK(owner->result_ok);
3596 return *owner->contents.result;
3598 int8_tArray __attribute__((export_name("TS_CResult_TransactionNoneZ_get_ok"))) TS_CResult_TransactionNoneZ_get_ok(uint32_t owner) {
3599 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
3600 LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
3601 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
3602 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
3606 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
3607 CHECK(!owner->result_ok);
3608 return *owner->contents.err;
3610 void __attribute__((export_name("TS_CResult_TransactionNoneZ_get_err"))) TS_CResult_TransactionNoneZ_get_err(uint32_t owner) {
3611 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
3612 CResult_TransactionNoneZ_get_err(owner_conv);
3615 uint32_t __attribute__((export_name("TS_LDKCOption_u16Z_ty_from_ptr"))) TS_LDKCOption_u16Z_ty_from_ptr(uint32_t ptr) {
3616 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
3618 case LDKCOption_u16Z_Some: return 0;
3619 case LDKCOption_u16Z_None: return 1;
3623 int16_t __attribute__((export_name("TS_LDKCOption_u16Z_Some_get_some"))) TS_LDKCOption_u16Z_Some_get_some(uint32_t ptr) {
3624 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
3625 assert(obj->tag == LDKCOption_u16Z_Some);
3628 uint32_t __attribute__((export_name("TS_LDKAPIError_ty_from_ptr"))) TS_LDKAPIError_ty_from_ptr(uint32_t ptr) {
3629 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
3631 case LDKAPIError_APIMisuseError: return 0;
3632 case LDKAPIError_FeeRateTooHigh: return 1;
3633 case LDKAPIError_RouteError: return 2;
3634 case LDKAPIError_ChannelUnavailable: return 3;
3635 case LDKAPIError_MonitorUpdateFailed: return 4;
3636 case LDKAPIError_IncompatibleShutdownScript: return 5;
3640 jstring __attribute__((export_name("TS_LDKAPIError_APIMisuseError_get_err"))) TS_LDKAPIError_APIMisuseError_get_err(uint32_t ptr) {
3641 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
3642 assert(obj->tag == LDKAPIError_APIMisuseError);
3643 LDKStr err_str = obj->api_misuse_error.err;
3644 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
3647 jstring __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_err"))) TS_LDKAPIError_FeeRateTooHigh_get_err(uint32_t ptr) {
3648 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
3649 assert(obj->tag == LDKAPIError_FeeRateTooHigh);
3650 LDKStr err_str = obj->fee_rate_too_high.err;
3651 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
3654 int32_t __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_feerate"))) TS_LDKAPIError_FeeRateTooHigh_get_feerate(uint32_t ptr) {
3655 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
3656 assert(obj->tag == LDKAPIError_FeeRateTooHigh);
3657 return obj->fee_rate_too_high.feerate;
3659 jstring __attribute__((export_name("TS_LDKAPIError_RouteError_get_err"))) TS_LDKAPIError_RouteError_get_err(uint32_t ptr) {
3660 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
3661 assert(obj->tag == LDKAPIError_RouteError);
3662 LDKStr err_str = obj->route_error.err;
3663 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
3666 jstring __attribute__((export_name("TS_LDKAPIError_ChannelUnavailable_get_err"))) TS_LDKAPIError_ChannelUnavailable_get_err(uint32_t ptr) {
3667 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
3668 assert(obj->tag == LDKAPIError_ChannelUnavailable);
3669 LDKStr err_str = obj->channel_unavailable.err;
3670 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
3673 uint32_t __attribute__((export_name("TS_LDKAPIError_IncompatibleShutdownScript_get_script"))) TS_LDKAPIError_IncompatibleShutdownScript_get_script(uint32_t ptr) {
3674 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
3675 assert(obj->tag == LDKAPIError_IncompatibleShutdownScript);
3676 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
3677 uintptr_t script_ref = 0;
3678 CHECK((((uintptr_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3679 CHECK((((uintptr_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3680 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
3681 script_ref = (uintptr_t)script_var.inner & ~1;
3684 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
3685 CHECK(owner->result_ok);
3686 return *owner->contents.result;
3688 void __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_ok"))) TS_CResult_NoneAPIErrorZ_get_ok(uint32_t owner) {
3689 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
3690 CResult_NoneAPIErrorZ_get_ok(owner_conv);
3693 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
3694 CHECK(!owner->result_ok);
3695 return APIError_clone(&*owner->contents.err);
3697 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_err"))) TS_CResult_NoneAPIErrorZ_get_err(uint32_t owner) {
3698 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
3699 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
3700 *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
3701 uintptr_t ret_ref = (uintptr_t)ret_copy;
3705 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
3706 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
3707 for (size_t i = 0; i < ret.datalen; i++) {
3708 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
3712 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
3713 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
3714 for (size_t i = 0; i < ret.datalen; i++) {
3715 ret.data[i] = APIError_clone(&orig->data[i]);
3719 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
3720 CHECK(owner->result_ok);
3721 return ThirtyTwoBytes_clone(&*owner->contents.result);
3723 int8_tArray __attribute__((export_name("TS_CResult__u832APIErrorZ_get_ok"))) TS_CResult__u832APIErrorZ_get_ok(uint32_t owner) {
3724 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
3725 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3726 memcpy(ret_arr->elems, CResult__u832APIErrorZ_get_ok(owner_conv).data, 32);
3730 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
3731 CHECK(!owner->result_ok);
3732 return APIError_clone(&*owner->contents.err);
3734 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_get_err"))) TS_CResult__u832APIErrorZ_get_err(uint32_t owner) {
3735 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
3736 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
3737 *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
3738 uintptr_t ret_ref = (uintptr_t)ret_copy;
3742 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ty_from_ptr"))) TS_LDKPaymentSendFailure_ty_from_ptr(uint32_t ptr) {
3743 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
3745 case LDKPaymentSendFailure_ParameterError: return 0;
3746 case LDKPaymentSendFailure_PathParameterError: return 1;
3747 case LDKPaymentSendFailure_AllFailedRetrySafe: return 2;
3748 case LDKPaymentSendFailure_PartialFailure: return 3;
3752 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ParameterError_get_parameter_error"))) TS_LDKPaymentSendFailure_ParameterError_get_parameter_error(uint32_t ptr) {
3753 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
3754 assert(obj->tag == LDKPaymentSendFailure_ParameterError);
3755 uintptr_t parameter_error_ref = ((uintptr_t)&obj->parameter_error) | 1;
3756 return parameter_error_ref;
3758 uint32_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error"))) TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(uint32_t ptr) {
3759 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
3760 assert(obj->tag == LDKPaymentSendFailure_PathParameterError);
3761 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
3762 uint32_tArray path_parameter_error_arr = NULL;
3763 path_parameter_error_arr = init_uint32_tArray(path_parameter_error_var.datalen, __LINE__);
3764 uint32_t *path_parameter_error_arr_ptr = (uint32_t*)(((uint8_t*)path_parameter_error_arr) + 4);
3765 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
3766 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3767 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
3768 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
3769 path_parameter_error_arr_ptr[w] = (uintptr_t)path_parameter_error_conv_22_conv;
3772 return path_parameter_error_arr;
3774 uint32_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_AllFailedRetrySafe_get_all_failed_retry_safe"))) TS_LDKPaymentSendFailure_AllFailedRetrySafe_get_all_failed_retry_safe(uint32_t ptr) {
3775 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
3776 assert(obj->tag == LDKPaymentSendFailure_AllFailedRetrySafe);
3777 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
3778 uint32_tArray all_failed_retry_safe_arr = NULL;
3779 all_failed_retry_safe_arr = init_uint32_tArray(all_failed_retry_safe_var.datalen, __LINE__);
3780 uint32_t *all_failed_retry_safe_arr_ptr = (uint32_t*)(((uint8_t*)all_failed_retry_safe_arr) + 4);
3781 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
3782 uintptr_t all_failed_retry_safe_conv_10_ref = ((uintptr_t)&all_failed_retry_safe_var.data[k]) | 1;
3783 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
3786 return all_failed_retry_safe_arr;
3788 uint32_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_results"))) TS_LDKPaymentSendFailure_PartialFailure_get_results(uint32_t ptr) {
3789 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
3790 assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
3791 LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
3792 uint32_tArray results_arr = NULL;
3793 results_arr = init_uint32_tArray(results_var.datalen, __LINE__);
3794 uint32_t *results_arr_ptr = (uint32_t*)(((uint8_t*)results_arr) + 4);
3795 for (size_t w = 0; w < results_var.datalen; w++) {
3796 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3797 *results_conv_22_conv = results_var.data[w];
3798 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
3799 results_arr_ptr[w] = (uintptr_t)results_conv_22_conv;
3804 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry"))) TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(uint32_t ptr) {
3805 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
3806 assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
3807 LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
3808 uintptr_t failed_paths_retry_ref = 0;
3809 if ((uintptr_t)failed_paths_retry_var.inner > 4096) {
3810 CHECK((((uintptr_t)failed_paths_retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3811 CHECK((((uintptr_t)&failed_paths_retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3812 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
3813 failed_paths_retry_ref = (uintptr_t)failed_paths_retry_var.inner & ~1;
3815 return failed_paths_retry_ref;
3817 int8_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_payment_id"))) TS_LDKPaymentSendFailure_PartialFailure_get_payment_id(uint32_t ptr) {
3818 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
3819 assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
3820 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
3821 memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
3822 return payment_id_arr;
3824 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentSendFailureZ_get_ok(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
3825 CHECK(owner->result_ok);
3826 return ThirtyTwoBytes_clone(&*owner->contents.result);
3828 int8_tArray __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_get_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_get_ok(uint32_t owner) {
3829 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
3830 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3831 memcpy(ret_arr->elems, CResult_PaymentIdPaymentSendFailureZ_get_ok(owner_conv).data, 32);
3835 static inline struct LDKPaymentSendFailure CResult_PaymentIdPaymentSendFailureZ_get_err(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
3836 CHECK(!owner->result_ok);
3837 return PaymentSendFailure_clone(&*owner->contents.err);
3839 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_get_err"))) TS_CResult_PaymentIdPaymentSendFailureZ_get_err(uint32_t owner) {
3840 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
3841 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
3842 *ret_copy = CResult_PaymentIdPaymentSendFailureZ_get_err(owner_conv);
3843 uintptr_t ret_ref = (uintptr_t)ret_copy;
3847 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
3848 CHECK(owner->result_ok);
3849 return *owner->contents.result;
3851 void __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_ok"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint32_t owner) {
3852 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
3853 CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
3856 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
3857 CHECK(!owner->result_ok);
3858 return PaymentSendFailure_clone(&*owner->contents.err);
3860 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_err"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint32_t owner) {
3861 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
3862 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
3863 *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
3864 uintptr_t ret_ref = (uintptr_t)ret_copy;
3868 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
3869 return ThirtyTwoBytes_clone(&owner->a);
3871 int8_tArray __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_a"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_a(uint32_t owner) {
3872 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
3873 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3874 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data, 32);
3878 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
3879 return ThirtyTwoBytes_clone(&owner->b);
3881 int8_tArray __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_b"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_b(uint32_t owner) {
3882 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
3883 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3884 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data, 32);
3888 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
3889 CHECK(owner->result_ok);
3890 return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
3892 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(uint32_t owner) {
3893 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
3894 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
3895 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
3896 return ((uintptr_t)ret_conv);
3899 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
3900 CHECK(!owner->result_ok);
3901 return PaymentSendFailure_clone(&*owner->contents.err);
3903 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(uint32_t owner) {
3904 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
3905 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
3906 *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
3907 uintptr_t ret_ref = (uintptr_t)ret_copy;
3911 uint32_t __attribute__((export_name("TS_LDKNetAddress_ty_from_ptr"))) TS_LDKNetAddress_ty_from_ptr(uint32_t ptr) {
3912 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3914 case LDKNetAddress_IPv4: return 0;
3915 case LDKNetAddress_IPv6: return 1;
3916 case LDKNetAddress_OnionV2: return 2;
3917 case LDKNetAddress_OnionV3: return 3;
3921 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv4_get_addr"))) TS_LDKNetAddress_IPv4_get_addr(uint32_t ptr) {
3922 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3923 assert(obj->tag == LDKNetAddress_IPv4);
3924 int8_tArray addr_arr = init_int8_tArray(4, __LINE__);
3925 memcpy(addr_arr->elems, obj->i_pv4.addr.data, 4);
3928 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv4_get_port"))) TS_LDKNetAddress_IPv4_get_port(uint32_t ptr) {
3929 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3930 assert(obj->tag == LDKNetAddress_IPv4);
3931 return obj->i_pv4.port;
3933 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv6_get_addr"))) TS_LDKNetAddress_IPv6_get_addr(uint32_t ptr) {
3934 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3935 assert(obj->tag == LDKNetAddress_IPv6);
3936 int8_tArray addr_arr = init_int8_tArray(16, __LINE__);
3937 memcpy(addr_arr->elems, obj->i_pv6.addr.data, 16);
3940 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv6_get_port"))) TS_LDKNetAddress_IPv6_get_port(uint32_t ptr) {
3941 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3942 assert(obj->tag == LDKNetAddress_IPv6);
3943 return obj->i_pv6.port;
3945 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV2_get_onion_v2"))) TS_LDKNetAddress_OnionV2_get_onion_v2(uint32_t ptr) {
3946 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3947 assert(obj->tag == LDKNetAddress_OnionV2);
3948 int8_tArray onion_v2_arr = init_int8_tArray(12, __LINE__);
3949 memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
3950 return onion_v2_arr;
3952 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_ed25519_pubkey"))) TS_LDKNetAddress_OnionV3_get_ed25519_pubkey(uint32_t ptr) {
3953 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3954 assert(obj->tag == LDKNetAddress_OnionV3);
3955 int8_tArray ed25519_pubkey_arr = init_int8_tArray(32, __LINE__);
3956 memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
3957 return ed25519_pubkey_arr;
3959 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_checksum"))) TS_LDKNetAddress_OnionV3_get_checksum(uint32_t ptr) {
3960 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3961 assert(obj->tag == LDKNetAddress_OnionV3);
3962 return obj->onion_v3.checksum;
3964 int8_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_version"))) TS_LDKNetAddress_OnionV3_get_version(uint32_t ptr) {
3965 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3966 assert(obj->tag == LDKNetAddress_OnionV3);
3967 return obj->onion_v3.version;
3969 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_port"))) TS_LDKNetAddress_OnionV3_get_port(uint32_t ptr) {
3970 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3971 assert(obj->tag == LDKNetAddress_OnionV3);
3972 return obj->onion_v3.port;
3974 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3975 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3976 for (size_t i = 0; i < ret.datalen; i++) {
3977 ret.data[i] = NetAddress_clone(&orig->data[i]);
3981 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
3982 return ThirtyTwoBytes_clone(&owner->a);
3984 int8_tArray __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_a"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_a(uint32_t owner) {
3985 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
3986 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3987 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data, 32);
3991 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
3992 return ThirtyTwoBytes_clone(&owner->b);
3994 int8_tArray __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_b"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_b(uint32_t owner) {
3995 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
3996 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3997 memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data, 32);
4001 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
4002 CHECK(owner->result_ok);
4003 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
4005 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(uint32_t owner) {
4006 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
4007 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
4008 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
4009 return ((uintptr_t)ret_conv);
4012 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
4013 CHECK(!owner->result_ok);
4014 return *owner->contents.err;
4016 void __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(uint32_t owner) {
4017 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
4018 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
4021 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
4022 CHECK(owner->result_ok);
4023 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
4025 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(uint32_t owner) {
4026 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
4027 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
4028 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
4029 return ((uintptr_t)ret_conv);
4032 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
4033 CHECK(!owner->result_ok);
4034 return APIError_clone(&*owner->contents.err);
4036 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(uint32_t owner) {
4037 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
4038 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4039 *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
4040 uintptr_t ret_ref = (uintptr_t)ret_copy;
4044 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
4045 CHECK(owner->result_ok);
4046 return ThirtyTwoBytes_clone(&*owner->contents.result);
4048 int8_tArray __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_ok"))) TS_CResult_PaymentSecretNoneZ_get_ok(uint32_t owner) {
4049 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
4050 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4051 memcpy(ret_arr->elems, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data, 32);
4055 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
4056 CHECK(!owner->result_ok);
4057 return *owner->contents.err;
4059 void __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_err"))) TS_CResult_PaymentSecretNoneZ_get_err(uint32_t owner) {
4060 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
4061 CResult_PaymentSecretNoneZ_get_err(owner_conv);
4064 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
4065 CHECK(owner->result_ok);
4066 return ThirtyTwoBytes_clone(&*owner->contents.result);
4068 int8_tArray __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_ok"))) TS_CResult_PaymentSecretAPIErrorZ_get_ok(uint32_t owner) {
4069 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
4070 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4071 memcpy(ret_arr->elems, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data, 32);
4075 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
4076 CHECK(!owner->result_ok);
4077 return APIError_clone(&*owner->contents.err);
4079 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_err"))) TS_CResult_PaymentSecretAPIErrorZ_get_err(uint32_t owner) {
4080 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
4081 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4082 *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
4083 uintptr_t ret_ref = (uintptr_t)ret_copy;
4087 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
4088 CHECK(owner->result_ok);
4089 return ThirtyTwoBytes_clone(&*owner->contents.result);
4091 int8_tArray __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_get_ok(uint32_t owner) {
4092 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
4093 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4094 memcpy(ret_arr->elems, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data, 32);
4098 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
4099 CHECK(!owner->result_ok);
4100 return APIError_clone(&*owner->contents.err);
4102 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_err"))) TS_CResult_PaymentPreimageAPIErrorZ_get_err(uint32_t owner) {
4103 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
4104 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4105 *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
4106 uintptr_t ret_ref = (uintptr_t)ret_copy;
4110 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
4111 CHECK(owner->result_ok);
4112 return CounterpartyForwardingInfo_clone(&*owner->contents.result);
4114 uint32_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(uint32_t owner) {
4115 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(owner & ~1);
4116 LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
4117 uintptr_t ret_ref = 0;
4118 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4119 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4120 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4121 ret_ref = (uintptr_t)ret_var.inner;
4122 if (ret_var.is_owned) {
4128 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
4129 CHECK(!owner->result_ok);
4130 return DecodeError_clone(&*owner->contents.err);
4132 uint32_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(uint32_t owner) {
4133 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(owner & ~1);
4134 LDKDecodeError ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
4135 uintptr_t ret_ref = 0;
4136 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4137 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4138 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4139 ret_ref = (uintptr_t)ret_var.inner;
4140 if (ret_var.is_owned) {
4146 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
4147 CHECK(owner->result_ok);
4148 return ChannelCounterparty_clone(&*owner->contents.result);
4150 uint32_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok(uint32_t owner) {
4151 LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(owner & ~1);
4152 LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
4153 uintptr_t ret_ref = 0;
4154 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4155 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4156 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4157 ret_ref = (uintptr_t)ret_var.inner;
4158 if (ret_var.is_owned) {
4164 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
4165 CHECK(!owner->result_ok);
4166 return DecodeError_clone(&*owner->contents.err);
4168 uint32_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err(uint32_t owner) {
4169 LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(owner & ~1);
4170 LDKDecodeError ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
4171 uintptr_t ret_ref = 0;
4172 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4173 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4174 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4175 ret_ref = (uintptr_t)ret_var.inner;
4176 if (ret_var.is_owned) {
4182 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
4183 CHECK(owner->result_ok);
4184 return ChannelDetails_clone(&*owner->contents.result);
4186 uint32_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_ok(uint32_t owner) {
4187 LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(owner & ~1);
4188 LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
4189 uintptr_t ret_ref = 0;
4190 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4191 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4192 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4193 ret_ref = (uintptr_t)ret_var.inner;
4194 if (ret_var.is_owned) {
4200 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
4201 CHECK(!owner->result_ok);
4202 return DecodeError_clone(&*owner->contents.err);
4204 uint32_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_err(uint32_t owner) {
4205 LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(owner & ~1);
4206 LDKDecodeError ret_var = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
4207 uintptr_t ret_ref = 0;
4208 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4209 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4210 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4211 ret_ref = (uintptr_t)ret_var.inner;
4212 if (ret_var.is_owned) {
4218 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
4219 CHECK(owner->result_ok);
4220 return PhantomRouteHints_clone(&*owner->contents.result);
4222 uint32_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok(uint32_t owner) {
4223 LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(owner & ~1);
4224 LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
4225 uintptr_t ret_ref = 0;
4226 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4227 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4228 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4229 ret_ref = (uintptr_t)ret_var.inner;
4230 if (ret_var.is_owned) {
4236 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
4237 CHECK(!owner->result_ok);
4238 return DecodeError_clone(&*owner->contents.err);
4240 uint32_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err(uint32_t owner) {
4241 LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(owner & ~1);
4242 LDKDecodeError ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
4243 uintptr_t ret_ref = 0;
4244 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4245 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4246 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4247 ret_ref = (uintptr_t)ret_var.inner;
4248 if (ret_var.is_owned) {
4254 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
4255 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
4256 for (size_t i = 0; i < ret.datalen; i++) {
4257 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
4261 typedef struct LDKWatch_JCalls {
4262 atomic_size_t refcnt;
4263 uint32_t instance_ptr;
4265 static void LDKWatch_JCalls_free(void* this_arg) {
4266 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4267 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4271 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
4272 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4273 LDKOutPoint funding_txo_var = funding_txo;
4274 uintptr_t funding_txo_ref = 0;
4275 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4276 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4277 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
4278 funding_txo_ref = (uintptr_t)funding_txo_var.inner;
4279 if (funding_txo_var.is_owned) {
4280 funding_txo_ref |= 1;
4282 LDKChannelMonitor monitor_var = monitor;
4283 uintptr_t monitor_ref = 0;
4284 CHECK((((uintptr_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4285 CHECK((((uintptr_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4286 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
4287 monitor_ref = (uintptr_t)monitor_var.inner;
4288 if (monitor_var.is_owned) {
4291 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 14, (uint32_t)funding_txo_ref, (uint32_t)monitor_ref);
4292 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4293 CHECK_ACCESS(ret_ptr);
4294 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
4298 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
4299 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4300 LDKOutPoint funding_txo_var = funding_txo;
4301 uintptr_t funding_txo_ref = 0;
4302 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4303 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4304 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
4305 funding_txo_ref = (uintptr_t)funding_txo_var.inner;
4306 if (funding_txo_var.is_owned) {
4307 funding_txo_ref |= 1;
4309 LDKChannelMonitorUpdate update_var = update;
4310 uintptr_t update_ref = 0;
4311 CHECK((((uintptr_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4312 CHECK((((uintptr_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4313 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
4314 update_ref = (uintptr_t)update_var.inner;
4315 if (update_var.is_owned) {
4318 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 15, (uint32_t)funding_txo_ref, (uint32_t)update_ref);
4319 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4320 CHECK_ACCESS(ret_ptr);
4321 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
4325 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
4326 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4327 uint32_tArray ret = (uint32_tArray)js_invoke_function_0(j_calls->instance_ptr, 16);
4328 LDKCVec_MonitorEventZ ret_constr;
4329 ret_constr.datalen = ret->arr_len;
4330 if (ret_constr.datalen > 0)
4331 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
4333 ret_constr.data = NULL;
4334 uint32_t* ret_vals = ret->elems /* XXX ret leaks */;
4335 for (size_t o = 0; o < ret_constr.datalen; o++) {
4336 uint32_t ret_conv_14 = ret_vals[o];
4337 void* ret_conv_14_ptr = (void*)(((uintptr_t)ret_conv_14) & ~1);
4338 CHECK_ACCESS(ret_conv_14_ptr);
4339 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(ret_conv_14_ptr);
4340 FREE((void*)ret_conv_14);
4341 ret_constr.data[o] = ret_conv_14_conv;
4345 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
4346 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
4347 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4349 static inline LDKWatch LDKWatch_init (JSValue o) {
4350 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
4351 atomic_init(&calls->refcnt, 1);
4352 calls->instance_ptr = o;
4355 .this_arg = (void*) calls,
4356 .watch_channel = watch_channel_LDKWatch_jcall,
4357 .update_channel = update_channel_LDKWatch_jcall,
4358 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
4359 .free = LDKWatch_JCalls_free,
4363 long __attribute__((export_name("TS_LDKWatch_new"))) TS_LDKWatch_new(JSValue o) {
4364 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
4365 *res_ptr = LDKWatch_init(o);
4366 return (long)res_ptr;
4368 uint32_t __attribute__((export_name("TS_Watch_watch_channel"))) TS_Watch_watch_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t monitor) {
4369 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4370 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4371 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
4372 LDKOutPoint funding_txo_conv;
4373 funding_txo_conv.inner = (void*)(funding_txo & (~1));
4374 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
4375 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
4376 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
4377 LDKChannelMonitor monitor_conv;
4378 monitor_conv.inner = (void*)(monitor & (~1));
4379 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
4380 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
4381 monitor_conv = ChannelMonitor_clone(&monitor_conv);
4382 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4383 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
4384 return (uintptr_t)ret_conv;
4387 uint32_t __attribute__((export_name("TS_Watch_update_channel"))) TS_Watch_update_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t update) {
4388 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4389 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4390 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
4391 LDKOutPoint funding_txo_conv;
4392 funding_txo_conv.inner = (void*)(funding_txo & (~1));
4393 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
4394 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
4395 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
4396 LDKChannelMonitorUpdate update_conv;
4397 update_conv.inner = (void*)(update & (~1));
4398 update_conv.is_owned = (update & 1) || (update == 0);
4399 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
4400 update_conv = ChannelMonitorUpdate_clone(&update_conv);
4401 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4402 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
4403 return (uintptr_t)ret_conv;
4406 uint32_tArray __attribute__((export_name("TS_Watch_release_pending_monitor_events"))) TS_Watch_release_pending_monitor_events(uint32_t this_arg) {
4407 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4408 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4409 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
4410 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
4411 uint32_tArray ret_arr = NULL;
4412 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
4413 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
4414 for (size_t o = 0; o < ret_var.datalen; o++) {
4415 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
4416 *ret_conv_14_copy = ret_var.data[o];
4417 uintptr_t ret_conv_14_ref = (uintptr_t)ret_conv_14_copy;
4418 ret_arr_ptr[o] = ret_conv_14_ref;
4425 typedef struct LDKBroadcasterInterface_JCalls {
4426 atomic_size_t refcnt;
4427 uint32_t instance_ptr;
4428 } LDKBroadcasterInterface_JCalls;
4429 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
4430 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
4431 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4435 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
4436 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
4437 LDKTransaction tx_var = tx;
4438 int8_tArray tx_arr = init_int8_tArray(tx_var.datalen, __LINE__);
4439 memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
4440 Transaction_free(tx_var);
4441 js_invoke_function_1(j_calls->instance_ptr, 17, (uint32_t)tx_arr);
4443 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
4444 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
4445 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4447 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JSValue o) {
4448 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
4449 atomic_init(&calls->refcnt, 1);
4450 calls->instance_ptr = o;
4452 LDKBroadcasterInterface ret = {
4453 .this_arg = (void*) calls,
4454 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
4455 .free = LDKBroadcasterInterface_JCalls_free,
4459 long __attribute__((export_name("TS_LDKBroadcasterInterface_new"))) TS_LDKBroadcasterInterface_new(JSValue o) {
4460 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
4461 *res_ptr = LDKBroadcasterInterface_init(o);
4462 return (long)res_ptr;
4464 void __attribute__((export_name("TS_BroadcasterInterface_broadcast_transaction"))) TS_BroadcasterInterface_broadcast_transaction(uint32_t this_arg, int8_tArray tx) {
4465 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4466 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4467 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
4468 LDKTransaction tx_ref;
4469 tx_ref.datalen = tx->arr_len;
4470 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
4471 memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
4472 tx_ref.data_is_owned = true;
4473 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
4476 typedef struct LDKKeysInterface_JCalls {
4477 atomic_size_t refcnt;
4478 uint32_t instance_ptr;
4479 } LDKKeysInterface_JCalls;
4480 static void LDKKeysInterface_JCalls_free(void* this_arg) {
4481 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4482 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4486 LDKCResult_SecretKeyNoneZ get_node_secret_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) {
4487 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4488 uint32_t recipient_conv = LDKRecipient_to_js(recipient);
4489 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 18, (uint32_t)recipient_conv);
4490 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4491 CHECK_ACCESS(ret_ptr);
4492 LDKCResult_SecretKeyNoneZ ret_conv = *(LDKCResult_SecretKeyNoneZ*)(ret_ptr);
4496 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
4497 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4498 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 19);
4499 LDKCVec_u8Z ret_ref;
4500 ret_ref.datalen = ret->arr_len;
4501 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4502 memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
4505 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
4506 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4507 uint32_t ret = js_invoke_function_0(j_calls->instance_ptr, 20);
4508 LDKShutdownScript ret_conv;
4509 ret_conv.inner = (void*)(ret & (~1));
4510 ret_conv.is_owned = (ret & 1) || (ret == 0);
4511 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
4514 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
4515 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4516 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 21, (uint32_t)inbound, (uint32_t)channel_value_satoshis);
4517 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4518 CHECK_ACCESS(ret_ptr);
4519 LDKSign ret_conv = *(LDKSign*)(ret_ptr);
4523 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
4524 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4525 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 22);
4526 LDKThirtyTwoBytes ret_ref;
4527 CHECK(ret->arr_len == 32);
4528 memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
4531 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
4532 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4533 LDKu8slice reader_var = reader;
4534 int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__);
4535 memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
4536 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 23, (uint32_t)reader_arr);
4537 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4538 CHECK_ACCESS(ret_ptr);
4539 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
4543 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_u5Z invoice_data, LDKRecipient receipient) {
4544 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4545 LDKu8slice hrp_bytes_var = hrp_bytes;
4546 int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__);
4547 memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen);
4548 LDKCVec_u5Z invoice_data_var = invoice_data;
4549 ptrArray invoice_data_arr = NULL;
4550 invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__);
4551 int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 4);
4552 for (size_t h = 0; h < invoice_data_var.datalen; h++) {
4553 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
4554 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
4557 FREE(invoice_data_var.data);
4558 uint32_t receipient_conv = LDKRecipient_to_js(receipient);
4559 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);
4560 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4561 CHECK_ACCESS(ret_ptr);
4562 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
4566 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) {
4567 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4568 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 25);
4569 LDKThirtyTwoBytes ret_ref;
4570 CHECK(ret->arr_len == 32);
4571 memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
4574 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
4575 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
4576 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4578 static inline LDKKeysInterface LDKKeysInterface_init (JSValue o) {
4579 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
4580 atomic_init(&calls->refcnt, 1);
4581 calls->instance_ptr = o;
4583 LDKKeysInterface ret = {
4584 .this_arg = (void*) calls,
4585 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
4586 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
4587 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
4588 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
4589 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
4590 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
4591 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
4592 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall,
4593 .free = LDKKeysInterface_JCalls_free,
4597 long __attribute__((export_name("TS_LDKKeysInterface_new"))) TS_LDKKeysInterface_new(JSValue o) {
4598 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
4599 *res_ptr = LDKKeysInterface_init(o);
4600 return (long)res_ptr;
4602 uint32_t __attribute__((export_name("TS_KeysInterface_get_node_secret"))) TS_KeysInterface_get_node_secret(uint32_t this_arg, uint32_t recipient) {
4603 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4604 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4605 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4606 LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
4607 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
4608 *ret_conv = (this_arg_conv->get_node_secret)(this_arg_conv->this_arg, recipient_conv);
4609 return (uintptr_t)ret_conv;
4612 int8_tArray __attribute__((export_name("TS_KeysInterface_get_destination_script"))) TS_KeysInterface_get_destination_script(uint32_t this_arg) {
4613 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4614 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4615 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4616 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
4617 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
4618 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
4619 CVec_u8Z_free(ret_var);
4623 uint32_t __attribute__((export_name("TS_KeysInterface_get_shutdown_scriptpubkey"))) TS_KeysInterface_get_shutdown_scriptpubkey(uint32_t this_arg) {
4624 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4625 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4626 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4627 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
4628 uintptr_t ret_ref = 0;
4629 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4630 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4631 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4632 ret_ref = (uintptr_t)ret_var.inner;
4633 if (ret_var.is_owned) {
4639 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) {
4640 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4641 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4642 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4643 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
4644 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
4645 return (uintptr_t)ret_ret;
4648 int8_tArray __attribute__((export_name("TS_KeysInterface_get_secure_random_bytes"))) TS_KeysInterface_get_secure_random_bytes(uint32_t this_arg) {
4649 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4650 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4651 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4652 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4653 memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
4657 uint32_t __attribute__((export_name("TS_KeysInterface_read_chan_signer"))) TS_KeysInterface_read_chan_signer(uint32_t this_arg, int8_tArray reader) {
4658 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4659 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4660 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4661 LDKu8slice reader_ref;
4662 reader_ref.datalen = reader->arr_len;
4663 reader_ref.data = reader->elems /* XXX reader leaks */;
4664 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
4665 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
4666 return (uintptr_t)ret_conv;
4669 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) {
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 LDKu8slice hrp_bytes_ref;
4674 hrp_bytes_ref.datalen = hrp_bytes->arr_len;
4675 hrp_bytes_ref.data = hrp_bytes->elems /* XXX hrp_bytes leaks */;
4676 LDKCVec_u5Z invoice_data_constr;
4677 invoice_data_constr.datalen = invoice_data->arr_len;
4678 if (invoice_data_constr.datalen > 0)
4679 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
4681 invoice_data_constr.data = NULL;
4682 int8_t* invoice_data_vals = (void*) invoice_data->elems /* XXX invoice_data leaks */;
4683 for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
4684 int8_t invoice_data_conv_7 = invoice_data_vals[h];
4686 invoice_data_constr.data[h] = (LDKu5){ ._0 = invoice_data_conv_7 };
4688 LDKRecipient receipient_conv = LDKRecipient_from_js(receipient);
4689 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
4690 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, receipient_conv);
4691 return (uintptr_t)ret_conv;
4694 int8_tArray __attribute__((export_name("TS_KeysInterface_get_inbound_payment_key_material"))) TS_KeysInterface_get_inbound_payment_key_material(uint32_t this_arg) {
4695 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4696 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4697 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
4698 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4699 memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
4703 typedef struct LDKFeeEstimator_JCalls {
4704 atomic_size_t refcnt;
4705 uint32_t instance_ptr;
4706 } LDKFeeEstimator_JCalls;
4707 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
4708 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
4709 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4713 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
4714 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
4715 uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
4716 return js_invoke_function_1(j_calls->instance_ptr, 26, (uint32_t)confirmation_target_conv);
4718 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
4719 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
4720 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4722 static inline LDKFeeEstimator LDKFeeEstimator_init (JSValue o) {
4723 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
4724 atomic_init(&calls->refcnt, 1);
4725 calls->instance_ptr = o;
4727 LDKFeeEstimator ret = {
4728 .this_arg = (void*) calls,
4729 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
4730 .free = LDKFeeEstimator_JCalls_free,
4734 long __attribute__((export_name("TS_LDKFeeEstimator_new"))) TS_LDKFeeEstimator_new(JSValue o) {
4735 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
4736 *res_ptr = LDKFeeEstimator_init(o);
4737 return (long)res_ptr;
4739 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) {
4740 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4741 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4742 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
4743 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
4744 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
4748 typedef struct LDKLogger_JCalls {
4749 atomic_size_t refcnt;
4750 uint32_t instance_ptr;
4752 static void LDKLogger_JCalls_free(void* this_arg) {
4753 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4754 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4758 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
4759 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4760 LDKRecord record_var = *record;
4761 uintptr_t record_ref = 0;
4762 record_var = Record_clone(record);
4763 CHECK((((uintptr_t)record_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4764 CHECK((((uintptr_t)&record_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4765 CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
4766 record_ref = (uintptr_t)record_var.inner;
4767 if (record_var.is_owned) {
4770 js_invoke_function_1(j_calls->instance_ptr, 27, (uint32_t)record_ref);
4772 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
4773 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
4774 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4776 static inline LDKLogger LDKLogger_init (JSValue o) {
4777 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
4778 atomic_init(&calls->refcnt, 1);
4779 calls->instance_ptr = o;
4782 .this_arg = (void*) calls,
4783 .log = log_LDKLogger_jcall,
4784 .free = LDKLogger_JCalls_free,
4788 long __attribute__((export_name("TS_LDKLogger_new"))) TS_LDKLogger_new(JSValue o) {
4789 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
4790 *res_ptr = LDKLogger_init(o);
4791 return (long)res_ptr;
4793 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
4794 return ThirtyTwoBytes_clone(&owner->a);
4796 int8_tArray __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_a"))) TS_C2Tuple_BlockHashChannelManagerZ_get_a(uint32_t owner) {
4797 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
4798 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4799 memcpy(ret_arr->elems, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data, 32);
4803 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
4806 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_b"))) TS_C2Tuple_BlockHashChannelManagerZ_get_b(uint32_t owner) {
4807 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
4808 LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
4809 uintptr_t ret_ref = 0;
4810 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4811 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4812 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4813 ret_ref = (uintptr_t)ret_var.inner & ~1;
4817 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
4818 CHECK(owner->result_ok);
4819 return &*owner->contents.result;
4821 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint32_t owner) {
4822 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
4823 uintptr_t ret_ret = (uintptr_t)CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv) | 1;
4827 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
4828 CHECK(!owner->result_ok);
4829 return DecodeError_clone(&*owner->contents.err);
4831 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint32_t owner) {
4832 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
4833 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
4834 uintptr_t ret_ref = 0;
4835 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4836 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4837 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4838 ret_ref = (uintptr_t)ret_var.inner;
4839 if (ret_var.is_owned) {
4845 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
4846 CHECK(owner->result_ok);
4847 return ChannelConfig_clone(&*owner->contents.result);
4849 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_get_ok(uint32_t owner) {
4850 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
4851 LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
4852 uintptr_t ret_ref = 0;
4853 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4854 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4855 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4856 ret_ref = (uintptr_t)ret_var.inner;
4857 if (ret_var.is_owned) {
4863 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
4864 CHECK(!owner->result_ok);
4865 return DecodeError_clone(&*owner->contents.err);
4867 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_err"))) TS_CResult_ChannelConfigDecodeErrorZ_get_err(uint32_t owner) {
4868 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
4869 LDKDecodeError ret_var = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
4870 uintptr_t ret_ref = 0;
4871 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4872 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4873 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4874 ret_ref = (uintptr_t)ret_var.inner;
4875 if (ret_var.is_owned) {
4881 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
4882 CHECK(owner->result_ok);
4883 return OutPoint_clone(&*owner->contents.result);
4885 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_ok"))) TS_CResult_OutPointDecodeErrorZ_get_ok(uint32_t owner) {
4886 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
4887 LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
4888 uintptr_t ret_ref = 0;
4889 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4890 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4891 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4892 ret_ref = (uintptr_t)ret_var.inner;
4893 if (ret_var.is_owned) {
4899 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
4900 CHECK(!owner->result_ok);
4901 return DecodeError_clone(&*owner->contents.err);
4903 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_err"))) TS_CResult_OutPointDecodeErrorZ_get_err(uint32_t owner) {
4904 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
4905 LDKDecodeError ret_var = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
4906 uintptr_t ret_ref = 0;
4907 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4908 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4909 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4910 ret_ref = (uintptr_t)ret_var.inner;
4911 if (ret_var.is_owned) {
4917 typedef struct LDKType_JCalls {
4918 atomic_size_t refcnt;
4919 uint32_t instance_ptr;
4921 static void LDKType_JCalls_free(void* this_arg) {
4922 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
4923 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4927 uint16_t type_id_LDKType_jcall(const void* this_arg) {
4928 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
4929 return js_invoke_function_0(j_calls->instance_ptr, 28);
4931 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
4932 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
4933 jstring ret = (jstring)js_invoke_function_0(j_calls->instance_ptr, 29);
4934 LDKStr ret_conv = str_ref_to_owned_c(ret);
4937 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
4938 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
4939 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 30);
4940 LDKCVec_u8Z ret_ref;
4941 ret_ref.datalen = ret->arr_len;
4942 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4943 memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
4946 static void LDKType_JCalls_cloned(LDKType* new_obj) {
4947 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
4948 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4950 static inline LDKType LDKType_init (JSValue o) {
4951 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
4952 atomic_init(&calls->refcnt, 1);
4953 calls->instance_ptr = o;
4956 .this_arg = (void*) calls,
4957 .type_id = type_id_LDKType_jcall,
4958 .debug_str = debug_str_LDKType_jcall,
4959 .write = write_LDKType_jcall,
4960 .cloned = LDKType_JCalls_cloned,
4961 .free = LDKType_JCalls_free,
4965 long __attribute__((export_name("TS_LDKType_new"))) TS_LDKType_new(JSValue o) {
4966 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
4967 *res_ptr = LDKType_init(o);
4968 return (long)res_ptr;
4970 int16_t __attribute__((export_name("TS_Type_type_id"))) TS_Type_type_id(uint32_t this_arg) {
4971 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4972 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4973 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
4974 int16_t ret_val = (this_arg_conv->type_id)(this_arg_conv->this_arg);
4978 jstring __attribute__((export_name("TS_Type_debug_str"))) TS_Type_debug_str(uint32_t this_arg) {
4979 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4980 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4981 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
4982 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
4983 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
4988 int8_tArray __attribute__((export_name("TS_Type_write"))) TS_Type_write(uint32_t this_arg) {
4989 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4990 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4991 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
4992 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4993 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
4994 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
4995 CVec_u8Z_free(ret_var);
4999 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_ty_from_ptr"))) TS_LDKCOption_TypeZ_ty_from_ptr(uint32_t ptr) {
5000 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
5002 case LDKCOption_TypeZ_Some: return 0;
5003 case LDKCOption_TypeZ_None: return 1;
5007 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_Some_get_some"))) TS_LDKCOption_TypeZ_Some_get_some(uint32_t ptr) {
5008 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
5009 assert(obj->tag == LDKCOption_TypeZ_Some);
5010 LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
5011 *some_ret = Type_clone(&obj->some);
5012 return (uintptr_t)some_ret;
5014 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
5015 CHECK(owner->result_ok);
5016 return COption_TypeZ_clone(&*owner->contents.result);
5018 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_get_ok(uint32_t owner) {
5019 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
5020 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
5021 *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
5022 uintptr_t ret_ref = (uintptr_t)ret_copy;
5026 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
5027 CHECK(!owner->result_ok);
5028 return DecodeError_clone(&*owner->contents.err);
5030 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_err"))) TS_CResult_COption_TypeZDecodeErrorZ_get_err(uint32_t owner) {
5031 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
5032 LDKDecodeError ret_var = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
5033 uintptr_t ret_ref = 0;
5034 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5035 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5036 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5037 ret_ref = (uintptr_t)ret_var.inner;
5038 if (ret_var.is_owned) {
5044 uint32_t __attribute__((export_name("TS_LDKPaymentError_ty_from_ptr"))) TS_LDKPaymentError_ty_from_ptr(uint32_t ptr) {
5045 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
5047 case LDKPaymentError_Invoice: return 0;
5048 case LDKPaymentError_Routing: return 1;
5049 case LDKPaymentError_Sending: return 2;
5053 jstring __attribute__((export_name("TS_LDKPaymentError_Invoice_get_invoice"))) TS_LDKPaymentError_Invoice_get_invoice(uint32_t ptr) {
5054 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
5055 assert(obj->tag == LDKPaymentError_Invoice);
5056 LDKStr invoice_str = obj->invoice;
5057 jstring invoice_conv = str_ref_to_ts(invoice_str.chars, invoice_str.len);
5058 return invoice_conv;
5060 uint32_t __attribute__((export_name("TS_LDKPaymentError_Routing_get_routing"))) TS_LDKPaymentError_Routing_get_routing(uint32_t ptr) {
5061 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
5062 assert(obj->tag == LDKPaymentError_Routing);
5063 LDKLightningError routing_var = obj->routing;
5064 uintptr_t routing_ref = 0;
5065 CHECK((((uintptr_t)routing_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5066 CHECK((((uintptr_t)&routing_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5067 CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var);
5068 routing_ref = (uintptr_t)routing_var.inner & ~1;
5071 uint32_t __attribute__((export_name("TS_LDKPaymentError_Sending_get_sending"))) TS_LDKPaymentError_Sending_get_sending(uint32_t ptr) {
5072 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
5073 assert(obj->tag == LDKPaymentError_Sending);
5074 uintptr_t sending_ref = ((uintptr_t)&obj->sending) | 1;
5077 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
5078 CHECK(owner->result_ok);
5079 return ThirtyTwoBytes_clone(&*owner->contents.result);
5081 int8_tArray __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_ok"))) TS_CResult_PaymentIdPaymentErrorZ_get_ok(uint32_t owner) {
5082 LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(owner & ~1);
5083 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5084 memcpy(ret_arr->elems, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data, 32);
5088 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
5089 CHECK(!owner->result_ok);
5090 return PaymentError_clone(&*owner->contents.err);
5092 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_err"))) TS_CResult_PaymentIdPaymentErrorZ_get_err(uint32_t owner) {
5093 LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(owner & ~1);
5094 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
5095 *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
5096 uintptr_t ret_ref = (uintptr_t)ret_copy;
5100 static inline enum LDKSiPrefix CResult_SiPrefixNoneZ_get_ok(LDKCResult_SiPrefixNoneZ *NONNULL_PTR owner){
5101 CHECK(owner->result_ok);
5102 return SiPrefix_clone(&*owner->contents.result);
5104 uint32_t __attribute__((export_name("TS_CResult_SiPrefixNoneZ_get_ok"))) TS_CResult_SiPrefixNoneZ_get_ok(uint32_t owner) {
5105 LDKCResult_SiPrefixNoneZ* owner_conv = (LDKCResult_SiPrefixNoneZ*)(owner & ~1);
5106 uint32_t ret_conv = LDKSiPrefix_to_js(CResult_SiPrefixNoneZ_get_ok(owner_conv));
5110 static inline void CResult_SiPrefixNoneZ_get_err(LDKCResult_SiPrefixNoneZ *NONNULL_PTR owner){
5111 CHECK(!owner->result_ok);
5112 return *owner->contents.err;
5114 void __attribute__((export_name("TS_CResult_SiPrefixNoneZ_get_err"))) TS_CResult_SiPrefixNoneZ_get_err(uint32_t owner) {
5115 LDKCResult_SiPrefixNoneZ* owner_conv = (LDKCResult_SiPrefixNoneZ*)(owner & ~1);
5116 CResult_SiPrefixNoneZ_get_err(owner_conv);
5119 static inline struct LDKInvoice CResult_InvoiceNoneZ_get_ok(LDKCResult_InvoiceNoneZ *NONNULL_PTR owner){
5120 CHECK(owner->result_ok);
5121 return Invoice_clone(&*owner->contents.result);
5123 uint32_t __attribute__((export_name("TS_CResult_InvoiceNoneZ_get_ok"))) TS_CResult_InvoiceNoneZ_get_ok(uint32_t owner) {
5124 LDKCResult_InvoiceNoneZ* owner_conv = (LDKCResult_InvoiceNoneZ*)(owner & ~1);
5125 LDKInvoice ret_var = CResult_InvoiceNoneZ_get_ok(owner_conv);
5126 uintptr_t ret_ref = 0;
5127 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5128 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5129 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5130 ret_ref = (uintptr_t)ret_var.inner;
5131 if (ret_var.is_owned) {
5137 static inline void CResult_InvoiceNoneZ_get_err(LDKCResult_InvoiceNoneZ *NONNULL_PTR owner){
5138 CHECK(!owner->result_ok);
5139 return *owner->contents.err;
5141 void __attribute__((export_name("TS_CResult_InvoiceNoneZ_get_err"))) TS_CResult_InvoiceNoneZ_get_err(uint32_t owner) {
5142 LDKCResult_InvoiceNoneZ* owner_conv = (LDKCResult_InvoiceNoneZ*)(owner & ~1);
5143 CResult_InvoiceNoneZ_get_err(owner_conv);
5146 static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceNoneZ_get_ok(LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR owner){
5147 CHECK(owner->result_ok);
5148 return SignedRawInvoice_clone(&*owner->contents.result);
5150 uint32_t __attribute__((export_name("TS_CResult_SignedRawInvoiceNoneZ_get_ok"))) TS_CResult_SignedRawInvoiceNoneZ_get_ok(uint32_t owner) {
5151 LDKCResult_SignedRawInvoiceNoneZ* owner_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(owner & ~1);
5152 LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceNoneZ_get_ok(owner_conv);
5153 uintptr_t ret_ref = 0;
5154 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5155 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5156 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5157 ret_ref = (uintptr_t)ret_var.inner;
5158 if (ret_var.is_owned) {
5164 static inline void CResult_SignedRawInvoiceNoneZ_get_err(LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR owner){
5165 CHECK(!owner->result_ok);
5166 return *owner->contents.err;
5168 void __attribute__((export_name("TS_CResult_SignedRawInvoiceNoneZ_get_err"))) TS_CResult_SignedRawInvoiceNoneZ_get_err(uint32_t owner) {
5169 LDKCResult_SignedRawInvoiceNoneZ* owner_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(owner & ~1);
5170 CResult_SignedRawInvoiceNoneZ_get_err(owner_conv);
5173 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
5174 return RawInvoice_clone(&owner->a);
5176 uint32_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(uint32_t owner) {
5177 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
5178 LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv);
5179 uintptr_t ret_ref = 0;
5180 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5181 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5182 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5183 ret_ref = (uintptr_t)ret_var.inner;
5184 if (ret_var.is_owned) {
5190 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
5191 return ThirtyTwoBytes_clone(&owner->b);
5193 int8_tArray __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(uint32_t owner) {
5194 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
5195 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5196 memcpy(ret_arr->elems, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data, 32);
5200 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
5201 return InvoiceSignature_clone(&owner->c);
5203 uint32_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(uint32_t owner) {
5204 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
5205 LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(owner_conv);
5206 uintptr_t ret_ref = 0;
5207 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5208 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5209 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5210 ret_ref = (uintptr_t)ret_var.inner;
5211 if (ret_var.is_owned) {
5217 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
5218 CHECK(owner->result_ok);
5219 return PayeePubKey_clone(&*owner->contents.result);
5221 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_ok"))) TS_CResult_PayeePubKeyErrorZ_get_ok(uint32_t owner) {
5222 LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)(owner & ~1);
5223 LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
5224 uintptr_t ret_ref = 0;
5225 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5226 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5227 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5228 ret_ref = (uintptr_t)ret_var.inner;
5229 if (ret_var.is_owned) {
5235 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
5236 CHECK(!owner->result_ok);
5237 return *owner->contents.err;
5239 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_err"))) TS_CResult_PayeePubKeyErrorZ_get_err(uint32_t owner) {
5240 LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)(owner & ~1);
5241 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PayeePubKeyErrorZ_get_err(owner_conv));
5245 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
5246 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
5247 for (size_t i = 0; i < ret.datalen; i++) {
5248 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
5252 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
5253 CHECK(owner->result_ok);
5254 return PositiveTimestamp_clone(&*owner->contents.result);
5256 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_get_ok(uint32_t owner) {
5257 LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(owner & ~1);
5258 LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
5259 uintptr_t ret_ref = 0;
5260 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5261 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5262 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5263 ret_ref = (uintptr_t)ret_var.inner;
5264 if (ret_var.is_owned) {
5270 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
5271 CHECK(!owner->result_ok);
5272 return CreationError_clone(&*owner->contents.err);
5274 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_err"))) TS_CResult_PositiveTimestampCreationErrorZ_get_err(uint32_t owner) {
5275 LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(owner & ~1);
5276 uint32_t ret_conv = LDKCreationError_to_js(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
5280 static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
5281 CHECK(owner->result_ok);
5282 return *owner->contents.result;
5284 void __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_ok"))) TS_CResult_NoneSemanticErrorZ_get_ok(uint32_t owner) {
5285 LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)(owner & ~1);
5286 CResult_NoneSemanticErrorZ_get_ok(owner_conv);
5289 static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
5290 CHECK(!owner->result_ok);
5291 return SemanticError_clone(&*owner->contents.err);
5293 uint32_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_err"))) TS_CResult_NoneSemanticErrorZ_get_err(uint32_t owner) {
5294 LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)(owner & ~1);
5295 uint32_t ret_conv = LDKSemanticError_to_js(CResult_NoneSemanticErrorZ_get_err(owner_conv));
5299 static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
5300 CHECK(owner->result_ok);
5301 return Invoice_clone(&*owner->contents.result);
5303 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_ok"))) TS_CResult_InvoiceSemanticErrorZ_get_ok(uint32_t owner) {
5304 LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)(owner & ~1);
5305 LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv);
5306 uintptr_t ret_ref = 0;
5307 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5308 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5309 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5310 ret_ref = (uintptr_t)ret_var.inner;
5311 if (ret_var.is_owned) {
5317 static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
5318 CHECK(!owner->result_ok);
5319 return SemanticError_clone(&*owner->contents.err);
5321 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_err"))) TS_CResult_InvoiceSemanticErrorZ_get_err(uint32_t owner) {
5322 LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)(owner & ~1);
5323 uint32_t ret_conv = LDKSemanticError_to_js(CResult_InvoiceSemanticErrorZ_get_err(owner_conv));
5327 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
5328 CHECK(owner->result_ok);
5329 return Description_clone(&*owner->contents.result);
5331 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_ok"))) TS_CResult_DescriptionCreationErrorZ_get_ok(uint32_t owner) {
5332 LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)(owner & ~1);
5333 LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
5334 uintptr_t ret_ref = 0;
5335 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5336 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5337 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5338 ret_ref = (uintptr_t)ret_var.inner;
5339 if (ret_var.is_owned) {
5345 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
5346 CHECK(!owner->result_ok);
5347 return CreationError_clone(&*owner->contents.err);
5349 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_err"))) TS_CResult_DescriptionCreationErrorZ_get_err(uint32_t owner) {
5350 LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)(owner & ~1);
5351 uint32_t ret_conv = LDKCreationError_to_js(CResult_DescriptionCreationErrorZ_get_err(owner_conv));
5355 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
5356 CHECK(owner->result_ok);
5357 return PrivateRoute_clone(&*owner->contents.result);
5359 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_ok"))) TS_CResult_PrivateRouteCreationErrorZ_get_ok(uint32_t owner) {
5360 LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(owner & ~1);
5361 LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
5362 uintptr_t ret_ref = 0;
5363 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5364 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5365 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5366 ret_ref = (uintptr_t)ret_var.inner;
5367 if (ret_var.is_owned) {
5373 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
5374 CHECK(!owner->result_ok);
5375 return CreationError_clone(&*owner->contents.err);
5377 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_err"))) TS_CResult_PrivateRouteCreationErrorZ_get_err(uint32_t owner) {
5378 LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(owner & ~1);
5379 uint32_t ret_conv = LDKCreationError_to_js(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
5383 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
5384 CHECK(owner->result_ok);
5385 return *owner->contents.result;
5387 jstring __attribute__((export_name("TS_CResult_StringErrorZ_get_ok"))) TS_CResult_StringErrorZ_get_ok(uint32_t owner) {
5388 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
5389 LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
5390 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
5394 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
5395 CHECK(!owner->result_ok);
5396 return *owner->contents.err;
5398 uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_get_err"))) TS_CResult_StringErrorZ_get_err(uint32_t owner) {
5399 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
5400 uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StringErrorZ_get_err(owner_conv));
5404 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
5405 CHECK(owner->result_ok);
5406 return ChannelMonitorUpdate_clone(&*owner->contents.result);
5408 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint32_t owner) {
5409 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
5410 LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
5411 uintptr_t ret_ref = 0;
5412 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5413 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5414 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5415 ret_ref = (uintptr_t)ret_var.inner;
5416 if (ret_var.is_owned) {
5422 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
5423 CHECK(!owner->result_ok);
5424 return DecodeError_clone(&*owner->contents.err);
5426 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint32_t owner) {
5427 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
5428 LDKDecodeError ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
5429 uintptr_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 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_ty_from_ptr"))) TS_LDKCOption_MonitorEventZ_ty_from_ptr(uint32_t ptr) {
5441 LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)(ptr & ~1);
5443 case LDKCOption_MonitorEventZ_Some: return 0;
5444 case LDKCOption_MonitorEventZ_None: return 1;
5448 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_Some_get_some"))) TS_LDKCOption_MonitorEventZ_Some_get_some(uint32_t ptr) {
5449 LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)(ptr & ~1);
5450 assert(obj->tag == LDKCOption_MonitorEventZ_Some);
5451 uintptr_t some_ref = ((uintptr_t)&obj->some) | 1;
5454 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
5455 CHECK(owner->result_ok);
5456 return COption_MonitorEventZ_clone(&*owner->contents.result);
5458 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint32_t owner) {
5459 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
5460 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
5461 *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
5462 uintptr_t ret_ref = (uintptr_t)ret_copy;
5466 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
5467 CHECK(!owner->result_ok);
5468 return DecodeError_clone(&*owner->contents.err);
5470 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint32_t owner) {
5471 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
5472 LDKDecodeError ret_var = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
5473 uintptr_t ret_ref = 0;
5474 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5475 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5476 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5477 ret_ref = (uintptr_t)ret_var.inner;
5478 if (ret_var.is_owned) {
5484 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
5485 CHECK(owner->result_ok);
5486 return HTLCUpdate_clone(&*owner->contents.result);
5488 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint32_t owner) {
5489 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
5490 LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
5491 uintptr_t ret_ref = 0;
5492 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5493 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5494 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5495 ret_ref = (uintptr_t)ret_var.inner;
5496 if (ret_var.is_owned) {
5502 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
5503 CHECK(!owner->result_ok);
5504 return DecodeError_clone(&*owner->contents.err);
5506 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint32_t owner) {
5507 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
5508 LDKDecodeError ret_var = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
5509 uintptr_t ret_ref = 0;
5510 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5511 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5512 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5513 ret_ref = (uintptr_t)ret_var.inner;
5514 if (ret_var.is_owned) {
5520 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
5521 return OutPoint_clone(&owner->a);
5523 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_a"))) TS_C2Tuple_OutPointScriptZ_get_a(uint32_t owner) {
5524 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
5525 LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
5526 uintptr_t ret_ref = 0;
5527 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5528 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5529 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5530 ret_ref = (uintptr_t)ret_var.inner;
5531 if (ret_var.is_owned) {
5537 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
5538 return CVec_u8Z_clone(&owner->b);
5540 int8_tArray __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_b"))) TS_C2Tuple_OutPointScriptZ_get_b(uint32_t owner) {
5541 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
5542 LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
5543 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5544 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5545 CVec_u8Z_free(ret_var);
5549 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
5552 int32_t __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_a"))) TS_C2Tuple_u32ScriptZ_get_a(uint32_t owner) {
5553 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
5554 int32_t ret_val = C2Tuple_u32ScriptZ_get_a(owner_conv);
5558 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
5559 return CVec_u8Z_clone(&owner->b);
5561 int8_tArray __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_b"))) TS_C2Tuple_u32ScriptZ_get_b(uint32_t owner) {
5562 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
5563 LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
5564 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5565 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5566 CVec_u8Z_free(ret_var);
5570 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
5571 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
5572 for (size_t i = 0; i < ret.datalen; i++) {
5573 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
5577 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
5578 return ThirtyTwoBytes_clone(&owner->a);
5580 int8_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint32_t owner) {
5581 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
5582 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5583 memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data, 32);
5587 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
5588 return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
5590 uint32_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint32_t owner) {
5591 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
5592 LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
5593 uint32_tArray ret_arr = NULL;
5594 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
5595 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
5596 for (size_t v = 0; v < ret_var.datalen; v++) {
5597 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
5598 *ret_conv_21_conv = ret_var.data[v];
5599 ret_arr_ptr[v] = ((uintptr_t)ret_conv_21_conv);
5606 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
5607 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 };
5608 for (size_t i = 0; i < ret.datalen; i++) {
5609 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
5613 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
5614 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
5615 for (size_t i = 0; i < ret.datalen; i++) {
5616 ret.data[i] = Event_clone(&orig->data[i]);
5620 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
5623 int32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_a"))) TS_C2Tuple_u32TxOutZ_get_a(uint32_t owner) {
5624 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
5625 int32_t ret_val = C2Tuple_u32TxOutZ_get_a(owner_conv);
5629 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
5630 return TxOut_clone(&owner->b);
5632 uint32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_b"))) TS_C2Tuple_u32TxOutZ_get_b(uint32_t owner) {
5633 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
5634 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
5635 *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
5636 return (uintptr_t)ret_ref;
5639 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
5640 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
5641 for (size_t i = 0; i < ret.datalen; i++) {
5642 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
5646 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
5647 return ThirtyTwoBytes_clone(&owner->a);
5649 int8_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint32_t owner) {
5650 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
5651 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5652 memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
5656 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
5657 return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
5659 uint32_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint32_t owner) {
5660 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
5661 LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
5662 uint32_tArray ret_arr = NULL;
5663 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
5664 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
5665 for (size_t u = 0; u < ret_var.datalen; u++) {
5666 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
5667 *ret_conv_20_conv = ret_var.data[u];
5668 ret_arr_ptr[u] = ((uintptr_t)ret_conv_20_conv);
5675 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
5676 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 };
5677 for (size_t i = 0; i < ret.datalen; i++) {
5678 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
5682 uint32_t __attribute__((export_name("TS_LDKBalance_ty_from_ptr"))) TS_LDKBalance_ty_from_ptr(uint32_t ptr) {
5683 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
5685 case LDKBalance_ClaimableOnChannelClose: return 0;
5686 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
5687 case LDKBalance_ContentiousClaimable: return 2;
5688 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: return 3;
5692 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis(uint32_t ptr) {
5693 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
5694 assert(obj->tag == LDKBalance_ClaimableOnChannelClose);
5695 return obj->claimable_on_channel_close.claimable_amount_satoshis;
5697 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis(uint32_t ptr) {
5698 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
5699 assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
5700 return obj->claimable_awaiting_confirmations.claimable_amount_satoshis;
5702 int32_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(uint32_t ptr) {
5703 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
5704 assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
5705 return obj->claimable_awaiting_confirmations.confirmation_height;
5707 int64_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis"))) TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis(uint32_t ptr) {
5708 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
5709 assert(obj->tag == LDKBalance_ContentiousClaimable);
5710 return obj->contentious_claimable.claimable_amount_satoshis;
5712 int32_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_timeout_height"))) TS_LDKBalance_ContentiousClaimable_get_timeout_height(uint32_t ptr) {
5713 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
5714 assert(obj->tag == LDKBalance_ContentiousClaimable);
5715 return obj->contentious_claimable.timeout_height;
5717 int64_t __attribute__((export_name("TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_amount_satoshis"))) TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_amount_satoshis(uint32_t ptr) {
5718 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
5719 assert(obj->tag == LDKBalance_MaybeClaimableHTLCAwaitingTimeout);
5720 return obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis;
5722 int32_t __attribute__((export_name("TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_height"))) TS_LDKBalance_MaybeClaimableHTLCAwaitingTimeout_get_claimable_height(uint32_t ptr) {
5723 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
5724 assert(obj->tag == LDKBalance_MaybeClaimableHTLCAwaitingTimeout);
5725 return obj->maybe_claimable_htlc_awaiting_timeout.claimable_height;
5727 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
5728 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
5729 for (size_t i = 0; i < ret.datalen; i++) {
5730 ret.data[i] = Balance_clone(&orig->data[i]);
5734 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
5735 return ThirtyTwoBytes_clone(&owner->a);
5737 int8_tArray __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_a"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_a(uint32_t owner) {
5738 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
5739 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5740 memcpy(ret_arr->elems, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data, 32);
5744 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
5745 return ChannelMonitor_clone(&owner->b);
5747 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_b"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_b(uint32_t owner) {
5748 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
5749 LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
5750 uintptr_t ret_ref = 0;
5751 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5752 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5753 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5754 ret_ref = (uintptr_t)ret_var.inner;
5755 if (ret_var.is_owned) {
5761 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
5762 CHECK(owner->result_ok);
5763 return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
5765 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint32_t owner) {
5766 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
5767 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
5768 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
5769 return ((uintptr_t)ret_conv);
5772 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
5773 CHECK(!owner->result_ok);
5774 return DecodeError_clone(&*owner->contents.err);
5776 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint32_t owner) {
5777 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
5778 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
5779 uintptr_t ret_ref = 0;
5780 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5781 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5782 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5783 ret_ref = (uintptr_t)ret_var.inner;
5784 if (ret_var.is_owned) {
5790 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
5791 CHECK(owner->result_ok);
5792 return *owner->contents.result;
5794 void __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_ok"))) TS_CResult_NoneLightningErrorZ_get_ok(uint32_t owner) {
5795 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
5796 CResult_NoneLightningErrorZ_get_ok(owner_conv);
5799 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
5800 CHECK(!owner->result_ok);
5801 return LightningError_clone(&*owner->contents.err);
5803 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_err"))) TS_CResult_NoneLightningErrorZ_get_err(uint32_t owner) {
5804 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
5805 LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
5806 uintptr_t ret_ref = 0;
5807 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5808 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5809 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5810 ret_ref = (uintptr_t)ret_var.inner;
5811 if (ret_var.is_owned) {
5817 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
5820 int8_tArray __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_a"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint32_t owner) {
5821 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
5822 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
5823 memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
5827 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
5828 return Type_clone(&owner->b);
5830 uint32_t __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_b"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint32_t owner) {
5831 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
5832 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
5833 *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
5834 return (uintptr_t)ret_ret;
5837 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
5838 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
5839 for (size_t i = 0; i < ret.datalen; i++) {
5840 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
5844 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
5845 CHECK(owner->result_ok);
5846 return *owner->contents.result;
5848 jboolean __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_ok"))) TS_CResult_boolLightningErrorZ_get_ok(uint32_t owner) {
5849 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
5850 jboolean ret_val = CResult_boolLightningErrorZ_get_ok(owner_conv);
5854 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
5855 CHECK(!owner->result_ok);
5856 return LightningError_clone(&*owner->contents.err);
5858 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_err"))) TS_CResult_boolLightningErrorZ_get_err(uint32_t owner) {
5859 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
5860 LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
5861 uintptr_t ret_ref = 0;
5862 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5863 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5864 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5865 ret_ref = (uintptr_t)ret_var.inner;
5866 if (ret_var.is_owned) {
5872 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5873 return ChannelAnnouncement_clone(&owner->a);
5875 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint32_t owner) {
5876 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
5877 LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
5878 uintptr_t ret_ref = 0;
5879 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5880 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5881 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5882 ret_ref = (uintptr_t)ret_var.inner;
5883 if (ret_var.is_owned) {
5889 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5890 return ChannelUpdate_clone(&owner->b);
5892 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint32_t owner) {
5893 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
5894 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
5895 uintptr_t ret_ref = 0;
5896 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5897 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5898 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5899 ret_ref = (uintptr_t)ret_var.inner;
5900 if (ret_var.is_owned) {
5906 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5907 return ChannelUpdate_clone(&owner->c);
5909 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint32_t owner) {
5910 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
5911 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
5912 uintptr_t ret_ref = 0;
5913 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5914 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5915 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5916 ret_ref = (uintptr_t)ret_var.inner;
5917 if (ret_var.is_owned) {
5923 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
5924 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
5925 for (size_t i = 0; i < ret.datalen; i++) {
5926 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
5930 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
5931 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
5932 for (size_t i = 0; i < ret.datalen; i++) {
5933 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
5937 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
5938 CHECK(owner->result_ok);
5939 return CVec_u8Z_clone(&*owner->contents.result);
5941 int8_tArray __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint32_t owner) {
5942 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
5943 LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
5944 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5945 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5946 CVec_u8Z_free(ret_var);
5950 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
5951 CHECK(!owner->result_ok);
5952 return PeerHandleError_clone(&*owner->contents.err);
5954 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err(uint32_t owner) {
5955 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
5956 LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
5957 uintptr_t ret_ref = 0;
5958 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5959 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5960 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5961 ret_ref = (uintptr_t)ret_var.inner;
5962 if (ret_var.is_owned) {
5968 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
5969 CHECK(owner->result_ok);
5970 return *owner->contents.result;
5972 void __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_ok"))) TS_CResult_NonePeerHandleErrorZ_get_ok(uint32_t owner) {
5973 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
5974 CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
5977 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
5978 CHECK(!owner->result_ok);
5979 return PeerHandleError_clone(&*owner->contents.err);
5981 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_err"))) TS_CResult_NonePeerHandleErrorZ_get_err(uint32_t owner) {
5982 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
5983 LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
5984 uintptr_t ret_ref = 0;
5985 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5986 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5987 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5988 ret_ref = (uintptr_t)ret_var.inner;
5989 if (ret_var.is_owned) {
5995 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
5996 CHECK(owner->result_ok);
5997 return *owner->contents.result;
5999 jboolean __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_ok"))) TS_CResult_boolPeerHandleErrorZ_get_ok(uint32_t owner) {
6000 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
6001 jboolean ret_val = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
6005 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
6006 CHECK(!owner->result_ok);
6007 return PeerHandleError_clone(&*owner->contents.err);
6009 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_err"))) TS_CResult_boolPeerHandleErrorZ_get_err(uint32_t owner) {
6010 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
6011 LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
6012 uintptr_t ret_ref = 0;
6013 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6014 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6015 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6016 ret_ref = (uintptr_t)ret_var.inner;
6017 if (ret_var.is_owned) {
6023 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
6024 CHECK(owner->result_ok);
6025 return NodeId_clone(&*owner->contents.result);
6027 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_ok"))) TS_CResult_NodeIdDecodeErrorZ_get_ok(uint32_t owner) {
6028 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
6029 LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
6030 uintptr_t ret_ref = 0;
6031 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6032 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6033 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6034 ret_ref = (uintptr_t)ret_var.inner;
6035 if (ret_var.is_owned) {
6041 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
6042 CHECK(!owner->result_ok);
6043 return DecodeError_clone(&*owner->contents.err);
6045 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_err"))) TS_CResult_NodeIdDecodeErrorZ_get_err(uint32_t owner) {
6046 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
6047 LDKDecodeError ret_var = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
6048 uintptr_t ret_ref = 0;
6049 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6050 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6051 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6052 ret_ref = (uintptr_t)ret_var.inner;
6053 if (ret_var.is_owned) {
6059 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
6060 CHECK(owner->result_ok);
6061 return COption_NetworkUpdateZ_clone(&*owner->contents.result);
6063 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint32_t owner) {
6064 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
6065 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
6066 *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
6067 uintptr_t ret_ref = (uintptr_t)ret_copy;
6071 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
6072 CHECK(!owner->result_ok);
6073 return DecodeError_clone(&*owner->contents.err);
6075 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint32_t owner) {
6076 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
6077 LDKDecodeError ret_var = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
6078 uintptr_t ret_ref = 0;
6079 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6080 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6081 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6082 ret_ref = (uintptr_t)ret_var.inner;
6083 if (ret_var.is_owned) {
6089 typedef struct LDKAccess_JCalls {
6090 atomic_size_t refcnt;
6091 uint32_t instance_ptr;
6093 static void LDKAccess_JCalls_free(void* this_arg) {
6094 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6095 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6099 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
6100 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6101 int8_tArray genesis_hash_arr = init_int8_tArray(32, __LINE__);
6102 memcpy(genesis_hash_arr->elems, *genesis_hash, 32);
6103 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 31, (uint32_t)genesis_hash_arr, (uint32_t)short_channel_id);
6104 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
6105 CHECK_ACCESS(ret_ptr);
6106 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
6110 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
6111 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
6112 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6114 static inline LDKAccess LDKAccess_init (JSValue o) {
6115 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
6116 atomic_init(&calls->refcnt, 1);
6117 calls->instance_ptr = o;
6120 .this_arg = (void*) calls,
6121 .get_utxo = get_utxo_LDKAccess_jcall,
6122 .free = LDKAccess_JCalls_free,
6126 long __attribute__((export_name("TS_LDKAccess_new"))) TS_LDKAccess_new(JSValue o) {
6127 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
6128 *res_ptr = LDKAccess_init(o);
6129 return (long)res_ptr;
6131 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) {
6132 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6133 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6134 LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
6135 unsigned char genesis_hash_arr[32];
6136 CHECK(genesis_hash->arr_len == 32);
6137 memcpy(genesis_hash_arr, genesis_hash->elems, 32); FREE(genesis_hash);
6138 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
6139 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6140 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
6141 return (uintptr_t)ret_conv;
6144 uint32_t __attribute__((export_name("TS_LDKCOption_AccessZ_ty_from_ptr"))) TS_LDKCOption_AccessZ_ty_from_ptr(uint32_t ptr) {
6145 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
6147 case LDKCOption_AccessZ_Some: return 0;
6148 case LDKCOption_AccessZ_None: return 1;
6152 uint32_t __attribute__((export_name("TS_LDKCOption_AccessZ_Some_get_some"))) TS_LDKCOption_AccessZ_Some_get_some(uint32_t ptr) {
6153 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
6154 assert(obj->tag == LDKCOption_AccessZ_Some);
6155 LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
6156 *some_ret = obj->some;
6157 // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
6158 return (uintptr_t)some_ret;
6160 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
6161 CHECK(owner->result_ok);
6162 return ChannelUpdateInfo_clone(&*owner->contents.result);
6164 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(uint32_t owner) {
6165 LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(owner & ~1);
6166 LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
6167 uintptr_t ret_ref = 0;
6168 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6169 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6170 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6171 ret_ref = (uintptr_t)ret_var.inner;
6172 if (ret_var.is_owned) {
6178 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
6179 CHECK(!owner->result_ok);
6180 return DecodeError_clone(&*owner->contents.err);
6182 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err(uint32_t owner) {
6183 LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(owner & ~1);
6184 LDKDecodeError ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
6185 uintptr_t ret_ref = 0;
6186 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6187 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6188 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6189 ret_ref = (uintptr_t)ret_var.inner;
6190 if (ret_var.is_owned) {
6196 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
6197 CHECK(owner->result_ok);
6198 return ChannelInfo_clone(&*owner->contents.result);
6200 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_get_ok(uint32_t owner) {
6201 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
6202 LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
6203 uintptr_t ret_ref = 0;
6204 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6205 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6206 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6207 ret_ref = (uintptr_t)ret_var.inner;
6208 if (ret_var.is_owned) {
6214 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
6215 CHECK(!owner->result_ok);
6216 return DecodeError_clone(&*owner->contents.err);
6218 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelInfoDecodeErrorZ_get_err(uint32_t owner) {
6219 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
6220 LDKDecodeError ret_var = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
6221 uintptr_t ret_ref = 0;
6222 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6223 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6224 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6225 ret_ref = (uintptr_t)ret_var.inner;
6226 if (ret_var.is_owned) {
6232 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
6233 CHECK(owner->result_ok);
6234 return RoutingFees_clone(&*owner->contents.result);
6236 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_get_ok(uint32_t owner) {
6237 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
6238 LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
6239 uintptr_t ret_ref = 0;
6240 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6241 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6242 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6243 ret_ref = (uintptr_t)ret_var.inner;
6244 if (ret_var.is_owned) {
6250 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
6251 CHECK(!owner->result_ok);
6252 return DecodeError_clone(&*owner->contents.err);
6254 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_err"))) TS_CResult_RoutingFeesDecodeErrorZ_get_err(uint32_t owner) {
6255 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
6256 LDKDecodeError ret_var = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
6257 uintptr_t ret_ref = 0;
6258 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6259 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6260 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6261 ret_ref = (uintptr_t)ret_var.inner;
6262 if (ret_var.is_owned) {
6268 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
6269 CHECK(owner->result_ok);
6270 return NodeAnnouncementInfo_clone(&*owner->contents.result);
6272 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint32_t owner) {
6273 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
6274 LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
6275 uintptr_t ret_ref = 0;
6276 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6277 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6278 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6279 ret_ref = (uintptr_t)ret_var.inner;
6280 if (ret_var.is_owned) {
6286 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
6287 CHECK(!owner->result_ok);
6288 return DecodeError_clone(&*owner->contents.err);
6290 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint32_t owner) {
6291 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
6292 LDKDecodeError ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
6293 uintptr_t ret_ref = 0;
6294 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6295 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6296 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6297 ret_ref = (uintptr_t)ret_var.inner;
6298 if (ret_var.is_owned) {
6304 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
6305 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
6306 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
6309 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
6310 CHECK(owner->result_ok);
6311 return NodeInfo_clone(&*owner->contents.result);
6313 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeInfoDecodeErrorZ_get_ok(uint32_t owner) {
6314 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
6315 LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
6316 uintptr_t ret_ref = 0;
6317 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6318 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6319 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6320 ret_ref = (uintptr_t)ret_var.inner;
6321 if (ret_var.is_owned) {
6327 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
6328 CHECK(!owner->result_ok);
6329 return DecodeError_clone(&*owner->contents.err);
6331 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_err"))) TS_CResult_NodeInfoDecodeErrorZ_get_err(uint32_t owner) {
6332 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
6333 LDKDecodeError ret_var = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
6334 uintptr_t ret_ref = 0;
6335 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6336 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6337 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6338 ret_ref = (uintptr_t)ret_var.inner;
6339 if (ret_var.is_owned) {
6345 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
6346 CHECK(owner->result_ok);
6347 return NetworkGraph_clone(&*owner->contents.result);
6349 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_get_ok(uint32_t owner) {
6350 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
6351 LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
6352 uintptr_t ret_ref = 0;
6353 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6354 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6355 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6356 ret_ref = (uintptr_t)ret_var.inner;
6357 if (ret_var.is_owned) {
6363 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
6364 CHECK(!owner->result_ok);
6365 return DecodeError_clone(&*owner->contents.err);
6367 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_err"))) TS_CResult_NetworkGraphDecodeErrorZ_get_err(uint32_t owner) {
6368 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
6369 LDKDecodeError ret_var = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
6370 uintptr_t ret_ref = 0;
6371 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6372 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6373 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6374 ret_ref = (uintptr_t)ret_var.inner;
6375 if (ret_var.is_owned) {
6381 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr"))) TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr(uint32_t ptr) {
6382 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
6384 case LDKCOption_CVec_NetAddressZZ_Some: return 0;
6385 case LDKCOption_CVec_NetAddressZZ_None: return 1;
6389 uint32_tArray __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_Some_get_some"))) TS_LDKCOption_CVec_NetAddressZZ_Some_get_some(uint32_t ptr) {
6390 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
6391 assert(obj->tag == LDKCOption_CVec_NetAddressZZ_Some);
6392 LDKCVec_NetAddressZ some_var = obj->some;
6393 uint32_tArray some_arr = NULL;
6394 some_arr = init_uint32_tArray(some_var.datalen, __LINE__);
6395 uint32_t *some_arr_ptr = (uint32_t*)(((uint8_t*)some_arr) + 4);
6396 for (size_t m = 0; m < some_var.datalen; m++) {
6397 uintptr_t some_conv_12_ref = ((uintptr_t)&some_var.data[m]) | 1;
6398 some_arr_ptr[m] = some_conv_12_ref;
6403 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
6404 CHECK(owner->result_ok);
6405 return NetAddress_clone(&*owner->contents.result);
6407 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_ok"))) TS_CResult_NetAddressDecodeErrorZ_get_ok(uint32_t owner) {
6408 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
6409 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
6410 *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
6411 uintptr_t ret_ref = (uintptr_t)ret_copy;
6415 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
6416 CHECK(!owner->result_ok);
6417 return DecodeError_clone(&*owner->contents.err);
6419 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_err"))) TS_CResult_NetAddressDecodeErrorZ_get_err(uint32_t owner) {
6420 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
6421 LDKDecodeError ret_var = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
6422 uintptr_t ret_ref = 0;
6423 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6424 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6425 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6426 ret_ref = (uintptr_t)ret_var.inner;
6427 if (ret_var.is_owned) {
6433 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
6434 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
6435 for (size_t i = 0; i < ret.datalen; i++) {
6436 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
6440 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
6441 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
6442 for (size_t i = 0; i < ret.datalen; i++) {
6443 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
6447 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
6448 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
6449 for (size_t i = 0; i < ret.datalen; i++) {
6450 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
6454 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
6455 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
6456 for (size_t i = 0; i < ret.datalen; i++) {
6457 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
6461 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
6462 CHECK(owner->result_ok);
6463 return AcceptChannel_clone(&*owner->contents.result);
6465 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint32_t owner) {
6466 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
6467 LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
6468 uintptr_t ret_ref = 0;
6469 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6470 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6471 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6472 ret_ref = (uintptr_t)ret_var.inner;
6473 if (ret_var.is_owned) {
6479 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
6480 CHECK(!owner->result_ok);
6481 return DecodeError_clone(&*owner->contents.err);
6483 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_err"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint32_t owner) {
6484 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
6485 LDKDecodeError ret_var = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
6486 uintptr_t ret_ref = 0;
6487 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6488 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6489 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6490 ret_ref = (uintptr_t)ret_var.inner;
6491 if (ret_var.is_owned) {
6497 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
6498 CHECK(owner->result_ok);
6499 return AnnouncementSignatures_clone(&*owner->contents.result);
6501 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint32_t owner) {
6502 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
6503 LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
6504 uintptr_t ret_ref = 0;
6505 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6506 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6507 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6508 ret_ref = (uintptr_t)ret_var.inner;
6509 if (ret_var.is_owned) {
6515 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
6516 CHECK(!owner->result_ok);
6517 return DecodeError_clone(&*owner->contents.err);
6519 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint32_t owner) {
6520 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
6521 LDKDecodeError ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
6522 uintptr_t ret_ref = 0;
6523 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6524 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6525 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6526 ret_ref = (uintptr_t)ret_var.inner;
6527 if (ret_var.is_owned) {
6533 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
6534 CHECK(owner->result_ok);
6535 return ChannelReestablish_clone(&*owner->contents.result);
6537 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint32_t owner) {
6538 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
6539 LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
6540 uintptr_t ret_ref = 0;
6541 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6542 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6543 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6544 ret_ref = (uintptr_t)ret_var.inner;
6545 if (ret_var.is_owned) {
6551 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
6552 CHECK(!owner->result_ok);
6553 return DecodeError_clone(&*owner->contents.err);
6555 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint32_t owner) {
6556 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
6557 LDKDecodeError ret_var = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
6558 uintptr_t ret_ref = 0;
6559 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6560 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6561 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6562 ret_ref = (uintptr_t)ret_var.inner;
6563 if (ret_var.is_owned) {
6569 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
6570 CHECK(owner->result_ok);
6571 return ClosingSigned_clone(&*owner->contents.result);
6573 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint32_t owner) {
6574 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
6575 LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
6576 uintptr_t ret_ref = 0;
6577 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6578 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6579 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6580 ret_ref = (uintptr_t)ret_var.inner;
6581 if (ret_var.is_owned) {
6587 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
6588 CHECK(!owner->result_ok);
6589 return DecodeError_clone(&*owner->contents.err);
6591 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint32_t owner) {
6592 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
6593 LDKDecodeError ret_var = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
6594 uintptr_t ret_ref = 0;
6595 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6596 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6597 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6598 ret_ref = (uintptr_t)ret_var.inner;
6599 if (ret_var.is_owned) {
6605 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
6606 CHECK(owner->result_ok);
6607 return ClosingSignedFeeRange_clone(&*owner->contents.result);
6609 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint32_t owner) {
6610 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
6611 LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
6612 uintptr_t ret_ref = 0;
6613 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6614 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6615 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6616 ret_ref = (uintptr_t)ret_var.inner;
6617 if (ret_var.is_owned) {
6623 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
6624 CHECK(!owner->result_ok);
6625 return DecodeError_clone(&*owner->contents.err);
6627 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint32_t owner) {
6628 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
6629 LDKDecodeError ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
6630 uintptr_t ret_ref = 0;
6631 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6632 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6633 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6634 ret_ref = (uintptr_t)ret_var.inner;
6635 if (ret_var.is_owned) {
6641 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
6642 CHECK(owner->result_ok);
6643 return CommitmentSigned_clone(&*owner->contents.result);
6645 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_ok(uint32_t owner) {
6646 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
6647 LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
6648 uintptr_t ret_ref = 0;
6649 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6650 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6651 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6652 ret_ref = (uintptr_t)ret_var.inner;
6653 if (ret_var.is_owned) {
6659 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
6660 CHECK(!owner->result_ok);
6661 return DecodeError_clone(&*owner->contents.err);
6663 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_err(uint32_t owner) {
6664 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
6665 LDKDecodeError ret_var = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
6666 uintptr_t ret_ref = 0;
6667 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6668 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6669 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6670 ret_ref = (uintptr_t)ret_var.inner;
6671 if (ret_var.is_owned) {
6677 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
6678 CHECK(owner->result_ok);
6679 return FundingCreated_clone(&*owner->contents.result);
6681 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_get_ok(uint32_t owner) {
6682 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
6683 LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
6684 uintptr_t ret_ref = 0;
6685 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6686 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6687 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6688 ret_ref = (uintptr_t)ret_var.inner;
6689 if (ret_var.is_owned) {
6695 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
6696 CHECK(!owner->result_ok);
6697 return DecodeError_clone(&*owner->contents.err);
6699 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_err"))) TS_CResult_FundingCreatedDecodeErrorZ_get_err(uint32_t owner) {
6700 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
6701 LDKDecodeError ret_var = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
6702 uintptr_t ret_ref = 0;
6703 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6704 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6705 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6706 ret_ref = (uintptr_t)ret_var.inner;
6707 if (ret_var.is_owned) {
6713 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
6714 CHECK(owner->result_ok);
6715 return FundingSigned_clone(&*owner->contents.result);
6717 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_ok"))) TS_CResult_FundingSignedDecodeErrorZ_get_ok(uint32_t owner) {
6718 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
6719 LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
6720 uintptr_t ret_ref = 0;
6721 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6722 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6723 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6724 ret_ref = (uintptr_t)ret_var.inner;
6725 if (ret_var.is_owned) {
6731 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
6732 CHECK(!owner->result_ok);
6733 return DecodeError_clone(&*owner->contents.err);
6735 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_err"))) TS_CResult_FundingSignedDecodeErrorZ_get_err(uint32_t owner) {
6736 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
6737 LDKDecodeError ret_var = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
6738 uintptr_t ret_ref = 0;
6739 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6740 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6741 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6742 ret_ref = (uintptr_t)ret_var.inner;
6743 if (ret_var.is_owned) {
6749 static inline struct LDKFundingLocked CResult_FundingLockedDecodeErrorZ_get_ok(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR owner){
6750 CHECK(owner->result_ok);
6751 return FundingLocked_clone(&*owner->contents.result);
6753 uint32_t __attribute__((export_name("TS_CResult_FundingLockedDecodeErrorZ_get_ok"))) TS_CResult_FundingLockedDecodeErrorZ_get_ok(uint32_t owner) {
6754 LDKCResult_FundingLockedDecodeErrorZ* owner_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(owner & ~1);
6755 LDKFundingLocked ret_var = CResult_FundingLockedDecodeErrorZ_get_ok(owner_conv);
6756 uintptr_t ret_ref = 0;
6757 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6758 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6759 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6760 ret_ref = (uintptr_t)ret_var.inner;
6761 if (ret_var.is_owned) {
6767 static inline struct LDKDecodeError CResult_FundingLockedDecodeErrorZ_get_err(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR owner){
6768 CHECK(!owner->result_ok);
6769 return DecodeError_clone(&*owner->contents.err);
6771 uint32_t __attribute__((export_name("TS_CResult_FundingLockedDecodeErrorZ_get_err"))) TS_CResult_FundingLockedDecodeErrorZ_get_err(uint32_t owner) {
6772 LDKCResult_FundingLockedDecodeErrorZ* owner_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(owner & ~1);
6773 LDKDecodeError ret_var = CResult_FundingLockedDecodeErrorZ_get_err(owner_conv);
6774 uintptr_t ret_ref = 0;
6775 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6776 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6777 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6778 ret_ref = (uintptr_t)ret_var.inner;
6779 if (ret_var.is_owned) {
6785 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
6786 CHECK(owner->result_ok);
6787 return Init_clone(&*owner->contents.result);
6789 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_ok"))) TS_CResult_InitDecodeErrorZ_get_ok(uint32_t owner) {
6790 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
6791 LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
6792 uintptr_t ret_ref = 0;
6793 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6794 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6795 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6796 ret_ref = (uintptr_t)ret_var.inner;
6797 if (ret_var.is_owned) {
6803 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
6804 CHECK(!owner->result_ok);
6805 return DecodeError_clone(&*owner->contents.err);
6807 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_err"))) TS_CResult_InitDecodeErrorZ_get_err(uint32_t owner) {
6808 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
6809 LDKDecodeError ret_var = CResult_InitDecodeErrorZ_get_err(owner_conv);
6810 uintptr_t ret_ref = 0;
6811 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6812 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6813 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6814 ret_ref = (uintptr_t)ret_var.inner;
6815 if (ret_var.is_owned) {
6821 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
6822 CHECK(owner->result_ok);
6823 return OpenChannel_clone(&*owner->contents.result);
6825 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_ok"))) TS_CResult_OpenChannelDecodeErrorZ_get_ok(uint32_t owner) {
6826 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
6827 LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
6828 uintptr_t ret_ref = 0;
6829 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6830 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6831 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6832 ret_ref = (uintptr_t)ret_var.inner;
6833 if (ret_var.is_owned) {
6839 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
6840 CHECK(!owner->result_ok);
6841 return DecodeError_clone(&*owner->contents.err);
6843 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_err"))) TS_CResult_OpenChannelDecodeErrorZ_get_err(uint32_t owner) {
6844 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
6845 LDKDecodeError ret_var = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
6846 uintptr_t ret_ref = 0;
6847 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6848 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6849 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6850 ret_ref = (uintptr_t)ret_var.inner;
6851 if (ret_var.is_owned) {
6857 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
6858 CHECK(owner->result_ok);
6859 return RevokeAndACK_clone(&*owner->contents.result);
6861 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_ok(uint32_t owner) {
6862 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
6863 LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
6864 uintptr_t ret_ref = 0;
6865 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6866 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6867 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6868 ret_ref = (uintptr_t)ret_var.inner;
6869 if (ret_var.is_owned) {
6875 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
6876 CHECK(!owner->result_ok);
6877 return DecodeError_clone(&*owner->contents.err);
6879 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_err(uint32_t owner) {
6880 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
6881 LDKDecodeError ret_var = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
6882 uintptr_t ret_ref = 0;
6883 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6884 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6885 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6886 ret_ref = (uintptr_t)ret_var.inner;
6887 if (ret_var.is_owned) {
6893 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
6894 CHECK(owner->result_ok);
6895 return Shutdown_clone(&*owner->contents.result);
6897 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_ok"))) TS_CResult_ShutdownDecodeErrorZ_get_ok(uint32_t owner) {
6898 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
6899 LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
6900 uintptr_t ret_ref = 0;
6901 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6902 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6903 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6904 ret_ref = (uintptr_t)ret_var.inner;
6905 if (ret_var.is_owned) {
6911 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
6912 CHECK(!owner->result_ok);
6913 return DecodeError_clone(&*owner->contents.err);
6915 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_err"))) TS_CResult_ShutdownDecodeErrorZ_get_err(uint32_t owner) {
6916 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
6917 LDKDecodeError ret_var = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
6918 uintptr_t ret_ref = 0;
6919 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6920 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6921 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6922 ret_ref = (uintptr_t)ret_var.inner;
6923 if (ret_var.is_owned) {
6929 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
6930 CHECK(owner->result_ok);
6931 return UpdateFailHTLC_clone(&*owner->contents.result);
6933 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint32_t owner) {
6934 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
6935 LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
6936 uintptr_t ret_ref = 0;
6937 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6938 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6939 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6940 ret_ref = (uintptr_t)ret_var.inner;
6941 if (ret_var.is_owned) {
6947 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
6948 CHECK(!owner->result_ok);
6949 return DecodeError_clone(&*owner->contents.err);
6951 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err(uint32_t owner) {
6952 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
6953 LDKDecodeError ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
6954 uintptr_t ret_ref = 0;
6955 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6956 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6957 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6958 ret_ref = (uintptr_t)ret_var.inner;
6959 if (ret_var.is_owned) {
6965 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
6966 CHECK(owner->result_ok);
6967 return UpdateFailMalformedHTLC_clone(&*owner->contents.result);
6969 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint32_t owner) {
6970 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
6971 LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
6972 uintptr_t ret_ref = 0;
6973 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6974 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6975 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6976 ret_ref = (uintptr_t)ret_var.inner;
6977 if (ret_var.is_owned) {
6983 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
6984 CHECK(!owner->result_ok);
6985 return DecodeError_clone(&*owner->contents.err);
6987 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint32_t owner) {
6988 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
6989 LDKDecodeError ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
6990 uintptr_t ret_ref = 0;
6991 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6992 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6993 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6994 ret_ref = (uintptr_t)ret_var.inner;
6995 if (ret_var.is_owned) {
7001 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
7002 CHECK(owner->result_ok);
7003 return UpdateFee_clone(&*owner->contents.result);
7005 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_get_ok(uint32_t owner) {
7006 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
7007 LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
7008 uintptr_t ret_ref = 0;
7009 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7010 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7011 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7012 ret_ref = (uintptr_t)ret_var.inner;
7013 if (ret_var.is_owned) {
7019 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
7020 CHECK(!owner->result_ok);
7021 return DecodeError_clone(&*owner->contents.err);
7023 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_err"))) TS_CResult_UpdateFeeDecodeErrorZ_get_err(uint32_t owner) {
7024 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
7025 LDKDecodeError ret_var = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
7026 uintptr_t ret_ref = 0;
7027 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7028 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7029 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7030 ret_ref = (uintptr_t)ret_var.inner;
7031 if (ret_var.is_owned) {
7037 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
7038 CHECK(owner->result_ok);
7039 return UpdateFulfillHTLC_clone(&*owner->contents.result);
7041 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint32_t owner) {
7042 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
7043 LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
7044 uintptr_t ret_ref = 0;
7045 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7046 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7047 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7048 ret_ref = (uintptr_t)ret_var.inner;
7049 if (ret_var.is_owned) {
7055 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
7056 CHECK(!owner->result_ok);
7057 return DecodeError_clone(&*owner->contents.err);
7059 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint32_t owner) {
7060 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
7061 LDKDecodeError ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
7062 uintptr_t ret_ref = 0;
7063 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7064 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7065 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7066 ret_ref = (uintptr_t)ret_var.inner;
7067 if (ret_var.is_owned) {
7073 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
7074 CHECK(owner->result_ok);
7075 return UpdateAddHTLC_clone(&*owner->contents.result);
7077 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint32_t owner) {
7078 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
7079 LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
7080 uintptr_t ret_ref = 0;
7081 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7082 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7083 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7084 ret_ref = (uintptr_t)ret_var.inner;
7085 if (ret_var.is_owned) {
7091 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
7092 CHECK(!owner->result_ok);
7093 return DecodeError_clone(&*owner->contents.err);
7095 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err(uint32_t owner) {
7096 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
7097 LDKDecodeError ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
7098 uintptr_t ret_ref = 0;
7099 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7100 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7101 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7102 ret_ref = (uintptr_t)ret_var.inner;
7103 if (ret_var.is_owned) {
7109 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
7110 CHECK(owner->result_ok);
7111 return Ping_clone(&*owner->contents.result);
7113 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_ok"))) TS_CResult_PingDecodeErrorZ_get_ok(uint32_t owner) {
7114 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
7115 LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
7116 uintptr_t ret_ref = 0;
7117 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7118 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7119 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7120 ret_ref = (uintptr_t)ret_var.inner;
7121 if (ret_var.is_owned) {
7127 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
7128 CHECK(!owner->result_ok);
7129 return DecodeError_clone(&*owner->contents.err);
7131 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_err"))) TS_CResult_PingDecodeErrorZ_get_err(uint32_t owner) {
7132 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
7133 LDKDecodeError ret_var = CResult_PingDecodeErrorZ_get_err(owner_conv);
7134 uintptr_t ret_ref = 0;
7135 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7136 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7137 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7138 ret_ref = (uintptr_t)ret_var.inner;
7139 if (ret_var.is_owned) {
7145 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
7146 CHECK(owner->result_ok);
7147 return Pong_clone(&*owner->contents.result);
7149 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_ok"))) TS_CResult_PongDecodeErrorZ_get_ok(uint32_t owner) {
7150 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
7151 LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
7152 uintptr_t ret_ref = 0;
7153 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7154 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7155 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7156 ret_ref = (uintptr_t)ret_var.inner;
7157 if (ret_var.is_owned) {
7163 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
7164 CHECK(!owner->result_ok);
7165 return DecodeError_clone(&*owner->contents.err);
7167 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_err"))) TS_CResult_PongDecodeErrorZ_get_err(uint32_t owner) {
7168 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
7169 LDKDecodeError ret_var = CResult_PongDecodeErrorZ_get_err(owner_conv);
7170 uintptr_t ret_ref = 0;
7171 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7172 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7173 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7174 ret_ref = (uintptr_t)ret_var.inner;
7175 if (ret_var.is_owned) {
7181 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7182 CHECK(owner->result_ok);
7183 return UnsignedChannelAnnouncement_clone(&*owner->contents.result);
7185 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
7186 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
7187 LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
7188 uintptr_t ret_ref = 0;
7189 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7190 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7191 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7192 ret_ref = (uintptr_t)ret_var.inner;
7193 if (ret_var.is_owned) {
7199 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7200 CHECK(!owner->result_ok);
7201 return DecodeError_clone(&*owner->contents.err);
7203 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
7204 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
7205 LDKDecodeError ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
7206 uintptr_t ret_ref = 0;
7207 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7208 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7209 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7210 ret_ref = (uintptr_t)ret_var.inner;
7211 if (ret_var.is_owned) {
7217 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7218 CHECK(owner->result_ok);
7219 return ChannelAnnouncement_clone(&*owner->contents.result);
7221 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
7222 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
7223 LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
7224 uintptr_t ret_ref = 0;
7225 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7226 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7227 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7228 ret_ref = (uintptr_t)ret_var.inner;
7229 if (ret_var.is_owned) {
7235 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7236 CHECK(!owner->result_ok);
7237 return DecodeError_clone(&*owner->contents.err);
7239 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
7240 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
7241 LDKDecodeError ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
7242 uintptr_t ret_ref = 0;
7243 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7244 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7245 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7246 ret_ref = (uintptr_t)ret_var.inner;
7247 if (ret_var.is_owned) {
7253 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7254 CHECK(owner->result_ok);
7255 return UnsignedChannelUpdate_clone(&*owner->contents.result);
7257 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint32_t owner) {
7258 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
7259 LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
7260 uintptr_t ret_ref = 0;
7261 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7262 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7263 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7264 ret_ref = (uintptr_t)ret_var.inner;
7265 if (ret_var.is_owned) {
7271 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7272 CHECK(!owner->result_ok);
7273 return DecodeError_clone(&*owner->contents.err);
7275 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint32_t owner) {
7276 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
7277 LDKDecodeError ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
7278 uintptr_t ret_ref = 0;
7279 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7280 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7281 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7282 ret_ref = (uintptr_t)ret_var.inner;
7283 if (ret_var.is_owned) {
7289 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7290 CHECK(owner->result_ok);
7291 return ChannelUpdate_clone(&*owner->contents.result);
7293 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_ok(uint32_t owner) {
7294 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
7295 LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
7296 uintptr_t ret_ref = 0;
7297 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7298 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7299 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7300 ret_ref = (uintptr_t)ret_var.inner;
7301 if (ret_var.is_owned) {
7307 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7308 CHECK(!owner->result_ok);
7309 return DecodeError_clone(&*owner->contents.err);
7311 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_err(uint32_t owner) {
7312 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
7313 LDKDecodeError ret_var = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
7314 uintptr_t ret_ref = 0;
7315 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7316 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7317 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7318 ret_ref = (uintptr_t)ret_var.inner;
7319 if (ret_var.is_owned) {
7325 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
7326 CHECK(owner->result_ok);
7327 return ErrorMessage_clone(&*owner->contents.result);
7329 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_get_ok(uint32_t owner) {
7330 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
7331 LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
7332 uintptr_t ret_ref = 0;
7333 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7334 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7335 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7336 ret_ref = (uintptr_t)ret_var.inner;
7337 if (ret_var.is_owned) {
7343 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
7344 CHECK(!owner->result_ok);
7345 return DecodeError_clone(&*owner->contents.err);
7347 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_err"))) TS_CResult_ErrorMessageDecodeErrorZ_get_err(uint32_t owner) {
7348 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
7349 LDKDecodeError ret_var = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
7350 uintptr_t ret_ref = 0;
7351 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7352 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7353 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7354 ret_ref = (uintptr_t)ret_var.inner;
7355 if (ret_var.is_owned) {
7361 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
7362 CHECK(owner->result_ok);
7363 return WarningMessage_clone(&*owner->contents.result);
7365 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_ok"))) TS_CResult_WarningMessageDecodeErrorZ_get_ok(uint32_t owner) {
7366 LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(owner & ~1);
7367 LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
7368 uintptr_t ret_ref = 0;
7369 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7370 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7371 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7372 ret_ref = (uintptr_t)ret_var.inner;
7373 if (ret_var.is_owned) {
7379 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
7380 CHECK(!owner->result_ok);
7381 return DecodeError_clone(&*owner->contents.err);
7383 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_err"))) TS_CResult_WarningMessageDecodeErrorZ_get_err(uint32_t owner) {
7384 LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(owner & ~1);
7385 LDKDecodeError ret_var = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
7386 uintptr_t ret_ref = 0;
7387 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7388 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7389 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7390 ret_ref = (uintptr_t)ret_var.inner;
7391 if (ret_var.is_owned) {
7397 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7398 CHECK(owner->result_ok);
7399 return UnsignedNodeAnnouncement_clone(&*owner->contents.result);
7401 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
7402 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
7403 LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
7404 uintptr_t ret_ref = 0;
7405 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7406 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7407 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7408 ret_ref = (uintptr_t)ret_var.inner;
7409 if (ret_var.is_owned) {
7415 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7416 CHECK(!owner->result_ok);
7417 return DecodeError_clone(&*owner->contents.err);
7419 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
7420 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
7421 LDKDecodeError ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
7422 uintptr_t ret_ref = 0;
7423 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7424 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7425 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7426 ret_ref = (uintptr_t)ret_var.inner;
7427 if (ret_var.is_owned) {
7433 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7434 CHECK(owner->result_ok);
7435 return NodeAnnouncement_clone(&*owner->contents.result);
7437 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok(uint32_t owner) {
7438 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
7439 LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
7440 uintptr_t ret_ref = 0;
7441 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7442 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7443 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7444 ret_ref = (uintptr_t)ret_var.inner;
7445 if (ret_var.is_owned) {
7451 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7452 CHECK(!owner->result_ok);
7453 return DecodeError_clone(&*owner->contents.err);
7455 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_err(uint32_t owner) {
7456 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
7457 LDKDecodeError ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
7458 uintptr_t ret_ref = 0;
7459 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7460 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7461 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7462 ret_ref = (uintptr_t)ret_var.inner;
7463 if (ret_var.is_owned) {
7469 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
7470 CHECK(owner->result_ok);
7471 return QueryShortChannelIds_clone(&*owner->contents.result);
7473 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint32_t owner) {
7474 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
7475 LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
7476 uintptr_t ret_ref = 0;
7477 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7478 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7479 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7480 ret_ref = (uintptr_t)ret_var.inner;
7481 if (ret_var.is_owned) {
7487 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
7488 CHECK(!owner->result_ok);
7489 return DecodeError_clone(&*owner->contents.err);
7491 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint32_t owner) {
7492 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
7493 LDKDecodeError ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
7494 uintptr_t ret_ref = 0;
7495 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7496 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7497 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7498 ret_ref = (uintptr_t)ret_var.inner;
7499 if (ret_var.is_owned) {
7505 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
7506 CHECK(owner->result_ok);
7507 return ReplyShortChannelIdsEnd_clone(&*owner->contents.result);
7509 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint32_t owner) {
7510 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
7511 LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
7512 uintptr_t ret_ref = 0;
7513 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7514 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7515 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7516 ret_ref = (uintptr_t)ret_var.inner;
7517 if (ret_var.is_owned) {
7523 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
7524 CHECK(!owner->result_ok);
7525 return DecodeError_clone(&*owner->contents.err);
7527 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint32_t owner) {
7528 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
7529 LDKDecodeError ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
7530 uintptr_t ret_ref = 0;
7531 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7532 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7533 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7534 ret_ref = (uintptr_t)ret_var.inner;
7535 if (ret_var.is_owned) {
7541 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7542 CHECK(owner->result_ok);
7543 return QueryChannelRange_clone(&*owner->contents.result);
7545 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok(uint32_t owner) {
7546 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
7547 LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
7548 uintptr_t ret_ref = 0;
7549 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7550 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7551 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7552 ret_ref = (uintptr_t)ret_var.inner;
7553 if (ret_var.is_owned) {
7559 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7560 CHECK(!owner->result_ok);
7561 return DecodeError_clone(&*owner->contents.err);
7563 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_err(uint32_t owner) {
7564 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
7565 LDKDecodeError ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
7566 uintptr_t ret_ref = 0;
7567 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7568 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7569 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7570 ret_ref = (uintptr_t)ret_var.inner;
7571 if (ret_var.is_owned) {
7577 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7578 CHECK(owner->result_ok);
7579 return ReplyChannelRange_clone(&*owner->contents.result);
7581 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint32_t owner) {
7582 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
7583 LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
7584 uintptr_t ret_ref = 0;
7585 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7586 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7587 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7588 ret_ref = (uintptr_t)ret_var.inner;
7589 if (ret_var.is_owned) {
7595 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7596 CHECK(!owner->result_ok);
7597 return DecodeError_clone(&*owner->contents.err);
7599 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err(uint32_t owner) {
7600 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
7601 LDKDecodeError ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
7602 uintptr_t ret_ref = 0;
7603 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7604 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7605 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7606 ret_ref = (uintptr_t)ret_var.inner;
7607 if (ret_var.is_owned) {
7613 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
7614 CHECK(owner->result_ok);
7615 return GossipTimestampFilter_clone(&*owner->contents.result);
7617 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint32_t owner) {
7618 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
7619 LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
7620 uintptr_t ret_ref = 0;
7621 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7622 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7623 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7624 ret_ref = (uintptr_t)ret_var.inner;
7625 if (ret_var.is_owned) {
7631 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
7632 CHECK(!owner->result_ok);
7633 return DecodeError_clone(&*owner->contents.err);
7635 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err(uint32_t owner) {
7636 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
7637 LDKDecodeError ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
7638 uintptr_t ret_ref = 0;
7639 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7640 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7641 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7642 ret_ref = (uintptr_t)ret_var.inner;
7643 if (ret_var.is_owned) {
7649 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_ty_from_ptr"))) TS_LDKSignOrCreationError_ty_from_ptr(uint32_t ptr) {
7650 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
7652 case LDKSignOrCreationError_SignError: return 0;
7653 case LDKSignOrCreationError_CreationError: return 1;
7657 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_CreationError_get_creation_error"))) TS_LDKSignOrCreationError_CreationError_get_creation_error(uint32_t ptr) {
7658 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
7659 assert(obj->tag == LDKSignOrCreationError_CreationError);
7660 uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
7661 return creation_error_conv;
7663 static inline struct LDKInvoice CResult_InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
7664 CHECK(owner->result_ok);
7665 return Invoice_clone(&*owner->contents.result);
7667 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_ok(uint32_t owner) {
7668 LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(owner & ~1);
7669 LDKInvoice ret_var = CResult_InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
7670 uintptr_t ret_ref = 0;
7671 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7672 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7673 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7674 ret_ref = (uintptr_t)ret_var.inner;
7675 if (ret_var.is_owned) {
7681 static inline struct LDKSignOrCreationError CResult_InvoiceSignOrCreationErrorZ_get_err(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
7682 CHECK(!owner->result_ok);
7683 return SignOrCreationError_clone(&*owner->contents.err);
7685 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_err(uint32_t owner) {
7686 LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(owner & ~1);
7687 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
7688 *ret_copy = CResult_InvoiceSignOrCreationErrorZ_get_err(owner_conv);
7689 uintptr_t ret_ref = (uintptr_t)ret_copy;
7693 typedef struct LDKFilter_JCalls {
7694 atomic_size_t refcnt;
7695 uint32_t instance_ptr;
7697 static void LDKFilter_JCalls_free(void* this_arg) {
7698 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7699 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7703 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
7704 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7705 int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
7706 memcpy(txid_arr->elems, *txid, 32);
7707 LDKu8slice script_pubkey_var = script_pubkey;
7708 int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__);
7709 memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
7710 js_invoke_function_2(j_calls->instance_ptr, 32, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr);
7712 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
7713 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7714 LDKWatchedOutput output_var = output;
7715 uintptr_t output_ref = 0;
7716 CHECK((((uintptr_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7717 CHECK((((uintptr_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7718 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
7719 output_ref = (uintptr_t)output_var.inner;
7720 if (output_var.is_owned) {
7723 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 33, (uint32_t)output_ref);
7724 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
7725 CHECK_ACCESS(ret_ptr);
7726 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(ret_ptr);
7730 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
7731 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
7732 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7734 static inline LDKFilter LDKFilter_init (JSValue o) {
7735 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
7736 atomic_init(&calls->refcnt, 1);
7737 calls->instance_ptr = o;
7740 .this_arg = (void*) calls,
7741 .register_tx = register_tx_LDKFilter_jcall,
7742 .register_output = register_output_LDKFilter_jcall,
7743 .free = LDKFilter_JCalls_free,
7747 long __attribute__((export_name("TS_LDKFilter_new"))) TS_LDKFilter_new(JSValue o) {
7748 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
7749 *res_ptr = LDKFilter_init(o);
7750 return (long)res_ptr;
7752 void __attribute__((export_name("TS_Filter_register_tx"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
7753 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7754 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7755 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
7756 unsigned char txid_arr[32];
7757 CHECK(txid->arr_len == 32);
7758 memcpy(txid_arr, txid->elems, 32); FREE(txid);
7759 unsigned char (*txid_ref)[32] = &txid_arr;
7760 LDKu8slice script_pubkey_ref;
7761 script_pubkey_ref.datalen = script_pubkey->arr_len;
7762 script_pubkey_ref.data = script_pubkey->elems /* XXX script_pubkey leaks */;
7763 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
7766 uint32_t __attribute__((export_name("TS_Filter_register_output"))) TS_Filter_register_output(uint32_t this_arg, uint32_t output) {
7767 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7768 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7769 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
7770 LDKWatchedOutput output_conv;
7771 output_conv.inner = (void*)(output & (~1));
7772 output_conv.is_owned = (output & 1) || (output == 0);
7773 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
7774 output_conv = WatchedOutput_clone(&output_conv);
7775 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
7776 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
7777 uintptr_t ret_ref = (uintptr_t)ret_copy;
7781 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_ty_from_ptr"))) TS_LDKCOption_FilterZ_ty_from_ptr(uint32_t ptr) {
7782 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
7784 case LDKCOption_FilterZ_Some: return 0;
7785 case LDKCOption_FilterZ_None: return 1;
7789 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_Some_get_some"))) TS_LDKCOption_FilterZ_Some_get_some(uint32_t ptr) {
7790 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
7791 assert(obj->tag == LDKCOption_FilterZ_Some);
7792 LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
7793 *some_ret = obj->some;
7794 // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
7795 return (uintptr_t)some_ret;
7797 static inline struct LDKLockedChannelMonitor *CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
7798 CHECK(owner->result_ok);
7799 return &*owner->contents.result;
7801 uint32_t __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_ok"))) TS_CResult_LockedChannelMonitorNoneZ_get_ok(uint32_t owner) {
7802 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
7803 LDKLockedChannelMonitor ret_var = *CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
7804 uintptr_t ret_ref = 0;
7805 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7806 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7807 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7808 ret_ref = (uintptr_t)ret_var.inner & ~1;
7812 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
7813 CHECK(!owner->result_ok);
7814 return *owner->contents.err;
7816 void __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_err"))) TS_CResult_LockedChannelMonitorNoneZ_get_err(uint32_t owner) {
7817 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
7818 CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
7821 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
7822 LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
7823 for (size_t i = 0; i < ret.datalen; i++) {
7824 ret.data[i] = OutPoint_clone(&orig->data[i]);
7828 typedef struct LDKMessageSendEventsProvider_JCalls {
7829 atomic_size_t refcnt;
7830 uint32_t instance_ptr;
7831 } LDKMessageSendEventsProvider_JCalls;
7832 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
7833 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
7834 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7838 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
7839 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
7840 uint32_tArray ret = (uint32_tArray)js_invoke_function_0(j_calls->instance_ptr, 34);
7841 LDKCVec_MessageSendEventZ ret_constr;
7842 ret_constr.datalen = ret->arr_len;
7843 if (ret_constr.datalen > 0)
7844 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
7846 ret_constr.data = NULL;
7847 uint32_t* ret_vals = ret->elems /* XXX ret leaks */;
7848 for (size_t s = 0; s < ret_constr.datalen; s++) {
7849 uint32_t ret_conv_18 = ret_vals[s];
7850 void* ret_conv_18_ptr = (void*)(((uintptr_t)ret_conv_18) & ~1);
7851 CHECK_ACCESS(ret_conv_18_ptr);
7852 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
7853 FREE((void*)ret_conv_18);
7854 ret_constr.data[s] = ret_conv_18_conv;
7858 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
7859 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
7860 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7862 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JSValue o) {
7863 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
7864 atomic_init(&calls->refcnt, 1);
7865 calls->instance_ptr = o;
7867 LDKMessageSendEventsProvider ret = {
7868 .this_arg = (void*) calls,
7869 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
7870 .free = LDKMessageSendEventsProvider_JCalls_free,
7874 long __attribute__((export_name("TS_LDKMessageSendEventsProvider_new"))) TS_LDKMessageSendEventsProvider_new(JSValue o) {
7875 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
7876 *res_ptr = LDKMessageSendEventsProvider_init(o);
7877 return (long)res_ptr;
7879 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) {
7880 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7881 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7882 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
7883 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
7884 uint32_tArray ret_arr = NULL;
7885 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
7886 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
7887 for (size_t s = 0; s < ret_var.datalen; s++) {
7888 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
7889 *ret_conv_18_copy = ret_var.data[s];
7890 uintptr_t ret_conv_18_ref = (uintptr_t)ret_conv_18_copy;
7891 ret_arr_ptr[s] = ret_conv_18_ref;
7898 typedef struct LDKEventHandler_JCalls {
7899 atomic_size_t refcnt;
7900 uint32_t instance_ptr;
7901 } LDKEventHandler_JCalls;
7902 static void LDKEventHandler_JCalls_free(void* this_arg) {
7903 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
7904 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7908 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
7909 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
7910 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
7911 *ret_event = Event_clone(event);
7912 js_invoke_function_1(j_calls->instance_ptr, 35, (uint32_t)(uintptr_t)ret_event);
7914 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
7915 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
7916 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7918 static inline LDKEventHandler LDKEventHandler_init (JSValue o) {
7919 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
7920 atomic_init(&calls->refcnt, 1);
7921 calls->instance_ptr = o;
7923 LDKEventHandler ret = {
7924 .this_arg = (void*) calls,
7925 .handle_event = handle_event_LDKEventHandler_jcall,
7926 .free = LDKEventHandler_JCalls_free,
7930 long __attribute__((export_name("TS_LDKEventHandler_new"))) TS_LDKEventHandler_new(JSValue o) {
7931 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
7932 *res_ptr = LDKEventHandler_init(o);
7933 return (long)res_ptr;
7935 void __attribute__((export_name("TS_EventHandler_handle_event"))) TS_EventHandler_handle_event(uint32_t this_arg, uint32_t event) {
7936 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7937 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7938 LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
7939 LDKEvent* event_conv = (LDKEvent*)event;
7940 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
7943 typedef struct LDKEventsProvider_JCalls {
7944 atomic_size_t refcnt;
7945 uint32_t instance_ptr;
7946 } LDKEventsProvider_JCalls;
7947 static void LDKEventsProvider_JCalls_free(void* this_arg) {
7948 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
7949 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7953 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
7954 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
7955 LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
7956 *handler_ret = handler;
7957 js_invoke_function_1(j_calls->instance_ptr, 36, (uint32_t)(uintptr_t)handler_ret);
7959 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
7960 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
7961 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7963 static inline LDKEventsProvider LDKEventsProvider_init (JSValue o) {
7964 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
7965 atomic_init(&calls->refcnt, 1);
7966 calls->instance_ptr = o;
7968 LDKEventsProvider ret = {
7969 .this_arg = (void*) calls,
7970 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
7971 .free = LDKEventsProvider_JCalls_free,
7975 long __attribute__((export_name("TS_LDKEventsProvider_new"))) TS_LDKEventsProvider_new(JSValue o) {
7976 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
7977 *res_ptr = LDKEventsProvider_init(o);
7978 return (long)res_ptr;
7980 void __attribute__((export_name("TS_EventsProvider_process_pending_events"))) TS_EventsProvider_process_pending_events(uint32_t this_arg, uint32_t handler) {
7981 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7982 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7983 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
7984 void* handler_ptr = (void*)(((uintptr_t)handler) & ~1);
7985 CHECK_ACCESS(handler_ptr);
7986 LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
7987 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
7990 typedef struct LDKListen_JCalls {
7991 atomic_size_t refcnt;
7992 uint32_t instance_ptr;
7994 static void LDKListen_JCalls_free(void* this_arg) {
7995 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
7996 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8000 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
8001 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8002 LDKu8slice block_var = block;
8003 int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__);
8004 memcpy(block_arr->elems, block_var.data, block_var.datalen);
8005 js_invoke_function_2(j_calls->instance_ptr, 37, (uint32_t)block_arr, (uint32_t)height);
8007 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
8008 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8009 int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8010 memcpy(header_arr->elems, *header, 80);
8011 js_invoke_function_2(j_calls->instance_ptr, 38, (uint32_t)header_arr, (uint32_t)height);
8013 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
8014 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
8015 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8017 static inline LDKListen LDKListen_init (JSValue o) {
8018 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
8019 atomic_init(&calls->refcnt, 1);
8020 calls->instance_ptr = o;
8023 .this_arg = (void*) calls,
8024 .block_connected = block_connected_LDKListen_jcall,
8025 .block_disconnected = block_disconnected_LDKListen_jcall,
8026 .free = LDKListen_JCalls_free,
8030 long __attribute__((export_name("TS_LDKListen_new"))) TS_LDKListen_new(JSValue o) {
8031 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
8032 *res_ptr = LDKListen_init(o);
8033 return (long)res_ptr;
8035 void __attribute__((export_name("TS_Listen_block_connected"))) TS_Listen_block_connected(uint32_t this_arg, int8_tArray block, int32_t height) {
8036 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8037 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8038 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8039 LDKu8slice block_ref;
8040 block_ref.datalen = block->arr_len;
8041 block_ref.data = block->elems /* XXX block leaks */;
8042 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
8045 void __attribute__((export_name("TS_Listen_block_disconnected"))) TS_Listen_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height) {
8046 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8047 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8048 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8049 unsigned char header_arr[80];
8050 CHECK(header->arr_len == 80);
8051 memcpy(header_arr, header->elems, 80); FREE(header);
8052 unsigned char (*header_ref)[80] = &header_arr;
8053 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
8056 typedef struct LDKConfirm_JCalls {
8057 atomic_size_t refcnt;
8058 uint32_t instance_ptr;
8059 } LDKConfirm_JCalls;
8060 static void LDKConfirm_JCalls_free(void* this_arg) {
8061 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8062 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8066 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
8067 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8068 int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8069 memcpy(header_arr->elems, *header, 80);
8070 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
8071 uint32_tArray txdata_arr = NULL;
8072 txdata_arr = init_uint32_tArray(txdata_var.datalen, __LINE__);
8073 uint32_t *txdata_arr_ptr = (uint32_t*)(((uint8_t*)txdata_arr) + 4);
8074 for (size_t c = 0; c < txdata_var.datalen; c++) {
8075 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
8076 *txdata_conv_28_conv = txdata_var.data[c];
8077 txdata_arr_ptr[c] = ((uintptr_t)txdata_conv_28_conv);
8080 FREE(txdata_var.data);
8081 js_invoke_function_3(j_calls->instance_ptr, 39, (uint32_t)header_arr, (uint32_t)txdata_arr, (uint32_t)height);
8083 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
8084 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8085 int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
8086 memcpy(txid_arr->elems, *txid, 32);
8087 js_invoke_function_1(j_calls->instance_ptr, 40, (uint32_t)txid_arr);
8089 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
8090 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8091 int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8092 memcpy(header_arr->elems, *header, 80);
8093 js_invoke_function_2(j_calls->instance_ptr, 41, (uint32_t)header_arr, (uint32_t)height);
8095 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
8096 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8097 ptrArray ret = (ptrArray)js_invoke_function_0(j_calls->instance_ptr, 42);
8098 LDKCVec_TxidZ ret_constr;
8099 ret_constr.datalen = ret->arr_len;
8100 if (ret_constr.datalen > 0)
8101 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
8103 ret_constr.data = NULL;
8104 int8_tArray* ret_vals = (void*) ret->elems /* XXX ret leaks */;
8105 for (size_t m = 0; m < ret_constr.datalen; m++) {
8106 int8_tArray ret_conv_12 = ret_vals[m];
8107 LDKThirtyTwoBytes ret_conv_12_ref;
8108 CHECK(ret_conv_12->arr_len == 32);
8109 memcpy(ret_conv_12_ref.data, ret_conv_12->elems, 32); FREE(ret_conv_12);
8110 ret_constr.data[m] = ret_conv_12_ref;
8114 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
8115 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
8116 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8118 static inline LDKConfirm LDKConfirm_init (JSValue o) {
8119 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
8120 atomic_init(&calls->refcnt, 1);
8121 calls->instance_ptr = o;
8124 .this_arg = (void*) calls,
8125 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
8126 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
8127 .best_block_updated = best_block_updated_LDKConfirm_jcall,
8128 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
8129 .free = LDKConfirm_JCalls_free,
8133 long __attribute__((export_name("TS_LDKConfirm_new"))) TS_LDKConfirm_new(JSValue o) {
8134 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
8135 *res_ptr = LDKConfirm_init(o);
8136 return (long)res_ptr;
8138 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) {
8139 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8140 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8141 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8142 unsigned char header_arr[80];
8143 CHECK(header->arr_len == 80);
8144 memcpy(header_arr, header->elems, 80); FREE(header);
8145 unsigned char (*header_ref)[80] = &header_arr;
8146 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
8147 txdata_constr.datalen = txdata->arr_len;
8148 if (txdata_constr.datalen > 0)
8149 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8151 txdata_constr.data = NULL;
8152 uint32_t* txdata_vals = txdata->elems /* XXX txdata leaks */;
8153 for (size_t c = 0; c < txdata_constr.datalen; c++) {
8154 uint32_t txdata_conv_28 = txdata_vals[c];
8155 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
8156 CHECK_ACCESS(txdata_conv_28_ptr);
8157 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
8158 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
8159 txdata_constr.data[c] = txdata_conv_28_conv;
8161 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
8164 void __attribute__((export_name("TS_Confirm_transaction_unconfirmed"))) TS_Confirm_transaction_unconfirmed(uint32_t this_arg, int8_tArray txid) {
8165 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8166 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8167 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8168 unsigned char txid_arr[32];
8169 CHECK(txid->arr_len == 32);
8170 memcpy(txid_arr, txid->elems, 32); FREE(txid);
8171 unsigned char (*txid_ref)[32] = &txid_arr;
8172 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
8175 void __attribute__((export_name("TS_Confirm_best_block_updated"))) TS_Confirm_best_block_updated(uint32_t this_arg, int8_tArray header, int32_t height) {
8176 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8177 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8178 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8179 unsigned char header_arr[80];
8180 CHECK(header->arr_len == 80);
8181 memcpy(header_arr, header->elems, 80); FREE(header);
8182 unsigned char (*header_ref)[80] = &header_arr;
8183 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
8186 ptrArray __attribute__((export_name("TS_Confirm_get_relevant_txids"))) TS_Confirm_get_relevant_txids(uint32_t this_arg) {
8187 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8188 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8189 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8190 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
8191 ptrArray ret_arr = NULL;
8192 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
8193 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
8194 for (size_t m = 0; m < ret_var.datalen; m++) {
8195 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
8196 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
8197 ret_arr_ptr[m] = ret_conv_12_arr;
8204 typedef struct LDKPersist_JCalls {
8205 atomic_size_t refcnt;
8206 uint32_t instance_ptr;
8207 } LDKPersist_JCalls;
8208 static void LDKPersist_JCalls_free(void* this_arg) {
8209 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8210 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8214 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
8215 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8216 LDKOutPoint channel_id_var = channel_id;
8217 uintptr_t channel_id_ref = 0;
8218 CHECK((((uintptr_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8219 CHECK((((uintptr_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8220 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
8221 channel_id_ref = (uintptr_t)channel_id_var.inner;
8222 if (channel_id_var.is_owned) {
8223 channel_id_ref |= 1;
8225 LDKChannelMonitor data_var = *data;
8226 uintptr_t data_ref = 0;
8227 data_var = ChannelMonitor_clone(data);
8228 CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8229 CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8230 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
8231 data_ref = (uintptr_t)data_var.inner;
8232 if (data_var.is_owned) {
8235 LDKMonitorUpdateId update_id_var = update_id;
8236 uintptr_t update_id_ref = 0;
8237 CHECK((((uintptr_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8238 CHECK((((uintptr_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8239 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
8240 update_id_ref = (uintptr_t)update_id_var.inner;
8241 if (update_id_var.is_owned) {
8244 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);
8245 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
8246 CHECK_ACCESS(ret_ptr);
8247 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
8251 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
8252 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8253 LDKOutPoint channel_id_var = channel_id;
8254 uintptr_t channel_id_ref = 0;
8255 CHECK((((uintptr_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8256 CHECK((((uintptr_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8257 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
8258 channel_id_ref = (uintptr_t)channel_id_var.inner;
8259 if (channel_id_var.is_owned) {
8260 channel_id_ref |= 1;
8262 LDKChannelMonitorUpdate update_var = *update;
8263 uintptr_t update_ref = 0;
8264 if ((uintptr_t)update_var.inner > 4096) {
8265 update_var = ChannelMonitorUpdate_clone(update);
8266 CHECK((((uintptr_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8267 CHECK((((uintptr_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8268 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
8269 update_ref = (uintptr_t)update_var.inner;
8270 if (update_var.is_owned) {
8274 LDKChannelMonitor data_var = *data;
8275 uintptr_t data_ref = 0;
8276 data_var = ChannelMonitor_clone(data);
8277 CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8278 CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8279 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
8280 data_ref = (uintptr_t)data_var.inner;
8281 if (data_var.is_owned) {
8284 LDKMonitorUpdateId update_id_var = update_id;
8285 uintptr_t update_id_ref = 0;
8286 CHECK((((uintptr_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8287 CHECK((((uintptr_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8288 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
8289 update_id_ref = (uintptr_t)update_id_var.inner;
8290 if (update_id_var.is_owned) {
8293 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);
8294 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
8295 CHECK_ACCESS(ret_ptr);
8296 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
8300 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
8301 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
8302 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8304 static inline LDKPersist LDKPersist_init (JSValue o) {
8305 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
8306 atomic_init(&calls->refcnt, 1);
8307 calls->instance_ptr = o;
8310 .this_arg = (void*) calls,
8311 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
8312 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
8313 .free = LDKPersist_JCalls_free,
8317 long __attribute__((export_name("TS_LDKPersist_new"))) TS_LDKPersist_new(JSValue o) {
8318 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
8319 *res_ptr = LDKPersist_init(o);
8320 return (long)res_ptr;
8322 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) {
8323 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8324 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8325 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
8326 LDKOutPoint channel_id_conv;
8327 channel_id_conv.inner = (void*)(channel_id & (~1));
8328 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
8329 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
8330 channel_id_conv = OutPoint_clone(&channel_id_conv);
8331 LDKChannelMonitor data_conv;
8332 data_conv.inner = (void*)(data & (~1));
8333 data_conv.is_owned = false;
8334 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
8335 LDKMonitorUpdateId update_id_conv;
8336 update_id_conv.inner = (void*)(update_id & (~1));
8337 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
8338 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
8339 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
8340 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
8341 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv);
8342 return (uintptr_t)ret_conv;
8345 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) {
8346 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8347 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8348 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
8349 LDKOutPoint channel_id_conv;
8350 channel_id_conv.inner = (void*)(channel_id & (~1));
8351 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
8352 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
8353 channel_id_conv = OutPoint_clone(&channel_id_conv);
8354 LDKChannelMonitorUpdate update_conv;
8355 update_conv.inner = (void*)(update & (~1));
8356 update_conv.is_owned = false;
8357 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
8358 LDKChannelMonitor data_conv;
8359 data_conv.inner = (void*)(data & (~1));
8360 data_conv.is_owned = false;
8361 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
8362 LDKMonitorUpdateId update_id_conv;
8363 update_id_conv.inner = (void*)(update_id & (~1));
8364 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
8365 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
8366 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
8367 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
8368 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv);
8369 return (uintptr_t)ret_conv;
8372 typedef struct LDKChannelMessageHandler_JCalls {
8373 atomic_size_t refcnt;
8374 uint32_t instance_ptr;
8375 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
8376 } LDKChannelMessageHandler_JCalls;
8377 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
8378 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8379 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8383 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
8384 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8385 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8386 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8387 LDKInitFeatures their_features_var = their_features;
8388 uintptr_t their_features_ref = 0;
8389 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8390 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8391 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
8392 their_features_ref = (uintptr_t)their_features_var.inner;
8393 if (their_features_var.is_owned) {
8394 their_features_ref |= 1;
8396 LDKOpenChannel msg_var = *msg;
8397 uintptr_t msg_ref = 0;
8398 msg_var = OpenChannel_clone(msg);
8399 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8400 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8401 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8402 msg_ref = (uintptr_t)msg_var.inner;
8403 if (msg_var.is_owned) {
8406 js_invoke_function_3(j_calls->instance_ptr, 45, (uint32_t)their_node_id_arr, (uint32_t)their_features_ref, (uint32_t)msg_ref);
8408 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
8409 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8410 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8411 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8412 LDKInitFeatures their_features_var = their_features;
8413 uintptr_t their_features_ref = 0;
8414 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8415 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8416 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
8417 their_features_ref = (uintptr_t)their_features_var.inner;
8418 if (their_features_var.is_owned) {
8419 their_features_ref |= 1;
8421 LDKAcceptChannel msg_var = *msg;
8422 uintptr_t msg_ref = 0;
8423 msg_var = AcceptChannel_clone(msg);
8424 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8425 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8426 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8427 msg_ref = (uintptr_t)msg_var.inner;
8428 if (msg_var.is_owned) {
8431 js_invoke_function_3(j_calls->instance_ptr, 46, (uint32_t)their_node_id_arr, (uint32_t)their_features_ref, (uint32_t)msg_ref);
8433 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
8434 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8435 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8436 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8437 LDKFundingCreated msg_var = *msg;
8438 uintptr_t msg_ref = 0;
8439 msg_var = FundingCreated_clone(msg);
8440 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8441 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8442 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8443 msg_ref = (uintptr_t)msg_var.inner;
8444 if (msg_var.is_owned) {
8447 js_invoke_function_2(j_calls->instance_ptr, 47, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8449 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
8450 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8451 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8452 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8453 LDKFundingSigned msg_var = *msg;
8454 uintptr_t msg_ref = 0;
8455 msg_var = FundingSigned_clone(msg);
8456 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8457 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8458 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8459 msg_ref = (uintptr_t)msg_var.inner;
8460 if (msg_var.is_owned) {
8463 js_invoke_function_2(j_calls->instance_ptr, 48, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8465 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
8466 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8467 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8468 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8469 LDKFundingLocked msg_var = *msg;
8470 uintptr_t msg_ref = 0;
8471 msg_var = FundingLocked_clone(msg);
8472 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8473 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8474 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8475 msg_ref = (uintptr_t)msg_var.inner;
8476 if (msg_var.is_owned) {
8479 js_invoke_function_2(j_calls->instance_ptr, 49, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8481 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
8482 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8483 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8484 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8485 LDKInitFeatures their_features_var = *their_features;
8486 uintptr_t their_features_ref = 0;
8487 their_features_var = InitFeatures_clone(their_features);
8488 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8489 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8490 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
8491 their_features_ref = (uintptr_t)their_features_var.inner;
8492 if (their_features_var.is_owned) {
8493 their_features_ref |= 1;
8495 LDKShutdown msg_var = *msg;
8496 uintptr_t msg_ref = 0;
8497 msg_var = Shutdown_clone(msg);
8498 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8499 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8500 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8501 msg_ref = (uintptr_t)msg_var.inner;
8502 if (msg_var.is_owned) {
8505 js_invoke_function_3(j_calls->instance_ptr, 50, (uint32_t)their_node_id_arr, (uint32_t)their_features_ref, (uint32_t)msg_ref);
8507 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
8508 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8509 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8510 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8511 LDKClosingSigned msg_var = *msg;
8512 uintptr_t msg_ref = 0;
8513 msg_var = ClosingSigned_clone(msg);
8514 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8515 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8516 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8517 msg_ref = (uintptr_t)msg_var.inner;
8518 if (msg_var.is_owned) {
8521 js_invoke_function_2(j_calls->instance_ptr, 51, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8523 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
8524 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8525 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8526 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8527 LDKUpdateAddHTLC msg_var = *msg;
8528 uintptr_t msg_ref = 0;
8529 msg_var = UpdateAddHTLC_clone(msg);
8530 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8531 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8532 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8533 msg_ref = (uintptr_t)msg_var.inner;
8534 if (msg_var.is_owned) {
8537 js_invoke_function_2(j_calls->instance_ptr, 52, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8539 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
8540 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8541 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8542 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8543 LDKUpdateFulfillHTLC msg_var = *msg;
8544 uintptr_t msg_ref = 0;
8545 msg_var = UpdateFulfillHTLC_clone(msg);
8546 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8547 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8548 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8549 msg_ref = (uintptr_t)msg_var.inner;
8550 if (msg_var.is_owned) {
8553 js_invoke_function_2(j_calls->instance_ptr, 53, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8555 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
8556 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8557 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8558 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8559 LDKUpdateFailHTLC msg_var = *msg;
8560 uintptr_t msg_ref = 0;
8561 msg_var = UpdateFailHTLC_clone(msg);
8562 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8563 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8564 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8565 msg_ref = (uintptr_t)msg_var.inner;
8566 if (msg_var.is_owned) {
8569 js_invoke_function_2(j_calls->instance_ptr, 54, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8571 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
8572 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8573 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8574 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8575 LDKUpdateFailMalformedHTLC msg_var = *msg;
8576 uintptr_t msg_ref = 0;
8577 msg_var = UpdateFailMalformedHTLC_clone(msg);
8578 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8579 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8580 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8581 msg_ref = (uintptr_t)msg_var.inner;
8582 if (msg_var.is_owned) {
8585 js_invoke_function_2(j_calls->instance_ptr, 55, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8587 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
8588 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8589 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8590 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8591 LDKCommitmentSigned msg_var = *msg;
8592 uintptr_t msg_ref = 0;
8593 msg_var = CommitmentSigned_clone(msg);
8594 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8595 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8596 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8597 msg_ref = (uintptr_t)msg_var.inner;
8598 if (msg_var.is_owned) {
8601 js_invoke_function_2(j_calls->instance_ptr, 56, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8603 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
8604 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8605 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8606 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8607 LDKRevokeAndACK msg_var = *msg;
8608 uintptr_t msg_ref = 0;
8609 msg_var = RevokeAndACK_clone(msg);
8610 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8611 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8612 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8613 msg_ref = (uintptr_t)msg_var.inner;
8614 if (msg_var.is_owned) {
8617 js_invoke_function_2(j_calls->instance_ptr, 57, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8619 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
8620 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8621 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8622 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8623 LDKUpdateFee msg_var = *msg;
8624 uintptr_t msg_ref = 0;
8625 msg_var = UpdateFee_clone(msg);
8626 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8627 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8628 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8629 msg_ref = (uintptr_t)msg_var.inner;
8630 if (msg_var.is_owned) {
8633 js_invoke_function_2(j_calls->instance_ptr, 58, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8635 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
8636 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8637 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8638 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8639 LDKAnnouncementSignatures msg_var = *msg;
8640 uintptr_t msg_ref = 0;
8641 msg_var = AnnouncementSignatures_clone(msg);
8642 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8643 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8644 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8645 msg_ref = (uintptr_t)msg_var.inner;
8646 if (msg_var.is_owned) {
8649 js_invoke_function_2(j_calls->instance_ptr, 59, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8651 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
8652 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8653 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8654 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8655 js_invoke_function_2(j_calls->instance_ptr, 60, (uint32_t)their_node_id_arr, (uint32_t)no_connection_possible);
8657 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
8658 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8659 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8660 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8661 LDKInit msg_var = *msg;
8662 uintptr_t msg_ref = 0;
8663 msg_var = Init_clone(msg);
8664 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8665 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8666 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8667 msg_ref = (uintptr_t)msg_var.inner;
8668 if (msg_var.is_owned) {
8671 js_invoke_function_2(j_calls->instance_ptr, 61, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8673 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
8674 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8675 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8676 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8677 LDKChannelReestablish msg_var = *msg;
8678 uintptr_t msg_ref = 0;
8679 msg_var = ChannelReestablish_clone(msg);
8680 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8681 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8682 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8683 msg_ref = (uintptr_t)msg_var.inner;
8684 if (msg_var.is_owned) {
8687 js_invoke_function_2(j_calls->instance_ptr, 62, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8689 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
8690 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8691 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8692 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8693 LDKChannelUpdate msg_var = *msg;
8694 uintptr_t msg_ref = 0;
8695 msg_var = ChannelUpdate_clone(msg);
8696 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8697 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8698 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8699 msg_ref = (uintptr_t)msg_var.inner;
8700 if (msg_var.is_owned) {
8703 js_invoke_function_2(j_calls->instance_ptr, 63, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8705 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
8706 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8707 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
8708 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
8709 LDKErrorMessage msg_var = *msg;
8710 uintptr_t msg_ref = 0;
8711 msg_var = ErrorMessage_clone(msg);
8712 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8713 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8714 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
8715 msg_ref = (uintptr_t)msg_var.inner;
8716 if (msg_var.is_owned) {
8719 js_invoke_function_2(j_calls->instance_ptr, 64, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
8721 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
8722 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
8723 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8724 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
8726 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
8727 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
8728 atomic_init(&calls->refcnt, 1);
8729 calls->instance_ptr = o;
8731 LDKChannelMessageHandler ret = {
8732 .this_arg = (void*) calls,
8733 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
8734 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
8735 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
8736 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
8737 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
8738 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
8739 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
8740 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
8741 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
8742 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
8743 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
8744 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
8745 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
8746 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
8747 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
8748 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
8749 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
8750 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
8751 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
8752 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
8753 .free = LDKChannelMessageHandler_JCalls_free,
8754 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
8756 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
8759 long __attribute__((export_name("TS_LDKChannelMessageHandler_new"))) TS_LDKChannelMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
8760 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
8761 *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
8762 return (long)res_ptr;
8764 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) {
8765 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8766 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8767 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8768 LDKPublicKey their_node_id_ref;
8769 CHECK(their_node_id->arr_len == 33);
8770 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8771 LDKInitFeatures their_features_conv;
8772 their_features_conv.inner = (void*)(their_features & (~1));
8773 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
8774 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
8775 their_features_conv = InitFeatures_clone(&their_features_conv);
8776 LDKOpenChannel msg_conv;
8777 msg_conv.inner = (void*)(msg & (~1));
8778 msg_conv.is_owned = false;
8779 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8780 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
8783 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) {
8784 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8785 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8786 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8787 LDKPublicKey their_node_id_ref;
8788 CHECK(their_node_id->arr_len == 33);
8789 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8790 LDKInitFeatures their_features_conv;
8791 their_features_conv.inner = (void*)(their_features & (~1));
8792 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
8793 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
8794 their_features_conv = InitFeatures_clone(&their_features_conv);
8795 LDKAcceptChannel msg_conv;
8796 msg_conv.inner = (void*)(msg & (~1));
8797 msg_conv.is_owned = false;
8798 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8799 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
8802 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) {
8803 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8804 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8805 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8806 LDKPublicKey their_node_id_ref;
8807 CHECK(their_node_id->arr_len == 33);
8808 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8809 LDKFundingCreated msg_conv;
8810 msg_conv.inner = (void*)(msg & (~1));
8811 msg_conv.is_owned = false;
8812 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8813 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8816 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) {
8817 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8818 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8819 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8820 LDKPublicKey their_node_id_ref;
8821 CHECK(their_node_id->arr_len == 33);
8822 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8823 LDKFundingSigned msg_conv;
8824 msg_conv.inner = (void*)(msg & (~1));
8825 msg_conv.is_owned = false;
8826 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8827 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8830 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) {
8831 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8832 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8833 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8834 LDKPublicKey their_node_id_ref;
8835 CHECK(their_node_id->arr_len == 33);
8836 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8837 LDKFundingLocked msg_conv;
8838 msg_conv.inner = (void*)(msg & (~1));
8839 msg_conv.is_owned = false;
8840 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8841 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8844 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) {
8845 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8846 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8847 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8848 LDKPublicKey their_node_id_ref;
8849 CHECK(their_node_id->arr_len == 33);
8850 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8851 LDKInitFeatures their_features_conv;
8852 their_features_conv.inner = (void*)(their_features & (~1));
8853 their_features_conv.is_owned = false;
8854 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
8855 LDKShutdown msg_conv;
8856 msg_conv.inner = (void*)(msg & (~1));
8857 msg_conv.is_owned = false;
8858 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8859 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
8862 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) {
8863 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8864 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8865 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8866 LDKPublicKey their_node_id_ref;
8867 CHECK(their_node_id->arr_len == 33);
8868 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8869 LDKClosingSigned msg_conv;
8870 msg_conv.inner = (void*)(msg & (~1));
8871 msg_conv.is_owned = false;
8872 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8873 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8876 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) {
8877 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8878 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8879 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8880 LDKPublicKey their_node_id_ref;
8881 CHECK(their_node_id->arr_len == 33);
8882 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8883 LDKUpdateAddHTLC msg_conv;
8884 msg_conv.inner = (void*)(msg & (~1));
8885 msg_conv.is_owned = false;
8886 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8887 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8890 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) {
8891 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8892 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8893 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8894 LDKPublicKey their_node_id_ref;
8895 CHECK(their_node_id->arr_len == 33);
8896 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8897 LDKUpdateFulfillHTLC msg_conv;
8898 msg_conv.inner = (void*)(msg & (~1));
8899 msg_conv.is_owned = false;
8900 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8901 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8904 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) {
8905 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8906 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8907 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8908 LDKPublicKey their_node_id_ref;
8909 CHECK(their_node_id->arr_len == 33);
8910 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8911 LDKUpdateFailHTLC msg_conv;
8912 msg_conv.inner = (void*)(msg & (~1));
8913 msg_conv.is_owned = false;
8914 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8915 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8918 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) {
8919 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8920 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8921 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8922 LDKPublicKey their_node_id_ref;
8923 CHECK(their_node_id->arr_len == 33);
8924 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8925 LDKUpdateFailMalformedHTLC msg_conv;
8926 msg_conv.inner = (void*)(msg & (~1));
8927 msg_conv.is_owned = false;
8928 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8929 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8932 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) {
8933 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8934 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8935 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8936 LDKPublicKey their_node_id_ref;
8937 CHECK(their_node_id->arr_len == 33);
8938 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8939 LDKCommitmentSigned msg_conv;
8940 msg_conv.inner = (void*)(msg & (~1));
8941 msg_conv.is_owned = false;
8942 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8943 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8946 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) {
8947 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8948 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8949 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8950 LDKPublicKey their_node_id_ref;
8951 CHECK(their_node_id->arr_len == 33);
8952 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8953 LDKRevokeAndACK msg_conv;
8954 msg_conv.inner = (void*)(msg & (~1));
8955 msg_conv.is_owned = false;
8956 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8957 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8960 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) {
8961 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8962 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8963 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8964 LDKPublicKey their_node_id_ref;
8965 CHECK(their_node_id->arr_len == 33);
8966 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8967 LDKUpdateFee msg_conv;
8968 msg_conv.inner = (void*)(msg & (~1));
8969 msg_conv.is_owned = false;
8970 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8971 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8974 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) {
8975 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8976 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8977 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8978 LDKPublicKey their_node_id_ref;
8979 CHECK(their_node_id->arr_len == 33);
8980 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8981 LDKAnnouncementSignatures msg_conv;
8982 msg_conv.inner = (void*)(msg & (~1));
8983 msg_conv.is_owned = false;
8984 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
8985 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8988 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) {
8989 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8990 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8991 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
8992 LDKPublicKey their_node_id_ref;
8993 CHECK(their_node_id->arr_len == 33);
8994 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
8995 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
8998 void __attribute__((export_name("TS_ChannelMessageHandler_peer_connected"))) TS_ChannelMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
8999 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9000 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9001 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9002 LDKPublicKey their_node_id_ref;
9003 CHECK(their_node_id->arr_len == 33);
9004 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9006 msg_conv.inner = (void*)(msg & (~1));
9007 msg_conv.is_owned = false;
9008 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9009 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9012 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) {
9013 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9014 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9015 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9016 LDKPublicKey their_node_id_ref;
9017 CHECK(their_node_id->arr_len == 33);
9018 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9019 LDKChannelReestablish msg_conv;
9020 msg_conv.inner = (void*)(msg & (~1));
9021 msg_conv.is_owned = false;
9022 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9023 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9026 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) {
9027 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9028 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9029 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9030 LDKPublicKey their_node_id_ref;
9031 CHECK(their_node_id->arr_len == 33);
9032 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9033 LDKChannelUpdate msg_conv;
9034 msg_conv.inner = (void*)(msg & (~1));
9035 msg_conv.is_owned = false;
9036 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9037 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9040 void __attribute__((export_name("TS_ChannelMessageHandler_handle_error"))) TS_ChannelMessageHandler_handle_error(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
9041 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9042 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9043 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9044 LDKPublicKey their_node_id_ref;
9045 CHECK(their_node_id->arr_len == 33);
9046 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9047 LDKErrorMessage msg_conv;
9048 msg_conv.inner = (void*)(msg & (~1));
9049 msg_conv.is_owned = false;
9050 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9051 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9054 typedef struct LDKRoutingMessageHandler_JCalls {
9055 atomic_size_t refcnt;
9056 uint32_t instance_ptr;
9057 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
9058 } LDKRoutingMessageHandler_JCalls;
9059 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
9060 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9061 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9065 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
9066 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9067 LDKNodeAnnouncement msg_var = *msg;
9068 uintptr_t msg_ref = 0;
9069 msg_var = NodeAnnouncement_clone(msg);
9070 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9071 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9072 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9073 msg_ref = (uintptr_t)msg_var.inner;
9074 if (msg_var.is_owned) {
9077 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 65, (uint32_t)msg_ref);
9078 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9079 CHECK_ACCESS(ret_ptr);
9080 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9084 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
9085 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9086 LDKChannelAnnouncement msg_var = *msg;
9087 uintptr_t msg_ref = 0;
9088 msg_var = ChannelAnnouncement_clone(msg);
9089 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9090 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9091 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9092 msg_ref = (uintptr_t)msg_var.inner;
9093 if (msg_var.is_owned) {
9096 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 66, (uint32_t)msg_ref);
9097 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9098 CHECK_ACCESS(ret_ptr);
9099 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9103 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
9104 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9105 LDKChannelUpdate msg_var = *msg;
9106 uintptr_t msg_ref = 0;
9107 msg_var = ChannelUpdate_clone(msg);
9108 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9109 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9110 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9111 msg_ref = (uintptr_t)msg_var.inner;
9112 if (msg_var.is_owned) {
9115 uint32_t ret = js_invoke_function_1(j_calls->instance_ptr, 67, (uint32_t)msg_ref);
9116 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9117 CHECK_ACCESS(ret_ptr);
9118 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9122 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
9123 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9124 uint32_tArray ret = (uint32_tArray)js_invoke_function_2(j_calls->instance_ptr, 68, (uint32_t)starting_point, (uint32_t)batch_amount);
9125 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
9126 ret_constr.datalen = ret->arr_len;
9127 if (ret_constr.datalen > 0)
9128 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
9130 ret_constr.data = NULL;
9131 uint32_t* ret_vals = ret->elems /* XXX ret leaks */;
9132 for (size_t h = 0; h < ret_constr.datalen; h++) {
9133 uint32_t ret_conv_59 = ret_vals[h];
9134 void* ret_conv_59_ptr = (void*)(((uintptr_t)ret_conv_59) & ~1);
9135 CHECK_ACCESS(ret_conv_59_ptr);
9136 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ret_conv_59_ptr);
9137 FREE((void*)ret_conv_59);
9138 ret_constr.data[h] = ret_conv_59_conv;
9142 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
9143 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9144 int8_tArray starting_point_arr = init_int8_tArray(33, __LINE__);
9145 memcpy(starting_point_arr->elems, starting_point.compressed_form, 33);
9146 uint32_tArray ret = (uint32_tArray)js_invoke_function_2(j_calls->instance_ptr, 69, (uint32_t)starting_point_arr, (uint32_t)batch_amount);
9147 LDKCVec_NodeAnnouncementZ ret_constr;
9148 ret_constr.datalen = ret->arr_len;
9149 if (ret_constr.datalen > 0)
9150 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
9152 ret_constr.data = NULL;
9153 uint32_t* ret_vals = ret->elems /* XXX ret leaks */;
9154 for (size_t s = 0; s < ret_constr.datalen; s++) {
9155 uint32_t ret_conv_18 = ret_vals[s];
9156 LDKNodeAnnouncement ret_conv_18_conv;
9157 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
9158 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
9159 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_conv);
9160 ret_constr.data[s] = ret_conv_18_conv;
9164 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
9165 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9166 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9167 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9168 LDKInit init_var = *init;
9169 uintptr_t init_ref = 0;
9170 init_var = Init_clone(init);
9171 CHECK((((uintptr_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9172 CHECK((((uintptr_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9173 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
9174 init_ref = (uintptr_t)init_var.inner;
9175 if (init_var.is_owned) {
9178 js_invoke_function_2(j_calls->instance_ptr, 70, (uint32_t)their_node_id_arr, (uint32_t)init_ref);
9180 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
9181 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9182 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9183 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9184 LDKReplyChannelRange msg_var = msg;
9185 uintptr_t msg_ref = 0;
9186 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9187 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9188 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9189 msg_ref = (uintptr_t)msg_var.inner;
9190 if (msg_var.is_owned) {
9193 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 71, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9194 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9195 CHECK_ACCESS(ret_ptr);
9196 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9200 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
9201 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9202 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9203 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9204 LDKReplyShortChannelIdsEnd msg_var = msg;
9205 uintptr_t msg_ref = 0;
9206 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9207 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9208 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9209 msg_ref = (uintptr_t)msg_var.inner;
9210 if (msg_var.is_owned) {
9213 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 72, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9214 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9215 CHECK_ACCESS(ret_ptr);
9216 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9220 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
9221 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9222 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9223 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9224 LDKQueryChannelRange msg_var = msg;
9225 uintptr_t msg_ref = 0;
9226 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9227 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9228 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9229 msg_ref = (uintptr_t)msg_var.inner;
9230 if (msg_var.is_owned) {
9233 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 73, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9234 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9235 CHECK_ACCESS(ret_ptr);
9236 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9240 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
9241 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9242 int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9243 memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9244 LDKQueryShortChannelIds msg_var = msg;
9245 uintptr_t msg_ref = 0;
9246 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9247 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9248 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9249 msg_ref = (uintptr_t)msg_var.inner;
9250 if (msg_var.is_owned) {
9253 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 74, (uint32_t)their_node_id_arr, (uint32_t)msg_ref);
9254 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9255 CHECK_ACCESS(ret_ptr);
9256 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9260 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
9261 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
9262 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9263 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
9265 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
9266 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
9267 atomic_init(&calls->refcnt, 1);
9268 calls->instance_ptr = o;
9270 LDKRoutingMessageHandler ret = {
9271 .this_arg = (void*) calls,
9272 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
9273 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
9274 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
9275 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
9276 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
9277 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
9278 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
9279 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
9280 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
9281 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
9282 .free = LDKRoutingMessageHandler_JCalls_free,
9283 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
9285 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
9288 long __attribute__((export_name("TS_LDKRoutingMessageHandler_new"))) TS_LDKRoutingMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
9289 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
9290 *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
9291 return (long)res_ptr;
9293 uint32_t __attribute__((export_name("TS_RoutingMessageHandler_handle_node_announcement"))) TS_RoutingMessageHandler_handle_node_announcement(uint32_t this_arg, uint32_t msg) {
9294 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9295 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9296 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9297 LDKNodeAnnouncement msg_conv;
9298 msg_conv.inner = (void*)(msg & (~1));
9299 msg_conv.is_owned = false;
9300 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9301 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9302 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
9303 return (uintptr_t)ret_conv;
9306 uint32_t __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_announcement"))) TS_RoutingMessageHandler_handle_channel_announcement(uint32_t this_arg, uint32_t msg) {
9307 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9308 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9309 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9310 LDKChannelAnnouncement msg_conv;
9311 msg_conv.inner = (void*)(msg & (~1));
9312 msg_conv.is_owned = false;
9313 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9314 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9315 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
9316 return (uintptr_t)ret_conv;
9319 uint32_t __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_update"))) TS_RoutingMessageHandler_handle_channel_update(uint32_t this_arg, uint32_t msg) {
9320 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9321 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9322 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9323 LDKChannelUpdate msg_conv;
9324 msg_conv.inner = (void*)(msg & (~1));
9325 msg_conv.is_owned = false;
9326 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9327 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9328 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
9329 return (uintptr_t)ret_conv;
9332 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) {
9333 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9334 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9335 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9336 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
9337 uint32_tArray ret_arr = NULL;
9338 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
9339 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
9340 for (size_t h = 0; h < ret_var.datalen; h++) {
9341 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
9342 *ret_conv_59_conv = ret_var.data[h];
9343 ret_arr_ptr[h] = ((uintptr_t)ret_conv_59_conv);
9350 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) {
9351 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9352 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9353 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9354 LDKPublicKey starting_point_ref;
9355 CHECK(starting_point->arr_len == 33);
9356 memcpy(starting_point_ref.compressed_form, starting_point->elems, 33); FREE(starting_point);
9357 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
9358 uint32_tArray ret_arr = NULL;
9359 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
9360 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
9361 for (size_t s = 0; s < ret_var.datalen; s++) {
9362 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
9363 uintptr_t ret_conv_18_ref = 0;
9364 CHECK((((uintptr_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9365 CHECK((((uintptr_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9366 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_var);
9367 ret_conv_18_ref = (uintptr_t)ret_conv_18_var.inner;
9368 if (ret_conv_18_var.is_owned) {
9369 ret_conv_18_ref |= 1;
9371 ret_arr_ptr[s] = ret_conv_18_ref;
9378 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) {
9379 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9380 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9381 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9382 LDKPublicKey their_node_id_ref;
9383 CHECK(their_node_id->arr_len == 33);
9384 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9386 init_conv.inner = (void*)(init & (~1));
9387 init_conv.is_owned = false;
9388 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
9389 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
9392 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) {
9393 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9394 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9395 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9396 LDKPublicKey their_node_id_ref;
9397 CHECK(their_node_id->arr_len == 33);
9398 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9399 LDKReplyChannelRange msg_conv;
9400 msg_conv.inner = (void*)(msg & (~1));
9401 msg_conv.is_owned = (msg & 1) || (msg == 0);
9402 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9403 msg_conv = ReplyChannelRange_clone(&msg_conv);
9404 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9405 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9406 return (uintptr_t)ret_conv;
9409 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) {
9410 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9411 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9412 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9413 LDKPublicKey their_node_id_ref;
9414 CHECK(their_node_id->arr_len == 33);
9415 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9416 LDKReplyShortChannelIdsEnd msg_conv;
9417 msg_conv.inner = (void*)(msg & (~1));
9418 msg_conv.is_owned = (msg & 1) || (msg == 0);
9419 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9420 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
9421 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9422 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9423 return (uintptr_t)ret_conv;
9426 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) {
9427 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9428 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9429 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9430 LDKPublicKey their_node_id_ref;
9431 CHECK(their_node_id->arr_len == 33);
9432 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9433 LDKQueryChannelRange msg_conv;
9434 msg_conv.inner = (void*)(msg & (~1));
9435 msg_conv.is_owned = (msg & 1) || (msg == 0);
9436 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9437 msg_conv = QueryChannelRange_clone(&msg_conv);
9438 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9439 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9440 return (uintptr_t)ret_conv;
9443 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) {
9444 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9445 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9446 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9447 LDKPublicKey their_node_id_ref;
9448 CHECK(their_node_id->arr_len == 33);
9449 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9450 LDKQueryShortChannelIds msg_conv;
9451 msg_conv.inner = (void*)(msg & (~1));
9452 msg_conv.is_owned = (msg & 1) || (msg == 0);
9453 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9454 msg_conv = QueryShortChannelIds_clone(&msg_conv);
9455 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9456 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9457 return (uintptr_t)ret_conv;
9460 typedef struct LDKCustomMessageReader_JCalls {
9461 atomic_size_t refcnt;
9462 uint32_t instance_ptr;
9463 } LDKCustomMessageReader_JCalls;
9464 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
9465 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
9466 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9470 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
9471 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
9472 LDKu8slice buffer_var = buffer;
9473 int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
9474 memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
9475 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 75, (uint32_t)message_type, (uint32_t)buffer_arr);
9476 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9477 CHECK_ACCESS(ret_ptr);
9478 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
9482 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
9483 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
9484 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9486 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JSValue o) {
9487 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
9488 atomic_init(&calls->refcnt, 1);
9489 calls->instance_ptr = o;
9491 LDKCustomMessageReader ret = {
9492 .this_arg = (void*) calls,
9493 .read = read_LDKCustomMessageReader_jcall,
9494 .free = LDKCustomMessageReader_JCalls_free,
9498 long __attribute__((export_name("TS_LDKCustomMessageReader_new"))) TS_LDKCustomMessageReader_new(JSValue o) {
9499 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
9500 *res_ptr = LDKCustomMessageReader_init(o);
9501 return (long)res_ptr;
9503 uint32_t __attribute__((export_name("TS_CustomMessageReader_read"))) TS_CustomMessageReader_read(uint32_t this_arg, int16_t message_type, int8_tArray buffer) {
9504 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9505 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9506 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
9507 LDKu8slice buffer_ref;
9508 buffer_ref.datalen = buffer->arr_len;
9509 buffer_ref.data = buffer->elems /* XXX buffer leaks */;
9510 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9511 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
9512 return (uintptr_t)ret_conv;
9515 typedef struct LDKCustomMessageHandler_JCalls {
9516 atomic_size_t refcnt;
9517 uint32_t instance_ptr;
9518 LDKCustomMessageReader_JCalls* CustomMessageReader;
9519 } LDKCustomMessageHandler_JCalls;
9520 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
9521 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
9522 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9526 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
9527 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
9528 LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
9530 int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__);
9531 memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
9532 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 76, (uint32_t)(uintptr_t)msg_ret, (uint32_t)sender_node_id_arr);
9533 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9534 CHECK_ACCESS(ret_ptr);
9535 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9539 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
9540 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
9541 uint32_tArray ret = (uint32_tArray)js_invoke_function_0(j_calls->instance_ptr, 77);
9542 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
9543 ret_constr.datalen = ret->arr_len;
9544 if (ret_constr.datalen > 0)
9545 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
9547 ret_constr.data = NULL;
9548 uint32_t* ret_vals = ret->elems /* XXX ret leaks */;
9549 for (size_t z = 0; z < ret_constr.datalen; z++) {
9550 uint32_t ret_conv_25 = ret_vals[z];
9551 void* ret_conv_25_ptr = (void*)(((uintptr_t)ret_conv_25) & ~1);
9552 CHECK_ACCESS(ret_conv_25_ptr);
9553 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
9554 FREE((void*)ret_conv_25);
9555 ret_constr.data[z] = ret_conv_25_conv;
9559 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
9560 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
9561 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9562 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
9564 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JSValue o, JSValue CustomMessageReader) {
9565 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
9566 atomic_init(&calls->refcnt, 1);
9567 calls->instance_ptr = o;
9569 LDKCustomMessageHandler ret = {
9570 .this_arg = (void*) calls,
9571 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
9572 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
9573 .free = LDKCustomMessageHandler_JCalls_free,
9574 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
9576 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
9579 long __attribute__((export_name("TS_LDKCustomMessageHandler_new"))) TS_LDKCustomMessageHandler_new(JSValue o, JSValue CustomMessageReader) {
9580 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
9581 *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
9582 return (long)res_ptr;
9584 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) {
9585 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9586 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9587 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
9588 void* msg_ptr = (void*)(((uintptr_t)msg) & ~1);
9589 CHECK_ACCESS(msg_ptr);
9590 LDKType msg_conv = *(LDKType*)(msg_ptr);
9591 LDKPublicKey sender_node_id_ref;
9592 CHECK(sender_node_id->arr_len == 33);
9593 memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33); FREE(sender_node_id);
9594 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9595 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
9596 return (uintptr_t)ret_conv;
9599 uint32_tArray __attribute__((export_name("TS_CustomMessageHandler_get_and_clear_pending_msg"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint32_t this_arg) {
9600 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9601 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9602 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
9603 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
9604 uint32_tArray ret_arr = NULL;
9605 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
9606 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
9607 for (size_t z = 0; z < ret_var.datalen; z++) {
9608 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
9609 *ret_conv_25_conv = ret_var.data[z];
9610 ret_arr_ptr[z] = ((uintptr_t)ret_conv_25_conv);
9617 typedef struct LDKSocketDescriptor_JCalls {
9618 atomic_size_t refcnt;
9619 uint32_t instance_ptr;
9620 } LDKSocketDescriptor_JCalls;
9621 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
9622 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9623 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9627 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
9628 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9629 LDKu8slice data_var = data;
9630 int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__);
9631 memcpy(data_arr->elems, data_var.data, data_var.datalen);
9632 return js_invoke_function_2(j_calls->instance_ptr, 78, (uint32_t)data_arr, (uint32_t)resume_read);
9634 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
9635 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9636 js_invoke_function_0(j_calls->instance_ptr, 79);
9638 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
9639 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9640 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
9641 *other_arg_clone = SocketDescriptor_clone(other_arg);
9642 return js_invoke_function_1(j_calls->instance_ptr, 80, (uint32_t)(uintptr_t)other_arg_clone);
9644 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
9645 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9646 return js_invoke_function_0(j_calls->instance_ptr, 81);
9648 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
9649 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
9650 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9652 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JSValue o) {
9653 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
9654 atomic_init(&calls->refcnt, 1);
9655 calls->instance_ptr = o;
9657 LDKSocketDescriptor ret = {
9658 .this_arg = (void*) calls,
9659 .send_data = send_data_LDKSocketDescriptor_jcall,
9660 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
9661 .eq = eq_LDKSocketDescriptor_jcall,
9662 .hash = hash_LDKSocketDescriptor_jcall,
9663 .cloned = LDKSocketDescriptor_JCalls_cloned,
9664 .free = LDKSocketDescriptor_JCalls_free,
9668 long __attribute__((export_name("TS_LDKSocketDescriptor_new"))) TS_LDKSocketDescriptor_new(JSValue o) {
9669 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
9670 *res_ptr = LDKSocketDescriptor_init(o);
9671 return (long)res_ptr;
9673 intptr_t __attribute__((export_name("TS_SocketDescriptor_send_data"))) TS_SocketDescriptor_send_data(uint32_t this_arg, int8_tArray data, jboolean resume_read) {
9674 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9675 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9676 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
9677 LDKu8slice data_ref;
9678 data_ref.datalen = data->arr_len;
9679 data_ref.data = data->elems /* XXX data leaks */;
9680 intptr_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
9684 void __attribute__((export_name("TS_SocketDescriptor_disconnect_socket"))) TS_SocketDescriptor_disconnect_socket(uint32_t this_arg) {
9685 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9686 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9687 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
9688 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
9691 int64_t __attribute__((export_name("TS_SocketDescriptor_hash"))) TS_SocketDescriptor_hash(uint32_t this_arg) {
9692 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9693 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9694 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
9695 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
9699 uint32_t __attribute__((export_name("TS_LDKEffectiveCapacity_ty_from_ptr"))) TS_LDKEffectiveCapacity_ty_from_ptr(uint32_t ptr) {
9700 LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1);
9702 case LDKEffectiveCapacity_ExactLiquidity: return 0;
9703 case LDKEffectiveCapacity_MaximumHTLC: return 1;
9704 case LDKEffectiveCapacity_Total: return 2;
9705 case LDKEffectiveCapacity_Infinite: return 3;
9706 case LDKEffectiveCapacity_Unknown: return 4;
9710 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat"))) TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(uint32_t ptr) {
9711 LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1);
9712 assert(obj->tag == LDKEffectiveCapacity_ExactLiquidity);
9713 return obj->exact_liquidity.liquidity_msat;
9715 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat(uint32_t ptr) {
9716 LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1);
9717 assert(obj->tag == LDKEffectiveCapacity_MaximumHTLC);
9718 return obj->maximum_htlc.amount_msat;
9720 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_capacity_msat"))) TS_LDKEffectiveCapacity_Total_get_capacity_msat(uint32_t ptr) {
9721 LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1);
9722 assert(obj->tag == LDKEffectiveCapacity_Total);
9723 return obj->total.capacity_msat;
9725 typedef struct LDKScore_JCalls {
9726 atomic_size_t refcnt;
9727 uint32_t instance_ptr;
9729 static void LDKScore_JCalls_free(void* this_arg) {
9730 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9731 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9735 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) {
9736 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9737 LDKNodeId source_var = *source;
9738 uintptr_t source_ref = 0;
9739 source_var = NodeId_clone(source);
9740 CHECK((((uintptr_t)source_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9741 CHECK((((uintptr_t)&source_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9742 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
9743 source_ref = (uintptr_t)source_var.inner;
9744 if (source_var.is_owned) {
9747 LDKNodeId target_var = *target;
9748 uintptr_t target_ref = 0;
9749 target_var = NodeId_clone(target);
9750 CHECK((((uintptr_t)target_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9751 CHECK((((uintptr_t)&target_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9752 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
9753 target_ref = (uintptr_t)target_var.inner;
9754 if (target_var.is_owned) {
9757 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);
9759 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
9760 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9761 LDKCVec_RouteHopZ path_var = path;
9762 uint32_tArray path_arr = NULL;
9763 path_arr = init_uint32_tArray(path_var.datalen, __LINE__);
9764 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
9765 for (size_t k = 0; k < path_var.datalen; k++) {
9766 LDKRouteHop path_conv_10_var = path_var.data[k];
9767 uintptr_t path_conv_10_ref = 0;
9768 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9769 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9770 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
9771 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
9772 if (path_conv_10_var.is_owned) {
9773 path_conv_10_ref |= 1;
9775 path_arr_ptr[k] = path_conv_10_ref;
9778 FREE(path_var.data);
9779 js_invoke_function_2(j_calls->instance_ptr, 83, (uint32_t)path_arr, (uint32_t)short_channel_id);
9781 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
9782 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9783 LDKCVec_RouteHopZ path_var = path;
9784 uint32_tArray path_arr = NULL;
9785 path_arr = init_uint32_tArray(path_var.datalen, __LINE__);
9786 uint32_t *path_arr_ptr = (uint32_t*)(((uint8_t*)path_arr) + 4);
9787 for (size_t k = 0; k < path_var.datalen; k++) {
9788 LDKRouteHop path_conv_10_var = path_var.data[k];
9789 uintptr_t path_conv_10_ref = 0;
9790 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9791 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9792 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
9793 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
9794 if (path_conv_10_var.is_owned) {
9795 path_conv_10_ref |= 1;
9797 path_arr_ptr[k] = path_conv_10_ref;
9800 FREE(path_var.data);
9801 js_invoke_function_1(j_calls->instance_ptr, 84, (uint32_t)path_arr);
9803 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
9804 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9805 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 85);
9806 LDKCVec_u8Z ret_ref;
9807 ret_ref.datalen = ret->arr_len;
9808 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
9809 memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
9812 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
9813 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
9814 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9816 static inline LDKScore LDKScore_init (JSValue o) {
9817 LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
9818 atomic_init(&calls->refcnt, 1);
9819 calls->instance_ptr = o;
9822 .this_arg = (void*) calls,
9823 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
9824 .payment_path_failed = payment_path_failed_LDKScore_jcall,
9825 .payment_path_successful = payment_path_successful_LDKScore_jcall,
9826 .write = write_LDKScore_jcall,
9827 .free = LDKScore_JCalls_free,
9831 long __attribute__((export_name("TS_LDKScore_new"))) TS_LDKScore_new(JSValue o) {
9832 LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
9833 *res_ptr = LDKScore_init(o);
9834 return (long)res_ptr;
9836 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) {
9837 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9838 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9839 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9840 LDKNodeId source_conv;
9841 source_conv.inner = (void*)(source & (~1));
9842 source_conv.is_owned = false;
9843 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
9844 LDKNodeId target_conv;
9845 target_conv.inner = (void*)(target & (~1));
9846 target_conv.is_owned = false;
9847 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
9848 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);
9852 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) {
9853 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9854 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9855 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9856 LDKCVec_RouteHopZ path_constr;
9857 path_constr.datalen = path->arr_len;
9858 if (path_constr.datalen > 0)
9859 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9861 path_constr.data = NULL;
9862 uint32_t* path_vals = path->elems /* XXX path leaks */;
9863 for (size_t k = 0; k < path_constr.datalen; k++) {
9864 uint32_t path_conv_10 = path_vals[k];
9865 LDKRouteHop path_conv_10_conv;
9866 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
9867 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
9868 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
9869 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
9870 path_constr.data[k] = path_conv_10_conv;
9872 (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
9875 void __attribute__((export_name("TS_Score_payment_path_successful"))) TS_Score_payment_path_successful(uint32_t this_arg, uint32_tArray path) {
9876 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9877 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9878 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9879 LDKCVec_RouteHopZ path_constr;
9880 path_constr.datalen = path->arr_len;
9881 if (path_constr.datalen > 0)
9882 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9884 path_constr.data = NULL;
9885 uint32_t* path_vals = path->elems /* XXX path leaks */;
9886 for (size_t k = 0; k < path_constr.datalen; k++) {
9887 uint32_t path_conv_10 = path_vals[k];
9888 LDKRouteHop path_conv_10_conv;
9889 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
9890 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
9891 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
9892 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
9893 path_constr.data[k] = path_conv_10_conv;
9895 (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
9898 int8_tArray __attribute__((export_name("TS_Score_write"))) TS_Score_write(uint32_t this_arg) {
9899 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9900 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9901 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9902 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
9903 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
9904 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
9905 CVec_u8Z_free(ret_var);
9909 typedef struct LDKLockableScore_JCalls {
9910 atomic_size_t refcnt;
9911 uint32_t instance_ptr;
9912 } LDKLockableScore_JCalls;
9913 static void LDKLockableScore_JCalls_free(void* this_arg) {
9914 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
9915 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9919 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
9920 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
9921 uint32_t ret = js_invoke_function_0(j_calls->instance_ptr, 86);
9922 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9923 CHECK_ACCESS(ret_ptr);
9924 LDKScore ret_conv = *(LDKScore*)(ret_ptr);// WARNING: we may need a move here but no clone is available for LDKScore
9928 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
9929 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
9930 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9932 static inline LDKLockableScore LDKLockableScore_init (JSValue o) {
9933 LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
9934 atomic_init(&calls->refcnt, 1);
9935 calls->instance_ptr = o;
9937 LDKLockableScore ret = {
9938 .this_arg = (void*) calls,
9939 .lock = lock_LDKLockableScore_jcall,
9940 .free = LDKLockableScore_JCalls_free,
9944 long __attribute__((export_name("TS_LDKLockableScore_new"))) TS_LDKLockableScore_new(JSValue o) {
9945 LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
9946 *res_ptr = LDKLockableScore_init(o);
9947 return (long)res_ptr;
9949 uint32_t __attribute__((export_name("TS_LockableScore_lock"))) TS_LockableScore_lock(uint32_t this_arg) {
9950 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9951 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9952 LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
9953 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
9954 *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
9955 return (uintptr_t)ret_ret;
9958 uint32_t __attribute__((export_name("TS_LDKFallback_ty_from_ptr"))) TS_LDKFallback_ty_from_ptr(uint32_t ptr) {
9959 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
9961 case LDKFallback_SegWitProgram: return 0;
9962 case LDKFallback_PubKeyHash: return 1;
9963 case LDKFallback_ScriptHash: return 2;
9967 int8_t __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_version"))) TS_LDKFallback_SegWitProgram_get_version(uint32_t ptr) {
9968 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
9969 assert(obj->tag == LDKFallback_SegWitProgram);
9970 uint8_t version_val = obj->seg_wit_program.version._0;
9973 int8_tArray __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_program"))) TS_LDKFallback_SegWitProgram_get_program(uint32_t ptr) {
9974 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
9975 assert(obj->tag == LDKFallback_SegWitProgram);
9976 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
9977 int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__);
9978 memcpy(program_arr->elems, program_var.data, program_var.datalen);
9981 int8_tArray __attribute__((export_name("TS_LDKFallback_PubKeyHash_get_pub_key_hash"))) TS_LDKFallback_PubKeyHash_get_pub_key_hash(uint32_t ptr) {
9982 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
9983 assert(obj->tag == LDKFallback_PubKeyHash);
9984 int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__);
9985 memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20);
9986 return pub_key_hash_arr;
9988 int8_tArray __attribute__((export_name("TS_LDKFallback_ScriptHash_get_script_hash"))) TS_LDKFallback_ScriptHash_get_script_hash(uint32_t ptr) {
9989 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
9990 assert(obj->tag == LDKFallback_ScriptHash);
9991 int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__);
9992 memcpy(script_hash_arr->elems, obj->script_hash.data, 20);
9993 return script_hash_arr;
9995 typedef struct LDKPayer_JCalls {
9996 atomic_size_t refcnt;
9997 uint32_t instance_ptr;
9999 static void LDKPayer_JCalls_free(void* this_arg) {
10000 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10001 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10005 LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) {
10006 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10007 int8_tArray ret = (int8_tArray)js_invoke_function_0(j_calls->instance_ptr, 87);
10008 LDKPublicKey ret_ref;
10009 CHECK(ret->arr_len == 33);
10010 memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
10013 LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) {
10014 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10015 uint32_tArray ret = (uint32_tArray)js_invoke_function_0(j_calls->instance_ptr, 88);
10016 LDKCVec_ChannelDetailsZ ret_constr;
10017 ret_constr.datalen = ret->arr_len;
10018 if (ret_constr.datalen > 0)
10019 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
10021 ret_constr.data = NULL;
10022 uint32_t* ret_vals = ret->elems /* XXX ret leaks */;
10023 for (size_t q = 0; q < ret_constr.datalen; q++) {
10024 uint32_t ret_conv_16 = ret_vals[q];
10025 LDKChannelDetails ret_conv_16_conv;
10026 ret_conv_16_conv.inner = (void*)(ret_conv_16 & (~1));
10027 ret_conv_16_conv.is_owned = (ret_conv_16 & 1) || (ret_conv_16 == 0);
10028 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv);
10029 ret_constr.data[q] = ret_conv_16_conv;
10033 LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret) {
10034 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10035 LDKRoute route_var = *route;
10036 uintptr_t route_ref = 0;
10037 route_var = Route_clone(route);
10038 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10039 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10040 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
10041 route_ref = (uintptr_t)route_var.inner;
10042 if (route_var.is_owned) {
10045 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10046 memcpy(payment_hash_arr->elems, payment_hash.data, 32);
10047 int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
10048 memcpy(payment_secret_arr->elems, payment_secret.data, 32);
10049 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);
10050 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10051 CHECK_ACCESS(ret_ptr);
10052 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
10056 LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage) {
10057 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10058 LDKRoute route_var = *route;
10059 uintptr_t route_ref = 0;
10060 route_var = Route_clone(route);
10061 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10062 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10063 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
10064 route_ref = (uintptr_t)route_var.inner;
10065 if (route_var.is_owned) {
10068 int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
10069 memcpy(payment_preimage_arr->elems, payment_preimage.data, 32);
10070 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 90, (uint32_t)route_ref, (uint32_t)payment_preimage_arr);
10071 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10072 CHECK_ACCESS(ret_ptr);
10073 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
10077 LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) {
10078 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10079 LDKRoute route_var = *route;
10080 uintptr_t route_ref = 0;
10081 route_var = Route_clone(route);
10082 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10083 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10084 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
10085 route_ref = (uintptr_t)route_var.inner;
10086 if (route_var.is_owned) {
10089 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
10090 memcpy(payment_id_arr->elems, payment_id.data, 32);
10091 uint32_t ret = js_invoke_function_2(j_calls->instance_ptr, 91, (uint32_t)route_ref, (uint32_t)payment_id_arr);
10092 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10093 CHECK_ACCESS(ret_ptr);
10094 LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
10098 void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) {
10099 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10100 int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
10101 memcpy(payment_id_arr->elems, payment_id.data, 32);
10102 js_invoke_function_1(j_calls->instance_ptr, 92, (uint32_t)payment_id_arr);
10104 static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) {
10105 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg;
10106 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10108 static inline LDKPayer LDKPayer_init (JSValue o) {
10109 LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls");
10110 atomic_init(&calls->refcnt, 1);
10111 calls->instance_ptr = o;
10114 .this_arg = (void*) calls,
10115 .node_id = node_id_LDKPayer_jcall,
10116 .first_hops = first_hops_LDKPayer_jcall,
10117 .send_payment = send_payment_LDKPayer_jcall,
10118 .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall,
10119 .retry_payment = retry_payment_LDKPayer_jcall,
10120 .abandon_payment = abandon_payment_LDKPayer_jcall,
10121 .free = LDKPayer_JCalls_free,
10125 long __attribute__((export_name("TS_LDKPayer_new"))) TS_LDKPayer_new(JSValue o) {
10126 LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer");
10127 *res_ptr = LDKPayer_init(o);
10128 return (long)res_ptr;
10130 int8_tArray __attribute__((export_name("TS_Payer_node_id"))) TS_Payer_node_id(uint32_t this_arg) {
10131 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10132 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10133 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10134 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
10135 memcpy(ret_arr->elems, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form, 33);
10139 uint32_tArray __attribute__((export_name("TS_Payer_first_hops"))) TS_Payer_first_hops(uint32_t this_arg) {
10140 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10141 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10142 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10143 LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg);
10144 uint32_tArray ret_arr = NULL;
10145 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
10146 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
10147 for (size_t q = 0; q < ret_var.datalen; q++) {
10148 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
10149 uintptr_t ret_conv_16_ref = 0;
10150 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10151 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10152 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
10153 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
10154 if (ret_conv_16_var.is_owned) {
10155 ret_conv_16_ref |= 1;
10157 ret_arr_ptr[q] = ret_conv_16_ref;
10160 FREE(ret_var.data);
10164 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) {
10165 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10166 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10167 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10168 LDKRoute route_conv;
10169 route_conv.inner = (void*)(route & (~1));
10170 route_conv.is_owned = false;
10171 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
10172 LDKThirtyTwoBytes payment_hash_ref;
10173 CHECK(payment_hash->arr_len == 32);
10174 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
10175 LDKThirtyTwoBytes payment_secret_ref;
10176 CHECK(payment_secret->arr_len == 32);
10177 memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
10178 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
10179 *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref);
10180 return (uintptr_t)ret_conv;
10183 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) {
10184 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10185 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10186 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10187 LDKRoute route_conv;
10188 route_conv.inner = (void*)(route & (~1));
10189 route_conv.is_owned = false;
10190 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
10191 LDKThirtyTwoBytes payment_preimage_ref;
10192 CHECK(payment_preimage->arr_len == 32);
10193 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
10194 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
10195 *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref);
10196 return (uintptr_t)ret_conv;
10199 uint32_t __attribute__((export_name("TS_Payer_retry_payment"))) TS_Payer_retry_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_id) {
10200 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10201 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10202 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10203 LDKRoute route_conv;
10204 route_conv.inner = (void*)(route & (~1));
10205 route_conv.is_owned = false;
10206 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
10207 LDKThirtyTwoBytes payment_id_ref;
10208 CHECK(payment_id->arr_len == 32);
10209 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
10210 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10211 *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref);
10212 return (uintptr_t)ret_conv;
10215 void __attribute__((export_name("TS_Payer_abandon_payment"))) TS_Payer_abandon_payment(uint32_t this_arg, int8_tArray payment_id) {
10216 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10217 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10218 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10219 LDKThirtyTwoBytes payment_id_ref;
10220 CHECK(payment_id->arr_len == 32);
10221 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
10222 (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref);
10225 typedef struct LDKRouter_JCalls {
10226 atomic_size_t refcnt;
10227 uint32_t instance_ptr;
10228 } LDKRouter_JCalls;
10229 static void LDKRouter_JCalls_free(void* this_arg) {
10230 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10231 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10235 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) {
10236 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10237 int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
10238 memcpy(payer_arr->elems, payer.compressed_form, 33);
10239 LDKRouteParameters route_params_var = *route_params;
10240 uintptr_t route_params_ref = 0;
10241 route_params_var = RouteParameters_clone(route_params);
10242 CHECK((((uintptr_t)route_params_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10243 CHECK((((uintptr_t)&route_params_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10244 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
10245 route_params_ref = (uintptr_t)route_params_var.inner;
10246 if (route_params_var.is_owned) {
10247 route_params_ref |= 1;
10249 int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10250 memcpy(payment_hash_arr->elems, *payment_hash, 32);
10251 LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
10252 uint32_tArray first_hops_arr = NULL;
10253 if (first_hops != NULL) {
10254 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
10255 first_hops_arr = init_uint32_tArray(first_hops_var.datalen, __LINE__);
10256 uint32_t *first_hops_arr_ptr = (uint32_t*)(((uint8_t*)first_hops_arr) + 4);
10257 for (size_t q = 0; q < first_hops_var.datalen; q++) {
10258 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
10259 uintptr_t first_hops_conv_16_ref = 0;
10260 CHECK((((uintptr_t)first_hops_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10261 CHECK((((uintptr_t)&first_hops_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10262 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
10263 first_hops_conv_16_ref = (uintptr_t)first_hops_conv_16_var.inner;
10264 if (first_hops_conv_16_var.is_owned) {
10265 first_hops_conv_16_ref |= 1;
10267 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
10271 // WARNING: This object doesn't live past this scope, needs clone!
10272 uintptr_t ret_scorer = ((uintptr_t)scorer) | 1;
10273 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);
10274 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10275 CHECK_ACCESS(ret_ptr);
10276 LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
10280 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
10281 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
10282 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10284 static inline LDKRouter LDKRouter_init (JSValue o) {
10285 LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
10286 atomic_init(&calls->refcnt, 1);
10287 calls->instance_ptr = o;
10290 .this_arg = (void*) calls,
10291 .find_route = find_route_LDKRouter_jcall,
10292 .free = LDKRouter_JCalls_free,
10296 long __attribute__((export_name("TS_LDKRouter_new"))) TS_LDKRouter_new(JSValue o) {
10297 LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
10298 *res_ptr = LDKRouter_init(o);
10299 return (long)res_ptr;
10301 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) {
10302 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10303 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10304 LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
10305 LDKPublicKey payer_ref;
10306 CHECK(payer->arr_len == 33);
10307 memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
10308 LDKRouteParameters route_params_conv;
10309 route_params_conv.inner = (void*)(route_params & (~1));
10310 route_params_conv.is_owned = false;
10311 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
10312 unsigned char payment_hash_arr[32];
10313 CHECK(payment_hash->arr_len == 32);
10314 memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
10315 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
10316 LDKCVec_ChannelDetailsZ first_hops_constr;
10317 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
10318 if (first_hops != 0) {
10319 first_hops_constr.datalen = first_hops->arr_len;
10320 if (first_hops_constr.datalen > 0)
10321 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
10323 first_hops_constr.data = NULL;
10324 uint32_t* first_hops_vals = first_hops->elems /* XXX first_hops leaks */;
10325 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
10326 uint32_t first_hops_conv_16 = first_hops_vals[q];
10327 LDKChannelDetails first_hops_conv_16_conv;
10328 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
10329 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
10330 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
10331 first_hops_constr.data[q] = first_hops_conv_16_conv;
10333 first_hops_ptr = &first_hops_constr;
10335 void* scorer_ptr = (void*)(((uintptr_t)scorer) & ~1);
10336 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
10337 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
10338 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
10339 *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);
10340 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
10341 return (uintptr_t)ret_conv;
10344 jstring __attribute__((export_name("TS__ldk_get_compiled_version"))) TS__ldk_get_compiled_version() {
10345 LDKStr ret_str = _ldk_get_compiled_version();
10346 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
10351 jstring __attribute__((export_name("TS__ldk_c_bindings_get_compiled_version"))) TS__ldk_c_bindings_get_compiled_version() {
10352 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
10353 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
10358 void __attribute__((export_name("TS_Transaction_free"))) TS_Transaction_free(int8_tArray _res) {
10359 LDKTransaction _res_ref;
10360 _res_ref.datalen = _res->arr_len;
10361 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
10362 memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
10363 _res_ref.data_is_owned = true;
10364 Transaction_free(_res_ref);
10367 uint32_t __attribute__((export_name("TS_TxOut_new"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
10368 LDKCVec_u8Z script_pubkey_ref;
10369 script_pubkey_ref.datalen = script_pubkey->arr_len;
10370 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
10371 memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen); FREE(script_pubkey);
10372 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
10373 *ret_ref = TxOut_new(script_pubkey_ref, value);
10374 return (uintptr_t)ret_ref;
10377 void __attribute__((export_name("TS_TxOut_free"))) TS_TxOut_free(uint32_t _res) {
10378 if ((_res & 1) != 0) return;
10379 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
10380 CHECK_ACCESS(_res_ptr);
10381 LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
10383 TxOut_free(_res_conv);
10386 static inline uintptr_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
10387 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
10388 *ret_ref = TxOut_clone(arg);
10389 return (uintptr_t)ret_ref;
10391 intptr_t __attribute__((export_name("TS_TxOut_clone_ptr"))) TS_TxOut_clone_ptr(uint32_t arg) {
10392 LDKTxOut* arg_conv = (LDKTxOut*)(arg & ~1);
10393 intptr_t ret_val = TxOut_clone_ptr(arg_conv);
10397 uint32_t __attribute__((export_name("TS_TxOut_clone"))) TS_TxOut_clone(uint32_t orig) {
10398 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
10399 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
10400 *ret_ref = TxOut_clone(orig_conv);
10401 return (uintptr_t)ret_ref;
10404 void __attribute__((export_name("TS_Str_free"))) TS_Str_free(jstring _res) {
10405 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
10409 uint32_t __attribute__((export_name("TS_CResult_NoneNoneZ_ok"))) TS_CResult_NoneNoneZ_ok() {
10410 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10411 *ret_conv = CResult_NoneNoneZ_ok();
10412 return (uintptr_t)ret_conv;
10415 uint32_t __attribute__((export_name("TS_CResult_NoneNoneZ_err"))) TS_CResult_NoneNoneZ_err() {
10416 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10417 *ret_conv = CResult_NoneNoneZ_err();
10418 return (uintptr_t)ret_conv;
10421 jboolean __attribute__((export_name("TS_CResult_NoneNoneZ_is_ok"))) TS_CResult_NoneNoneZ_is_ok(uint32_t o) {
10422 LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)(o & ~1);
10423 jboolean ret_val = CResult_NoneNoneZ_is_ok(o_conv);
10427 void __attribute__((export_name("TS_CResult_NoneNoneZ_free"))) TS_CResult_NoneNoneZ_free(uint32_t _res) {
10428 if ((_res & 1) != 0) return;
10429 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
10430 CHECK_ACCESS(_res_ptr);
10431 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
10433 CResult_NoneNoneZ_free(_res_conv);
10436 static inline uintptr_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
10437 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10438 *ret_conv = CResult_NoneNoneZ_clone(arg);
10439 return (uintptr_t)ret_conv;
10441 intptr_t __attribute__((export_name("TS_CResult_NoneNoneZ_clone_ptr"))) TS_CResult_NoneNoneZ_clone_ptr(uint32_t arg) {
10442 LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)(arg & ~1);
10443 intptr_t ret_val = CResult_NoneNoneZ_clone_ptr(arg_conv);
10447 uint32_t __attribute__((export_name("TS_CResult_NoneNoneZ_clone"))) TS_CResult_NoneNoneZ_clone(uint32_t orig) {
10448 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
10449 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10450 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
10451 return (uintptr_t)ret_conv;
10454 uint32_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(uint32_t o) {
10455 LDKCounterpartyCommitmentSecrets o_conv;
10456 o_conv.inner = (void*)(o & (~1));
10457 o_conv.is_owned = (o & 1) || (o == 0);
10458 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10459 o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
10460 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
10461 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
10462 return (uintptr_t)ret_conv;
10465 uint32_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(uint32_t e) {
10466 LDKDecodeError e_conv;
10467 e_conv.inner = (void*)(e & (~1));
10468 e_conv.is_owned = (e & 1) || (e == 0);
10469 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10470 e_conv = DecodeError_clone(&e_conv);
10471 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
10472 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
10473 return (uintptr_t)ret_conv;
10476 jboolean __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(uint32_t o) {
10477 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(o & ~1);
10478 jboolean ret_val = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
10482 void __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(uint32_t _res) {
10483 if ((_res & 1) != 0) return;
10484 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
10485 CHECK_ACCESS(_res_ptr);
10486 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
10488 CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
10491 static inline uintptr_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
10492 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
10493 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
10494 return (uintptr_t)ret_conv;
10496 intptr_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(uint32_t arg) {
10497 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(arg & ~1);
10498 intptr_t ret_val = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
10502 uint32_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(uint32_t orig) {
10503 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(orig & ~1);
10504 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
10505 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
10506 return (uintptr_t)ret_conv;
10509 uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_ok"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
10510 LDKSecretKey o_ref;
10511 CHECK(o->arr_len == 32);
10512 memcpy(o_ref.bytes, o->elems, 32); FREE(o);
10513 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
10514 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
10515 return (uintptr_t)ret_conv;
10518 uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_err"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
10519 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
10520 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
10521 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
10522 return (uintptr_t)ret_conv;
10525 jboolean __attribute__((export_name("TS_CResult_SecretKeyErrorZ_is_ok"))) TS_CResult_SecretKeyErrorZ_is_ok(uint32_t o) {
10526 LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)(o & ~1);
10527 jboolean ret_val = CResult_SecretKeyErrorZ_is_ok(o_conv);
10531 void __attribute__((export_name("TS_CResult_SecretKeyErrorZ_free"))) TS_CResult_SecretKeyErrorZ_free(uint32_t _res) {
10532 if ((_res & 1) != 0) return;
10533 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
10534 CHECK_ACCESS(_res_ptr);
10535 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
10537 CResult_SecretKeyErrorZ_free(_res_conv);
10540 static inline uintptr_t CResult_SecretKeyErrorZ_clone_ptr(LDKCResult_SecretKeyErrorZ *NONNULL_PTR arg) {
10541 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
10542 *ret_conv = CResult_SecretKeyErrorZ_clone(arg);
10543 return (uintptr_t)ret_conv;
10545 intptr_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_clone_ptr"))) TS_CResult_SecretKeyErrorZ_clone_ptr(uint32_t arg) {
10546 LDKCResult_SecretKeyErrorZ* arg_conv = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
10547 intptr_t ret_val = CResult_SecretKeyErrorZ_clone_ptr(arg_conv);
10551 uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_clone"))) TS_CResult_SecretKeyErrorZ_clone(uint32_t orig) {
10552 LDKCResult_SecretKeyErrorZ* orig_conv = (LDKCResult_SecretKeyErrorZ*)(orig & ~1);
10553 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
10554 *ret_conv = CResult_SecretKeyErrorZ_clone(orig_conv);
10555 return (uintptr_t)ret_conv;
10558 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_ok"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
10559 LDKPublicKey o_ref;
10560 CHECK(o->arr_len == 33);
10561 memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
10562 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
10563 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
10564 return (uintptr_t)ret_conv;
10567 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_err"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
10568 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
10569 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
10570 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
10571 return (uintptr_t)ret_conv;
10574 jboolean __attribute__((export_name("TS_CResult_PublicKeyErrorZ_is_ok"))) TS_CResult_PublicKeyErrorZ_is_ok(uint32_t o) {
10575 LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)(o & ~1);
10576 jboolean ret_val = CResult_PublicKeyErrorZ_is_ok(o_conv);
10580 void __attribute__((export_name("TS_CResult_PublicKeyErrorZ_free"))) TS_CResult_PublicKeyErrorZ_free(uint32_t _res) {
10581 if ((_res & 1) != 0) return;
10582 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
10583 CHECK_ACCESS(_res_ptr);
10584 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
10586 CResult_PublicKeyErrorZ_free(_res_conv);
10589 static inline uintptr_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
10590 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
10591 *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
10592 return (uintptr_t)ret_conv;
10594 intptr_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone_ptr"))) TS_CResult_PublicKeyErrorZ_clone_ptr(uint32_t arg) {
10595 LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
10596 intptr_t ret_val = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
10600 uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone"))) TS_CResult_PublicKeyErrorZ_clone(uint32_t orig) {
10601 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
10602 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
10603 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
10604 return (uintptr_t)ret_conv;
10607 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint32_t o) {
10608 LDKTxCreationKeys o_conv;
10609 o_conv.inner = (void*)(o & (~1));
10610 o_conv.is_owned = (o & 1) || (o == 0);
10611 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10612 o_conv = TxCreationKeys_clone(&o_conv);
10613 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
10614 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
10615 return (uintptr_t)ret_conv;
10618 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint32_t e) {
10619 LDKDecodeError e_conv;
10620 e_conv.inner = (void*)(e & (~1));
10621 e_conv.is_owned = (e & 1) || (e == 0);
10622 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10623 e_conv = DecodeError_clone(&e_conv);
10624 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
10625 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
10626 return (uintptr_t)ret_conv;
10629 jboolean __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_is_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint32_t o) {
10630 LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(o & ~1);
10631 jboolean ret_val = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
10635 void __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_free"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint32_t _res) {
10636 if ((_res & 1) != 0) return;
10637 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
10638 CHECK_ACCESS(_res_ptr);
10639 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
10641 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
10644 static inline uintptr_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
10645 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
10646 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
10647 return (uintptr_t)ret_conv;
10649 intptr_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint32_t arg) {
10650 LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
10651 intptr_t ret_val = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
10655 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint32_t orig) {
10656 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
10657 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
10658 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
10659 return (uintptr_t)ret_conv;
10662 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint32_t o) {
10663 LDKChannelPublicKeys o_conv;
10664 o_conv.inner = (void*)(o & (~1));
10665 o_conv.is_owned = (o & 1) || (o == 0);
10666 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10667 o_conv = ChannelPublicKeys_clone(&o_conv);
10668 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
10669 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
10670 return (uintptr_t)ret_conv;
10673 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint32_t e) {
10674 LDKDecodeError e_conv;
10675 e_conv.inner = (void*)(e & (~1));
10676 e_conv.is_owned = (e & 1) || (e == 0);
10677 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10678 e_conv = DecodeError_clone(&e_conv);
10679 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
10680 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
10681 return (uintptr_t)ret_conv;
10684 jboolean __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint32_t o) {
10685 LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(o & ~1);
10686 jboolean ret_val = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
10690 void __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_free"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint32_t _res) {
10691 if ((_res & 1) != 0) return;
10692 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
10693 CHECK_ACCESS(_res_ptr);
10694 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
10696 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
10699 static inline uintptr_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
10700 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
10701 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
10702 return (uintptr_t)ret_conv;
10704 intptr_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint32_t arg) {
10705 LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
10706 intptr_t ret_val = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
10710 uint32_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint32_t orig) {
10711 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
10712 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
10713 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
10714 return (uintptr_t)ret_conv;
10717 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_ok"))) TS_CResult_TxCreationKeysErrorZ_ok(uint32_t o) {
10718 LDKTxCreationKeys o_conv;
10719 o_conv.inner = (void*)(o & (~1));
10720 o_conv.is_owned = (o & 1) || (o == 0);
10721 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10722 o_conv = TxCreationKeys_clone(&o_conv);
10723 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
10724 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
10725 return (uintptr_t)ret_conv;
10728 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_err"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
10729 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
10730 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
10731 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
10732 return (uintptr_t)ret_conv;
10735 jboolean __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_is_ok"))) TS_CResult_TxCreationKeysErrorZ_is_ok(uint32_t o) {
10736 LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)(o & ~1);
10737 jboolean ret_val = CResult_TxCreationKeysErrorZ_is_ok(o_conv);
10741 void __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_free"))) TS_CResult_TxCreationKeysErrorZ_free(uint32_t _res) {
10742 if ((_res & 1) != 0) return;
10743 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
10744 CHECK_ACCESS(_res_ptr);
10745 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
10747 CResult_TxCreationKeysErrorZ_free(_res_conv);
10750 static inline uintptr_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) {
10751 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
10752 *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg);
10753 return (uintptr_t)ret_conv;
10755 intptr_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysErrorZ_clone_ptr(uint32_t arg) {
10756 LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
10757 intptr_t ret_val = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv);
10761 uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_clone"))) TS_CResult_TxCreationKeysErrorZ_clone(uint32_t orig) {
10762 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
10763 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
10764 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
10765 return (uintptr_t)ret_conv;
10768 uint32_t __attribute__((export_name("TS_COption_u32Z_some"))) TS_COption_u32Z_some(int32_t o) {
10769 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
10770 *ret_copy = COption_u32Z_some(o);
10771 uintptr_t ret_ref = (uintptr_t)ret_copy;
10775 uint32_t __attribute__((export_name("TS_COption_u32Z_none"))) TS_COption_u32Z_none() {
10776 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
10777 *ret_copy = COption_u32Z_none();
10778 uintptr_t ret_ref = (uintptr_t)ret_copy;
10782 void __attribute__((export_name("TS_COption_u32Z_free"))) TS_COption_u32Z_free(uint32_t _res) {
10783 if ((_res & 1) != 0) return;
10784 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
10785 CHECK_ACCESS(_res_ptr);
10786 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
10788 COption_u32Z_free(_res_conv);
10791 static inline uintptr_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
10792 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
10793 *ret_copy = COption_u32Z_clone(arg);
10794 uintptr_t ret_ref = (uintptr_t)ret_copy;
10797 intptr_t __attribute__((export_name("TS_COption_u32Z_clone_ptr"))) TS_COption_u32Z_clone_ptr(uint32_t arg) {
10798 LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)arg;
10799 intptr_t ret_val = COption_u32Z_clone_ptr(arg_conv);
10803 uint32_t __attribute__((export_name("TS_COption_u32Z_clone"))) TS_COption_u32Z_clone(uint32_t orig) {
10804 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
10805 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
10806 *ret_copy = COption_u32Z_clone(orig_conv);
10807 uintptr_t ret_ref = (uintptr_t)ret_copy;
10811 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint32_t o) {
10812 LDKHTLCOutputInCommitment o_conv;
10813 o_conv.inner = (void*)(o & (~1));
10814 o_conv.is_owned = (o & 1) || (o == 0);
10815 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10816 o_conv = HTLCOutputInCommitment_clone(&o_conv);
10817 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
10818 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
10819 return (uintptr_t)ret_conv;
10822 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint32_t e) {
10823 LDKDecodeError e_conv;
10824 e_conv.inner = (void*)(e & (~1));
10825 e_conv.is_owned = (e & 1) || (e == 0);
10826 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10827 e_conv = DecodeError_clone(&e_conv);
10828 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
10829 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
10830 return (uintptr_t)ret_conv;
10833 jboolean __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint32_t o) {
10834 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(o & ~1);
10835 jboolean ret_val = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
10839 void __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint32_t _res) {
10840 if ((_res & 1) != 0) return;
10841 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
10842 CHECK_ACCESS(_res_ptr);
10843 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
10845 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
10848 static inline uintptr_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
10849 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
10850 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
10851 return (uintptr_t)ret_conv;
10853 intptr_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint32_t arg) {
10854 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
10855 intptr_t ret_val = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
10859 uint32_t __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint32_t orig) {
10860 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
10861 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
10862 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
10863 return (uintptr_t)ret_conv;
10866 uint32_t __attribute__((export_name("TS_COption_NoneZ_some"))) TS_COption_NoneZ_some() {
10867 uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
10871 uint32_t __attribute__((export_name("TS_COption_NoneZ_none"))) TS_COption_NoneZ_none() {
10872 uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
10876 void __attribute__((export_name("TS_COption_NoneZ_free"))) TS_COption_NoneZ_free(uint32_t _res) {
10877 LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
10878 COption_NoneZ_free(_res_conv);
10881 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
10882 LDKCounterpartyChannelTransactionParameters o_conv;
10883 o_conv.inner = (void*)(o & (~1));
10884 o_conv.is_owned = (o & 1) || (o == 0);
10885 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10886 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
10887 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
10888 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
10889 return (uintptr_t)ret_conv;
10892 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
10893 LDKDecodeError e_conv;
10894 e_conv.inner = (void*)(e & (~1));
10895 e_conv.is_owned = (e & 1) || (e == 0);
10896 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10897 e_conv = DecodeError_clone(&e_conv);
10898 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
10899 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
10900 return (uintptr_t)ret_conv;
10903 jboolean __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint32_t o) {
10904 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(o & ~1);
10905 jboolean ret_val = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
10909 void __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
10910 if ((_res & 1) != 0) return;
10911 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
10912 CHECK_ACCESS(_res_ptr);
10913 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
10915 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
10918 static inline uintptr_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
10919 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
10920 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
10921 return (uintptr_t)ret_conv;
10923 intptr_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
10924 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
10925 intptr_t ret_val = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
10929 uint32_t __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
10930 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
10931 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
10932 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
10933 return (uintptr_t)ret_conv;
10936 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
10937 LDKChannelTransactionParameters o_conv;
10938 o_conv.inner = (void*)(o & (~1));
10939 o_conv.is_owned = (o & 1) || (o == 0);
10940 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
10941 o_conv = ChannelTransactionParameters_clone(&o_conv);
10942 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
10943 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
10944 return (uintptr_t)ret_conv;
10947 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
10948 LDKDecodeError e_conv;
10949 e_conv.inner = (void*)(e & (~1));
10950 e_conv.is_owned = (e & 1) || (e == 0);
10951 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
10952 e_conv = DecodeError_clone(&e_conv);
10953 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
10954 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
10955 return (uintptr_t)ret_conv;
10958 jboolean __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint32_t o) {
10959 LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(o & ~1);
10960 jboolean ret_val = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
10964 void __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
10965 if ((_res & 1) != 0) return;
10966 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
10967 CHECK_ACCESS(_res_ptr);
10968 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
10970 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
10973 static inline uintptr_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
10974 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
10975 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
10976 return (uintptr_t)ret_conv;
10978 intptr_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
10979 LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
10980 intptr_t ret_val = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
10984 uint32_t __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
10985 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
10986 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
10987 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
10988 return (uintptr_t)ret_conv;
10991 void __attribute__((export_name("TS_CVec_SignatureZ_free"))) TS_CVec_SignatureZ_free(ptrArray _res) {
10992 LDKCVec_SignatureZ _res_constr;
10993 _res_constr.datalen = _res->arr_len;
10994 if (_res_constr.datalen > 0)
10995 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
10997 _res_constr.data = NULL;
10998 int8_tArray* _res_vals = (void*) _res->elems /* XXX _res leaks */;
10999 for (size_t m = 0; m < _res_constr.datalen; m++) {
11000 int8_tArray _res_conv_12 = _res_vals[m];
11001 LDKSignature _res_conv_12_ref;
11002 CHECK(_res_conv_12->arr_len == 64);
11003 memcpy(_res_conv_12_ref.compact_form, _res_conv_12->elems, 64); FREE(_res_conv_12);
11004 _res_constr.data[m] = _res_conv_12_ref;
11006 CVec_SignatureZ_free(_res_constr);
11009 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
11010 LDKHolderCommitmentTransaction o_conv;
11011 o_conv.inner = (void*)(o & (~1));
11012 o_conv.is_owned = (o & 1) || (o == 0);
11013 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11014 o_conv = HolderCommitmentTransaction_clone(&o_conv);
11015 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11016 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
11017 return (uintptr_t)ret_conv;
11020 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
11021 LDKDecodeError e_conv;
11022 e_conv.inner = (void*)(e & (~1));
11023 e_conv.is_owned = (e & 1) || (e == 0);
11024 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11025 e_conv = DecodeError_clone(&e_conv);
11026 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11027 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
11028 return (uintptr_t)ret_conv;
11031 jboolean __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
11032 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(o & ~1);
11033 jboolean ret_val = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
11037 void __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
11038 if ((_res & 1) != 0) return;
11039 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11040 CHECK_ACCESS(_res_ptr);
11041 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
11043 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
11046 static inline uintptr_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
11047 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11048 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
11049 return (uintptr_t)ret_conv;
11051 intptr_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
11052 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
11053 intptr_t ret_val = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
11057 uint32_t __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
11058 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
11059 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11060 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
11061 return (uintptr_t)ret_conv;
11064 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
11065 LDKBuiltCommitmentTransaction o_conv;
11066 o_conv.inner = (void*)(o & (~1));
11067 o_conv.is_owned = (o & 1) || (o == 0);
11068 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11069 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
11070 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
11071 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
11072 return (uintptr_t)ret_conv;
11075 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
11076 LDKDecodeError e_conv;
11077 e_conv.inner = (void*)(e & (~1));
11078 e_conv.is_owned = (e & 1) || (e == 0);
11079 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11080 e_conv = DecodeError_clone(&e_conv);
11081 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
11082 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
11083 return (uintptr_t)ret_conv;
11086 jboolean __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
11087 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(o & ~1);
11088 jboolean ret_val = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
11092 void __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
11093 if ((_res & 1) != 0) return;
11094 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11095 CHECK_ACCESS(_res_ptr);
11096 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
11098 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
11101 static inline uintptr_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
11102 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
11103 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
11104 return (uintptr_t)ret_conv;
11106 intptr_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
11107 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
11108 intptr_t ret_val = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
11112 uint32_t __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
11113 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
11114 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
11115 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
11116 return (uintptr_t)ret_conv;
11119 uint32_t __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint32_t o) {
11120 LDKTrustedClosingTransaction o_conv;
11121 o_conv.inner = (void*)(o & (~1));
11122 o_conv.is_owned = (o & 1) || (o == 0);
11123 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11124 // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
11125 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
11126 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
11127 return (uintptr_t)ret_conv;
11130 uint32_t __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_err"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
11131 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
11132 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
11133 return (uintptr_t)ret_conv;
11136 jboolean __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_is_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint32_t o) {
11137 LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(o & ~1);
11138 jboolean ret_val = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
11142 void __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_free"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint32_t _res) {
11143 if ((_res & 1) != 0) return;
11144 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11145 CHECK_ACCESS(_res_ptr);
11146 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
11148 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
11151 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
11152 LDKCommitmentTransaction o_conv;
11153 o_conv.inner = (void*)(o & (~1));
11154 o_conv.is_owned = (o & 1) || (o == 0);
11155 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11156 o_conv = CommitmentTransaction_clone(&o_conv);
11157 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
11158 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
11159 return (uintptr_t)ret_conv;
11162 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint32_t e) {
11163 LDKDecodeError e_conv;
11164 e_conv.inner = (void*)(e & (~1));
11165 e_conv.is_owned = (e & 1) || (e == 0);
11166 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11167 e_conv = DecodeError_clone(&e_conv);
11168 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
11169 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
11170 return (uintptr_t)ret_conv;
11173 jboolean __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint32_t o) {
11174 LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(o & ~1);
11175 jboolean ret_val = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
11179 void __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_free"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
11180 if ((_res & 1) != 0) return;
11181 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11182 CHECK_ACCESS(_res_ptr);
11183 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
11185 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
11188 static inline uintptr_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
11189 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
11190 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
11191 return (uintptr_t)ret_conv;
11193 intptr_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint32_t arg) {
11194 LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
11195 intptr_t ret_val = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
11199 uint32_t __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
11200 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
11201 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
11202 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
11203 return (uintptr_t)ret_conv;
11206 uint32_t __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint32_t o) {
11207 LDKTrustedCommitmentTransaction o_conv;
11208 o_conv.inner = (void*)(o & (~1));
11209 o_conv.is_owned = (o & 1) || (o == 0);
11210 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11211 // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
11212 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
11213 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
11214 return (uintptr_t)ret_conv;
11217 uint32_t __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
11218 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
11219 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
11220 return (uintptr_t)ret_conv;
11223 jboolean __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint32_t o) {
11224 LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(o & ~1);
11225 jboolean ret_val = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
11229 void __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_free"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint32_t _res) {
11230 if ((_res & 1) != 0) return;
11231 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11232 CHECK_ACCESS(_res_ptr);
11233 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
11235 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
11238 uint32_t __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_ok"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
11239 LDKCVec_SignatureZ o_constr;
11240 o_constr.datalen = o->arr_len;
11241 if (o_constr.datalen > 0)
11242 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
11244 o_constr.data = NULL;
11245 int8_tArray* o_vals = (void*) o->elems /* XXX o leaks */;
11246 for (size_t m = 0; m < o_constr.datalen; m++) {
11247 int8_tArray o_conv_12 = o_vals[m];
11248 LDKSignature o_conv_12_ref;
11249 CHECK(o_conv_12->arr_len == 64);
11250 memcpy(o_conv_12_ref.compact_form, o_conv_12->elems, 64); FREE(o_conv_12);
11251 o_constr.data[m] = o_conv_12_ref;
11253 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
11254 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
11255 return (uintptr_t)ret_conv;
11258 uint32_t __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_err"))) TS_CResult_CVec_SignatureZNoneZ_err() {
11259 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
11260 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
11261 return (uintptr_t)ret_conv;
11264 jboolean __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_is_ok"))) TS_CResult_CVec_SignatureZNoneZ_is_ok(uint32_t o) {
11265 LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)(o & ~1);
11266 jboolean ret_val = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
11270 void __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_free"))) TS_CResult_CVec_SignatureZNoneZ_free(uint32_t _res) {
11271 if ((_res & 1) != 0) return;
11272 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11273 CHECK_ACCESS(_res_ptr);
11274 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
11276 CResult_CVec_SignatureZNoneZ_free(_res_conv);
11279 static inline uintptr_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
11280 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
11281 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
11282 return (uintptr_t)ret_conv;
11284 intptr_t __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone_ptr"))) TS_CResult_CVec_SignatureZNoneZ_clone_ptr(uint32_t arg) {
11285 LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
11286 intptr_t ret_val = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
11290 uint32_t __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint32_t orig) {
11291 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
11292 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
11293 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
11294 return (uintptr_t)ret_conv;
11297 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint32_t o) {
11298 LDKShutdownScript o_conv;
11299 o_conv.inner = (void*)(o & (~1));
11300 o_conv.is_owned = (o & 1) || (o == 0);
11301 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11302 o_conv = ShutdownScript_clone(&o_conv);
11303 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
11304 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
11305 return (uintptr_t)ret_conv;
11308 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint32_t e) {
11309 LDKDecodeError e_conv;
11310 e_conv.inner = (void*)(e & (~1));
11311 e_conv.is_owned = (e & 1) || (e == 0);
11312 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11313 e_conv = DecodeError_clone(&e_conv);
11314 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
11315 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
11316 return (uintptr_t)ret_conv;
11319 jboolean __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_is_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint32_t o) {
11320 LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(o & ~1);
11321 jboolean ret_val = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
11325 void __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_free"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint32_t _res) {
11326 if ((_res & 1) != 0) return;
11327 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11328 CHECK_ACCESS(_res_ptr);
11329 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
11331 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
11334 static inline uintptr_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
11335 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
11336 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
11337 return (uintptr_t)ret_conv;
11339 intptr_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint32_t arg) {
11340 LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
11341 intptr_t ret_val = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
11345 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint32_t orig) {
11346 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
11347 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
11348 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
11349 return (uintptr_t)ret_conv;
11352 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint32_t o) {
11353 LDKShutdownScript o_conv;
11354 o_conv.inner = (void*)(o & (~1));
11355 o_conv.is_owned = (o & 1) || (o == 0);
11356 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11357 o_conv = ShutdownScript_clone(&o_conv);
11358 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
11359 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
11360 return (uintptr_t)ret_conv;
11363 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint32_t e) {
11364 LDKInvalidShutdownScript e_conv;
11365 e_conv.inner = (void*)(e & (~1));
11366 e_conv.is_owned = (e & 1) || (e == 0);
11367 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11368 e_conv = InvalidShutdownScript_clone(&e_conv);
11369 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
11370 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
11371 return (uintptr_t)ret_conv;
11374 jboolean __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint32_t o) {
11375 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(o & ~1);
11376 jboolean ret_val = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
11380 void __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint32_t _res) {
11381 if ((_res & 1) != 0) return;
11382 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11383 CHECK_ACCESS(_res_ptr);
11384 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
11386 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
11389 static inline uintptr_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
11390 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
11391 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
11392 return (uintptr_t)ret_conv;
11394 intptr_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint32_t arg) {
11395 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
11396 intptr_t ret_val = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
11400 uint32_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint32_t orig) {
11401 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(orig & ~1);
11402 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
11403 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
11404 return (uintptr_t)ret_conv;
11407 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_ok"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint32_t o) {
11408 LDKRouteHop o_conv;
11409 o_conv.inner = (void*)(o & (~1));
11410 o_conv.is_owned = (o & 1) || (o == 0);
11411 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11412 o_conv = RouteHop_clone(&o_conv);
11413 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
11414 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
11415 return (uintptr_t)ret_conv;
11418 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_err"))) TS_CResult_RouteHopDecodeErrorZ_err(uint32_t e) {
11419 LDKDecodeError e_conv;
11420 e_conv.inner = (void*)(e & (~1));
11421 e_conv.is_owned = (e & 1) || (e == 0);
11422 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11423 e_conv = DecodeError_clone(&e_conv);
11424 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
11425 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
11426 return (uintptr_t)ret_conv;
11429 jboolean __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint32_t o) {
11430 LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)(o & ~1);
11431 jboolean ret_val = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
11435 void __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_free"))) TS_CResult_RouteHopDecodeErrorZ_free(uint32_t _res) {
11436 if ((_res & 1) != 0) return;
11437 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11438 CHECK_ACCESS(_res_ptr);
11439 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
11441 CResult_RouteHopDecodeErrorZ_free(_res_conv);
11444 static inline uintptr_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
11445 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
11446 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
11447 return (uintptr_t)ret_conv;
11449 intptr_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint32_t arg) {
11450 LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
11451 intptr_t ret_val = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
11455 uint32_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint32_t orig) {
11456 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
11457 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
11458 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
11459 return (uintptr_t)ret_conv;
11462 void __attribute__((export_name("TS_CVec_RouteHopZ_free"))) TS_CVec_RouteHopZ_free(uint32_tArray _res) {
11463 LDKCVec_RouteHopZ _res_constr;
11464 _res_constr.datalen = _res->arr_len;
11465 if (_res_constr.datalen > 0)
11466 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11468 _res_constr.data = NULL;
11469 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
11470 for (size_t k = 0; k < _res_constr.datalen; k++) {
11471 uint32_t _res_conv_10 = _res_vals[k];
11472 LDKRouteHop _res_conv_10_conv;
11473 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
11474 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
11475 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
11476 _res_constr.data[k] = _res_conv_10_conv;
11478 CVec_RouteHopZ_free(_res_constr);
11481 void __attribute__((export_name("TS_CVec_CVec_RouteHopZZ_free"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
11482 LDKCVec_CVec_RouteHopZZ _res_constr;
11483 _res_constr.datalen = _res->arr_len;
11484 if (_res_constr.datalen > 0)
11485 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
11487 _res_constr.data = NULL;
11488 uint32_tArray* _res_vals = (void*) _res->elems /* XXX _res leaks */;
11489 for (size_t m = 0; m < _res_constr.datalen; m++) {
11490 uint32_tArray _res_conv_12 = _res_vals[m];
11491 LDKCVec_RouteHopZ _res_conv_12_constr;
11492 _res_conv_12_constr.datalen = _res_conv_12->arr_len;
11493 if (_res_conv_12_constr.datalen > 0)
11494 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11496 _res_conv_12_constr.data = NULL;
11497 uint32_t* _res_conv_12_vals = _res_conv_12->elems /* XXX _res_conv_12 leaks */;
11498 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
11499 uint32_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
11500 LDKRouteHop _res_conv_12_conv_10_conv;
11501 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
11502 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
11503 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
11504 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
11506 _res_constr.data[m] = _res_conv_12_constr;
11508 CVec_CVec_RouteHopZZ_free(_res_constr);
11511 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_ok"))) TS_CResult_RouteDecodeErrorZ_ok(uint32_t o) {
11513 o_conv.inner = (void*)(o & (~1));
11514 o_conv.is_owned = (o & 1) || (o == 0);
11515 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11516 o_conv = Route_clone(&o_conv);
11517 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
11518 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
11519 return (uintptr_t)ret_conv;
11522 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_err"))) TS_CResult_RouteDecodeErrorZ_err(uint32_t e) {
11523 LDKDecodeError e_conv;
11524 e_conv.inner = (void*)(e & (~1));
11525 e_conv.is_owned = (e & 1) || (e == 0);
11526 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11527 e_conv = DecodeError_clone(&e_conv);
11528 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
11529 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
11530 return (uintptr_t)ret_conv;
11533 jboolean __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_is_ok"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint32_t o) {
11534 LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)(o & ~1);
11535 jboolean ret_val = CResult_RouteDecodeErrorZ_is_ok(o_conv);
11539 void __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_free"))) TS_CResult_RouteDecodeErrorZ_free(uint32_t _res) {
11540 if ((_res & 1) != 0) return;
11541 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11542 CHECK_ACCESS(_res_ptr);
11543 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
11545 CResult_RouteDecodeErrorZ_free(_res_conv);
11548 static inline uintptr_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
11549 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
11550 *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
11551 return (uintptr_t)ret_conv;
11553 intptr_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone_ptr"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint32_t arg) {
11554 LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
11555 intptr_t ret_val = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
11559 uint32_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone"))) TS_CResult_RouteDecodeErrorZ_clone(uint32_t orig) {
11560 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
11561 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
11562 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
11563 return (uintptr_t)ret_conv;
11566 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_ok"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint32_t o) {
11567 LDKRouteParameters o_conv;
11568 o_conv.inner = (void*)(o & (~1));
11569 o_conv.is_owned = (o & 1) || (o == 0);
11570 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11571 o_conv = RouteParameters_clone(&o_conv);
11572 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
11573 *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
11574 return (uintptr_t)ret_conv;
11577 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_err"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint32_t e) {
11578 LDKDecodeError e_conv;
11579 e_conv.inner = (void*)(e & (~1));
11580 e_conv.is_owned = (e & 1) || (e == 0);
11581 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11582 e_conv = DecodeError_clone(&e_conv);
11583 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
11584 *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
11585 return (uintptr_t)ret_conv;
11588 jboolean __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_is_ok"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint32_t o) {
11589 LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(o & ~1);
11590 jboolean ret_val = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
11594 void __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_free"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint32_t _res) {
11595 if ((_res & 1) != 0) return;
11596 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11597 CHECK_ACCESS(_res_ptr);
11598 LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
11600 CResult_RouteParametersDecodeErrorZ_free(_res_conv);
11603 static inline uintptr_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
11604 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
11605 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
11606 return (uintptr_t)ret_conv;
11608 intptr_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone_ptr"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
11609 LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
11610 intptr_t ret_val = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
11614 uint32_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint32_t orig) {
11615 LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(orig & ~1);
11616 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
11617 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
11618 return (uintptr_t)ret_conv;
11621 void __attribute__((export_name("TS_CVec_RouteHintZ_free"))) TS_CVec_RouteHintZ_free(uint32_tArray _res) {
11622 LDKCVec_RouteHintZ _res_constr;
11623 _res_constr.datalen = _res->arr_len;
11624 if (_res_constr.datalen > 0)
11625 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
11627 _res_constr.data = NULL;
11628 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
11629 for (size_t l = 0; l < _res_constr.datalen; l++) {
11630 uint32_t _res_conv_11 = _res_vals[l];
11631 LDKRouteHint _res_conv_11_conv;
11632 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
11633 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
11634 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
11635 _res_constr.data[l] = _res_conv_11_conv;
11637 CVec_RouteHintZ_free(_res_constr);
11640 uint32_t __attribute__((export_name("TS_COption_u64Z_some"))) TS_COption_u64Z_some(int64_t o) {
11641 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11642 *ret_copy = COption_u64Z_some(o);
11643 uintptr_t ret_ref = (uintptr_t)ret_copy;
11647 uint32_t __attribute__((export_name("TS_COption_u64Z_none"))) TS_COption_u64Z_none() {
11648 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11649 *ret_copy = COption_u64Z_none();
11650 uintptr_t ret_ref = (uintptr_t)ret_copy;
11654 void __attribute__((export_name("TS_COption_u64Z_free"))) TS_COption_u64Z_free(uint32_t _res) {
11655 if ((_res & 1) != 0) return;
11656 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11657 CHECK_ACCESS(_res_ptr);
11658 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
11660 COption_u64Z_free(_res_conv);
11663 static inline uintptr_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
11664 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11665 *ret_copy = COption_u64Z_clone(arg);
11666 uintptr_t ret_ref = (uintptr_t)ret_copy;
11669 intptr_t __attribute__((export_name("TS_COption_u64Z_clone_ptr"))) TS_COption_u64Z_clone_ptr(uint32_t arg) {
11670 LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)arg;
11671 intptr_t ret_val = COption_u64Z_clone_ptr(arg_conv);
11675 uint32_t __attribute__((export_name("TS_COption_u64Z_clone"))) TS_COption_u64Z_clone(uint32_t orig) {
11676 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
11677 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11678 *ret_copy = COption_u64Z_clone(orig_conv);
11679 uintptr_t ret_ref = (uintptr_t)ret_copy;
11683 uint32_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_ok(uint32_t o) {
11684 LDKPaymentParameters o_conv;
11685 o_conv.inner = (void*)(o & (~1));
11686 o_conv.is_owned = (o & 1) || (o == 0);
11687 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11688 o_conv = PaymentParameters_clone(&o_conv);
11689 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
11690 *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
11691 return (uintptr_t)ret_conv;
11694 uint32_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_err"))) TS_CResult_PaymentParametersDecodeErrorZ_err(uint32_t e) {
11695 LDKDecodeError e_conv;
11696 e_conv.inner = (void*)(e & (~1));
11697 e_conv.is_owned = (e & 1) || (e == 0);
11698 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11699 e_conv = DecodeError_clone(&e_conv);
11700 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
11701 *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
11702 return (uintptr_t)ret_conv;
11705 jboolean __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_is_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_is_ok(uint32_t o) {
11706 LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(o & ~1);
11707 jboolean ret_val = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
11711 void __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_free"))) TS_CResult_PaymentParametersDecodeErrorZ_free(uint32_t _res) {
11712 if ((_res & 1) != 0) return;
11713 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11714 CHECK_ACCESS(_res_ptr);
11715 LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
11717 CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
11720 static inline uintptr_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
11721 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
11722 *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
11723 return (uintptr_t)ret_conv;
11725 intptr_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
11726 LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(arg & ~1);
11727 intptr_t ret_val = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
11731 uint32_t __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone"))) TS_CResult_PaymentParametersDecodeErrorZ_clone(uint32_t orig) {
11732 LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(orig & ~1);
11733 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
11734 *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
11735 return (uintptr_t)ret_conv;
11738 void __attribute__((export_name("TS_CVec_RouteHintHopZ_free"))) TS_CVec_RouteHintHopZ_free(uint32_tArray _res) {
11739 LDKCVec_RouteHintHopZ _res_constr;
11740 _res_constr.datalen = _res->arr_len;
11741 if (_res_constr.datalen > 0)
11742 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
11744 _res_constr.data = NULL;
11745 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
11746 for (size_t o = 0; o < _res_constr.datalen; o++) {
11747 uint32_t _res_conv_14 = _res_vals[o];
11748 LDKRouteHintHop _res_conv_14_conv;
11749 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
11750 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
11751 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
11752 _res_constr.data[o] = _res_conv_14_conv;
11754 CVec_RouteHintHopZ_free(_res_constr);
11757 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_ok"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint32_t o) {
11758 LDKRouteHint o_conv;
11759 o_conv.inner = (void*)(o & (~1));
11760 o_conv.is_owned = (o & 1) || (o == 0);
11761 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11762 o_conv = RouteHint_clone(&o_conv);
11763 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
11764 *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
11765 return (uintptr_t)ret_conv;
11768 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_err"))) TS_CResult_RouteHintDecodeErrorZ_err(uint32_t e) {
11769 LDKDecodeError e_conv;
11770 e_conv.inner = (void*)(e & (~1));
11771 e_conv.is_owned = (e & 1) || (e == 0);
11772 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11773 e_conv = DecodeError_clone(&e_conv);
11774 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
11775 *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
11776 return (uintptr_t)ret_conv;
11779 jboolean __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_is_ok"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint32_t o) {
11780 LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)(o & ~1);
11781 jboolean ret_val = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
11785 void __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_free"))) TS_CResult_RouteHintDecodeErrorZ_free(uint32_t _res) {
11786 if ((_res & 1) != 0) return;
11787 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11788 CHECK_ACCESS(_res_ptr);
11789 LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
11791 CResult_RouteHintDecodeErrorZ_free(_res_conv);
11794 static inline uintptr_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
11795 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
11796 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
11797 return (uintptr_t)ret_conv;
11799 intptr_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint32_t arg) {
11800 LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
11801 intptr_t ret_val = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
11805 uint32_t __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint32_t orig) {
11806 LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)(orig & ~1);
11807 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
11808 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
11809 return (uintptr_t)ret_conv;
11812 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint32_t o) {
11813 LDKRouteHintHop o_conv;
11814 o_conv.inner = (void*)(o & (~1));
11815 o_conv.is_owned = (o & 1) || (o == 0);
11816 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11817 o_conv = RouteHintHop_clone(&o_conv);
11818 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
11819 *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
11820 return (uintptr_t)ret_conv;
11823 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_err"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint32_t e) {
11824 LDKDecodeError e_conv;
11825 e_conv.inner = (void*)(e & (~1));
11826 e_conv.is_owned = (e & 1) || (e == 0);
11827 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11828 e_conv = DecodeError_clone(&e_conv);
11829 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
11830 *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
11831 return (uintptr_t)ret_conv;
11834 jboolean __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint32_t o) {
11835 LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(o & ~1);
11836 jboolean ret_val = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
11840 void __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_free"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint32_t _res) {
11841 if ((_res & 1) != 0) return;
11842 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11843 CHECK_ACCESS(_res_ptr);
11844 LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
11846 CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
11849 static inline uintptr_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
11850 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
11851 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
11852 return (uintptr_t)ret_conv;
11854 intptr_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint32_t arg) {
11855 LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
11856 intptr_t ret_val = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
11860 uint32_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint32_t orig) {
11861 LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(orig & ~1);
11862 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
11863 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
11864 return (uintptr_t)ret_conv;
11867 void __attribute__((export_name("TS_CVec_ChannelDetailsZ_free"))) TS_CVec_ChannelDetailsZ_free(uint32_tArray _res) {
11868 LDKCVec_ChannelDetailsZ _res_constr;
11869 _res_constr.datalen = _res->arr_len;
11870 if (_res_constr.datalen > 0)
11871 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
11873 _res_constr.data = NULL;
11874 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
11875 for (size_t q = 0; q < _res_constr.datalen; q++) {
11876 uint32_t _res_conv_16 = _res_vals[q];
11877 LDKChannelDetails _res_conv_16_conv;
11878 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
11879 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
11880 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
11881 _res_constr.data[q] = _res_conv_16_conv;
11883 CVec_ChannelDetailsZ_free(_res_constr);
11886 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_ok"))) TS_CResult_RouteLightningErrorZ_ok(uint32_t o) {
11888 o_conv.inner = (void*)(o & (~1));
11889 o_conv.is_owned = (o & 1) || (o == 0);
11890 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11891 o_conv = Route_clone(&o_conv);
11892 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11893 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
11894 return (uintptr_t)ret_conv;
11897 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_err"))) TS_CResult_RouteLightningErrorZ_err(uint32_t e) {
11898 LDKLightningError e_conv;
11899 e_conv.inner = (void*)(e & (~1));
11900 e_conv.is_owned = (e & 1) || (e == 0);
11901 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11902 e_conv = LightningError_clone(&e_conv);
11903 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11904 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
11905 return (uintptr_t)ret_conv;
11908 jboolean __attribute__((export_name("TS_CResult_RouteLightningErrorZ_is_ok"))) TS_CResult_RouteLightningErrorZ_is_ok(uint32_t o) {
11909 LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)(o & ~1);
11910 jboolean ret_val = CResult_RouteLightningErrorZ_is_ok(o_conv);
11914 void __attribute__((export_name("TS_CResult_RouteLightningErrorZ_free"))) TS_CResult_RouteLightningErrorZ_free(uint32_t _res) {
11915 if ((_res & 1) != 0) return;
11916 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11917 CHECK_ACCESS(_res_ptr);
11918 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
11920 CResult_RouteLightningErrorZ_free(_res_conv);
11923 static inline uintptr_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
11924 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11925 *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
11926 return (uintptr_t)ret_conv;
11928 intptr_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone_ptr"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint32_t arg) {
11929 LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
11930 intptr_t ret_val = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
11934 uint32_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone"))) TS_CResult_RouteLightningErrorZ_clone(uint32_t orig) {
11935 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
11936 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11937 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
11938 return (uintptr_t)ret_conv;
11941 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_ok"))) TS_CResult_TxOutAccessErrorZ_ok(uint32_t o) {
11942 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
11943 CHECK_ACCESS(o_ptr);
11944 LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
11945 o_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)o) & ~1));
11946 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
11947 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
11948 return (uintptr_t)ret_conv;
11951 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_err"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
11952 LDKAccessError e_conv = LDKAccessError_from_js(e);
11953 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
11954 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
11955 return (uintptr_t)ret_conv;
11958 jboolean __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_is_ok"))) TS_CResult_TxOutAccessErrorZ_is_ok(uint32_t o) {
11959 LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)(o & ~1);
11960 jboolean ret_val = CResult_TxOutAccessErrorZ_is_ok(o_conv);
11964 void __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_free"))) TS_CResult_TxOutAccessErrorZ_free(uint32_t _res) {
11965 if ((_res & 1) != 0) return;
11966 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
11967 CHECK_ACCESS(_res_ptr);
11968 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
11970 CResult_TxOutAccessErrorZ_free(_res_conv);
11973 static inline uintptr_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
11974 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
11975 *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
11976 return (uintptr_t)ret_conv;
11978 intptr_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone_ptr"))) TS_CResult_TxOutAccessErrorZ_clone_ptr(uint32_t arg) {
11979 LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
11980 intptr_t ret_val = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
11984 uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone"))) TS_CResult_TxOutAccessErrorZ_clone(uint32_t orig) {
11985 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
11986 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
11987 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
11988 return (uintptr_t)ret_conv;
11991 static inline uintptr_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
11992 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
11993 *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
11994 return ((uintptr_t)ret_conv);
11996 intptr_t __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone_ptr"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint32_t arg) {
11997 LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)(arg & ~1);
11998 intptr_t ret_val = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
12002 uint32_t __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone"))) TS_C2Tuple_usizeTransactionZ_clone(uint32_t orig) {
12003 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
12004 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
12005 *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
12006 return ((uintptr_t)ret_conv);
12009 uint32_t __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_new"))) TS_C2Tuple_usizeTransactionZ_new(intptr_t a, int8_tArray b) {
12010 LDKTransaction b_ref;
12011 b_ref.datalen = b->arr_len;
12012 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
12013 memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
12014 b_ref.data_is_owned = true;
12015 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
12016 *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
12017 return ((uintptr_t)ret_conv);
12020 void __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_free"))) TS_C2Tuple_usizeTransactionZ_free(uint32_t _res) {
12021 if ((_res & 1) != 0) return;
12022 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12023 CHECK_ACCESS(_res_ptr);
12024 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
12026 C2Tuple_usizeTransactionZ_free(_res_conv);
12029 void __attribute__((export_name("TS_CVec_C2Tuple_usizeTransactionZZ_free"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint32_tArray _res) {
12030 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
12031 _res_constr.datalen = _res->arr_len;
12032 if (_res_constr.datalen > 0)
12033 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
12035 _res_constr.data = NULL;
12036 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
12037 for (size_t c = 0; c < _res_constr.datalen; c++) {
12038 uint32_t _res_conv_28 = _res_vals[c];
12039 void* _res_conv_28_ptr = (void*)(((uintptr_t)_res_conv_28) & ~1);
12040 CHECK_ACCESS(_res_conv_28_ptr);
12041 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
12042 FREE((void*)_res_conv_28);
12043 _res_constr.data[c] = _res_conv_28_conv;
12045 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
12048 void __attribute__((export_name("TS_CVec_TxidZ_free"))) TS_CVec_TxidZ_free(ptrArray _res) {
12049 LDKCVec_TxidZ _res_constr;
12050 _res_constr.datalen = _res->arr_len;
12051 if (_res_constr.datalen > 0)
12052 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
12054 _res_constr.data = NULL;
12055 int8_tArray* _res_vals = (void*) _res->elems /* XXX _res leaks */;
12056 for (size_t m = 0; m < _res_constr.datalen; m++) {
12057 int8_tArray _res_conv_12 = _res_vals[m];
12058 LDKThirtyTwoBytes _res_conv_12_ref;
12059 CHECK(_res_conv_12->arr_len == 32);
12060 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
12061 _res_constr.data[m] = _res_conv_12_ref;
12063 CVec_TxidZ_free(_res_constr);
12066 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
12067 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
12068 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
12069 return (uintptr_t)ret_conv;
12072 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_err"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
12073 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
12074 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
12075 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
12076 return (uintptr_t)ret_conv;
12079 jboolean __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_is_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_is_ok(uint32_t o) {
12080 LDKCResult_NoneChannelMonitorUpdateErrZ* o_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(o & ~1);
12081 jboolean ret_val = CResult_NoneChannelMonitorUpdateErrZ_is_ok(o_conv);
12085 void __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_free"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint32_t _res) {
12086 if ((_res & 1) != 0) return;
12087 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12088 CHECK_ACCESS(_res_ptr);
12089 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
12091 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
12094 static inline uintptr_t CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR arg) {
12095 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
12096 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(arg);
12097 return (uintptr_t)ret_conv;
12099 intptr_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_clone_ptr"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(uint32_t arg) {
12100 LDKCResult_NoneChannelMonitorUpdateErrZ* arg_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
12101 intptr_t ret_val = CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(arg_conv);
12105 uint32_t __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_clone"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint32_t orig) {
12106 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
12107 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
12108 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
12109 return (uintptr_t)ret_conv;
12112 void __attribute__((export_name("TS_CVec_MonitorEventZ_free"))) TS_CVec_MonitorEventZ_free(uint32_tArray _res) {
12113 LDKCVec_MonitorEventZ _res_constr;
12114 _res_constr.datalen = _res->arr_len;
12115 if (_res_constr.datalen > 0)
12116 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
12118 _res_constr.data = NULL;
12119 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
12120 for (size_t o = 0; o < _res_constr.datalen; o++) {
12121 uint32_t _res_conv_14 = _res_vals[o];
12122 void* _res_conv_14_ptr = (void*)(((uintptr_t)_res_conv_14) & ~1);
12123 CHECK_ACCESS(_res_conv_14_ptr);
12124 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
12125 FREE((void*)_res_conv_14);
12126 _res_constr.data[o] = _res_conv_14_conv;
12128 CVec_MonitorEventZ_free(_res_constr);
12131 uint32_t __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_some"))) TS_COption_C2Tuple_usizeTransactionZZ_some(uint32_t o) {
12132 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12133 CHECK_ACCESS(o_ptr);
12134 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(o_ptr);
12135 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)o) & ~1));
12136 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
12137 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
12138 uintptr_t ret_ref = (uintptr_t)ret_copy;
12142 uint32_t __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_none"))) TS_COption_C2Tuple_usizeTransactionZZ_none() {
12143 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
12144 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
12145 uintptr_t ret_ref = (uintptr_t)ret_copy;
12149 void __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_free"))) TS_COption_C2Tuple_usizeTransactionZZ_free(uint32_t _res) {
12150 if ((_res & 1) != 0) return;
12151 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12152 CHECK_ACCESS(_res_ptr);
12153 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(_res_ptr);
12155 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
12158 static inline uintptr_t COption_C2Tuple_usizeTransactionZZ_clone_ptr(LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR arg) {
12159 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
12160 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(arg);
12161 uintptr_t ret_ref = (uintptr_t)ret_copy;
12164 intptr_t __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_clone_ptr"))) TS_COption_C2Tuple_usizeTransactionZZ_clone_ptr(uint32_t arg) {
12165 LDKCOption_C2Tuple_usizeTransactionZZ* arg_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)arg;
12166 intptr_t ret_val = COption_C2Tuple_usizeTransactionZZ_clone_ptr(arg_conv);
12170 uint32_t __attribute__((export_name("TS_COption_C2Tuple_usizeTransactionZZ_clone"))) TS_COption_C2Tuple_usizeTransactionZZ_clone(uint32_t orig) {
12171 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
12172 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
12173 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
12174 uintptr_t ret_ref = (uintptr_t)ret_copy;
12178 uint32_t __attribute__((export_name("TS_COption_ClosureReasonZ_some"))) TS_COption_ClosureReasonZ_some(uint32_t o) {
12179 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12180 CHECK_ACCESS(o_ptr);
12181 LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
12182 o_conv = ClosureReason_clone((LDKClosureReason*)(((uintptr_t)o) & ~1));
12183 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12184 *ret_copy = COption_ClosureReasonZ_some(o_conv);
12185 uintptr_t ret_ref = (uintptr_t)ret_copy;
12189 uint32_t __attribute__((export_name("TS_COption_ClosureReasonZ_none"))) TS_COption_ClosureReasonZ_none() {
12190 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12191 *ret_copy = COption_ClosureReasonZ_none();
12192 uintptr_t ret_ref = (uintptr_t)ret_copy;
12196 void __attribute__((export_name("TS_COption_ClosureReasonZ_free"))) TS_COption_ClosureReasonZ_free(uint32_t _res) {
12197 if ((_res & 1) != 0) return;
12198 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12199 CHECK_ACCESS(_res_ptr);
12200 LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
12202 COption_ClosureReasonZ_free(_res_conv);
12205 static inline uintptr_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
12206 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12207 *ret_copy = COption_ClosureReasonZ_clone(arg);
12208 uintptr_t ret_ref = (uintptr_t)ret_copy;
12211 intptr_t __attribute__((export_name("TS_COption_ClosureReasonZ_clone_ptr"))) TS_COption_ClosureReasonZ_clone_ptr(uint32_t arg) {
12212 LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)arg;
12213 intptr_t ret_val = COption_ClosureReasonZ_clone_ptr(arg_conv);
12217 uint32_t __attribute__((export_name("TS_COption_ClosureReasonZ_clone"))) TS_COption_ClosureReasonZ_clone(uint32_t orig) {
12218 LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)orig;
12219 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12220 *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
12221 uintptr_t ret_ref = (uintptr_t)ret_copy;
12225 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint32_t o) {
12226 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12227 CHECK_ACCESS(o_ptr);
12228 LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
12229 o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)(((uintptr_t)o) & ~1));
12230 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12231 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
12232 return (uintptr_t)ret_conv;
12235 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint32_t e) {
12236 LDKDecodeError e_conv;
12237 e_conv.inner = (void*)(e & (~1));
12238 e_conv.is_owned = (e & 1) || (e == 0);
12239 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12240 e_conv = DecodeError_clone(&e_conv);
12241 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12242 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
12243 return (uintptr_t)ret_conv;
12246 jboolean __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint32_t o) {
12247 LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(o & ~1);
12248 jboolean ret_val = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
12252 void __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_free"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint32_t _res) {
12253 if ((_res & 1) != 0) return;
12254 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12255 CHECK_ACCESS(_res_ptr);
12256 LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
12258 CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
12261 static inline uintptr_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
12262 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12263 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
12264 return (uintptr_t)ret_conv;
12266 intptr_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint32_t arg) {
12267 LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(arg & ~1);
12268 intptr_t ret_val = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
12272 uint32_t __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint32_t orig) {
12273 LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(orig & ~1);
12274 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12275 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
12276 return (uintptr_t)ret_conv;
12279 uint32_t __attribute__((export_name("TS_COption_NetworkUpdateZ_some"))) TS_COption_NetworkUpdateZ_some(uint32_t o) {
12280 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12281 CHECK_ACCESS(o_ptr);
12282 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
12283 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uintptr_t)o) & ~1));
12284 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12285 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
12286 uintptr_t ret_ref = (uintptr_t)ret_copy;
12290 uint32_t __attribute__((export_name("TS_COption_NetworkUpdateZ_none"))) TS_COption_NetworkUpdateZ_none() {
12291 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12292 *ret_copy = COption_NetworkUpdateZ_none();
12293 uintptr_t ret_ref = (uintptr_t)ret_copy;
12297 void __attribute__((export_name("TS_COption_NetworkUpdateZ_free"))) TS_COption_NetworkUpdateZ_free(uint32_t _res) {
12298 if ((_res & 1) != 0) return;
12299 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12300 CHECK_ACCESS(_res_ptr);
12301 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
12303 COption_NetworkUpdateZ_free(_res_conv);
12306 static inline uintptr_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
12307 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12308 *ret_copy = COption_NetworkUpdateZ_clone(arg);
12309 uintptr_t ret_ref = (uintptr_t)ret_copy;
12312 intptr_t __attribute__((export_name("TS_COption_NetworkUpdateZ_clone_ptr"))) TS_COption_NetworkUpdateZ_clone_ptr(uint32_t arg) {
12313 LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)arg;
12314 intptr_t ret_val = COption_NetworkUpdateZ_clone_ptr(arg_conv);
12318 uint32_t __attribute__((export_name("TS_COption_NetworkUpdateZ_clone"))) TS_COption_NetworkUpdateZ_clone(uint32_t orig) {
12319 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
12320 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
12321 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
12322 uintptr_t ret_ref = (uintptr_t)ret_copy;
12326 void __attribute__((export_name("TS_CVec_SpendableOutputDescriptorZ_free"))) TS_CVec_SpendableOutputDescriptorZ_free(uint32_tArray _res) {
12327 LDKCVec_SpendableOutputDescriptorZ _res_constr;
12328 _res_constr.datalen = _res->arr_len;
12329 if (_res_constr.datalen > 0)
12330 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
12332 _res_constr.data = NULL;
12333 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
12334 for (size_t b = 0; b < _res_constr.datalen; b++) {
12335 uint32_t _res_conv_27 = _res_vals[b];
12336 void* _res_conv_27_ptr = (void*)(((uintptr_t)_res_conv_27) & ~1);
12337 CHECK_ACCESS(_res_conv_27_ptr);
12338 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
12339 FREE((void*)_res_conv_27);
12340 _res_constr.data[b] = _res_conv_27_conv;
12342 CVec_SpendableOutputDescriptorZ_free(_res_constr);
12345 uint32_t __attribute__((export_name("TS_COption_EventZ_some"))) TS_COption_EventZ_some(uint32_t o) {
12346 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12347 CHECK_ACCESS(o_ptr);
12348 LDKEvent o_conv = *(LDKEvent*)(o_ptr);
12349 o_conv = Event_clone((LDKEvent*)(((uintptr_t)o) & ~1));
12350 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12351 *ret_copy = COption_EventZ_some(o_conv);
12352 uintptr_t ret_ref = (uintptr_t)ret_copy;
12356 uint32_t __attribute__((export_name("TS_COption_EventZ_none"))) TS_COption_EventZ_none() {
12357 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12358 *ret_copy = COption_EventZ_none();
12359 uintptr_t ret_ref = (uintptr_t)ret_copy;
12363 void __attribute__((export_name("TS_COption_EventZ_free"))) TS_COption_EventZ_free(uint32_t _res) {
12364 if ((_res & 1) != 0) return;
12365 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12366 CHECK_ACCESS(_res_ptr);
12367 LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
12369 COption_EventZ_free(_res_conv);
12372 static inline uintptr_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
12373 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12374 *ret_copy = COption_EventZ_clone(arg);
12375 uintptr_t ret_ref = (uintptr_t)ret_copy;
12378 intptr_t __attribute__((export_name("TS_COption_EventZ_clone_ptr"))) TS_COption_EventZ_clone_ptr(uint32_t arg) {
12379 LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)arg;
12380 intptr_t ret_val = COption_EventZ_clone_ptr(arg_conv);
12384 uint32_t __attribute__((export_name("TS_COption_EventZ_clone"))) TS_COption_EventZ_clone(uint32_t orig) {
12385 LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)orig;
12386 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12387 *ret_copy = COption_EventZ_clone(orig_conv);
12388 uintptr_t ret_ref = (uintptr_t)ret_copy;
12392 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_ok"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint32_t o) {
12393 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12394 CHECK_ACCESS(o_ptr);
12395 LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
12396 o_conv = COption_EventZ_clone((LDKCOption_EventZ*)(((uintptr_t)o) & ~1));
12397 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12398 *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
12399 return (uintptr_t)ret_conv;
12402 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_err"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint32_t e) {
12403 LDKDecodeError e_conv;
12404 e_conv.inner = (void*)(e & (~1));
12405 e_conv.is_owned = (e & 1) || (e == 0);
12406 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12407 e_conv = DecodeError_clone(&e_conv);
12408 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12409 *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
12410 return (uintptr_t)ret_conv;
12413 jboolean __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_is_ok"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint32_t o) {
12414 LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(o & ~1);
12415 jboolean ret_val = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
12419 void __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_free"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint32_t _res) {
12420 if ((_res & 1) != 0) return;
12421 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12422 CHECK_ACCESS(_res_ptr);
12423 LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
12425 CResult_COption_EventZDecodeErrorZ_free(_res_conv);
12428 static inline uintptr_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
12429 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12430 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
12431 return (uintptr_t)ret_conv;
12433 intptr_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint32_t arg) {
12434 LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(arg & ~1);
12435 intptr_t ret_val = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
12439 uint32_t __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint32_t orig) {
12440 LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(orig & ~1);
12441 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
12442 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
12443 return (uintptr_t)ret_conv;
12446 void __attribute__((export_name("TS_CVec_MessageSendEventZ_free"))) TS_CVec_MessageSendEventZ_free(uint32_tArray _res) {
12447 LDKCVec_MessageSendEventZ _res_constr;
12448 _res_constr.datalen = _res->arr_len;
12449 if (_res_constr.datalen > 0)
12450 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
12452 _res_constr.data = NULL;
12453 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
12454 for (size_t s = 0; s < _res_constr.datalen; s++) {
12455 uint32_t _res_conv_18 = _res_vals[s];
12456 void* _res_conv_18_ptr = (void*)(((uintptr_t)_res_conv_18) & ~1);
12457 CHECK_ACCESS(_res_conv_18_ptr);
12458 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
12459 FREE((void*)_res_conv_18);
12460 _res_constr.data[s] = _res_conv_18_conv;
12462 CVec_MessageSendEventZ_free(_res_constr);
12465 uint32_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok(uint32_t o) {
12466 LDKFixedPenaltyScorer o_conv;
12467 o_conv.inner = (void*)(o & (~1));
12468 o_conv.is_owned = (o & 1) || (o == 0);
12469 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12470 o_conv = FixedPenaltyScorer_clone(&o_conv);
12471 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
12472 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
12473 return (uintptr_t)ret_conv;
12476 uint32_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_err(uint32_t e) {
12477 LDKDecodeError e_conv;
12478 e_conv.inner = (void*)(e & (~1));
12479 e_conv.is_owned = (e & 1) || (e == 0);
12480 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12481 e_conv = DecodeError_clone(&e_conv);
12482 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
12483 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
12484 return (uintptr_t)ret_conv;
12487 jboolean __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(uint32_t o) {
12488 LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(o & ~1);
12489 jboolean ret_val = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
12493 void __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_free"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_free(uint32_t _res) {
12494 if ((_res & 1) != 0) return;
12495 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12496 CHECK_ACCESS(_res_ptr);
12497 LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
12499 CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
12502 static inline uintptr_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
12503 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
12504 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
12505 return (uintptr_t)ret_conv;
12507 intptr_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(uint32_t arg) {
12508 LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(arg & ~1);
12509 intptr_t ret_val = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
12513 uint32_t __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone(uint32_t orig) {
12514 LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(orig & ~1);
12515 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
12516 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
12517 return (uintptr_t)ret_conv;
12520 uint32_t __attribute__((export_name("TS_CResult_ScoringParametersDecodeErrorZ_ok"))) TS_CResult_ScoringParametersDecodeErrorZ_ok(uint32_t o) {
12521 LDKScoringParameters o_conv;
12522 o_conv.inner = (void*)(o & (~1));
12523 o_conv.is_owned = (o & 1) || (o == 0);
12524 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12525 o_conv = ScoringParameters_clone(&o_conv);
12526 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
12527 *ret_conv = CResult_ScoringParametersDecodeErrorZ_ok(o_conv);
12528 return (uintptr_t)ret_conv;
12531 uint32_t __attribute__((export_name("TS_CResult_ScoringParametersDecodeErrorZ_err"))) TS_CResult_ScoringParametersDecodeErrorZ_err(uint32_t e) {
12532 LDKDecodeError e_conv;
12533 e_conv.inner = (void*)(e & (~1));
12534 e_conv.is_owned = (e & 1) || (e == 0);
12535 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12536 e_conv = DecodeError_clone(&e_conv);
12537 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
12538 *ret_conv = CResult_ScoringParametersDecodeErrorZ_err(e_conv);
12539 return (uintptr_t)ret_conv;
12542 jboolean __attribute__((export_name("TS_CResult_ScoringParametersDecodeErrorZ_is_ok"))) TS_CResult_ScoringParametersDecodeErrorZ_is_ok(uint32_t o) {
12543 LDKCResult_ScoringParametersDecodeErrorZ* o_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(o & ~1);
12544 jboolean ret_val = CResult_ScoringParametersDecodeErrorZ_is_ok(o_conv);
12548 void __attribute__((export_name("TS_CResult_ScoringParametersDecodeErrorZ_free"))) TS_CResult_ScoringParametersDecodeErrorZ_free(uint32_t _res) {
12549 if ((_res & 1) != 0) return;
12550 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12551 CHECK_ACCESS(_res_ptr);
12552 LDKCResult_ScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ScoringParametersDecodeErrorZ*)(_res_ptr);
12554 CResult_ScoringParametersDecodeErrorZ_free(_res_conv);
12557 static inline uintptr_t CResult_ScoringParametersDecodeErrorZ_clone_ptr(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR arg) {
12558 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
12559 *ret_conv = CResult_ScoringParametersDecodeErrorZ_clone(arg);
12560 return (uintptr_t)ret_conv;
12562 intptr_t __attribute__((export_name("TS_CResult_ScoringParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ScoringParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
12563 LDKCResult_ScoringParametersDecodeErrorZ* arg_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1);
12564 intptr_t ret_val = CResult_ScoringParametersDecodeErrorZ_clone_ptr(arg_conv);
12568 uint32_t __attribute__((export_name("TS_CResult_ScoringParametersDecodeErrorZ_clone"))) TS_CResult_ScoringParametersDecodeErrorZ_clone(uint32_t orig) {
12569 LDKCResult_ScoringParametersDecodeErrorZ* orig_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(orig & ~1);
12570 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
12571 *ret_conv = CResult_ScoringParametersDecodeErrorZ_clone(orig_conv);
12572 return (uintptr_t)ret_conv;
12575 uint32_t __attribute__((export_name("TS_CResult_ScorerDecodeErrorZ_ok"))) TS_CResult_ScorerDecodeErrorZ_ok(uint32_t o) {
12577 o_conv.inner = (void*)(o & (~1));
12578 o_conv.is_owned = (o & 1) || (o == 0);
12579 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12580 // WARNING: we need a move here but no clone is available for LDKScorer
12581 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
12582 *ret_conv = CResult_ScorerDecodeErrorZ_ok(o_conv);
12583 return (uintptr_t)ret_conv;
12586 uint32_t __attribute__((export_name("TS_CResult_ScorerDecodeErrorZ_err"))) TS_CResult_ScorerDecodeErrorZ_err(uint32_t e) {
12587 LDKDecodeError e_conv;
12588 e_conv.inner = (void*)(e & (~1));
12589 e_conv.is_owned = (e & 1) || (e == 0);
12590 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12591 e_conv = DecodeError_clone(&e_conv);
12592 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
12593 *ret_conv = CResult_ScorerDecodeErrorZ_err(e_conv);
12594 return (uintptr_t)ret_conv;
12597 jboolean __attribute__((export_name("TS_CResult_ScorerDecodeErrorZ_is_ok"))) TS_CResult_ScorerDecodeErrorZ_is_ok(uint32_t o) {
12598 LDKCResult_ScorerDecodeErrorZ* o_conv = (LDKCResult_ScorerDecodeErrorZ*)(o & ~1);
12599 jboolean ret_val = CResult_ScorerDecodeErrorZ_is_ok(o_conv);
12603 void __attribute__((export_name("TS_CResult_ScorerDecodeErrorZ_free"))) TS_CResult_ScorerDecodeErrorZ_free(uint32_t _res) {
12604 if ((_res & 1) != 0) return;
12605 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12606 CHECK_ACCESS(_res_ptr);
12607 LDKCResult_ScorerDecodeErrorZ _res_conv = *(LDKCResult_ScorerDecodeErrorZ*)(_res_ptr);
12609 CResult_ScorerDecodeErrorZ_free(_res_conv);
12612 uint32_t __attribute__((export_name("TS_CResult_ProbabilisticScoringParametersDecodeErrorZ_ok"))) TS_CResult_ProbabilisticScoringParametersDecodeErrorZ_ok(uint32_t o) {
12613 LDKProbabilisticScoringParameters o_conv;
12614 o_conv.inner = (void*)(o & (~1));
12615 o_conv.is_owned = (o & 1) || (o == 0);
12616 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12617 o_conv = ProbabilisticScoringParameters_clone(&o_conv);
12618 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ");
12619 *ret_conv = CResult_ProbabilisticScoringParametersDecodeErrorZ_ok(o_conv);
12620 return (uintptr_t)ret_conv;
12623 uint32_t __attribute__((export_name("TS_CResult_ProbabilisticScoringParametersDecodeErrorZ_err"))) TS_CResult_ProbabilisticScoringParametersDecodeErrorZ_err(uint32_t e) {
12624 LDKDecodeError e_conv;
12625 e_conv.inner = (void*)(e & (~1));
12626 e_conv.is_owned = (e & 1) || (e == 0);
12627 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12628 e_conv = DecodeError_clone(&e_conv);
12629 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ");
12630 *ret_conv = CResult_ProbabilisticScoringParametersDecodeErrorZ_err(e_conv);
12631 return (uintptr_t)ret_conv;
12634 jboolean __attribute__((export_name("TS_CResult_ProbabilisticScoringParametersDecodeErrorZ_is_ok"))) TS_CResult_ProbabilisticScoringParametersDecodeErrorZ_is_ok(uint32_t o) {
12635 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(o & ~1);
12636 jboolean ret_val = CResult_ProbabilisticScoringParametersDecodeErrorZ_is_ok(o_conv);
12640 void __attribute__((export_name("TS_CResult_ProbabilisticScoringParametersDecodeErrorZ_free"))) TS_CResult_ProbabilisticScoringParametersDecodeErrorZ_free(uint32_t _res) {
12641 if ((_res & 1) != 0) return;
12642 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12643 CHECK_ACCESS(_res_ptr);
12644 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(_res_ptr);
12646 CResult_ProbabilisticScoringParametersDecodeErrorZ_free(_res_conv);
12649 static inline uintptr_t CResult_ProbabilisticScoringParametersDecodeErrorZ_clone_ptr(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR arg) {
12650 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ");
12651 *ret_conv = CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(arg);
12652 return (uintptr_t)ret_conv;
12654 intptr_t __attribute__((export_name("TS_CResult_ProbabilisticScoringParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ProbabilisticScoringParametersDecodeErrorZ_clone_ptr(uint32_t arg) {
12655 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* arg_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(arg & ~1);
12656 intptr_t ret_val = CResult_ProbabilisticScoringParametersDecodeErrorZ_clone_ptr(arg_conv);
12660 uint32_t __attribute__((export_name("TS_CResult_ProbabilisticScoringParametersDecodeErrorZ_clone"))) TS_CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(uint32_t orig) {
12661 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* orig_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(orig & ~1);
12662 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ");
12663 *ret_conv = CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(orig_conv);
12664 return (uintptr_t)ret_conv;
12667 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) {
12668 LDKInitFeatures o_conv;
12669 o_conv.inner = (void*)(o & (~1));
12670 o_conv.is_owned = (o & 1) || (o == 0);
12671 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12672 o_conv = InitFeatures_clone(&o_conv);
12673 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
12674 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
12675 return (uintptr_t)ret_conv;
12678 uint32_t __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_err"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) {
12679 LDKDecodeError e_conv;
12680 e_conv.inner = (void*)(e & (~1));
12681 e_conv.is_owned = (e & 1) || (e == 0);
12682 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12683 e_conv = DecodeError_clone(&e_conv);
12684 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
12685 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
12686 return (uintptr_t)ret_conv;
12689 jboolean __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint32_t o) {
12690 LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(o & ~1);
12691 jboolean ret_val = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
12695 void __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_free"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) {
12696 if ((_res & 1) != 0) return;
12697 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12698 CHECK_ACCESS(_res_ptr);
12699 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
12701 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
12704 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint32_t o) {
12705 LDKChannelFeatures o_conv;
12706 o_conv.inner = (void*)(o & (~1));
12707 o_conv.is_owned = (o & 1) || (o == 0);
12708 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12709 o_conv = ChannelFeatures_clone(&o_conv);
12710 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
12711 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
12712 return (uintptr_t)ret_conv;
12715 uint32_t __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint32_t e) {
12716 LDKDecodeError e_conv;
12717 e_conv.inner = (void*)(e & (~1));
12718 e_conv.is_owned = (e & 1) || (e == 0);
12719 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12720 e_conv = DecodeError_clone(&e_conv);
12721 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
12722 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
12723 return (uintptr_t)ret_conv;
12726 jboolean __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint32_t o) {
12727 LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(o & ~1);
12728 jboolean ret_val = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
12732 void __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint32_t _res) {
12733 if ((_res & 1) != 0) return;
12734 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12735 CHECK_ACCESS(_res_ptr);
12736 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
12738 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
12741 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) {
12742 LDKNodeFeatures o_conv;
12743 o_conv.inner = (void*)(o & (~1));
12744 o_conv.is_owned = (o & 1) || (o == 0);
12745 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12746 o_conv = NodeFeatures_clone(&o_conv);
12747 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
12748 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
12749 return (uintptr_t)ret_conv;
12752 uint32_t __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) {
12753 LDKDecodeError e_conv;
12754 e_conv.inner = (void*)(e & (~1));
12755 e_conv.is_owned = (e & 1) || (e == 0);
12756 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12757 e_conv = DecodeError_clone(&e_conv);
12758 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
12759 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
12760 return (uintptr_t)ret_conv;
12763 jboolean __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint32_t o) {
12764 LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(o & ~1);
12765 jboolean ret_val = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
12769 void __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_free"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) {
12770 if ((_res & 1) != 0) return;
12771 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12772 CHECK_ACCESS(_res_ptr);
12773 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
12775 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
12778 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint32_t o) {
12779 LDKInvoiceFeatures o_conv;
12780 o_conv.inner = (void*)(o & (~1));
12781 o_conv.is_owned = (o & 1) || (o == 0);
12782 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12783 o_conv = InvoiceFeatures_clone(&o_conv);
12784 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
12785 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
12786 return (uintptr_t)ret_conv;
12789 uint32_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint32_t e) {
12790 LDKDecodeError e_conv;
12791 e_conv.inner = (void*)(e & (~1));
12792 e_conv.is_owned = (e & 1) || (e == 0);
12793 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12794 e_conv = DecodeError_clone(&e_conv);
12795 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
12796 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
12797 return (uintptr_t)ret_conv;
12800 jboolean __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok(uint32_t o) {
12801 LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(o & ~1);
12802 jboolean ret_val = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
12806 void __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint32_t _res) {
12807 if ((_res & 1) != 0) return;
12808 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12809 CHECK_ACCESS(_res_ptr);
12810 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
12812 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
12815 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint32_t o) {
12816 LDKChannelTypeFeatures o_conv;
12817 o_conv.inner = (void*)(o & (~1));
12818 o_conv.is_owned = (o & 1) || (o == 0);
12819 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12820 o_conv = ChannelTypeFeatures_clone(&o_conv);
12821 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
12822 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
12823 return (uintptr_t)ret_conv;
12826 uint32_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint32_t e) {
12827 LDKDecodeError e_conv;
12828 e_conv.inner = (void*)(e & (~1));
12829 e_conv.is_owned = (e & 1) || (e == 0);
12830 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12831 e_conv = DecodeError_clone(&e_conv);
12832 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
12833 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
12834 return (uintptr_t)ret_conv;
12837 jboolean __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint32_t o) {
12838 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(o & ~1);
12839 jboolean ret_val = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
12843 void __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint32_t _res) {
12844 if ((_res & 1) != 0) return;
12845 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12846 CHECK_ACCESS(_res_ptr);
12847 LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
12849 CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
12852 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
12853 LDKDelayedPaymentOutputDescriptor o_conv;
12854 o_conv.inner = (void*)(o & (~1));
12855 o_conv.is_owned = (o & 1) || (o == 0);
12856 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12857 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
12858 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
12859 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
12860 return (uintptr_t)ret_conv;
12863 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
12864 LDKDecodeError e_conv;
12865 e_conv.inner = (void*)(e & (~1));
12866 e_conv.is_owned = (e & 1) || (e == 0);
12867 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12868 e_conv = DecodeError_clone(&e_conv);
12869 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
12870 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
12871 return (uintptr_t)ret_conv;
12874 jboolean __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
12875 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
12876 jboolean ret_val = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
12880 void __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
12881 if ((_res & 1) != 0) return;
12882 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12883 CHECK_ACCESS(_res_ptr);
12884 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
12886 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
12889 static inline uintptr_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
12890 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
12891 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
12892 return (uintptr_t)ret_conv;
12894 intptr_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
12895 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
12896 intptr_t ret_val = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
12900 uint32_t __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
12901 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
12902 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
12903 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
12904 return (uintptr_t)ret_conv;
12907 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
12908 LDKStaticPaymentOutputDescriptor o_conv;
12909 o_conv.inner = (void*)(o & (~1));
12910 o_conv.is_owned = (o & 1) || (o == 0);
12911 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12912 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
12913 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
12914 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
12915 return (uintptr_t)ret_conv;
12918 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint32_t e) {
12919 LDKDecodeError e_conv;
12920 e_conv.inner = (void*)(e & (~1));
12921 e_conv.is_owned = (e & 1) || (e == 0);
12922 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12923 e_conv = DecodeError_clone(&e_conv);
12924 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
12925 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
12926 return (uintptr_t)ret_conv;
12929 jboolean __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
12930 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
12931 jboolean ret_val = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
12935 void __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
12936 if ((_res & 1) != 0) return;
12937 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
12938 CHECK_ACCESS(_res_ptr);
12939 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
12941 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
12944 static inline uintptr_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
12945 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
12946 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
12947 return (uintptr_t)ret_conv;
12949 intptr_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
12950 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
12951 intptr_t ret_val = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
12955 uint32_t __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
12956 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
12957 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
12958 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
12959 return (uintptr_t)ret_conv;
12962 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
12963 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
12964 CHECK_ACCESS(o_ptr);
12965 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
12966 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)o) & ~1));
12967 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
12968 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
12969 return (uintptr_t)ret_conv;
12972 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_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_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
12979 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
12980 return (uintptr_t)ret_conv;
12983 jboolean __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint32_t o) {
12984 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(o & ~1);
12985 jboolean ret_val = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
12989 void __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_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_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
12995 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
12998 static inline uintptr_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
12999 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
13000 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
13001 return (uintptr_t)ret_conv;
13003 intptr_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint32_t arg) {
13004 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
13005 intptr_t ret_val = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
13009 uint32_t __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
13010 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
13011 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
13012 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
13013 return (uintptr_t)ret_conv;
13016 void __attribute__((export_name("TS_CVec_PaymentPreimageZ_free"))) TS_CVec_PaymentPreimageZ_free(ptrArray _res) {
13017 LDKCVec_PaymentPreimageZ _res_constr;
13018 _res_constr.datalen = _res->arr_len;
13019 if (_res_constr.datalen > 0)
13020 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
13022 _res_constr.data = NULL;
13023 int8_tArray* _res_vals = (void*) _res->elems /* XXX _res leaks */;
13024 for (size_t m = 0; m < _res_constr.datalen; m++) {
13025 int8_tArray _res_conv_12 = _res_vals[m];
13026 LDKThirtyTwoBytes _res_conv_12_ref;
13027 CHECK(_res_conv_12->arr_len == 32);
13028 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
13029 _res_constr.data[m] = _res_conv_12_ref;
13031 CVec_PaymentPreimageZ_free(_res_constr);
13034 static inline uintptr_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
13035 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
13036 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
13037 return ((uintptr_t)ret_conv);
13039 intptr_t __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(uint32_t arg) {
13040 LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(arg & ~1);
13041 intptr_t ret_val = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
13045 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint32_t orig) {
13046 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
13047 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
13048 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
13049 return ((uintptr_t)ret_conv);
13052 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_new"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
13053 LDKSignature a_ref;
13054 CHECK(a->arr_len == 64);
13055 memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
13056 LDKCVec_SignatureZ b_constr;
13057 b_constr.datalen = b->arr_len;
13058 if (b_constr.datalen > 0)
13059 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
13061 b_constr.data = NULL;
13062 int8_tArray* b_vals = (void*) b->elems /* XXX b leaks */;
13063 for (size_t m = 0; m < b_constr.datalen; m++) {
13064 int8_tArray b_conv_12 = b_vals[m];
13065 LDKSignature b_conv_12_ref;
13066 CHECK(b_conv_12->arr_len == 64);
13067 memcpy(b_conv_12_ref.compact_form, b_conv_12->elems, 64); FREE(b_conv_12);
13068 b_constr.data[m] = b_conv_12_ref;
13070 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
13071 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
13072 return ((uintptr_t)ret_conv);
13075 void __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_free"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint32_t _res) {
13076 if ((_res & 1) != 0) return;
13077 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13078 CHECK_ACCESS(_res_ptr);
13079 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
13081 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
13084 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint32_t o) {
13085 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
13086 CHECK_ACCESS(o_ptr);
13087 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
13088 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uintptr_t)o) & ~1));
13089 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
13090 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
13091 return (uintptr_t)ret_conv;
13094 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
13095 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
13096 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
13097 return (uintptr_t)ret_conv;
13100 jboolean __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(uint32_t o) {
13101 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(o & ~1);
13102 jboolean ret_val = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
13106 void __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint32_t _res) {
13107 if ((_res & 1) != 0) return;
13108 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13109 CHECK_ACCESS(_res_ptr);
13110 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
13112 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
13115 static inline uintptr_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
13116 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
13117 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
13118 return (uintptr_t)ret_conv;
13120 intptr_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(uint32_t arg) {
13121 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
13122 intptr_t ret_val = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
13126 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint32_t orig) {
13127 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
13128 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
13129 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
13130 return (uintptr_t)ret_conv;
13133 uint32_t __attribute__((export_name("TS_CResult_SignatureNoneZ_ok"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
13134 LDKSignature o_ref;
13135 CHECK(o->arr_len == 64);
13136 memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
13137 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
13138 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
13139 return (uintptr_t)ret_conv;
13142 uint32_t __attribute__((export_name("TS_CResult_SignatureNoneZ_err"))) TS_CResult_SignatureNoneZ_err() {
13143 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
13144 *ret_conv = CResult_SignatureNoneZ_err();
13145 return (uintptr_t)ret_conv;
13148 jboolean __attribute__((export_name("TS_CResult_SignatureNoneZ_is_ok"))) TS_CResult_SignatureNoneZ_is_ok(uint32_t o) {
13149 LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)(o & ~1);
13150 jboolean ret_val = CResult_SignatureNoneZ_is_ok(o_conv);
13154 void __attribute__((export_name("TS_CResult_SignatureNoneZ_free"))) TS_CResult_SignatureNoneZ_free(uint32_t _res) {
13155 if ((_res & 1) != 0) return;
13156 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13157 CHECK_ACCESS(_res_ptr);
13158 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
13160 CResult_SignatureNoneZ_free(_res_conv);
13163 static inline uintptr_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
13164 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
13165 *ret_conv = CResult_SignatureNoneZ_clone(arg);
13166 return (uintptr_t)ret_conv;
13168 intptr_t __attribute__((export_name("TS_CResult_SignatureNoneZ_clone_ptr"))) TS_CResult_SignatureNoneZ_clone_ptr(uint32_t arg) {
13169 LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)(arg & ~1);
13170 intptr_t ret_val = CResult_SignatureNoneZ_clone_ptr(arg_conv);
13174 uint32_t __attribute__((export_name("TS_CResult_SignatureNoneZ_clone"))) TS_CResult_SignatureNoneZ_clone(uint32_t orig) {
13175 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
13176 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
13177 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
13178 return (uintptr_t)ret_conv;
13181 static inline uintptr_t C2Tuple_SignatureSignatureZ_clone_ptr(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR arg) {
13182 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
13183 *ret_conv = C2Tuple_SignatureSignatureZ_clone(arg);
13184 return ((uintptr_t)ret_conv);
13186 intptr_t __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_clone_ptr"))) TS_C2Tuple_SignatureSignatureZ_clone_ptr(uint32_t arg) {
13187 LDKC2Tuple_SignatureSignatureZ* arg_conv = (LDKC2Tuple_SignatureSignatureZ*)(arg & ~1);
13188 intptr_t ret_val = C2Tuple_SignatureSignatureZ_clone_ptr(arg_conv);
13192 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_clone"))) TS_C2Tuple_SignatureSignatureZ_clone(uint32_t orig) {
13193 LDKC2Tuple_SignatureSignatureZ* orig_conv = (LDKC2Tuple_SignatureSignatureZ*)(orig & ~1);
13194 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
13195 *ret_conv = C2Tuple_SignatureSignatureZ_clone(orig_conv);
13196 return ((uintptr_t)ret_conv);
13199 uint32_t __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_new"))) TS_C2Tuple_SignatureSignatureZ_new(int8_tArray a, int8_tArray b) {
13200 LDKSignature a_ref;
13201 CHECK(a->arr_len == 64);
13202 memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
13203 LDKSignature b_ref;
13204 CHECK(b->arr_len == 64);
13205 memcpy(b_ref.compact_form, b->elems, 64); FREE(b);
13206 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
13207 *ret_conv = C2Tuple_SignatureSignatureZ_new(a_ref, b_ref);
13208 return ((uintptr_t)ret_conv);
13211 void __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_free"))) TS_C2Tuple_SignatureSignatureZ_free(uint32_t _res) {
13212 if ((_res & 1) != 0) return;
13213 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13214 CHECK_ACCESS(_res_ptr);
13215 LDKC2Tuple_SignatureSignatureZ _res_conv = *(LDKC2Tuple_SignatureSignatureZ*)(_res_ptr);
13217 C2Tuple_SignatureSignatureZ_free(_res_conv);
13220 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_ok(uint32_t o) {
13221 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
13222 CHECK_ACCESS(o_ptr);
13223 LDKC2Tuple_SignatureSignatureZ o_conv = *(LDKC2Tuple_SignatureSignatureZ*)(o_ptr);
13224 o_conv = C2Tuple_SignatureSignatureZ_clone((LDKC2Tuple_SignatureSignatureZ*)(((uintptr_t)o) & ~1));
13225 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
13226 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o_conv);
13227 return (uintptr_t)ret_conv;
13230 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_err"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_err() {
13231 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
13232 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_err();
13233 return (uintptr_t)ret_conv;
13236 jboolean __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(uint32_t o) {
13237 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(o & ~1);
13238 jboolean ret_val = CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o_conv);
13242 void __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_free"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_free(uint32_t _res) {
13243 if ((_res & 1) != 0) return;
13244 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13245 CHECK_ACCESS(_res_ptr);
13246 LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(_res_ptr);
13248 CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res_conv);
13251 static inline uintptr_t CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR arg) {
13252 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
13253 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(arg);
13254 return (uintptr_t)ret_conv;
13256 intptr_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(uint32_t arg) {
13257 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(arg & ~1);
13258 intptr_t ret_val = CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(arg_conv);
13262 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone(uint32_t orig) {
13263 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(orig & ~1);
13264 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
13265 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig_conv);
13266 return (uintptr_t)ret_conv;
13269 uint32_t __attribute__((export_name("TS_CResult_SecretKeyNoneZ_ok"))) TS_CResult_SecretKeyNoneZ_ok(int8_tArray o) {
13270 LDKSecretKey o_ref;
13271 CHECK(o->arr_len == 32);
13272 memcpy(o_ref.bytes, o->elems, 32); FREE(o);
13273 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
13274 *ret_conv = CResult_SecretKeyNoneZ_ok(o_ref);
13275 return (uintptr_t)ret_conv;
13278 uint32_t __attribute__((export_name("TS_CResult_SecretKeyNoneZ_err"))) TS_CResult_SecretKeyNoneZ_err() {
13279 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
13280 *ret_conv = CResult_SecretKeyNoneZ_err();
13281 return (uintptr_t)ret_conv;
13284 jboolean __attribute__((export_name("TS_CResult_SecretKeyNoneZ_is_ok"))) TS_CResult_SecretKeyNoneZ_is_ok(uint32_t o) {
13285 LDKCResult_SecretKeyNoneZ* o_conv = (LDKCResult_SecretKeyNoneZ*)(o & ~1);
13286 jboolean ret_val = CResult_SecretKeyNoneZ_is_ok(o_conv);
13290 void __attribute__((export_name("TS_CResult_SecretKeyNoneZ_free"))) TS_CResult_SecretKeyNoneZ_free(uint32_t _res) {
13291 if ((_res & 1) != 0) return;
13292 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13293 CHECK_ACCESS(_res_ptr);
13294 LDKCResult_SecretKeyNoneZ _res_conv = *(LDKCResult_SecretKeyNoneZ*)(_res_ptr);
13296 CResult_SecretKeyNoneZ_free(_res_conv);
13299 static inline uintptr_t CResult_SecretKeyNoneZ_clone_ptr(LDKCResult_SecretKeyNoneZ *NONNULL_PTR arg) {
13300 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
13301 *ret_conv = CResult_SecretKeyNoneZ_clone(arg);
13302 return (uintptr_t)ret_conv;
13304 intptr_t __attribute__((export_name("TS_CResult_SecretKeyNoneZ_clone_ptr"))) TS_CResult_SecretKeyNoneZ_clone_ptr(uint32_t arg) {
13305 LDKCResult_SecretKeyNoneZ* arg_conv = (LDKCResult_SecretKeyNoneZ*)(arg & ~1);
13306 intptr_t ret_val = CResult_SecretKeyNoneZ_clone_ptr(arg_conv);
13310 uint32_t __attribute__((export_name("TS_CResult_SecretKeyNoneZ_clone"))) TS_CResult_SecretKeyNoneZ_clone(uint32_t orig) {
13311 LDKCResult_SecretKeyNoneZ* orig_conv = (LDKCResult_SecretKeyNoneZ*)(orig & ~1);
13312 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
13313 *ret_conv = CResult_SecretKeyNoneZ_clone(orig_conv);
13314 return (uintptr_t)ret_conv;
13317 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_ok"))) TS_CResult_SignDecodeErrorZ_ok(uint32_t o) {
13318 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
13319 CHECK_ACCESS(o_ptr);
13320 LDKSign o_conv = *(LDKSign*)(o_ptr);
13321 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
13322 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
13323 return (uintptr_t)ret_conv;
13326 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_err"))) TS_CResult_SignDecodeErrorZ_err(uint32_t e) {
13327 LDKDecodeError e_conv;
13328 e_conv.inner = (void*)(e & (~1));
13329 e_conv.is_owned = (e & 1) || (e == 0);
13330 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13331 e_conv = DecodeError_clone(&e_conv);
13332 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
13333 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
13334 return (uintptr_t)ret_conv;
13337 jboolean __attribute__((export_name("TS_CResult_SignDecodeErrorZ_is_ok"))) TS_CResult_SignDecodeErrorZ_is_ok(uint32_t o) {
13338 LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)(o & ~1);
13339 jboolean ret_val = CResult_SignDecodeErrorZ_is_ok(o_conv);
13343 void __attribute__((export_name("TS_CResult_SignDecodeErrorZ_free"))) TS_CResult_SignDecodeErrorZ_free(uint32_t _res) {
13344 if ((_res & 1) != 0) return;
13345 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13346 CHECK_ACCESS(_res_ptr);
13347 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
13349 CResult_SignDecodeErrorZ_free(_res_conv);
13352 static inline uintptr_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
13353 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
13354 *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
13355 return (uintptr_t)ret_conv;
13357 intptr_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone_ptr"))) TS_CResult_SignDecodeErrorZ_clone_ptr(uint32_t arg) {
13358 LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
13359 intptr_t ret_val = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
13363 uint32_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone"))) TS_CResult_SignDecodeErrorZ_clone(uint32_t orig) {
13364 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
13365 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
13366 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
13367 return (uintptr_t)ret_conv;
13370 void __attribute__((export_name("TS_CVec_u5Z_free"))) TS_CVec_u5Z_free(ptrArray _res) {
13371 LDKCVec_u5Z _res_constr;
13372 _res_constr.datalen = _res->arr_len;
13373 if (_res_constr.datalen > 0)
13374 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
13376 _res_constr.data = NULL;
13377 int8_t* _res_vals = (void*) _res->elems /* XXX _res leaks */;
13378 for (size_t h = 0; h < _res_constr.datalen; h++) {
13379 int8_t _res_conv_7 = _res_vals[h];
13381 _res_constr.data[h] = (LDKu5){ ._0 = _res_conv_7 };
13383 CVec_u5Z_free(_res_constr);
13386 uint32_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
13387 LDKRecoverableSignature o_ref;
13388 CHECK(o->arr_len == 68);
13389 memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
13390 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
13391 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
13392 return (uintptr_t)ret_conv;
13395 uint32_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_err"))) TS_CResult_RecoverableSignatureNoneZ_err() {
13396 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
13397 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
13398 return (uintptr_t)ret_conv;
13401 jboolean __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_is_ok"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint32_t o) {
13402 LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)(o & ~1);
13403 jboolean ret_val = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
13407 void __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_free"))) TS_CResult_RecoverableSignatureNoneZ_free(uint32_t _res) {
13408 if ((_res & 1) != 0) return;
13409 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13410 CHECK_ACCESS(_res_ptr);
13411 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
13413 CResult_RecoverableSignatureNoneZ_free(_res_conv);
13416 static inline uintptr_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
13417 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
13418 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
13419 return (uintptr_t)ret_conv;
13421 intptr_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone_ptr"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint32_t arg) {
13422 LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
13423 intptr_t ret_val = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
13427 uint32_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint32_t orig) {
13428 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
13429 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
13430 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
13431 return (uintptr_t)ret_conv;
13434 void __attribute__((export_name("TS_CVec_u8Z_free"))) TS_CVec_u8Z_free(int8_tArray _res) {
13435 LDKCVec_u8Z _res_ref;
13436 _res_ref.datalen = _res->arr_len;
13437 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
13438 memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
13439 CVec_u8Z_free(_res_ref);
13442 void __attribute__((export_name("TS_CVec_CVec_u8ZZ_free"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
13443 LDKCVec_CVec_u8ZZ _res_constr;
13444 _res_constr.datalen = _res->arr_len;
13445 if (_res_constr.datalen > 0)
13446 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
13448 _res_constr.data = NULL;
13449 int8_tArray* _res_vals = (void*) _res->elems /* XXX _res leaks */;
13450 for (size_t m = 0; m < _res_constr.datalen; m++) {
13451 int8_tArray _res_conv_12 = _res_vals[m];
13452 LDKCVec_u8Z _res_conv_12_ref;
13453 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
13454 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
13455 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
13456 _res_constr.data[m] = _res_conv_12_ref;
13458 CVec_CVec_u8ZZ_free(_res_constr);
13461 uint32_t __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
13462 LDKCVec_CVec_u8ZZ o_constr;
13463 o_constr.datalen = o->arr_len;
13464 if (o_constr.datalen > 0)
13465 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
13467 o_constr.data = NULL;
13468 int8_tArray* o_vals = (void*) o->elems /* XXX o leaks */;
13469 for (size_t m = 0; m < o_constr.datalen; m++) {
13470 int8_tArray o_conv_12 = o_vals[m];
13471 LDKCVec_u8Z o_conv_12_ref;
13472 o_conv_12_ref.datalen = o_conv_12->arr_len;
13473 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
13474 memcpy(o_conv_12_ref.data, o_conv_12->elems, o_conv_12_ref.datalen); FREE(o_conv_12);
13475 o_constr.data[m] = o_conv_12_ref;
13477 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
13478 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
13479 return (uintptr_t)ret_conv;
13482 uint32_t __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
13483 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
13484 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
13485 return (uintptr_t)ret_conv;
13488 jboolean __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok(uint32_t o) {
13489 LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(o & ~1);
13490 jboolean ret_val = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
13494 void __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_free"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint32_t _res) {
13495 if ((_res & 1) != 0) return;
13496 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13497 CHECK_ACCESS(_res_ptr);
13498 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
13500 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
13503 static inline uintptr_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
13504 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
13505 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
13506 return (uintptr_t)ret_conv;
13508 intptr_t __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(uint32_t arg) {
13509 LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
13510 intptr_t ret_val = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
13514 uint32_t __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint32_t orig) {
13515 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
13516 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
13517 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
13518 return (uintptr_t)ret_conv;
13521 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint32_t o) {
13522 LDKInMemorySigner o_conv;
13523 o_conv.inner = (void*)(o & (~1));
13524 o_conv.is_owned = (o & 1) || (o == 0);
13525 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13526 o_conv = InMemorySigner_clone(&o_conv);
13527 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
13528 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
13529 return (uintptr_t)ret_conv;
13532 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_err"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint32_t e) {
13533 LDKDecodeError e_conv;
13534 e_conv.inner = (void*)(e & (~1));
13535 e_conv.is_owned = (e & 1) || (e == 0);
13536 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13537 e_conv = DecodeError_clone(&e_conv);
13538 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
13539 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
13540 return (uintptr_t)ret_conv;
13543 jboolean __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_is_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint32_t o) {
13544 LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(o & ~1);
13545 jboolean ret_val = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
13549 void __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_free"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint32_t _res) {
13550 if ((_res & 1) != 0) return;
13551 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13552 CHECK_ACCESS(_res_ptr);
13553 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
13555 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
13558 static inline uintptr_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
13559 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
13560 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
13561 return (uintptr_t)ret_conv;
13563 intptr_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint32_t arg) {
13564 LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
13565 intptr_t ret_val = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
13569 uint32_t __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint32_t orig) {
13570 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
13571 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
13572 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
13573 return (uintptr_t)ret_conv;
13576 void __attribute__((export_name("TS_CVec_TxOutZ_free"))) TS_CVec_TxOutZ_free(uint32_tArray _res) {
13577 LDKCVec_TxOutZ _res_constr;
13578 _res_constr.datalen = _res->arr_len;
13579 if (_res_constr.datalen > 0)
13580 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
13582 _res_constr.data = NULL;
13583 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
13584 for (size_t h = 0; h < _res_constr.datalen; h++) {
13585 uint32_t _res_conv_7 = _res_vals[h];
13586 void* _res_conv_7_ptr = (void*)(((uintptr_t)_res_conv_7) & ~1);
13587 CHECK_ACCESS(_res_conv_7_ptr);
13588 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
13589 FREE((void*)_res_conv_7);
13590 _res_constr.data[h] = _res_conv_7_conv;
13592 CVec_TxOutZ_free(_res_constr);
13595 uint32_t __attribute__((export_name("TS_CResult_TransactionNoneZ_ok"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
13596 LDKTransaction o_ref;
13597 o_ref.datalen = o->arr_len;
13598 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
13599 memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
13600 o_ref.data_is_owned = true;
13601 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
13602 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
13603 return (uintptr_t)ret_conv;
13606 uint32_t __attribute__((export_name("TS_CResult_TransactionNoneZ_err"))) TS_CResult_TransactionNoneZ_err() {
13607 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
13608 *ret_conv = CResult_TransactionNoneZ_err();
13609 return (uintptr_t)ret_conv;
13612 jboolean __attribute__((export_name("TS_CResult_TransactionNoneZ_is_ok"))) TS_CResult_TransactionNoneZ_is_ok(uint32_t o) {
13613 LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)(o & ~1);
13614 jboolean ret_val = CResult_TransactionNoneZ_is_ok(o_conv);
13618 void __attribute__((export_name("TS_CResult_TransactionNoneZ_free"))) TS_CResult_TransactionNoneZ_free(uint32_t _res) {
13619 if ((_res & 1) != 0) return;
13620 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13621 CHECK_ACCESS(_res_ptr);
13622 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
13624 CResult_TransactionNoneZ_free(_res_conv);
13627 static inline uintptr_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
13628 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
13629 *ret_conv = CResult_TransactionNoneZ_clone(arg);
13630 return (uintptr_t)ret_conv;
13632 intptr_t __attribute__((export_name("TS_CResult_TransactionNoneZ_clone_ptr"))) TS_CResult_TransactionNoneZ_clone_ptr(uint32_t arg) {
13633 LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)(arg & ~1);
13634 intptr_t ret_val = CResult_TransactionNoneZ_clone_ptr(arg_conv);
13638 uint32_t __attribute__((export_name("TS_CResult_TransactionNoneZ_clone"))) TS_CResult_TransactionNoneZ_clone(uint32_t orig) {
13639 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
13640 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
13641 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
13642 return (uintptr_t)ret_conv;
13645 uint32_t __attribute__((export_name("TS_COption_u16Z_some"))) TS_COption_u16Z_some(int16_t o) {
13646 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
13647 *ret_copy = COption_u16Z_some(o);
13648 uintptr_t ret_ref = (uintptr_t)ret_copy;
13652 uint32_t __attribute__((export_name("TS_COption_u16Z_none"))) TS_COption_u16Z_none() {
13653 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
13654 *ret_copy = COption_u16Z_none();
13655 uintptr_t ret_ref = (uintptr_t)ret_copy;
13659 void __attribute__((export_name("TS_COption_u16Z_free"))) TS_COption_u16Z_free(uint32_t _res) {
13660 if ((_res & 1) != 0) return;
13661 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13662 CHECK_ACCESS(_res_ptr);
13663 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
13665 COption_u16Z_free(_res_conv);
13668 static inline uintptr_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
13669 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
13670 *ret_copy = COption_u16Z_clone(arg);
13671 uintptr_t ret_ref = (uintptr_t)ret_copy;
13674 intptr_t __attribute__((export_name("TS_COption_u16Z_clone_ptr"))) TS_COption_u16Z_clone_ptr(uint32_t arg) {
13675 LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)arg;
13676 intptr_t ret_val = COption_u16Z_clone_ptr(arg_conv);
13680 uint32_t __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_clone(uint32_t orig) {
13681 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
13682 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
13683 *ret_copy = COption_u16Z_clone(orig_conv);
13684 uintptr_t ret_ref = (uintptr_t)ret_copy;
13688 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_ok"))) TS_CResult_NoneAPIErrorZ_ok() {
13689 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
13690 *ret_conv = CResult_NoneAPIErrorZ_ok();
13691 return (uintptr_t)ret_conv;
13694 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_err"))) TS_CResult_NoneAPIErrorZ_err(uint32_t e) {
13695 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
13696 CHECK_ACCESS(e_ptr);
13697 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
13698 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
13699 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
13700 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
13701 return (uintptr_t)ret_conv;
13704 jboolean __attribute__((export_name("TS_CResult_NoneAPIErrorZ_is_ok"))) TS_CResult_NoneAPIErrorZ_is_ok(uint32_t o) {
13705 LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)(o & ~1);
13706 jboolean ret_val = CResult_NoneAPIErrorZ_is_ok(o_conv);
13710 void __attribute__((export_name("TS_CResult_NoneAPIErrorZ_free"))) TS_CResult_NoneAPIErrorZ_free(uint32_t _res) {
13711 if ((_res & 1) != 0) return;
13712 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13713 CHECK_ACCESS(_res_ptr);
13714 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
13716 CResult_NoneAPIErrorZ_free(_res_conv);
13719 static inline uintptr_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
13720 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
13721 *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
13722 return (uintptr_t)ret_conv;
13724 intptr_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone_ptr"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint32_t arg) {
13725 LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
13726 intptr_t ret_val = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
13730 uint32_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone"))) TS_CResult_NoneAPIErrorZ_clone(uint32_t orig) {
13731 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
13732 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
13733 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
13734 return (uintptr_t)ret_conv;
13737 void __attribute__((export_name("TS_CVec_CResult_NoneAPIErrorZZ_free"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint32_tArray _res) {
13738 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
13739 _res_constr.datalen = _res->arr_len;
13740 if (_res_constr.datalen > 0)
13741 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
13743 _res_constr.data = NULL;
13744 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
13745 for (size_t w = 0; w < _res_constr.datalen; w++) {
13746 uint32_t _res_conv_22 = _res_vals[w];
13747 void* _res_conv_22_ptr = (void*)(((uintptr_t)_res_conv_22) & ~1);
13748 CHECK_ACCESS(_res_conv_22_ptr);
13749 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
13750 FREE((void*)_res_conv_22);
13751 _res_constr.data[w] = _res_conv_22_conv;
13753 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
13756 void __attribute__((export_name("TS_CVec_APIErrorZ_free"))) TS_CVec_APIErrorZ_free(uint32_tArray _res) {
13757 LDKCVec_APIErrorZ _res_constr;
13758 _res_constr.datalen = _res->arr_len;
13759 if (_res_constr.datalen > 0)
13760 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
13762 _res_constr.data = NULL;
13763 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
13764 for (size_t k = 0; k < _res_constr.datalen; k++) {
13765 uint32_t _res_conv_10 = _res_vals[k];
13766 void* _res_conv_10_ptr = (void*)(((uintptr_t)_res_conv_10) & ~1);
13767 CHECK_ACCESS(_res_conv_10_ptr);
13768 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
13769 FREE((void*)_res_conv_10);
13770 _res_constr.data[k] = _res_conv_10_conv;
13772 CVec_APIErrorZ_free(_res_constr);
13775 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_ok"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) {
13776 LDKThirtyTwoBytes o_ref;
13777 CHECK(o->arr_len == 32);
13778 memcpy(o_ref.data, o->elems, 32); FREE(o);
13779 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
13780 *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
13781 return (uintptr_t)ret_conv;
13784 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_err"))) TS_CResult__u832APIErrorZ_err(uint32_t e) {
13785 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
13786 CHECK_ACCESS(e_ptr);
13787 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
13788 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
13789 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
13790 *ret_conv = CResult__u832APIErrorZ_err(e_conv);
13791 return (uintptr_t)ret_conv;
13794 jboolean __attribute__((export_name("TS_CResult__u832APIErrorZ_is_ok"))) TS_CResult__u832APIErrorZ_is_ok(uint32_t o) {
13795 LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)(o & ~1);
13796 jboolean ret_val = CResult__u832APIErrorZ_is_ok(o_conv);
13800 void __attribute__((export_name("TS_CResult__u832APIErrorZ_free"))) TS_CResult__u832APIErrorZ_free(uint32_t _res) {
13801 if ((_res & 1) != 0) return;
13802 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13803 CHECK_ACCESS(_res_ptr);
13804 LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
13806 CResult__u832APIErrorZ_free(_res_conv);
13809 static inline uintptr_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
13810 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
13811 *ret_conv = CResult__u832APIErrorZ_clone(arg);
13812 return (uintptr_t)ret_conv;
13814 intptr_t __attribute__((export_name("TS_CResult__u832APIErrorZ_clone_ptr"))) TS_CResult__u832APIErrorZ_clone_ptr(uint32_t arg) {
13815 LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)(arg & ~1);
13816 intptr_t ret_val = CResult__u832APIErrorZ_clone_ptr(arg_conv);
13820 uint32_t __attribute__((export_name("TS_CResult__u832APIErrorZ_clone"))) TS_CResult__u832APIErrorZ_clone(uint32_t orig) {
13821 LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1);
13822 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
13823 *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
13824 return (uintptr_t)ret_conv;
13827 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_ok(int8_tArray o) {
13828 LDKThirtyTwoBytes o_ref;
13829 CHECK(o->arr_len == 32);
13830 memcpy(o_ref.data, o->elems, 32); FREE(o);
13831 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
13832 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
13833 return (uintptr_t)ret_conv;
13836 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_err"))) TS_CResult_PaymentIdPaymentSendFailureZ_err(uint32_t e) {
13837 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
13838 CHECK_ACCESS(e_ptr);
13839 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
13840 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
13841 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
13842 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
13843 return (uintptr_t)ret_conv;
13846 jboolean __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_is_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_is_ok(uint32_t o) {
13847 LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(o & ~1);
13848 jboolean ret_val = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv);
13852 void __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_free"))) TS_CResult_PaymentIdPaymentSendFailureZ_free(uint32_t _res) {
13853 if ((_res & 1) != 0) return;
13854 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13855 CHECK_ACCESS(_res_ptr);
13856 LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
13858 CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
13861 static inline uintptr_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) {
13862 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
13863 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg);
13864 return (uintptr_t)ret_conv;
13866 intptr_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr(uint32_t arg) {
13867 LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
13868 intptr_t ret_val = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv);
13872 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_clone"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone(uint32_t orig) {
13873 LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1);
13874 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
13875 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
13876 return (uintptr_t)ret_conv;
13879 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() {
13880 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
13881 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
13882 return (uintptr_t)ret_conv;
13885 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint32_t e) {
13886 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
13887 CHECK_ACCESS(e_ptr);
13888 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
13889 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
13890 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
13891 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
13892 return (uintptr_t)ret_conv;
13895 jboolean __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint32_t o) {
13896 LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)(o & ~1);
13897 jboolean ret_val = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
13901 void __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint32_t _res) {
13902 if ((_res & 1) != 0) return;
13903 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13904 CHECK_ACCESS(_res_ptr);
13905 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
13907 CResult_NonePaymentSendFailureZ_free(_res_conv);
13910 static inline uintptr_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
13911 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
13912 *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
13913 return (uintptr_t)ret_conv;
13915 intptr_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint32_t arg) {
13916 LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
13917 intptr_t ret_val = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
13921 uint32_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint32_t orig) {
13922 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
13923 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
13924 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
13925 return (uintptr_t)ret_conv;
13928 static inline uintptr_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
13929 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
13930 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
13931 return ((uintptr_t)ret_conv);
13933 intptr_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr(uint32_t arg) {
13934 LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(arg & ~1);
13935 intptr_t ret_val = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
13939 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint32_t orig) {
13940 LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1);
13941 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
13942 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
13943 return ((uintptr_t)ret_conv);
13946 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_new"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, int8_tArray b) {
13947 LDKThirtyTwoBytes a_ref;
13948 CHECK(a->arr_len == 32);
13949 memcpy(a_ref.data, a->elems, 32); FREE(a);
13950 LDKThirtyTwoBytes b_ref;
13951 CHECK(b->arr_len == 32);
13952 memcpy(b_ref.data, b->elems, 32); FREE(b);
13953 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
13954 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
13955 return ((uintptr_t)ret_conv);
13958 void __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_free"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint32_t _res) {
13959 if ((_res & 1) != 0) return;
13960 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13961 CHECK_ACCESS(_res_ptr);
13962 LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
13964 C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
13967 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint32_t o) {
13968 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
13969 CHECK_ACCESS(o_ptr);
13970 LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
13971 o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uintptr_t)o) & ~1));
13972 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
13973 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
13974 return (uintptr_t)ret_conv;
13977 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint32_t e) {
13978 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
13979 CHECK_ACCESS(e_ptr);
13980 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
13981 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
13982 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
13983 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
13984 return (uintptr_t)ret_conv;
13987 jboolean __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(uint32_t o) {
13988 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(o & ~1);
13989 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
13993 void __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint32_t _res) {
13994 if ((_res & 1) != 0) return;
13995 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13996 CHECK_ACCESS(_res_ptr);
13997 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
13999 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
14002 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
14003 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
14004 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
14005 return (uintptr_t)ret_conv;
14007 intptr_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(uint32_t arg) {
14008 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
14009 intptr_t ret_val = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
14013 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint32_t orig) {
14014 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1);
14015 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
14016 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
14017 return (uintptr_t)ret_conv;
14020 void __attribute__((export_name("TS_CVec_NetAddressZ_free"))) TS_CVec_NetAddressZ_free(uint32_tArray _res) {
14021 LDKCVec_NetAddressZ _res_constr;
14022 _res_constr.datalen = _res->arr_len;
14023 if (_res_constr.datalen > 0)
14024 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14026 _res_constr.data = NULL;
14027 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
14028 for (size_t m = 0; m < _res_constr.datalen; m++) {
14029 uint32_t _res_conv_12 = _res_vals[m];
14030 void* _res_conv_12_ptr = (void*)(((uintptr_t)_res_conv_12) & ~1);
14031 CHECK_ACCESS(_res_conv_12_ptr);
14032 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
14033 FREE((void*)_res_conv_12);
14034 _res_constr.data[m] = _res_conv_12_conv;
14036 CVec_NetAddressZ_free(_res_constr);
14039 static inline uintptr_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
14040 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
14041 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
14042 return ((uintptr_t)ret_conv);
14044 intptr_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(uint32_t arg) {
14045 LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(arg & ~1);
14046 intptr_t ret_val = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
14050 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint32_t orig) {
14051 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
14052 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
14053 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
14054 return ((uintptr_t)ret_conv);
14057 uint32_t __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_new"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
14058 LDKThirtyTwoBytes a_ref;
14059 CHECK(a->arr_len == 32);
14060 memcpy(a_ref.data, a->elems, 32); FREE(a);
14061 LDKThirtyTwoBytes b_ref;
14062 CHECK(b->arr_len == 32);
14063 memcpy(b_ref.data, b->elems, 32); FREE(b);
14064 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
14065 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
14066 return ((uintptr_t)ret_conv);
14069 void __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_free"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint32_t _res) {
14070 if ((_res & 1) != 0) return;
14071 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14072 CHECK_ACCESS(_res_ptr);
14073 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
14075 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
14078 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(uint32_t o) {
14079 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14080 CHECK_ACCESS(o_ptr);
14081 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
14082 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uintptr_t)o) & ~1));
14083 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
14084 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
14085 return (uintptr_t)ret_conv;
14088 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() {
14089 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
14090 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
14091 return (uintptr_t)ret_conv;
14094 jboolean __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(uint32_t o) {
14095 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(o & ~1);
14096 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
14100 void __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(uint32_t _res) {
14101 if ((_res & 1) != 0) return;
14102 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14103 CHECK_ACCESS(_res_ptr);
14104 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
14106 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
14109 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
14110 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
14111 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
14112 return (uintptr_t)ret_conv;
14114 intptr_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(uint32_t arg) {
14115 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1);
14116 intptr_t ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
14120 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(uint32_t orig) {
14121 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(orig & ~1);
14122 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
14123 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
14124 return (uintptr_t)ret_conv;
14127 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(uint32_t o) {
14128 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14129 CHECK_ACCESS(o_ptr);
14130 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
14131 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uintptr_t)o) & ~1));
14132 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
14133 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
14134 return (uintptr_t)ret_conv;
14137 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(uint32_t e) {
14138 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
14139 CHECK_ACCESS(e_ptr);
14140 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
14141 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
14142 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
14143 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
14144 return (uintptr_t)ret_conv;
14147 jboolean __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(uint32_t o) {
14148 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(o & ~1);
14149 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
14153 void __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(uint32_t _res) {
14154 if ((_res & 1) != 0) return;
14155 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14156 CHECK_ACCESS(_res_ptr);
14157 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
14159 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
14162 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
14163 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
14164 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
14165 return (uintptr_t)ret_conv;
14167 intptr_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(uint32_t arg) {
14168 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1);
14169 intptr_t ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
14173 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(uint32_t orig) {
14174 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(orig & ~1);
14175 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
14176 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
14177 return (uintptr_t)ret_conv;
14180 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_ok"))) TS_CResult_PaymentSecretNoneZ_ok(int8_tArray o) {
14181 LDKThirtyTwoBytes o_ref;
14182 CHECK(o->arr_len == 32);
14183 memcpy(o_ref.data, o->elems, 32); FREE(o);
14184 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
14185 *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
14186 return (uintptr_t)ret_conv;
14189 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_err"))) TS_CResult_PaymentSecretNoneZ_err() {
14190 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
14191 *ret_conv = CResult_PaymentSecretNoneZ_err();
14192 return (uintptr_t)ret_conv;
14195 jboolean __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_is_ok"))) TS_CResult_PaymentSecretNoneZ_is_ok(uint32_t o) {
14196 LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)(o & ~1);
14197 jboolean ret_val = CResult_PaymentSecretNoneZ_is_ok(o_conv);
14201 void __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_free"))) TS_CResult_PaymentSecretNoneZ_free(uint32_t _res) {
14202 if ((_res & 1) != 0) return;
14203 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14204 CHECK_ACCESS(_res_ptr);
14205 LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
14207 CResult_PaymentSecretNoneZ_free(_res_conv);
14210 static inline uintptr_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
14211 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
14212 *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
14213 return (uintptr_t)ret_conv;
14215 intptr_t __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone_ptr"))) TS_CResult_PaymentSecretNoneZ_clone_ptr(uint32_t arg) {
14216 LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1);
14217 intptr_t ret_val = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
14221 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone"))) TS_CResult_PaymentSecretNoneZ_clone(uint32_t orig) {
14222 LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)(orig & ~1);
14223 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
14224 *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
14225 return (uintptr_t)ret_conv;
14228 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_ok"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
14229 LDKThirtyTwoBytes o_ref;
14230 CHECK(o->arr_len == 32);
14231 memcpy(o_ref.data, o->elems, 32); FREE(o);
14232 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
14233 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
14234 return (uintptr_t)ret_conv;
14237 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_err"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint32_t e) {
14238 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
14239 CHECK_ACCESS(e_ptr);
14240 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
14241 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
14242 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
14243 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
14244 return (uintptr_t)ret_conv;
14247 jboolean __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_is_ok"))) TS_CResult_PaymentSecretAPIErrorZ_is_ok(uint32_t o) {
14248 LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(o & ~1);
14249 jboolean ret_val = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
14253 void __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_free"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint32_t _res) {
14254 if ((_res & 1) != 0) return;
14255 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14256 CHECK_ACCESS(_res_ptr);
14257 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
14259 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
14262 static inline uintptr_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
14263 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
14264 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
14265 return (uintptr_t)ret_conv;
14267 intptr_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone_ptr"))) TS_CResult_PaymentSecretAPIErrorZ_clone_ptr(uint32_t arg) {
14268 LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
14269 intptr_t ret_val = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
14273 uint32_t __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint32_t orig) {
14274 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
14275 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
14276 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
14277 return (uintptr_t)ret_conv;
14280 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_ok(int8_tArray o) {
14281 LDKThirtyTwoBytes o_ref;
14282 CHECK(o->arr_len == 32);
14283 memcpy(o_ref.data, o->elems, 32); FREE(o);
14284 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
14285 *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
14286 return (uintptr_t)ret_conv;
14289 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_err"))) TS_CResult_PaymentPreimageAPIErrorZ_err(uint32_t e) {
14290 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
14291 CHECK_ACCESS(e_ptr);
14292 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
14293 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
14294 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
14295 *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
14296 return (uintptr_t)ret_conv;
14299 jboolean __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_is_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_is_ok(uint32_t o) {
14300 LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(o & ~1);
14301 jboolean ret_val = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
14305 void __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_free"))) TS_CResult_PaymentPreimageAPIErrorZ_free(uint32_t _res) {
14306 if ((_res & 1) != 0) return;
14307 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14308 CHECK_ACCESS(_res_ptr);
14309 LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
14311 CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
14314 static inline uintptr_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
14315 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
14316 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
14317 return (uintptr_t)ret_conv;
14319 intptr_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr"))) TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr(uint32_t arg) {
14320 LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1);
14321 intptr_t ret_val = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
14325 uint32_t __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone"))) TS_CResult_PaymentPreimageAPIErrorZ_clone(uint32_t orig) {
14326 LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(orig & ~1);
14327 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
14328 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
14329 return (uintptr_t)ret_conv;
14332 uint32_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(uint32_t o) {
14333 LDKCounterpartyForwardingInfo o_conv;
14334 o_conv.inner = (void*)(o & (~1));
14335 o_conv.is_owned = (o & 1) || (o == 0);
14336 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14337 o_conv = CounterpartyForwardingInfo_clone(&o_conv);
14338 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
14339 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
14340 return (uintptr_t)ret_conv;
14343 uint32_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(uint32_t e) {
14344 LDKDecodeError e_conv;
14345 e_conv.inner = (void*)(e & (~1));
14346 e_conv.is_owned = (e & 1) || (e == 0);
14347 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14348 e_conv = DecodeError_clone(&e_conv);
14349 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
14350 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
14351 return (uintptr_t)ret_conv;
14354 jboolean __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(uint32_t o) {
14355 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(o & ~1);
14356 jboolean ret_val = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
14360 void __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(uint32_t _res) {
14361 if ((_res & 1) != 0) return;
14362 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14363 CHECK_ACCESS(_res_ptr);
14364 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
14366 CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
14369 static inline uintptr_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
14370 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
14371 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
14372 return (uintptr_t)ret_conv;
14374 intptr_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
14375 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(arg & ~1);
14376 intptr_t ret_val = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
14380 uint32_t __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(uint32_t orig) {
14381 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(orig & ~1);
14382 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
14383 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
14384 return (uintptr_t)ret_conv;
14387 uint32_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_ok(uint32_t o) {
14388 LDKChannelCounterparty o_conv;
14389 o_conv.inner = (void*)(o & (~1));
14390 o_conv.is_owned = (o & 1) || (o == 0);
14391 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14392 o_conv = ChannelCounterparty_clone(&o_conv);
14393 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
14394 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
14395 return (uintptr_t)ret_conv;
14398 uint32_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_err(uint32_t e) {
14399 LDKDecodeError e_conv;
14400 e_conv.inner = (void*)(e & (~1));
14401 e_conv.is_owned = (e & 1) || (e == 0);
14402 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14403 e_conv = DecodeError_clone(&e_conv);
14404 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
14405 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
14406 return (uintptr_t)ret_conv;
14409 jboolean __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(uint32_t o) {
14410 LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(o & ~1);
14411 jboolean ret_val = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
14415 void __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_free"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_free(uint32_t _res) {
14416 if ((_res & 1) != 0) return;
14417 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14418 CHECK_ACCESS(_res_ptr);
14419 LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
14421 CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
14424 static inline uintptr_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
14425 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
14426 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
14427 return (uintptr_t)ret_conv;
14429 intptr_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(uint32_t arg) {
14430 LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(arg & ~1);
14431 intptr_t ret_val = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
14435 uint32_t __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone(uint32_t orig) {
14436 LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(orig & ~1);
14437 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
14438 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
14439 return (uintptr_t)ret_conv;
14442 uint32_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_ok(uint32_t o) {
14443 LDKChannelDetails o_conv;
14444 o_conv.inner = (void*)(o & (~1));
14445 o_conv.is_owned = (o & 1) || (o == 0);
14446 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14447 o_conv = ChannelDetails_clone(&o_conv);
14448 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
14449 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
14450 return (uintptr_t)ret_conv;
14453 uint32_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_err(uint32_t e) {
14454 LDKDecodeError e_conv;
14455 e_conv.inner = (void*)(e & (~1));
14456 e_conv.is_owned = (e & 1) || (e == 0);
14457 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14458 e_conv = DecodeError_clone(&e_conv);
14459 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
14460 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
14461 return (uintptr_t)ret_conv;
14464 jboolean __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_is_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_is_ok(uint32_t o) {
14465 LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(o & ~1);
14466 jboolean ret_val = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
14470 void __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_free"))) TS_CResult_ChannelDetailsDecodeErrorZ_free(uint32_t _res) {
14471 if ((_res & 1) != 0) return;
14472 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14473 CHECK_ACCESS(_res_ptr);
14474 LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
14476 CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
14479 static inline uintptr_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
14480 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
14481 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
14482 return (uintptr_t)ret_conv;
14484 intptr_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(uint32_t arg) {
14485 LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(arg & ~1);
14486 intptr_t ret_val = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
14490 uint32_t __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone(uint32_t orig) {
14491 LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(orig & ~1);
14492 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
14493 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
14494 return (uintptr_t)ret_conv;
14497 uint32_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_ok(uint32_t o) {
14498 LDKPhantomRouteHints o_conv;
14499 o_conv.inner = (void*)(o & (~1));
14500 o_conv.is_owned = (o & 1) || (o == 0);
14501 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14502 o_conv = PhantomRouteHints_clone(&o_conv);
14503 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
14504 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
14505 return (uintptr_t)ret_conv;
14508 uint32_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_err(uint32_t e) {
14509 LDKDecodeError e_conv;
14510 e_conv.inner = (void*)(e & (~1));
14511 e_conv.is_owned = (e & 1) || (e == 0);
14512 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14513 e_conv = DecodeError_clone(&e_conv);
14514 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
14515 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
14516 return (uintptr_t)ret_conv;
14519 jboolean __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(uint32_t o) {
14520 LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(o & ~1);
14521 jboolean ret_val = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
14525 void __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_free"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_free(uint32_t _res) {
14526 if ((_res & 1) != 0) return;
14527 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14528 CHECK_ACCESS(_res_ptr);
14529 LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
14531 CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
14534 static inline uintptr_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
14535 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
14536 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
14537 return (uintptr_t)ret_conv;
14539 intptr_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(uint32_t arg) {
14540 LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(arg & ~1);
14541 intptr_t ret_val = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
14545 uint32_t __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone(uint32_t orig) {
14546 LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(orig & ~1);
14547 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
14548 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
14549 return (uintptr_t)ret_conv;
14552 void __attribute__((export_name("TS_CVec_ChannelMonitorZ_free"))) TS_CVec_ChannelMonitorZ_free(uint32_tArray _res) {
14553 LDKCVec_ChannelMonitorZ _res_constr;
14554 _res_constr.datalen = _res->arr_len;
14555 if (_res_constr.datalen > 0)
14556 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
14558 _res_constr.data = NULL;
14559 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
14560 for (size_t q = 0; q < _res_constr.datalen; q++) {
14561 uint32_t _res_conv_16 = _res_vals[q];
14562 LDKChannelMonitor _res_conv_16_conv;
14563 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
14564 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
14565 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
14566 _res_constr.data[q] = _res_conv_16_conv;
14568 CVec_ChannelMonitorZ_free(_res_constr);
14571 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_new"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
14572 LDKThirtyTwoBytes a_ref;
14573 CHECK(a->arr_len == 32);
14574 memcpy(a_ref.data, a->elems, 32); FREE(a);
14575 LDKChannelManager b_conv;
14576 b_conv.inner = (void*)(b & (~1));
14577 b_conv.is_owned = (b & 1) || (b == 0);
14578 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
14579 // WARNING: we need a move here but no clone is available for LDKChannelManager
14580 LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
14581 *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
14582 return ((uintptr_t)ret_conv);
14585 void __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_free"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint32_t _res) {
14586 if ((_res & 1) != 0) return;
14587 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14588 CHECK_ACCESS(_res_ptr);
14589 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
14591 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
14594 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint32_t o) {
14595 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14596 CHECK_ACCESS(o_ptr);
14597 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
14598 // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
14599 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
14600 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
14601 return (uintptr_t)ret_conv;
14604 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint32_t e) {
14605 LDKDecodeError e_conv;
14606 e_conv.inner = (void*)(e & (~1));
14607 e_conv.is_owned = (e & 1) || (e == 0);
14608 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14609 e_conv = DecodeError_clone(&e_conv);
14610 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
14611 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
14612 return (uintptr_t)ret_conv;
14615 jboolean __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(uint32_t o) {
14616 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(o & ~1);
14617 jboolean ret_val = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
14621 void __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint32_t _res) {
14622 if ((_res & 1) != 0) return;
14623 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14624 CHECK_ACCESS(_res_ptr);
14625 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
14627 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
14630 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint32_t o) {
14631 LDKChannelConfig o_conv;
14632 o_conv.inner = (void*)(o & (~1));
14633 o_conv.is_owned = (o & 1) || (o == 0);
14634 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14635 o_conv = ChannelConfig_clone(&o_conv);
14636 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
14637 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
14638 return (uintptr_t)ret_conv;
14641 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_err"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint32_t e) {
14642 LDKDecodeError e_conv;
14643 e_conv.inner = (void*)(e & (~1));
14644 e_conv.is_owned = (e & 1) || (e == 0);
14645 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14646 e_conv = DecodeError_clone(&e_conv);
14647 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
14648 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
14649 return (uintptr_t)ret_conv;
14652 jboolean __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_is_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint32_t o) {
14653 LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(o & ~1);
14654 jboolean ret_val = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
14658 void __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_free"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint32_t _res) {
14659 if ((_res & 1) != 0) return;
14660 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14661 CHECK_ACCESS(_res_ptr);
14662 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
14664 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
14667 static inline uintptr_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
14668 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
14669 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
14670 return (uintptr_t)ret_conv;
14672 intptr_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint32_t arg) {
14673 LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
14674 intptr_t ret_val = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
14678 uint32_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint32_t orig) {
14679 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
14680 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
14681 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
14682 return (uintptr_t)ret_conv;
14685 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint32_t o) {
14686 LDKOutPoint o_conv;
14687 o_conv.inner = (void*)(o & (~1));
14688 o_conv.is_owned = (o & 1) || (o == 0);
14689 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14690 o_conv = OutPoint_clone(&o_conv);
14691 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
14692 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
14693 return (uintptr_t)ret_conv;
14696 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_err"))) TS_CResult_OutPointDecodeErrorZ_err(uint32_t e) {
14697 LDKDecodeError e_conv;
14698 e_conv.inner = (void*)(e & (~1));
14699 e_conv.is_owned = (e & 1) || (e == 0);
14700 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14701 e_conv = DecodeError_clone(&e_conv);
14702 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
14703 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
14704 return (uintptr_t)ret_conv;
14707 jboolean __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_is_ok"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint32_t o) {
14708 LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)(o & ~1);
14709 jboolean ret_val = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
14713 void __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_free"))) TS_CResult_OutPointDecodeErrorZ_free(uint32_t _res) {
14714 if ((_res & 1) != 0) return;
14715 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14716 CHECK_ACCESS(_res_ptr);
14717 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
14719 CResult_OutPointDecodeErrorZ_free(_res_conv);
14722 static inline uintptr_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
14723 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
14724 *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
14725 return (uintptr_t)ret_conv;
14727 intptr_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone_ptr"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint32_t arg) {
14728 LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
14729 intptr_t ret_val = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
14733 uint32_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone"))) TS_CResult_OutPointDecodeErrorZ_clone(uint32_t orig) {
14734 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
14735 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
14736 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
14737 return (uintptr_t)ret_conv;
14740 uint32_t __attribute__((export_name("TS_COption_TypeZ_some"))) TS_COption_TypeZ_some(uint32_t o) {
14741 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14742 CHECK_ACCESS(o_ptr);
14743 LDKType o_conv = *(LDKType*)(o_ptr);
14744 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
14745 *ret_copy = COption_TypeZ_some(o_conv);
14746 uintptr_t ret_ref = (uintptr_t)ret_copy;
14750 uint32_t __attribute__((export_name("TS_COption_TypeZ_none"))) TS_COption_TypeZ_none() {
14751 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
14752 *ret_copy = COption_TypeZ_none();
14753 uintptr_t ret_ref = (uintptr_t)ret_copy;
14757 void __attribute__((export_name("TS_COption_TypeZ_free"))) TS_COption_TypeZ_free(uint32_t _res) {
14758 if ((_res & 1) != 0) return;
14759 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14760 CHECK_ACCESS(_res_ptr);
14761 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
14763 COption_TypeZ_free(_res_conv);
14766 static inline uintptr_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
14767 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
14768 *ret_copy = COption_TypeZ_clone(arg);
14769 uintptr_t ret_ref = (uintptr_t)ret_copy;
14772 intptr_t __attribute__((export_name("TS_COption_TypeZ_clone_ptr"))) TS_COption_TypeZ_clone_ptr(uint32_t arg) {
14773 LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)arg;
14774 intptr_t ret_val = COption_TypeZ_clone_ptr(arg_conv);
14778 uint32_t __attribute__((export_name("TS_COption_TypeZ_clone"))) TS_COption_TypeZ_clone(uint32_t orig) {
14779 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
14780 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
14781 *ret_copy = COption_TypeZ_clone(orig_conv);
14782 uintptr_t ret_ref = (uintptr_t)ret_copy;
14786 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint32_t o) {
14787 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14788 CHECK_ACCESS(o_ptr);
14789 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
14790 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uintptr_t)o) & ~1));
14791 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
14792 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
14793 return (uintptr_t)ret_conv;
14796 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_err"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint32_t e) {
14797 LDKDecodeError e_conv;
14798 e_conv.inner = (void*)(e & (~1));
14799 e_conv.is_owned = (e & 1) || (e == 0);
14800 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14801 e_conv = DecodeError_clone(&e_conv);
14802 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
14803 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
14804 return (uintptr_t)ret_conv;
14807 jboolean __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_is_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint32_t o) {
14808 LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(o & ~1);
14809 jboolean ret_val = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
14813 void __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_free"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint32_t _res) {
14814 if ((_res & 1) != 0) return;
14815 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14816 CHECK_ACCESS(_res_ptr);
14817 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
14819 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
14822 static inline uintptr_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
14823 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
14824 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
14825 return (uintptr_t)ret_conv;
14827 intptr_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint32_t arg) {
14828 LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
14829 intptr_t ret_val = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
14833 uint32_t __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint32_t orig) {
14834 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
14835 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
14836 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
14837 return (uintptr_t)ret_conv;
14840 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_ok"))) TS_CResult_PaymentIdPaymentErrorZ_ok(int8_tArray o) {
14841 LDKThirtyTwoBytes o_ref;
14842 CHECK(o->arr_len == 32);
14843 memcpy(o_ref.data, o->elems, 32); FREE(o);
14844 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
14845 *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
14846 return (uintptr_t)ret_conv;
14849 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_err"))) TS_CResult_PaymentIdPaymentErrorZ_err(uint32_t e) {
14850 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
14851 CHECK_ACCESS(e_ptr);
14852 LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
14853 e_conv = PaymentError_clone((LDKPaymentError*)(((uintptr_t)e) & ~1));
14854 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
14855 *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
14856 return (uintptr_t)ret_conv;
14859 jboolean __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_is_ok"))) TS_CResult_PaymentIdPaymentErrorZ_is_ok(uint32_t o) {
14860 LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(o & ~1);
14861 jboolean ret_val = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
14865 void __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_free"))) TS_CResult_PaymentIdPaymentErrorZ_free(uint32_t _res) {
14866 if ((_res & 1) != 0) return;
14867 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14868 CHECK_ACCESS(_res_ptr);
14869 LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
14871 CResult_PaymentIdPaymentErrorZ_free(_res_conv);
14874 static inline uintptr_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
14875 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
14876 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
14877 return (uintptr_t)ret_conv;
14879 intptr_t __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone_ptr"))) TS_CResult_PaymentIdPaymentErrorZ_clone_ptr(uint32_t arg) {
14880 LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(arg & ~1);
14881 intptr_t ret_val = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
14885 uint32_t __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone"))) TS_CResult_PaymentIdPaymentErrorZ_clone(uint32_t orig) {
14886 LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(orig & ~1);
14887 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
14888 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
14889 return (uintptr_t)ret_conv;
14892 uint32_t __attribute__((export_name("TS_CResult_SiPrefixNoneZ_ok"))) TS_CResult_SiPrefixNoneZ_ok(uint32_t o) {
14893 LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
14894 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
14895 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
14896 return (uintptr_t)ret_conv;
14899 uint32_t __attribute__((export_name("TS_CResult_SiPrefixNoneZ_err"))) TS_CResult_SiPrefixNoneZ_err() {
14900 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
14901 *ret_conv = CResult_SiPrefixNoneZ_err();
14902 return (uintptr_t)ret_conv;
14905 jboolean __attribute__((export_name("TS_CResult_SiPrefixNoneZ_is_ok"))) TS_CResult_SiPrefixNoneZ_is_ok(uint32_t o) {
14906 LDKCResult_SiPrefixNoneZ* o_conv = (LDKCResult_SiPrefixNoneZ*)(o & ~1);
14907 jboolean ret_val = CResult_SiPrefixNoneZ_is_ok(o_conv);
14911 void __attribute__((export_name("TS_CResult_SiPrefixNoneZ_free"))) TS_CResult_SiPrefixNoneZ_free(uint32_t _res) {
14912 if ((_res & 1) != 0) return;
14913 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14914 CHECK_ACCESS(_res_ptr);
14915 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(_res_ptr);
14917 CResult_SiPrefixNoneZ_free(_res_conv);
14920 static inline uintptr_t CResult_SiPrefixNoneZ_clone_ptr(LDKCResult_SiPrefixNoneZ *NONNULL_PTR arg) {
14921 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
14922 *ret_conv = CResult_SiPrefixNoneZ_clone(arg);
14923 return (uintptr_t)ret_conv;
14925 intptr_t __attribute__((export_name("TS_CResult_SiPrefixNoneZ_clone_ptr"))) TS_CResult_SiPrefixNoneZ_clone_ptr(uint32_t arg) {
14926 LDKCResult_SiPrefixNoneZ* arg_conv = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
14927 intptr_t ret_val = CResult_SiPrefixNoneZ_clone_ptr(arg_conv);
14931 uint32_t __attribute__((export_name("TS_CResult_SiPrefixNoneZ_clone"))) TS_CResult_SiPrefixNoneZ_clone(uint32_t orig) {
14932 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
14933 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
14934 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
14935 return (uintptr_t)ret_conv;
14938 uint32_t __attribute__((export_name("TS_CResult_InvoiceNoneZ_ok"))) TS_CResult_InvoiceNoneZ_ok(uint32_t o) {
14940 o_conv.inner = (void*)(o & (~1));
14941 o_conv.is_owned = (o & 1) || (o == 0);
14942 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14943 o_conv = Invoice_clone(&o_conv);
14944 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
14945 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
14946 return (uintptr_t)ret_conv;
14949 uint32_t __attribute__((export_name("TS_CResult_InvoiceNoneZ_err"))) TS_CResult_InvoiceNoneZ_err() {
14950 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
14951 *ret_conv = CResult_InvoiceNoneZ_err();
14952 return (uintptr_t)ret_conv;
14955 jboolean __attribute__((export_name("TS_CResult_InvoiceNoneZ_is_ok"))) TS_CResult_InvoiceNoneZ_is_ok(uint32_t o) {
14956 LDKCResult_InvoiceNoneZ* o_conv = (LDKCResult_InvoiceNoneZ*)(o & ~1);
14957 jboolean ret_val = CResult_InvoiceNoneZ_is_ok(o_conv);
14961 void __attribute__((export_name("TS_CResult_InvoiceNoneZ_free"))) TS_CResult_InvoiceNoneZ_free(uint32_t _res) {
14962 if ((_res & 1) != 0) return;
14963 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14964 CHECK_ACCESS(_res_ptr);
14965 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(_res_ptr);
14967 CResult_InvoiceNoneZ_free(_res_conv);
14970 static inline uintptr_t CResult_InvoiceNoneZ_clone_ptr(LDKCResult_InvoiceNoneZ *NONNULL_PTR arg) {
14971 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
14972 *ret_conv = CResult_InvoiceNoneZ_clone(arg);
14973 return (uintptr_t)ret_conv;
14975 intptr_t __attribute__((export_name("TS_CResult_InvoiceNoneZ_clone_ptr"))) TS_CResult_InvoiceNoneZ_clone_ptr(uint32_t arg) {
14976 LDKCResult_InvoiceNoneZ* arg_conv = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
14977 intptr_t ret_val = CResult_InvoiceNoneZ_clone_ptr(arg_conv);
14981 uint32_t __attribute__((export_name("TS_CResult_InvoiceNoneZ_clone"))) TS_CResult_InvoiceNoneZ_clone(uint32_t orig) {
14982 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
14983 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
14984 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
14985 return (uintptr_t)ret_conv;
14988 uint32_t __attribute__((export_name("TS_CResult_SignedRawInvoiceNoneZ_ok"))) TS_CResult_SignedRawInvoiceNoneZ_ok(uint32_t o) {
14989 LDKSignedRawInvoice o_conv;
14990 o_conv.inner = (void*)(o & (~1));
14991 o_conv.is_owned = (o & 1) || (o == 0);
14992 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14993 o_conv = SignedRawInvoice_clone(&o_conv);
14994 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
14995 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
14996 return (uintptr_t)ret_conv;
14999 uint32_t __attribute__((export_name("TS_CResult_SignedRawInvoiceNoneZ_err"))) TS_CResult_SignedRawInvoiceNoneZ_err() {
15000 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
15001 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
15002 return (uintptr_t)ret_conv;
15005 jboolean __attribute__((export_name("TS_CResult_SignedRawInvoiceNoneZ_is_ok"))) TS_CResult_SignedRawInvoiceNoneZ_is_ok(uint32_t o) {
15006 LDKCResult_SignedRawInvoiceNoneZ* o_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(o & ~1);
15007 jboolean ret_val = CResult_SignedRawInvoiceNoneZ_is_ok(o_conv);
15011 void __attribute__((export_name("TS_CResult_SignedRawInvoiceNoneZ_free"))) TS_CResult_SignedRawInvoiceNoneZ_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_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(_res_ptr);
15017 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
15020 static inline uintptr_t CResult_SignedRawInvoiceNoneZ_clone_ptr(LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR arg) {
15021 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
15022 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(arg);
15023 return (uintptr_t)ret_conv;
15025 intptr_t __attribute__((export_name("TS_CResult_SignedRawInvoiceNoneZ_clone_ptr"))) TS_CResult_SignedRawInvoiceNoneZ_clone_ptr(uint32_t arg) {
15026 LDKCResult_SignedRawInvoiceNoneZ* arg_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
15027 intptr_t ret_val = CResult_SignedRawInvoiceNoneZ_clone_ptr(arg_conv);
15031 uint32_t __attribute__((export_name("TS_CResult_SignedRawInvoiceNoneZ_clone"))) TS_CResult_SignedRawInvoiceNoneZ_clone(uint32_t orig) {
15032 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
15033 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
15034 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
15035 return (uintptr_t)ret_conv;
15038 static inline uintptr_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
15039 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
15040 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
15041 return ((uintptr_t)ret_conv);
15043 intptr_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(uint32_t arg) {
15044 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(arg & ~1);
15045 intptr_t ret_val = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
15049 uint32_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint32_t orig) {
15050 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
15051 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
15052 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
15053 return ((uintptr_t)ret_conv);
15056 uint32_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint32_t a, int8_tArray b, uint32_t c) {
15057 LDKRawInvoice a_conv;
15058 a_conv.inner = (void*)(a & (~1));
15059 a_conv.is_owned = (a & 1) || (a == 0);
15060 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
15061 a_conv = RawInvoice_clone(&a_conv);
15062 LDKThirtyTwoBytes b_ref;
15063 CHECK(b->arr_len == 32);
15064 memcpy(b_ref.data, b->elems, 32); FREE(b);
15065 LDKInvoiceSignature c_conv;
15066 c_conv.inner = (void*)(c & (~1));
15067 c_conv.is_owned = (c & 1) || (c == 0);
15068 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
15069 c_conv = InvoiceSignature_clone(&c_conv);
15070 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
15071 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
15072 return ((uintptr_t)ret_conv);
15075 void __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint32_t _res) {
15076 if ((_res & 1) != 0) return;
15077 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15078 CHECK_ACCESS(_res_ptr);
15079 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
15081 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
15084 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_ok"))) TS_CResult_PayeePubKeyErrorZ_ok(uint32_t o) {
15085 LDKPayeePubKey o_conv;
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 = PayeePubKey_clone(&o_conv);
15090 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
15091 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
15092 return (uintptr_t)ret_conv;
15095 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_err"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
15096 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
15097 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
15098 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
15099 return (uintptr_t)ret_conv;
15102 jboolean __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_is_ok"))) TS_CResult_PayeePubKeyErrorZ_is_ok(uint32_t o) {
15103 LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)(o & ~1);
15104 jboolean ret_val = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
15108 void __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_free"))) TS_CResult_PayeePubKeyErrorZ_free(uint32_t _res) {
15109 if ((_res & 1) != 0) return;
15110 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15111 CHECK_ACCESS(_res_ptr);
15112 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
15114 CResult_PayeePubKeyErrorZ_free(_res_conv);
15117 static inline uintptr_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
15118 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
15119 *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
15120 return (uintptr_t)ret_conv;
15122 intptr_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone_ptr"))) TS_CResult_PayeePubKeyErrorZ_clone_ptr(uint32_t arg) {
15123 LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
15124 intptr_t ret_val = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
15128 uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone"))) TS_CResult_PayeePubKeyErrorZ_clone(uint32_t orig) {
15129 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
15130 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
15131 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
15132 return (uintptr_t)ret_conv;
15135 void __attribute__((export_name("TS_CVec_PrivateRouteZ_free"))) TS_CVec_PrivateRouteZ_free(uint32_tArray _res) {
15136 LDKCVec_PrivateRouteZ _res_constr;
15137 _res_constr.datalen = _res->arr_len;
15138 if (_res_constr.datalen > 0)
15139 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
15141 _res_constr.data = NULL;
15142 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
15143 for (size_t o = 0; o < _res_constr.datalen; o++) {
15144 uint32_t _res_conv_14 = _res_vals[o];
15145 LDKPrivateRoute _res_conv_14_conv;
15146 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
15147 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
15148 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
15149 _res_constr.data[o] = _res_conv_14_conv;
15151 CVec_PrivateRouteZ_free(_res_constr);
15154 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint32_t o) {
15155 LDKPositiveTimestamp o_conv;
15156 o_conv.inner = (void*)(o & (~1));
15157 o_conv.is_owned = (o & 1) || (o == 0);
15158 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15159 o_conv = PositiveTimestamp_clone(&o_conv);
15160 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
15161 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
15162 return (uintptr_t)ret_conv;
15165 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_err"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
15166 LDKCreationError e_conv = LDKCreationError_from_js(e);
15167 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
15168 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
15169 return (uintptr_t)ret_conv;
15172 jboolean __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_is_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint32_t o) {
15173 LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(o & ~1);
15174 jboolean ret_val = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
15178 void __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_free"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint32_t _res) {
15179 if ((_res & 1) != 0) return;
15180 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15181 CHECK_ACCESS(_res_ptr);
15182 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
15184 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
15187 static inline uintptr_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
15188 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
15189 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
15190 return (uintptr_t)ret_conv;
15192 intptr_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint32_t arg) {
15193 LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
15194 intptr_t ret_val = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
15198 uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint32_t orig) {
15199 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
15200 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
15201 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
15202 return (uintptr_t)ret_conv;
15205 uint32_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_ok"))) TS_CResult_NoneSemanticErrorZ_ok() {
15206 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
15207 *ret_conv = CResult_NoneSemanticErrorZ_ok();
15208 return (uintptr_t)ret_conv;
15211 uint32_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_err"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) {
15212 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
15213 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
15214 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
15215 return (uintptr_t)ret_conv;
15218 jboolean __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_is_ok"))) TS_CResult_NoneSemanticErrorZ_is_ok(uint32_t o) {
15219 LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)(o & ~1);
15220 jboolean ret_val = CResult_NoneSemanticErrorZ_is_ok(o_conv);
15224 void __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_free"))) TS_CResult_NoneSemanticErrorZ_free(uint32_t _res) {
15225 if ((_res & 1) != 0) return;
15226 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15227 CHECK_ACCESS(_res_ptr);
15228 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
15230 CResult_NoneSemanticErrorZ_free(_res_conv);
15233 static inline uintptr_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
15234 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
15235 *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
15236 return (uintptr_t)ret_conv;
15238 intptr_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone_ptr"))) TS_CResult_NoneSemanticErrorZ_clone_ptr(uint32_t arg) {
15239 LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
15240 intptr_t ret_val = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
15244 uint32_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone"))) TS_CResult_NoneSemanticErrorZ_clone(uint32_t orig) {
15245 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
15246 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
15247 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
15248 return (uintptr_t)ret_conv;
15251 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_ok"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint32_t o) {
15253 o_conv.inner = (void*)(o & (~1));
15254 o_conv.is_owned = (o & 1) || (o == 0);
15255 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15256 o_conv = Invoice_clone(&o_conv);
15257 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
15258 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
15259 return (uintptr_t)ret_conv;
15262 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_err"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) {
15263 LDKSemanticError e_conv = LDKSemanticError_from_js(e);
15264 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
15265 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
15266 return (uintptr_t)ret_conv;
15269 jboolean __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_is_ok"))) TS_CResult_InvoiceSemanticErrorZ_is_ok(uint32_t o) {
15270 LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)(o & ~1);
15271 jboolean ret_val = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
15275 void __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_free"))) TS_CResult_InvoiceSemanticErrorZ_free(uint32_t _res) {
15276 if ((_res & 1) != 0) return;
15277 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15278 CHECK_ACCESS(_res_ptr);
15279 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
15281 CResult_InvoiceSemanticErrorZ_free(_res_conv);
15284 static inline uintptr_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
15285 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
15286 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
15287 return (uintptr_t)ret_conv;
15289 intptr_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceSemanticErrorZ_clone_ptr(uint32_t arg) {
15290 LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
15291 intptr_t ret_val = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
15295 uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint32_t orig) {
15296 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
15297 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
15298 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
15299 return (uintptr_t)ret_conv;
15302 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_ok"))) TS_CResult_DescriptionCreationErrorZ_ok(uint32_t o) {
15303 LDKDescription o_conv;
15304 o_conv.inner = (void*)(o & (~1));
15305 o_conv.is_owned = (o & 1) || (o == 0);
15306 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15307 o_conv = Description_clone(&o_conv);
15308 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
15309 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
15310 return (uintptr_t)ret_conv;
15313 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_err"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
15314 LDKCreationError e_conv = LDKCreationError_from_js(e);
15315 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
15316 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
15317 return (uintptr_t)ret_conv;
15320 jboolean __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_is_ok"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint32_t o) {
15321 LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)(o & ~1);
15322 jboolean ret_val = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
15326 void __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_free"))) TS_CResult_DescriptionCreationErrorZ_free(uint32_t _res) {
15327 if ((_res & 1) != 0) return;
15328 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15329 CHECK_ACCESS(_res_ptr);
15330 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
15332 CResult_DescriptionCreationErrorZ_free(_res_conv);
15335 static inline uintptr_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
15336 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
15337 *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
15338 return (uintptr_t)ret_conv;
15340 intptr_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone_ptr"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint32_t arg) {
15341 LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
15342 intptr_t ret_val = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
15346 uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone"))) TS_CResult_DescriptionCreationErrorZ_clone(uint32_t orig) {
15347 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
15348 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
15349 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
15350 return (uintptr_t)ret_conv;
15353 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_ok"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint32_t o) {
15354 LDKPrivateRoute o_conv;
15355 o_conv.inner = (void*)(o & (~1));
15356 o_conv.is_owned = (o & 1) || (o == 0);
15357 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15358 o_conv = PrivateRoute_clone(&o_conv);
15359 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
15360 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
15361 return (uintptr_t)ret_conv;
15364 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_err"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
15365 LDKCreationError e_conv = LDKCreationError_from_js(e);
15366 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
15367 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
15368 return (uintptr_t)ret_conv;
15371 jboolean __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_is_ok"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint32_t o) {
15372 LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(o & ~1);
15373 jboolean ret_val = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
15377 void __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_free"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint32_t _res) {
15378 if ((_res & 1) != 0) return;
15379 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15380 CHECK_ACCESS(_res_ptr);
15381 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
15383 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
15386 static inline uintptr_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
15387 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
15388 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
15389 return (uintptr_t)ret_conv;
15391 intptr_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone_ptr"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint32_t arg) {
15392 LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
15393 intptr_t ret_val = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
15397 uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint32_t orig) {
15398 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
15399 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
15400 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
15401 return (uintptr_t)ret_conv;
15404 uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_ok"))) TS_CResult_StringErrorZ_ok(jstring o) {
15405 LDKStr o_conv = str_ref_to_owned_c(o);
15406 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
15407 *ret_conv = CResult_StringErrorZ_ok(o_conv);
15408 return (uintptr_t)ret_conv;
15411 uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_err"))) TS_CResult_StringErrorZ_err(uint32_t e) {
15412 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
15413 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
15414 *ret_conv = CResult_StringErrorZ_err(e_conv);
15415 return (uintptr_t)ret_conv;
15418 jboolean __attribute__((export_name("TS_CResult_StringErrorZ_is_ok"))) TS_CResult_StringErrorZ_is_ok(uint32_t o) {
15419 LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)(o & ~1);
15420 jboolean ret_val = CResult_StringErrorZ_is_ok(o_conv);
15424 void __attribute__((export_name("TS_CResult_StringErrorZ_free"))) TS_CResult_StringErrorZ_free(uint32_t _res) {
15425 if ((_res & 1) != 0) return;
15426 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15427 CHECK_ACCESS(_res_ptr);
15428 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
15430 CResult_StringErrorZ_free(_res_conv);
15433 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint32_t o) {
15434 LDKChannelMonitorUpdate o_conv;
15435 o_conv.inner = (void*)(o & (~1));
15436 o_conv.is_owned = (o & 1) || (o == 0);
15437 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15438 o_conv = ChannelMonitorUpdate_clone(&o_conv);
15439 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
15440 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
15441 return (uintptr_t)ret_conv;
15444 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint32_t e) {
15445 LDKDecodeError e_conv;
15446 e_conv.inner = (void*)(e & (~1));
15447 e_conv.is_owned = (e & 1) || (e == 0);
15448 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15449 e_conv = DecodeError_clone(&e_conv);
15450 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
15451 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
15452 return (uintptr_t)ret_conv;
15455 jboolean __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint32_t o) {
15456 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(o & ~1);
15457 jboolean ret_val = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
15461 void __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint32_t _res) {
15462 if ((_res & 1) != 0) return;
15463 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15464 CHECK_ACCESS(_res_ptr);
15465 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
15467 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
15470 static inline uintptr_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
15471 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
15472 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
15473 return (uintptr_t)ret_conv;
15475 intptr_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
15476 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
15477 intptr_t ret_val = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
15481 uint32_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint32_t orig) {
15482 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
15483 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
15484 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
15485 return (uintptr_t)ret_conv;
15488 uint32_t __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint32_t o) {
15489 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15490 CHECK_ACCESS(o_ptr);
15491 LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
15492 o_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uintptr_t)o) & ~1));
15493 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
15494 *ret_copy = COption_MonitorEventZ_some(o_conv);
15495 uintptr_t ret_ref = (uintptr_t)ret_copy;
15499 uint32_t __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() {
15500 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
15501 *ret_copy = COption_MonitorEventZ_none();
15502 uintptr_t ret_ref = (uintptr_t)ret_copy;
15506 void __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint32_t _res) {
15507 if ((_res & 1) != 0) return;
15508 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15509 CHECK_ACCESS(_res_ptr);
15510 LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
15512 COption_MonitorEventZ_free(_res_conv);
15515 static inline uintptr_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
15516 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
15517 *ret_copy = COption_MonitorEventZ_clone(arg);
15518 uintptr_t ret_ref = (uintptr_t)ret_copy;
15521 intptr_t __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint32_t arg) {
15522 LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)arg;
15523 intptr_t ret_val = COption_MonitorEventZ_clone_ptr(arg_conv);
15527 uint32_t __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint32_t orig) {
15528 LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)orig;
15529 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
15530 *ret_copy = COption_MonitorEventZ_clone(orig_conv);
15531 uintptr_t ret_ref = (uintptr_t)ret_copy;
15535 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint32_t o) {
15536 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15537 CHECK_ACCESS(o_ptr);
15538 LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
15539 o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)(((uintptr_t)o) & ~1));
15540 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
15541 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
15542 return (uintptr_t)ret_conv;
15545 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint32_t e) {
15546 LDKDecodeError e_conv;
15547 e_conv.inner = (void*)(e & (~1));
15548 e_conv.is_owned = (e & 1) || (e == 0);
15549 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15550 e_conv = DecodeError_clone(&e_conv);
15551 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
15552 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
15553 return (uintptr_t)ret_conv;
15556 jboolean __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint32_t o) {
15557 LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(o & ~1);
15558 jboolean ret_val = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
15562 void __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint32_t _res) {
15563 if ((_res & 1) != 0) return;
15564 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15565 CHECK_ACCESS(_res_ptr);
15566 LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
15568 CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
15571 static inline uintptr_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
15572 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
15573 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
15574 return (uintptr_t)ret_conv;
15576 intptr_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint32_t arg) {
15577 LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(arg & ~1);
15578 intptr_t ret_val = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
15582 uint32_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint32_t orig) {
15583 LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(orig & ~1);
15584 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
15585 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
15586 return (uintptr_t)ret_conv;
15589 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint32_t o) {
15590 LDKHTLCUpdate o_conv;
15591 o_conv.inner = (void*)(o & (~1));
15592 o_conv.is_owned = (o & 1) || (o == 0);
15593 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15594 o_conv = HTLCUpdate_clone(&o_conv);
15595 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
15596 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
15597 return (uintptr_t)ret_conv;
15600 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint32_t e) {
15601 LDKDecodeError e_conv;
15602 e_conv.inner = (void*)(e & (~1));
15603 e_conv.is_owned = (e & 1) || (e == 0);
15604 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15605 e_conv = DecodeError_clone(&e_conv);
15606 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
15607 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
15608 return (uintptr_t)ret_conv;
15611 jboolean __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_is_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint32_t o) {
15612 LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(o & ~1);
15613 jboolean ret_val = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
15617 void __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_free"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint32_t _res) {
15618 if ((_res & 1) != 0) return;
15619 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15620 CHECK_ACCESS(_res_ptr);
15621 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
15623 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
15626 static inline uintptr_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
15627 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
15628 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
15629 return (uintptr_t)ret_conv;
15631 intptr_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
15632 LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
15633 intptr_t ret_val = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
15637 uint32_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint32_t orig) {
15638 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
15639 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
15640 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
15641 return (uintptr_t)ret_conv;
15644 static inline uintptr_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
15645 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
15646 *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
15647 return ((uintptr_t)ret_conv);
15649 intptr_t __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone_ptr"))) TS_C2Tuple_OutPointScriptZ_clone_ptr(uint32_t arg) {
15650 LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)(arg & ~1);
15651 intptr_t ret_val = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
15655 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone"))) TS_C2Tuple_OutPointScriptZ_clone(uint32_t orig) {
15656 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
15657 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
15658 *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
15659 return ((uintptr_t)ret_conv);
15662 uint32_t __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_new"))) TS_C2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
15663 LDKOutPoint a_conv;
15664 a_conv.inner = (void*)(a & (~1));
15665 a_conv.is_owned = (a & 1) || (a == 0);
15666 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
15667 a_conv = OutPoint_clone(&a_conv);
15669 b_ref.datalen = b->arr_len;
15670 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
15671 memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
15672 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
15673 *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
15674 return ((uintptr_t)ret_conv);
15677 void __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_free"))) TS_C2Tuple_OutPointScriptZ_free(uint32_t _res) {
15678 if ((_res & 1) != 0) return;
15679 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15680 CHECK_ACCESS(_res_ptr);
15681 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
15683 C2Tuple_OutPointScriptZ_free(_res_conv);
15686 static inline uintptr_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
15687 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
15688 *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
15689 return ((uintptr_t)ret_conv);
15691 intptr_t __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone_ptr"))) TS_C2Tuple_u32ScriptZ_clone_ptr(uint32_t arg) {
15692 LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)(arg & ~1);
15693 intptr_t ret_val = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
15697 uint32_t __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone"))) TS_C2Tuple_u32ScriptZ_clone(uint32_t orig) {
15698 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
15699 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
15700 *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
15701 return ((uintptr_t)ret_conv);
15704 uint32_t __attribute__((export_name("TS_C2Tuple_u32ScriptZ_new"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
15706 b_ref.datalen = b->arr_len;
15707 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
15708 memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
15709 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
15710 *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
15711 return ((uintptr_t)ret_conv);
15714 void __attribute__((export_name("TS_C2Tuple_u32ScriptZ_free"))) TS_C2Tuple_u32ScriptZ_free(uint32_t _res) {
15715 if ((_res & 1) != 0) return;
15716 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15717 CHECK_ACCESS(_res_ptr);
15718 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
15720 C2Tuple_u32ScriptZ_free(_res_conv);
15723 void __attribute__((export_name("TS_CVec_C2Tuple_u32ScriptZZ_free"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint32_tArray _res) {
15724 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
15725 _res_constr.datalen = _res->arr_len;
15726 if (_res_constr.datalen > 0)
15727 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
15729 _res_constr.data = NULL;
15730 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
15731 for (size_t v = 0; v < _res_constr.datalen; v++) {
15732 uint32_t _res_conv_21 = _res_vals[v];
15733 void* _res_conv_21_ptr = (void*)(((uintptr_t)_res_conv_21) & ~1);
15734 CHECK_ACCESS(_res_conv_21_ptr);
15735 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
15736 FREE((void*)_res_conv_21);
15737 _res_constr.data[v] = _res_conv_21_conv;
15739 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
15742 static inline uintptr_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
15743 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
15744 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
15745 return ((uintptr_t)ret_conv);
15747 intptr_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(uint32_t arg) {
15748 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(arg & ~1);
15749 intptr_t ret_val = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
15753 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint32_t orig) {
15754 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
15755 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
15756 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
15757 return ((uintptr_t)ret_conv);
15760 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
15761 LDKThirtyTwoBytes a_ref;
15762 CHECK(a->arr_len == 32);
15763 memcpy(a_ref.data, a->elems, 32); FREE(a);
15764 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
15765 b_constr.datalen = b->arr_len;
15766 if (b_constr.datalen > 0)
15767 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
15769 b_constr.data = NULL;
15770 uint32_t* b_vals = b->elems /* XXX b leaks */;
15771 for (size_t v = 0; v < b_constr.datalen; v++) {
15772 uint32_t b_conv_21 = b_vals[v];
15773 void* b_conv_21_ptr = (void*)(((uintptr_t)b_conv_21) & ~1);
15774 CHECK_ACCESS(b_conv_21_ptr);
15775 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
15776 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uintptr_t)b_conv_21) & ~1));
15777 b_constr.data[v] = b_conv_21_conv;
15779 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
15780 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
15781 return ((uintptr_t)ret_conv);
15784 void __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint32_t _res) {
15785 if ((_res & 1) != 0) return;
15786 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15787 CHECK_ACCESS(_res_ptr);
15788 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
15790 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
15793 void __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint32_tArray _res) {
15794 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
15795 _res_constr.datalen = _res->arr_len;
15796 if (_res_constr.datalen > 0)
15797 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
15799 _res_constr.data = NULL;
15800 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
15801 for (size_t o = 0; o < _res_constr.datalen; o++) {
15802 uint32_t _res_conv_40 = _res_vals[o];
15803 void* _res_conv_40_ptr = (void*)(((uintptr_t)_res_conv_40) & ~1);
15804 CHECK_ACCESS(_res_conv_40_ptr);
15805 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
15806 FREE((void*)_res_conv_40);
15807 _res_constr.data[o] = _res_conv_40_conv;
15809 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
15812 void __attribute__((export_name("TS_CVec_EventZ_free"))) TS_CVec_EventZ_free(uint32_tArray _res) {
15813 LDKCVec_EventZ _res_constr;
15814 _res_constr.datalen = _res->arr_len;
15815 if (_res_constr.datalen > 0)
15816 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
15818 _res_constr.data = NULL;
15819 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
15820 for (size_t h = 0; h < _res_constr.datalen; h++) {
15821 uint32_t _res_conv_7 = _res_vals[h];
15822 void* _res_conv_7_ptr = (void*)(((uintptr_t)_res_conv_7) & ~1);
15823 CHECK_ACCESS(_res_conv_7_ptr);
15824 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
15825 FREE((void*)_res_conv_7);
15826 _res_constr.data[h] = _res_conv_7_conv;
15828 CVec_EventZ_free(_res_constr);
15831 void __attribute__((export_name("TS_CVec_TransactionZ_free"))) TS_CVec_TransactionZ_free(ptrArray _res) {
15832 LDKCVec_TransactionZ _res_constr;
15833 _res_constr.datalen = _res->arr_len;
15834 if (_res_constr.datalen > 0)
15835 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
15837 _res_constr.data = NULL;
15838 int8_tArray* _res_vals = (void*) _res->elems /* XXX _res leaks */;
15839 for (size_t m = 0; m < _res_constr.datalen; m++) {
15840 int8_tArray _res_conv_12 = _res_vals[m];
15841 LDKTransaction _res_conv_12_ref;
15842 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
15843 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
15844 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
15845 _res_conv_12_ref.data_is_owned = true;
15846 _res_constr.data[m] = _res_conv_12_ref;
15848 CVec_TransactionZ_free(_res_constr);
15851 static inline uintptr_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
15852 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
15853 *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
15854 return ((uintptr_t)ret_conv);
15856 intptr_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone_ptr"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint32_t arg) {
15857 LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)(arg & ~1);
15858 intptr_t ret_val = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
15862 uint32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone"))) TS_C2Tuple_u32TxOutZ_clone(uint32_t orig) {
15863 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
15864 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
15865 *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
15866 return ((uintptr_t)ret_conv);
15869 uint32_t __attribute__((export_name("TS_C2Tuple_u32TxOutZ_new"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
15870 void* b_ptr = (void*)(((uintptr_t)b) & ~1);
15871 CHECK_ACCESS(b_ptr);
15872 LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
15873 b_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)b) & ~1));
15874 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
15875 *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
15876 return ((uintptr_t)ret_conv);
15879 void __attribute__((export_name("TS_C2Tuple_u32TxOutZ_free"))) TS_C2Tuple_u32TxOutZ_free(uint32_t _res) {
15880 if ((_res & 1) != 0) return;
15881 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15882 CHECK_ACCESS(_res_ptr);
15883 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
15885 C2Tuple_u32TxOutZ_free(_res_conv);
15888 void __attribute__((export_name("TS_CVec_C2Tuple_u32TxOutZZ_free"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint32_tArray _res) {
15889 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
15890 _res_constr.datalen = _res->arr_len;
15891 if (_res_constr.datalen > 0)
15892 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
15894 _res_constr.data = NULL;
15895 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
15896 for (size_t u = 0; u < _res_constr.datalen; u++) {
15897 uint32_t _res_conv_20 = _res_vals[u];
15898 void* _res_conv_20_ptr = (void*)(((uintptr_t)_res_conv_20) & ~1);
15899 CHECK_ACCESS(_res_conv_20_ptr);
15900 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
15901 FREE((void*)_res_conv_20);
15902 _res_constr.data[u] = _res_conv_20_conv;
15904 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
15907 static inline uintptr_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
15908 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
15909 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
15910 return ((uintptr_t)ret_conv);
15912 intptr_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint32_t arg) {
15913 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(arg & ~1);
15914 intptr_t ret_val = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
15918 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint32_t orig) {
15919 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
15920 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
15921 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
15922 return ((uintptr_t)ret_conv);
15925 uint32_t __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
15926 LDKThirtyTwoBytes a_ref;
15927 CHECK(a->arr_len == 32);
15928 memcpy(a_ref.data, a->elems, 32); FREE(a);
15929 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
15930 b_constr.datalen = b->arr_len;
15931 if (b_constr.datalen > 0)
15932 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
15934 b_constr.data = NULL;
15935 uint32_t* b_vals = b->elems /* XXX b leaks */;
15936 for (size_t u = 0; u < b_constr.datalen; u++) {
15937 uint32_t b_conv_20 = b_vals[u];
15938 void* b_conv_20_ptr = (void*)(((uintptr_t)b_conv_20) & ~1);
15939 CHECK_ACCESS(b_conv_20_ptr);
15940 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
15941 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uintptr_t)b_conv_20) & ~1));
15942 b_constr.data[u] = b_conv_20_conv;
15944 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
15945 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
15946 return ((uintptr_t)ret_conv);
15949 void __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint32_t _res) {
15950 if ((_res & 1) != 0) return;
15951 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15952 CHECK_ACCESS(_res_ptr);
15953 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
15955 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
15958 void __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint32_tArray _res) {
15959 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
15960 _res_constr.datalen = _res->arr_len;
15961 if (_res_constr.datalen > 0)
15962 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
15964 _res_constr.data = NULL;
15965 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
15966 for (size_t n = 0; n < _res_constr.datalen; n++) {
15967 uint32_t _res_conv_39 = _res_vals[n];
15968 void* _res_conv_39_ptr = (void*)(((uintptr_t)_res_conv_39) & ~1);
15969 CHECK_ACCESS(_res_conv_39_ptr);
15970 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
15971 FREE((void*)_res_conv_39);
15972 _res_constr.data[n] = _res_conv_39_conv;
15974 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
15977 void __attribute__((export_name("TS_CVec_BalanceZ_free"))) TS_CVec_BalanceZ_free(uint32_tArray _res) {
15978 LDKCVec_BalanceZ _res_constr;
15979 _res_constr.datalen = _res->arr_len;
15980 if (_res_constr.datalen > 0)
15981 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
15983 _res_constr.data = NULL;
15984 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
15985 for (size_t j = 0; j < _res_constr.datalen; j++) {
15986 uint32_t _res_conv_9 = _res_vals[j];
15987 void* _res_conv_9_ptr = (void*)(((uintptr_t)_res_conv_9) & ~1);
15988 CHECK_ACCESS(_res_conv_9_ptr);
15989 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
15990 FREE((void*)_res_conv_9);
15991 _res_constr.data[j] = _res_conv_9_conv;
15993 CVec_BalanceZ_free(_res_constr);
15996 static inline uintptr_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
15997 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
15998 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
15999 return ((uintptr_t)ret_conv);
16001 intptr_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr(uint32_t arg) {
16002 LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(arg & ~1);
16003 intptr_t ret_val = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
16007 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint32_t orig) {
16008 LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(orig & ~1);
16009 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
16010 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
16011 return ((uintptr_t)ret_conv);
16014 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_new"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
16015 LDKThirtyTwoBytes a_ref;
16016 CHECK(a->arr_len == 32);
16017 memcpy(a_ref.data, a->elems, 32); FREE(a);
16018 LDKChannelMonitor b_conv;
16019 b_conv.inner = (void*)(b & (~1));
16020 b_conv.is_owned = (b & 1) || (b == 0);
16021 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
16022 b_conv = ChannelMonitor_clone(&b_conv);
16023 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
16024 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
16025 return ((uintptr_t)ret_conv);
16028 void __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_free"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint32_t _res) {
16029 if ((_res & 1) != 0) return;
16030 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16031 CHECK_ACCESS(_res_ptr);
16032 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
16034 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
16037 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint32_t o) {
16038 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16039 CHECK_ACCESS(o_ptr);
16040 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
16041 o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uintptr_t)o) & ~1));
16042 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
16043 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
16044 return (uintptr_t)ret_conv;
16047 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint32_t e) {
16048 LDKDecodeError e_conv;
16049 e_conv.inner = (void*)(e & (~1));
16050 e_conv.is_owned = (e & 1) || (e == 0);
16051 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16052 e_conv = DecodeError_clone(&e_conv);
16053 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
16054 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
16055 return (uintptr_t)ret_conv;
16058 jboolean __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(uint32_t o) {
16059 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(o & ~1);
16060 jboolean ret_val = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
16064 void __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint32_t _res) {
16065 if ((_res & 1) != 0) return;
16066 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16067 CHECK_ACCESS(_res_ptr);
16068 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
16070 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
16073 static inline uintptr_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
16074 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
16075 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
16076 return (uintptr_t)ret_conv;
16078 intptr_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(uint32_t arg) {
16079 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
16080 intptr_t ret_val = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
16084 uint32_t __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint32_t orig) {
16085 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(orig & ~1);
16086 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
16087 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
16088 return (uintptr_t)ret_conv;
16091 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_ok"))) TS_CResult_NoneLightningErrorZ_ok() {
16092 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16093 *ret_conv = CResult_NoneLightningErrorZ_ok();
16094 return (uintptr_t)ret_conv;
16097 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_err"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
16098 LDKLightningError e_conv;
16099 e_conv.inner = (void*)(e & (~1));
16100 e_conv.is_owned = (e & 1) || (e == 0);
16101 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16102 e_conv = LightningError_clone(&e_conv);
16103 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16104 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
16105 return (uintptr_t)ret_conv;
16108 jboolean __attribute__((export_name("TS_CResult_NoneLightningErrorZ_is_ok"))) TS_CResult_NoneLightningErrorZ_is_ok(uint32_t o) {
16109 LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)(o & ~1);
16110 jboolean ret_val = CResult_NoneLightningErrorZ_is_ok(o_conv);
16114 void __attribute__((export_name("TS_CResult_NoneLightningErrorZ_free"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
16115 if ((_res & 1) != 0) return;
16116 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16117 CHECK_ACCESS(_res_ptr);
16118 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
16120 CResult_NoneLightningErrorZ_free(_res_conv);
16123 static inline uintptr_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
16124 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16125 *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
16126 return (uintptr_t)ret_conv;
16128 intptr_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone_ptr"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint32_t arg) {
16129 LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
16130 intptr_t ret_val = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
16134 uint32_t __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
16135 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
16136 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16137 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
16138 return (uintptr_t)ret_conv;
16141 static inline uintptr_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
16142 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
16143 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
16144 return ((uintptr_t)ret_conv);
16146 intptr_t __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone_ptr"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint32_t arg) {
16147 LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)(arg & ~1);
16148 intptr_t ret_val = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
16152 uint32_t __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint32_t orig) {
16153 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
16154 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
16155 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
16156 return ((uintptr_t)ret_conv);
16159 uint32_t __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_new"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint32_t b) {
16160 LDKPublicKey a_ref;
16161 CHECK(a->arr_len == 33);
16162 memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
16163 void* b_ptr = (void*)(((uintptr_t)b) & ~1);
16164 CHECK_ACCESS(b_ptr);
16165 LDKType b_conv = *(LDKType*)(b_ptr);
16166 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
16167 *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
16168 return ((uintptr_t)ret_conv);
16171 void __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_free"))) TS_C2Tuple_PublicKeyTypeZ_free(uint32_t _res) {
16172 if ((_res & 1) != 0) return;
16173 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16174 CHECK_ACCESS(_res_ptr);
16175 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
16177 C2Tuple_PublicKeyTypeZ_free(_res_conv);
16180 void __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyTypeZZ_free"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint32_tArray _res) {
16181 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
16182 _res_constr.datalen = _res->arr_len;
16183 if (_res_constr.datalen > 0)
16184 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
16186 _res_constr.data = NULL;
16187 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
16188 for (size_t z = 0; z < _res_constr.datalen; z++) {
16189 uint32_t _res_conv_25 = _res_vals[z];
16190 void* _res_conv_25_ptr = (void*)(((uintptr_t)_res_conv_25) & ~1);
16191 CHECK_ACCESS(_res_conv_25_ptr);
16192 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
16193 FREE((void*)_res_conv_25);
16194 _res_constr.data[z] = _res_conv_25_conv;
16196 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
16199 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_ok"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
16200 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16201 *ret_conv = CResult_boolLightningErrorZ_ok(o);
16202 return (uintptr_t)ret_conv;
16205 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_err"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
16206 LDKLightningError e_conv;
16207 e_conv.inner = (void*)(e & (~1));
16208 e_conv.is_owned = (e & 1) || (e == 0);
16209 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16210 e_conv = LightningError_clone(&e_conv);
16211 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16212 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
16213 return (uintptr_t)ret_conv;
16216 jboolean __attribute__((export_name("TS_CResult_boolLightningErrorZ_is_ok"))) TS_CResult_boolLightningErrorZ_is_ok(uint32_t o) {
16217 LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)(o & ~1);
16218 jboolean ret_val = CResult_boolLightningErrorZ_is_ok(o_conv);
16222 void __attribute__((export_name("TS_CResult_boolLightningErrorZ_free"))) TS_CResult_boolLightningErrorZ_free(uint32_t _res) {
16223 if ((_res & 1) != 0) return;
16224 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16225 CHECK_ACCESS(_res_ptr);
16226 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
16228 CResult_boolLightningErrorZ_free(_res_conv);
16231 static inline uintptr_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
16232 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16233 *ret_conv = CResult_boolLightningErrorZ_clone(arg);
16234 return (uintptr_t)ret_conv;
16236 intptr_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone_ptr"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint32_t arg) {
16237 LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
16238 intptr_t ret_val = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
16242 uint32_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
16243 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
16244 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16245 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
16246 return (uintptr_t)ret_conv;
16249 static inline uintptr_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
16250 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
16251 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
16252 return ((uintptr_t)ret_conv);
16254 intptr_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint32_t arg) {
16255 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(arg & ~1);
16256 intptr_t ret_val = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
16260 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
16261 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
16262 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
16263 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
16264 return ((uintptr_t)ret_conv);
16267 uint32_t __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
16268 LDKChannelAnnouncement a_conv;
16269 a_conv.inner = (void*)(a & (~1));
16270 a_conv.is_owned = (a & 1) || (a == 0);
16271 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
16272 a_conv = ChannelAnnouncement_clone(&a_conv);
16273 LDKChannelUpdate b_conv;
16274 b_conv.inner = (void*)(b & (~1));
16275 b_conv.is_owned = (b & 1) || (b == 0);
16276 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
16277 b_conv = ChannelUpdate_clone(&b_conv);
16278 LDKChannelUpdate c_conv;
16279 c_conv.inner = (void*)(c & (~1));
16280 c_conv.is_owned = (c & 1) || (c == 0);
16281 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
16282 c_conv = ChannelUpdate_clone(&c_conv);
16283 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
16284 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
16285 return ((uintptr_t)ret_conv);
16288 void __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint32_t _res) {
16289 if ((_res & 1) != 0) return;
16290 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16291 CHECK_ACCESS(_res_ptr);
16292 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
16294 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
16297 void __attribute__((export_name("TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free"))) TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint32_tArray _res) {
16298 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
16299 _res_constr.datalen = _res->arr_len;
16300 if (_res_constr.datalen > 0)
16301 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
16303 _res_constr.data = NULL;
16304 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
16305 for (size_t h = 0; h < _res_constr.datalen; h++) {
16306 uint32_t _res_conv_59 = _res_vals[h];
16307 void* _res_conv_59_ptr = (void*)(((uintptr_t)_res_conv_59) & ~1);
16308 CHECK_ACCESS(_res_conv_59_ptr);
16309 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_conv_59_ptr);
16310 FREE((void*)_res_conv_59);
16311 _res_constr.data[h] = _res_conv_59_conv;
16313 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
16316 void __attribute__((export_name("TS_CVec_NodeAnnouncementZ_free"))) TS_CVec_NodeAnnouncementZ_free(uint32_tArray _res) {
16317 LDKCVec_NodeAnnouncementZ _res_constr;
16318 _res_constr.datalen = _res->arr_len;
16319 if (_res_constr.datalen > 0)
16320 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
16322 _res_constr.data = NULL;
16323 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
16324 for (size_t s = 0; s < _res_constr.datalen; s++) {
16325 uint32_t _res_conv_18 = _res_vals[s];
16326 LDKNodeAnnouncement _res_conv_18_conv;
16327 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
16328 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
16329 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_18_conv);
16330 _res_constr.data[s] = _res_conv_18_conv;
16332 CVec_NodeAnnouncementZ_free(_res_constr);
16335 void __attribute__((export_name("TS_CVec_PublicKeyZ_free"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
16336 LDKCVec_PublicKeyZ _res_constr;
16337 _res_constr.datalen = _res->arr_len;
16338 if (_res_constr.datalen > 0)
16339 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
16341 _res_constr.data = NULL;
16342 int8_tArray* _res_vals = (void*) _res->elems /* XXX _res leaks */;
16343 for (size_t m = 0; m < _res_constr.datalen; m++) {
16344 int8_tArray _res_conv_12 = _res_vals[m];
16345 LDKPublicKey _res_conv_12_ref;
16346 CHECK(_res_conv_12->arr_len == 33);
16347 memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33); FREE(_res_conv_12);
16348 _res_constr.data[m] = _res_conv_12_ref;
16350 CVec_PublicKeyZ_free(_res_constr);
16353 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
16355 o_ref.datalen = o->arr_len;
16356 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
16357 memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
16358 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
16359 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
16360 return (uintptr_t)ret_conv;
16363 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint32_t e) {
16364 LDKPeerHandleError e_conv;
16365 e_conv.inner = (void*)(e & (~1));
16366 e_conv.is_owned = (e & 1) || (e == 0);
16367 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16368 e_conv = PeerHandleError_clone(&e_conv);
16369 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
16370 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
16371 return (uintptr_t)ret_conv;
16374 jboolean __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint32_t o) {
16375 LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(o & ~1);
16376 jboolean ret_val = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
16380 void __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint32_t _res) {
16381 if ((_res & 1) != 0) return;
16382 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16383 CHECK_ACCESS(_res_ptr);
16384 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
16386 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
16389 static inline uintptr_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
16390 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
16391 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
16392 return (uintptr_t)ret_conv;
16394 intptr_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint32_t arg) {
16395 LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
16396 intptr_t ret_val = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
16400 uint32_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint32_t orig) {
16401 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
16402 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
16403 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
16404 return (uintptr_t)ret_conv;
16407 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() {
16408 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
16409 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
16410 return (uintptr_t)ret_conv;
16413 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint32_t e) {
16414 LDKPeerHandleError e_conv;
16415 e_conv.inner = (void*)(e & (~1));
16416 e_conv.is_owned = (e & 1) || (e == 0);
16417 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16418 e_conv = PeerHandleError_clone(&e_conv);
16419 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
16420 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
16421 return (uintptr_t)ret_conv;
16424 jboolean __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint32_t o) {
16425 LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)(o & ~1);
16426 jboolean ret_val = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
16430 void __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint32_t _res) {
16431 if ((_res & 1) != 0) return;
16432 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16433 CHECK_ACCESS(_res_ptr);
16434 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
16436 CResult_NonePeerHandleErrorZ_free(_res_conv);
16439 static inline uintptr_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
16440 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
16441 *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
16442 return (uintptr_t)ret_conv;
16444 intptr_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint32_t arg) {
16445 LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
16446 intptr_t ret_val = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
16450 uint32_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint32_t orig) {
16451 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
16452 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
16453 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
16454 return (uintptr_t)ret_conv;
16457 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
16458 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
16459 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
16460 return (uintptr_t)ret_conv;
16463 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint32_t e) {
16464 LDKPeerHandleError e_conv;
16465 e_conv.inner = (void*)(e & (~1));
16466 e_conv.is_owned = (e & 1) || (e == 0);
16467 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16468 e_conv = PeerHandleError_clone(&e_conv);
16469 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
16470 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
16471 return (uintptr_t)ret_conv;
16474 jboolean __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint32_t o) {
16475 LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)(o & ~1);
16476 jboolean ret_val = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
16480 void __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint32_t _res) {
16481 if ((_res & 1) != 0) return;
16482 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16483 CHECK_ACCESS(_res_ptr);
16484 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
16486 CResult_boolPeerHandleErrorZ_free(_res_conv);
16489 static inline uintptr_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
16490 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
16491 *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
16492 return (uintptr_t)ret_conv;
16494 intptr_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint32_t arg) {
16495 LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
16496 intptr_t ret_val = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
16500 uint32_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint32_t orig) {
16501 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
16502 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
16503 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
16504 return (uintptr_t)ret_conv;
16507 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_ok"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint32_t o) {
16509 o_conv.inner = (void*)(o & (~1));
16510 o_conv.is_owned = (o & 1) || (o == 0);
16511 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16512 o_conv = NodeId_clone(&o_conv);
16513 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
16514 *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
16515 return (uintptr_t)ret_conv;
16518 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_err"))) TS_CResult_NodeIdDecodeErrorZ_err(uint32_t e) {
16519 LDKDecodeError e_conv;
16520 e_conv.inner = (void*)(e & (~1));
16521 e_conv.is_owned = (e & 1) || (e == 0);
16522 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16523 e_conv = DecodeError_clone(&e_conv);
16524 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
16525 *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
16526 return (uintptr_t)ret_conv;
16529 jboolean __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_is_ok"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint32_t o) {
16530 LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)(o & ~1);
16531 jboolean ret_val = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
16535 void __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_free"))) TS_CResult_NodeIdDecodeErrorZ_free(uint32_t _res) {
16536 if ((_res & 1) != 0) return;
16537 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16538 CHECK_ACCESS(_res_ptr);
16539 LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
16541 CResult_NodeIdDecodeErrorZ_free(_res_conv);
16544 static inline uintptr_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
16545 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
16546 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
16547 return (uintptr_t)ret_conv;
16549 intptr_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone_ptr"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint32_t arg) {
16550 LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
16551 intptr_t ret_val = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
16555 uint32_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint32_t orig) {
16556 LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1);
16557 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
16558 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
16559 return (uintptr_t)ret_conv;
16562 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint32_t o) {
16563 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16564 CHECK_ACCESS(o_ptr);
16565 LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
16566 o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uintptr_t)o) & ~1));
16567 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
16568 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
16569 return (uintptr_t)ret_conv;
16572 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint32_t e) {
16573 LDKDecodeError e_conv;
16574 e_conv.inner = (void*)(e & (~1));
16575 e_conv.is_owned = (e & 1) || (e == 0);
16576 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16577 e_conv = DecodeError_clone(&e_conv);
16578 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
16579 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
16580 return (uintptr_t)ret_conv;
16583 jboolean __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint32_t o) {
16584 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(o & ~1);
16585 jboolean ret_val = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
16589 void __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint32_t _res) {
16590 if ((_res & 1) != 0) return;
16591 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16592 CHECK_ACCESS(_res_ptr);
16593 LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
16595 CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
16598 static inline uintptr_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
16599 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
16600 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
16601 return (uintptr_t)ret_conv;
16603 intptr_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint32_t arg) {
16604 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(arg & ~1);
16605 intptr_t ret_val = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
16609 uint32_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint32_t orig) {
16610 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(orig & ~1);
16611 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
16612 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
16613 return (uintptr_t)ret_conv;
16616 uint32_t __attribute__((export_name("TS_COption_AccessZ_some"))) TS_COption_AccessZ_some(uint32_t o) {
16617 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16618 CHECK_ACCESS(o_ptr);
16619 LDKAccess o_conv = *(LDKAccess*)(o_ptr);
16620 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
16621 *ret_copy = COption_AccessZ_some(o_conv);
16622 uintptr_t ret_ref = (uintptr_t)ret_copy;
16626 uint32_t __attribute__((export_name("TS_COption_AccessZ_none"))) TS_COption_AccessZ_none() {
16627 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
16628 *ret_copy = COption_AccessZ_none();
16629 uintptr_t ret_ref = (uintptr_t)ret_copy;
16633 void __attribute__((export_name("TS_COption_AccessZ_free"))) TS_COption_AccessZ_free(uint32_t _res) {
16634 if ((_res & 1) != 0) return;
16635 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16636 CHECK_ACCESS(_res_ptr);
16637 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
16639 COption_AccessZ_free(_res_conv);
16642 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok(uint32_t o) {
16643 LDKChannelUpdateInfo o_conv;
16644 o_conv.inner = (void*)(o & (~1));
16645 o_conv.is_owned = (o & 1) || (o == 0);
16646 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16647 o_conv = ChannelUpdateInfo_clone(&o_conv);
16648 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
16649 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
16650 return (uintptr_t)ret_conv;
16653 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_err(uint32_t e) {
16654 LDKDecodeError e_conv;
16655 e_conv.inner = (void*)(e & (~1));
16656 e_conv.is_owned = (e & 1) || (e == 0);
16657 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16658 e_conv = DecodeError_clone(&e_conv);
16659 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
16660 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
16661 return (uintptr_t)ret_conv;
16664 jboolean __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(uint32_t o) {
16665 LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(o & ~1);
16666 jboolean ret_val = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
16670 void __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_free"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_free(uint32_t _res) {
16671 if ((_res & 1) != 0) return;
16672 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16673 CHECK_ACCESS(_res_ptr);
16674 LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
16676 CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
16679 static inline uintptr_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
16680 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
16681 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
16682 return (uintptr_t)ret_conv;
16684 intptr_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
16685 LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(arg & ~1);
16686 intptr_t ret_val = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
16690 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone(uint32_t orig) {
16691 LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(orig & ~1);
16692 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
16693 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
16694 return (uintptr_t)ret_conv;
16697 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint32_t o) {
16698 LDKChannelInfo o_conv;
16699 o_conv.inner = (void*)(o & (~1));
16700 o_conv.is_owned = (o & 1) || (o == 0);
16701 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16702 o_conv = ChannelInfo_clone(&o_conv);
16703 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
16704 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
16705 return (uintptr_t)ret_conv;
16708 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_err"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint32_t e) {
16709 LDKDecodeError e_conv;
16710 e_conv.inner = (void*)(e & (~1));
16711 e_conv.is_owned = (e & 1) || (e == 0);
16712 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16713 e_conv = DecodeError_clone(&e_conv);
16714 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
16715 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
16716 return (uintptr_t)ret_conv;
16719 jboolean __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint32_t o) {
16720 LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(o & ~1);
16721 jboolean ret_val = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
16725 void __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_free"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint32_t _res) {
16726 if ((_res & 1) != 0) return;
16727 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16728 CHECK_ACCESS(_res_ptr);
16729 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
16731 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
16734 static inline uintptr_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
16735 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
16736 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
16737 return (uintptr_t)ret_conv;
16739 intptr_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
16740 LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
16741 intptr_t ret_val = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
16745 uint32_t __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint32_t orig) {
16746 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
16747 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
16748 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
16749 return (uintptr_t)ret_conv;
16752 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint32_t o) {
16753 LDKRoutingFees o_conv;
16754 o_conv.inner = (void*)(o & (~1));
16755 o_conv.is_owned = (o & 1) || (o == 0);
16756 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16757 o_conv = RoutingFees_clone(&o_conv);
16758 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
16759 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
16760 return (uintptr_t)ret_conv;
16763 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_err"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint32_t e) {
16764 LDKDecodeError e_conv;
16765 e_conv.inner = (void*)(e & (~1));
16766 e_conv.is_owned = (e & 1) || (e == 0);
16767 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16768 e_conv = DecodeError_clone(&e_conv);
16769 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
16770 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
16771 return (uintptr_t)ret_conv;
16774 jboolean __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_is_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint32_t o) {
16775 LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(o & ~1);
16776 jboolean ret_val = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
16780 void __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_free"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint32_t _res) {
16781 if ((_res & 1) != 0) return;
16782 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16783 CHECK_ACCESS(_res_ptr);
16784 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
16786 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
16789 static inline uintptr_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
16790 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
16791 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
16792 return (uintptr_t)ret_conv;
16794 intptr_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint32_t arg) {
16795 LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
16796 intptr_t ret_val = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
16800 uint32_t __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint32_t orig) {
16801 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
16802 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
16803 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
16804 return (uintptr_t)ret_conv;
16807 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint32_t o) {
16808 LDKNodeAnnouncementInfo o_conv;
16809 o_conv.inner = (void*)(o & (~1));
16810 o_conv.is_owned = (o & 1) || (o == 0);
16811 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16812 o_conv = NodeAnnouncementInfo_clone(&o_conv);
16813 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
16814 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
16815 return (uintptr_t)ret_conv;
16818 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint32_t e) {
16819 LDKDecodeError e_conv;
16820 e_conv.inner = (void*)(e & (~1));
16821 e_conv.is_owned = (e & 1) || (e == 0);
16822 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16823 e_conv = DecodeError_clone(&e_conv);
16824 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
16825 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
16826 return (uintptr_t)ret_conv;
16829 jboolean __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint32_t o) {
16830 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(o & ~1);
16831 jboolean ret_val = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
16835 void __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint32_t _res) {
16836 if ((_res & 1) != 0) return;
16837 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16838 CHECK_ACCESS(_res_ptr);
16839 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
16841 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
16844 static inline uintptr_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
16845 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
16846 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
16847 return (uintptr_t)ret_conv;
16849 intptr_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
16850 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
16851 intptr_t ret_val = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
16855 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint32_t orig) {
16856 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
16857 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
16858 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
16859 return (uintptr_t)ret_conv;
16862 void __attribute__((export_name("TS_CVec_u64Z_free"))) TS_CVec_u64Z_free(int64_tArray _res) {
16863 LDKCVec_u64Z _res_constr;
16864 _res_constr.datalen = _res->arr_len;
16865 if (_res_constr.datalen > 0)
16866 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
16868 _res_constr.data = NULL;
16869 int64_t* _res_vals = _res->elems /* XXX _res leaks */;
16870 for (size_t i = 0; i < _res_constr.datalen; i++) {
16871 int64_t _res_conv_8 = _res_vals[i];
16872 _res_constr.data[i] = _res_conv_8;
16874 CVec_u64Z_free(_res_constr);
16877 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_ok"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint32_t o) {
16878 LDKNodeInfo o_conv;
16879 o_conv.inner = (void*)(o & (~1));
16880 o_conv.is_owned = (o & 1) || (o == 0);
16881 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16882 o_conv = NodeInfo_clone(&o_conv);
16883 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
16884 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
16885 return (uintptr_t)ret_conv;
16888 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_err"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint32_t e) {
16889 LDKDecodeError e_conv;
16890 e_conv.inner = (void*)(e & (~1));
16891 e_conv.is_owned = (e & 1) || (e == 0);
16892 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16893 e_conv = DecodeError_clone(&e_conv);
16894 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
16895 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
16896 return (uintptr_t)ret_conv;
16899 jboolean __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint32_t o) {
16900 LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(o & ~1);
16901 jboolean ret_val = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
16905 void __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_free"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint32_t _res) {
16906 if ((_res & 1) != 0) return;
16907 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16908 CHECK_ACCESS(_res_ptr);
16909 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
16911 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
16914 static inline uintptr_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
16915 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
16916 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
16917 return (uintptr_t)ret_conv;
16919 intptr_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint32_t arg) {
16920 LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
16921 intptr_t ret_val = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
16925 uint32_t __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint32_t orig) {
16926 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
16927 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
16928 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
16929 return (uintptr_t)ret_conv;
16932 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint32_t o) {
16933 LDKNetworkGraph o_conv;
16934 o_conv.inner = (void*)(o & (~1));
16935 o_conv.is_owned = (o & 1) || (o == 0);
16936 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16937 o_conv = NetworkGraph_clone(&o_conv);
16938 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
16939 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
16940 return (uintptr_t)ret_conv;
16943 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_err"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint32_t e) {
16944 LDKDecodeError e_conv;
16945 e_conv.inner = (void*)(e & (~1));
16946 e_conv.is_owned = (e & 1) || (e == 0);
16947 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16948 e_conv = DecodeError_clone(&e_conv);
16949 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
16950 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
16951 return (uintptr_t)ret_conv;
16954 jboolean __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_is_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint32_t o) {
16955 LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(o & ~1);
16956 jboolean ret_val = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
16960 void __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_free"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint32_t _res) {
16961 if ((_res & 1) != 0) return;
16962 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16963 CHECK_ACCESS(_res_ptr);
16964 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
16966 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
16969 static inline uintptr_t CResult_NetworkGraphDecodeErrorZ_clone_ptr(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR arg) {
16970 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
16971 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(arg);
16972 return (uintptr_t)ret_conv;
16974 intptr_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_clone_ptr"))) TS_CResult_NetworkGraphDecodeErrorZ_clone_ptr(uint32_t arg) {
16975 LDKCResult_NetworkGraphDecodeErrorZ* arg_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
16976 intptr_t ret_val = CResult_NetworkGraphDecodeErrorZ_clone_ptr(arg_conv);
16980 uint32_t __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_clone"))) TS_CResult_NetworkGraphDecodeErrorZ_clone(uint32_t orig) {
16981 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
16982 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
16983 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
16984 return (uintptr_t)ret_conv;
16987 uint32_t __attribute__((export_name("TS_COption_CVec_NetAddressZZ_some"))) TS_COption_CVec_NetAddressZZ_some(uint32_tArray o) {
16988 LDKCVec_NetAddressZ o_constr;
16989 o_constr.datalen = o->arr_len;
16990 if (o_constr.datalen > 0)
16991 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
16993 o_constr.data = NULL;
16994 uint32_t* o_vals = o->elems /* XXX o leaks */;
16995 for (size_t m = 0; m < o_constr.datalen; m++) {
16996 uint32_t o_conv_12 = o_vals[m];
16997 void* o_conv_12_ptr = (void*)(((uintptr_t)o_conv_12) & ~1);
16998 CHECK_ACCESS(o_conv_12_ptr);
16999 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
17000 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o_conv_12) & ~1));
17001 o_constr.data[m] = o_conv_12_conv;
17003 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
17004 *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
17005 uintptr_t ret_ref = (uintptr_t)ret_copy;
17009 uint32_t __attribute__((export_name("TS_COption_CVec_NetAddressZZ_none"))) TS_COption_CVec_NetAddressZZ_none() {
17010 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
17011 *ret_copy = COption_CVec_NetAddressZZ_none();
17012 uintptr_t ret_ref = (uintptr_t)ret_copy;
17016 void __attribute__((export_name("TS_COption_CVec_NetAddressZZ_free"))) TS_COption_CVec_NetAddressZZ_free(uint32_t _res) {
17017 if ((_res & 1) != 0) return;
17018 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17019 CHECK_ACCESS(_res_ptr);
17020 LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
17022 COption_CVec_NetAddressZZ_free(_res_conv);
17025 static inline uintptr_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
17026 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
17027 *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
17028 uintptr_t ret_ref = (uintptr_t)ret_copy;
17031 intptr_t __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone_ptr"))) TS_COption_CVec_NetAddressZZ_clone_ptr(uint32_t arg) {
17032 LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)arg;
17033 intptr_t ret_val = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
17037 uint32_t __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone"))) TS_COption_CVec_NetAddressZZ_clone(uint32_t orig) {
17038 LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig;
17039 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
17040 *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
17041 uintptr_t ret_ref = (uintptr_t)ret_copy;
17045 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_ok"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint32_t o) {
17046 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17047 CHECK_ACCESS(o_ptr);
17048 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
17049 o_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o) & ~1));
17050 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
17051 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
17052 return (uintptr_t)ret_conv;
17055 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_err"))) TS_CResult_NetAddressDecodeErrorZ_err(uint32_t e) {
17056 LDKDecodeError e_conv;
17057 e_conv.inner = (void*)(e & (~1));
17058 e_conv.is_owned = (e & 1) || (e == 0);
17059 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17060 e_conv = DecodeError_clone(&e_conv);
17061 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
17062 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
17063 return (uintptr_t)ret_conv;
17066 jboolean __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_is_ok"))) TS_CResult_NetAddressDecodeErrorZ_is_ok(uint32_t o) {
17067 LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)(o & ~1);
17068 jboolean ret_val = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
17072 void __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_free"))) TS_CResult_NetAddressDecodeErrorZ_free(uint32_t _res) {
17073 if ((_res & 1) != 0) return;
17074 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17075 CHECK_ACCESS(_res_ptr);
17076 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
17078 CResult_NetAddressDecodeErrorZ_free(_res_conv);
17081 static inline uintptr_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
17082 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
17083 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
17084 return (uintptr_t)ret_conv;
17086 intptr_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone_ptr"))) TS_CResult_NetAddressDecodeErrorZ_clone_ptr(uint32_t arg) {
17087 LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
17088 intptr_t ret_val = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
17092 uint32_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint32_t orig) {
17093 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
17094 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
17095 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
17096 return (uintptr_t)ret_conv;
17099 void __attribute__((export_name("TS_CVec_UpdateAddHTLCZ_free"))) TS_CVec_UpdateAddHTLCZ_free(uint32_tArray _res) {
17100 LDKCVec_UpdateAddHTLCZ _res_constr;
17101 _res_constr.datalen = _res->arr_len;
17102 if (_res_constr.datalen > 0)
17103 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
17105 _res_constr.data = NULL;
17106 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
17107 for (size_t p = 0; p < _res_constr.datalen; p++) {
17108 uint32_t _res_conv_15 = _res_vals[p];
17109 LDKUpdateAddHTLC _res_conv_15_conv;
17110 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
17111 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
17112 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
17113 _res_constr.data[p] = _res_conv_15_conv;
17115 CVec_UpdateAddHTLCZ_free(_res_constr);
17118 void __attribute__((export_name("TS_CVec_UpdateFulfillHTLCZ_free"))) TS_CVec_UpdateFulfillHTLCZ_free(uint32_tArray _res) {
17119 LDKCVec_UpdateFulfillHTLCZ _res_constr;
17120 _res_constr.datalen = _res->arr_len;
17121 if (_res_constr.datalen > 0)
17122 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
17124 _res_constr.data = NULL;
17125 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
17126 for (size_t t = 0; t < _res_constr.datalen; t++) {
17127 uint32_t _res_conv_19 = _res_vals[t];
17128 LDKUpdateFulfillHTLC _res_conv_19_conv;
17129 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
17130 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
17131 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
17132 _res_constr.data[t] = _res_conv_19_conv;
17134 CVec_UpdateFulfillHTLCZ_free(_res_constr);
17137 void __attribute__((export_name("TS_CVec_UpdateFailHTLCZ_free"))) TS_CVec_UpdateFailHTLCZ_free(uint32_tArray _res) {
17138 LDKCVec_UpdateFailHTLCZ _res_constr;
17139 _res_constr.datalen = _res->arr_len;
17140 if (_res_constr.datalen > 0)
17141 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
17143 _res_constr.data = NULL;
17144 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
17145 for (size_t q = 0; q < _res_constr.datalen; q++) {
17146 uint32_t _res_conv_16 = _res_vals[q];
17147 LDKUpdateFailHTLC _res_conv_16_conv;
17148 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
17149 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
17150 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
17151 _res_constr.data[q] = _res_conv_16_conv;
17153 CVec_UpdateFailHTLCZ_free(_res_constr);
17156 void __attribute__((export_name("TS_CVec_UpdateFailMalformedHTLCZ_free"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint32_tArray _res) {
17157 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
17158 _res_constr.datalen = _res->arr_len;
17159 if (_res_constr.datalen > 0)
17160 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
17162 _res_constr.data = NULL;
17163 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
17164 for (size_t z = 0; z < _res_constr.datalen; z++) {
17165 uint32_t _res_conv_25 = _res_vals[z];
17166 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
17167 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
17168 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
17169 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
17170 _res_constr.data[z] = _res_conv_25_conv;
17172 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
17175 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint32_t o) {
17176 LDKAcceptChannel o_conv;
17177 o_conv.inner = (void*)(o & (~1));
17178 o_conv.is_owned = (o & 1) || (o == 0);
17179 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17180 o_conv = AcceptChannel_clone(&o_conv);
17181 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
17182 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
17183 return (uintptr_t)ret_conv;
17186 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_err"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint32_t e) {
17187 LDKDecodeError e_conv;
17188 e_conv.inner = (void*)(e & (~1));
17189 e_conv.is_owned = (e & 1) || (e == 0);
17190 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17191 e_conv = DecodeError_clone(&e_conv);
17192 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
17193 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
17194 return (uintptr_t)ret_conv;
17197 jboolean __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint32_t o) {
17198 LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(o & ~1);
17199 jboolean ret_val = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
17203 void __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_free"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint32_t _res) {
17204 if ((_res & 1) != 0) return;
17205 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17206 CHECK_ACCESS(_res_ptr);
17207 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
17209 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
17212 static inline uintptr_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
17213 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
17214 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
17215 return (uintptr_t)ret_conv;
17217 intptr_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint32_t arg) {
17218 LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
17219 intptr_t ret_val = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
17223 uint32_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint32_t orig) {
17224 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
17225 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
17226 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
17227 return (uintptr_t)ret_conv;
17230 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint32_t o) {
17231 LDKAnnouncementSignatures o_conv;
17232 o_conv.inner = (void*)(o & (~1));
17233 o_conv.is_owned = (o & 1) || (o == 0);
17234 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17235 o_conv = AnnouncementSignatures_clone(&o_conv);
17236 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
17237 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
17238 return (uintptr_t)ret_conv;
17241 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint32_t e) {
17242 LDKDecodeError e_conv;
17243 e_conv.inner = (void*)(e & (~1));
17244 e_conv.is_owned = (e & 1) || (e == 0);
17245 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17246 e_conv = DecodeError_clone(&e_conv);
17247 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
17248 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
17249 return (uintptr_t)ret_conv;
17252 jboolean __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint32_t o) {
17253 LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(o & ~1);
17254 jboolean ret_val = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
17258 void __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_free"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint32_t _res) {
17259 if ((_res & 1) != 0) return;
17260 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17261 CHECK_ACCESS(_res_ptr);
17262 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
17264 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
17267 static inline uintptr_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
17268 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
17269 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
17270 return (uintptr_t)ret_conv;
17272 intptr_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint32_t arg) {
17273 LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
17274 intptr_t ret_val = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
17278 uint32_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint32_t orig) {
17279 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
17280 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
17281 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
17282 return (uintptr_t)ret_conv;
17285 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint32_t o) {
17286 LDKChannelReestablish o_conv;
17287 o_conv.inner = (void*)(o & (~1));
17288 o_conv.is_owned = (o & 1) || (o == 0);
17289 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17290 o_conv = ChannelReestablish_clone(&o_conv);
17291 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
17292 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
17293 return (uintptr_t)ret_conv;
17296 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint32_t e) {
17297 LDKDecodeError e_conv;
17298 e_conv.inner = (void*)(e & (~1));
17299 e_conv.is_owned = (e & 1) || (e == 0);
17300 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17301 e_conv = DecodeError_clone(&e_conv);
17302 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
17303 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
17304 return (uintptr_t)ret_conv;
17307 jboolean __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_is_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint32_t o) {
17308 LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(o & ~1);
17309 jboolean ret_val = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
17313 void __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_free"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint32_t _res) {
17314 if ((_res & 1) != 0) return;
17315 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17316 CHECK_ACCESS(_res_ptr);
17317 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
17319 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
17322 static inline uintptr_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
17323 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
17324 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
17325 return (uintptr_t)ret_conv;
17327 intptr_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint32_t arg) {
17328 LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
17329 intptr_t ret_val = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
17333 uint32_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint32_t orig) {
17334 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
17335 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
17336 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
17337 return (uintptr_t)ret_conv;
17340 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint32_t o) {
17341 LDKClosingSigned o_conv;
17342 o_conv.inner = (void*)(o & (~1));
17343 o_conv.is_owned = (o & 1) || (o == 0);
17344 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17345 o_conv = ClosingSigned_clone(&o_conv);
17346 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
17347 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
17348 return (uintptr_t)ret_conv;
17351 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_err"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint32_t e) {
17352 LDKDecodeError e_conv;
17353 e_conv.inner = (void*)(e & (~1));
17354 e_conv.is_owned = (e & 1) || (e == 0);
17355 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17356 e_conv = DecodeError_clone(&e_conv);
17357 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
17358 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
17359 return (uintptr_t)ret_conv;
17362 jboolean __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint32_t o) {
17363 LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(o & ~1);
17364 jboolean ret_val = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
17368 void __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_free"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint32_t _res) {
17369 if ((_res & 1) != 0) return;
17370 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17371 CHECK_ACCESS(_res_ptr);
17372 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
17374 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
17377 static inline uintptr_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
17378 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
17379 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
17380 return (uintptr_t)ret_conv;
17382 intptr_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
17383 LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
17384 intptr_t ret_val = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
17388 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint32_t orig) {
17389 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
17390 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
17391 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
17392 return (uintptr_t)ret_conv;
17395 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint32_t o) {
17396 LDKClosingSignedFeeRange o_conv;
17397 o_conv.inner = (void*)(o & (~1));
17398 o_conv.is_owned = (o & 1) || (o == 0);
17399 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17400 o_conv = ClosingSignedFeeRange_clone(&o_conv);
17401 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
17402 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
17403 return (uintptr_t)ret_conv;
17406 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint32_t e) {
17407 LDKDecodeError e_conv;
17408 e_conv.inner = (void*)(e & (~1));
17409 e_conv.is_owned = (e & 1) || (e == 0);
17410 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17411 e_conv = DecodeError_clone(&e_conv);
17412 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
17413 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
17414 return (uintptr_t)ret_conv;
17417 jboolean __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint32_t o) {
17418 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(o & ~1);
17419 jboolean ret_val = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
17423 void __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint32_t _res) {
17424 if ((_res & 1) != 0) return;
17425 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17426 CHECK_ACCESS(_res_ptr);
17427 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
17429 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
17432 static inline uintptr_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
17433 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
17434 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
17435 return (uintptr_t)ret_conv;
17437 intptr_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
17438 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
17439 intptr_t ret_val = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
17443 uint32_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint32_t orig) {
17444 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
17445 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
17446 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
17447 return (uintptr_t)ret_conv;
17450 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint32_t o) {
17451 LDKCommitmentSigned o_conv;
17452 o_conv.inner = (void*)(o & (~1));
17453 o_conv.is_owned = (o & 1) || (o == 0);
17454 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17455 o_conv = CommitmentSigned_clone(&o_conv);
17456 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
17457 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
17458 return (uintptr_t)ret_conv;
17461 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint32_t e) {
17462 LDKDecodeError e_conv;
17463 e_conv.inner = (void*)(e & (~1));
17464 e_conv.is_owned = (e & 1) || (e == 0);
17465 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17466 e_conv = DecodeError_clone(&e_conv);
17467 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
17468 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
17469 return (uintptr_t)ret_conv;
17472 jboolean __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_is_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint32_t o) {
17473 LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(o & ~1);
17474 jboolean ret_val = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
17478 void __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_free"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint32_t _res) {
17479 if ((_res & 1) != 0) return;
17480 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17481 CHECK_ACCESS(_res_ptr);
17482 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
17484 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
17487 static inline uintptr_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
17488 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
17489 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
17490 return (uintptr_t)ret_conv;
17492 intptr_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
17493 LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
17494 intptr_t ret_val = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
17498 uint32_t __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint32_t orig) {
17499 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
17500 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
17501 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
17502 return (uintptr_t)ret_conv;
17505 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint32_t o) {
17506 LDKFundingCreated o_conv;
17507 o_conv.inner = (void*)(o & (~1));
17508 o_conv.is_owned = (o & 1) || (o == 0);
17509 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17510 o_conv = FundingCreated_clone(&o_conv);
17511 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
17512 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
17513 return (uintptr_t)ret_conv;
17516 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_err"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint32_t e) {
17517 LDKDecodeError e_conv;
17518 e_conv.inner = (void*)(e & (~1));
17519 e_conv.is_owned = (e & 1) || (e == 0);
17520 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17521 e_conv = DecodeError_clone(&e_conv);
17522 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
17523 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
17524 return (uintptr_t)ret_conv;
17527 jboolean __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_is_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint32_t o) {
17528 LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(o & ~1);
17529 jboolean ret_val = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
17533 void __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_free"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint32_t _res) {
17534 if ((_res & 1) != 0) return;
17535 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17536 CHECK_ACCESS(_res_ptr);
17537 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
17539 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
17542 static inline uintptr_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
17543 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
17544 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
17545 return (uintptr_t)ret_conv;
17547 intptr_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint32_t arg) {
17548 LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
17549 intptr_t ret_val = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
17553 uint32_t __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint32_t orig) {
17554 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
17555 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
17556 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
17557 return (uintptr_t)ret_conv;
17560 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_ok"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint32_t o) {
17561 LDKFundingSigned o_conv;
17562 o_conv.inner = (void*)(o & (~1));
17563 o_conv.is_owned = (o & 1) || (o == 0);
17564 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17565 o_conv = FundingSigned_clone(&o_conv);
17566 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
17567 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
17568 return (uintptr_t)ret_conv;
17571 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_err"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint32_t e) {
17572 LDKDecodeError e_conv;
17573 e_conv.inner = (void*)(e & (~1));
17574 e_conv.is_owned = (e & 1) || (e == 0);
17575 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17576 e_conv = DecodeError_clone(&e_conv);
17577 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
17578 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
17579 return (uintptr_t)ret_conv;
17582 jboolean __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_is_ok"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint32_t o) {
17583 LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(o & ~1);
17584 jboolean ret_val = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
17588 void __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_free"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint32_t _res) {
17589 if ((_res & 1) != 0) return;
17590 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17591 CHECK_ACCESS(_res_ptr);
17592 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
17594 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
17597 static inline uintptr_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
17598 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
17599 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
17600 return (uintptr_t)ret_conv;
17602 intptr_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint32_t arg) {
17603 LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
17604 intptr_t ret_val = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
17608 uint32_t __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint32_t orig) {
17609 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
17610 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
17611 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
17612 return (uintptr_t)ret_conv;
17615 uint32_t __attribute__((export_name("TS_CResult_FundingLockedDecodeErrorZ_ok"))) TS_CResult_FundingLockedDecodeErrorZ_ok(uint32_t o) {
17616 LDKFundingLocked o_conv;
17617 o_conv.inner = (void*)(o & (~1));
17618 o_conv.is_owned = (o & 1) || (o == 0);
17619 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17620 o_conv = FundingLocked_clone(&o_conv);
17621 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
17622 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
17623 return (uintptr_t)ret_conv;
17626 uint32_t __attribute__((export_name("TS_CResult_FundingLockedDecodeErrorZ_err"))) TS_CResult_FundingLockedDecodeErrorZ_err(uint32_t e) {
17627 LDKDecodeError e_conv;
17628 e_conv.inner = (void*)(e & (~1));
17629 e_conv.is_owned = (e & 1) || (e == 0);
17630 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17631 e_conv = DecodeError_clone(&e_conv);
17632 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
17633 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
17634 return (uintptr_t)ret_conv;
17637 jboolean __attribute__((export_name("TS_CResult_FundingLockedDecodeErrorZ_is_ok"))) TS_CResult_FundingLockedDecodeErrorZ_is_ok(uint32_t o) {
17638 LDKCResult_FundingLockedDecodeErrorZ* o_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(o & ~1);
17639 jboolean ret_val = CResult_FundingLockedDecodeErrorZ_is_ok(o_conv);
17643 void __attribute__((export_name("TS_CResult_FundingLockedDecodeErrorZ_free"))) TS_CResult_FundingLockedDecodeErrorZ_free(uint32_t _res) {
17644 if ((_res & 1) != 0) return;
17645 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17646 CHECK_ACCESS(_res_ptr);
17647 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(_res_ptr);
17649 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
17652 static inline uintptr_t CResult_FundingLockedDecodeErrorZ_clone_ptr(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR arg) {
17653 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
17654 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(arg);
17655 return (uintptr_t)ret_conv;
17657 intptr_t __attribute__((export_name("TS_CResult_FundingLockedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingLockedDecodeErrorZ_clone_ptr(uint32_t arg) {
17658 LDKCResult_FundingLockedDecodeErrorZ* arg_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
17659 intptr_t ret_val = CResult_FundingLockedDecodeErrorZ_clone_ptr(arg_conv);
17663 uint32_t __attribute__((export_name("TS_CResult_FundingLockedDecodeErrorZ_clone"))) TS_CResult_FundingLockedDecodeErrorZ_clone(uint32_t orig) {
17664 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
17665 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
17666 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
17667 return (uintptr_t)ret_conv;
17670 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_ok"))) TS_CResult_InitDecodeErrorZ_ok(uint32_t o) {
17672 o_conv.inner = (void*)(o & (~1));
17673 o_conv.is_owned = (o & 1) || (o == 0);
17674 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17675 o_conv = Init_clone(&o_conv);
17676 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
17677 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
17678 return (uintptr_t)ret_conv;
17681 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_err"))) TS_CResult_InitDecodeErrorZ_err(uint32_t e) {
17682 LDKDecodeError e_conv;
17683 e_conv.inner = (void*)(e & (~1));
17684 e_conv.is_owned = (e & 1) || (e == 0);
17685 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17686 e_conv = DecodeError_clone(&e_conv);
17687 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
17688 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
17689 return (uintptr_t)ret_conv;
17692 jboolean __attribute__((export_name("TS_CResult_InitDecodeErrorZ_is_ok"))) TS_CResult_InitDecodeErrorZ_is_ok(uint32_t o) {
17693 LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)(o & ~1);
17694 jboolean ret_val = CResult_InitDecodeErrorZ_is_ok(o_conv);
17698 void __attribute__((export_name("TS_CResult_InitDecodeErrorZ_free"))) TS_CResult_InitDecodeErrorZ_free(uint32_t _res) {
17699 if ((_res & 1) != 0) return;
17700 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17701 CHECK_ACCESS(_res_ptr);
17702 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
17704 CResult_InitDecodeErrorZ_free(_res_conv);
17707 static inline uintptr_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
17708 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
17709 *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
17710 return (uintptr_t)ret_conv;
17712 intptr_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone_ptr"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint32_t arg) {
17713 LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
17714 intptr_t ret_val = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
17718 uint32_t __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone"))) TS_CResult_InitDecodeErrorZ_clone(uint32_t orig) {
17719 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
17720 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
17721 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
17722 return (uintptr_t)ret_conv;
17725 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_ok"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint32_t o) {
17726 LDKOpenChannel o_conv;
17727 o_conv.inner = (void*)(o & (~1));
17728 o_conv.is_owned = (o & 1) || (o == 0);
17729 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17730 o_conv = OpenChannel_clone(&o_conv);
17731 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
17732 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
17733 return (uintptr_t)ret_conv;
17736 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_err"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint32_t e) {
17737 LDKDecodeError e_conv;
17738 e_conv.inner = (void*)(e & (~1));
17739 e_conv.is_owned = (e & 1) || (e == 0);
17740 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17741 e_conv = DecodeError_clone(&e_conv);
17742 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
17743 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
17744 return (uintptr_t)ret_conv;
17747 jboolean __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_is_ok"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint32_t o) {
17748 LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(o & ~1);
17749 jboolean ret_val = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
17753 void __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_free"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint32_t _res) {
17754 if ((_res & 1) != 0) return;
17755 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17756 CHECK_ACCESS(_res_ptr);
17757 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
17759 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
17762 static inline uintptr_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
17763 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
17764 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
17765 return (uintptr_t)ret_conv;
17767 intptr_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint32_t arg) {
17768 LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
17769 intptr_t ret_val = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
17773 uint32_t __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint32_t orig) {
17774 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
17775 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
17776 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
17777 return (uintptr_t)ret_conv;
17780 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint32_t o) {
17781 LDKRevokeAndACK o_conv;
17782 o_conv.inner = (void*)(o & (~1));
17783 o_conv.is_owned = (o & 1) || (o == 0);
17784 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17785 o_conv = RevokeAndACK_clone(&o_conv);
17786 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
17787 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
17788 return (uintptr_t)ret_conv;
17791 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint32_t e) {
17792 LDKDecodeError e_conv;
17793 e_conv.inner = (void*)(e & (~1));
17794 e_conv.is_owned = (e & 1) || (e == 0);
17795 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17796 e_conv = DecodeError_clone(&e_conv);
17797 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
17798 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
17799 return (uintptr_t)ret_conv;
17802 jboolean __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_is_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint32_t o) {
17803 LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(o & ~1);
17804 jboolean ret_val = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
17808 void __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_free"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint32_t _res) {
17809 if ((_res & 1) != 0) return;
17810 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17811 CHECK_ACCESS(_res_ptr);
17812 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
17814 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
17817 static inline uintptr_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
17818 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
17819 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
17820 return (uintptr_t)ret_conv;
17822 intptr_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint32_t arg) {
17823 LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
17824 intptr_t ret_val = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
17828 uint32_t __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint32_t orig) {
17829 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
17830 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
17831 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
17832 return (uintptr_t)ret_conv;
17835 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_ok"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint32_t o) {
17836 LDKShutdown o_conv;
17837 o_conv.inner = (void*)(o & (~1));
17838 o_conv.is_owned = (o & 1) || (o == 0);
17839 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17840 o_conv = Shutdown_clone(&o_conv);
17841 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
17842 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
17843 return (uintptr_t)ret_conv;
17846 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_err"))) TS_CResult_ShutdownDecodeErrorZ_err(uint32_t e) {
17847 LDKDecodeError e_conv;
17848 e_conv.inner = (void*)(e & (~1));
17849 e_conv.is_owned = (e & 1) || (e == 0);
17850 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17851 e_conv = DecodeError_clone(&e_conv);
17852 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
17853 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
17854 return (uintptr_t)ret_conv;
17857 jboolean __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_is_ok"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint32_t o) {
17858 LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)(o & ~1);
17859 jboolean ret_val = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
17863 void __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_free"))) TS_CResult_ShutdownDecodeErrorZ_free(uint32_t _res) {
17864 if ((_res & 1) != 0) return;
17865 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17866 CHECK_ACCESS(_res_ptr);
17867 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
17869 CResult_ShutdownDecodeErrorZ_free(_res_conv);
17872 static inline uintptr_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
17873 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
17874 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
17875 return (uintptr_t)ret_conv;
17877 intptr_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint32_t arg) {
17878 LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
17879 intptr_t ret_val = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
17883 uint32_t __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint32_t orig) {
17884 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
17885 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
17886 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
17887 return (uintptr_t)ret_conv;
17890 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint32_t o) {
17891 LDKUpdateFailHTLC o_conv;
17892 o_conv.inner = (void*)(o & (~1));
17893 o_conv.is_owned = (o & 1) || (o == 0);
17894 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17895 o_conv = UpdateFailHTLC_clone(&o_conv);
17896 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
17897 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
17898 return (uintptr_t)ret_conv;
17901 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint32_t e) {
17902 LDKDecodeError e_conv;
17903 e_conv.inner = (void*)(e & (~1));
17904 e_conv.is_owned = (e & 1) || (e == 0);
17905 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17906 e_conv = DecodeError_clone(&e_conv);
17907 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
17908 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
17909 return (uintptr_t)ret_conv;
17912 jboolean __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint32_t o) {
17913 LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(o & ~1);
17914 jboolean ret_val = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
17918 void __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint32_t _res) {
17919 if ((_res & 1) != 0) return;
17920 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17921 CHECK_ACCESS(_res_ptr);
17922 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
17924 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
17927 static inline uintptr_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
17928 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
17929 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
17930 return (uintptr_t)ret_conv;
17932 intptr_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
17933 LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
17934 intptr_t ret_val = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
17938 uint32_t __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint32_t orig) {
17939 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
17940 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
17941 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
17942 return (uintptr_t)ret_conv;
17945 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint32_t o) {
17946 LDKUpdateFailMalformedHTLC o_conv;
17947 o_conv.inner = (void*)(o & (~1));
17948 o_conv.is_owned = (o & 1) || (o == 0);
17949 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17950 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
17951 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
17952 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
17953 return (uintptr_t)ret_conv;
17956 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint32_t e) {
17957 LDKDecodeError e_conv;
17958 e_conv.inner = (void*)(e & (~1));
17959 e_conv.is_owned = (e & 1) || (e == 0);
17960 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17961 e_conv = DecodeError_clone(&e_conv);
17962 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
17963 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
17964 return (uintptr_t)ret_conv;
17967 jboolean __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint32_t o) {
17968 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(o & ~1);
17969 jboolean ret_val = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
17973 void __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint32_t _res) {
17974 if ((_res & 1) != 0) return;
17975 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17976 CHECK_ACCESS(_res_ptr);
17977 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
17979 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
17982 static inline uintptr_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
17983 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
17984 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
17985 return (uintptr_t)ret_conv;
17987 intptr_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
17988 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
17989 intptr_t ret_val = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
17993 uint32_t __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint32_t orig) {
17994 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
17995 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
17996 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
17997 return (uintptr_t)ret_conv;
18000 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint32_t o) {
18001 LDKUpdateFee o_conv;
18002 o_conv.inner = (void*)(o & (~1));
18003 o_conv.is_owned = (o & 1) || (o == 0);
18004 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18005 o_conv = UpdateFee_clone(&o_conv);
18006 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18007 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
18008 return (uintptr_t)ret_conv;
18011 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_err"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint32_t e) {
18012 LDKDecodeError e_conv;
18013 e_conv.inner = (void*)(e & (~1));
18014 e_conv.is_owned = (e & 1) || (e == 0);
18015 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18016 e_conv = DecodeError_clone(&e_conv);
18017 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18018 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
18019 return (uintptr_t)ret_conv;
18022 jboolean __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_is_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint32_t o) {
18023 LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(o & ~1);
18024 jboolean ret_val = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
18028 void __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_free"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint32_t _res) {
18029 if ((_res & 1) != 0) return;
18030 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18031 CHECK_ACCESS(_res_ptr);
18032 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
18034 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
18037 static inline uintptr_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
18038 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18039 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
18040 return (uintptr_t)ret_conv;
18042 intptr_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint32_t arg) {
18043 LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
18044 intptr_t ret_val = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
18048 uint32_t __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint32_t orig) {
18049 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
18050 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
18051 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
18052 return (uintptr_t)ret_conv;
18055 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint32_t o) {
18056 LDKUpdateFulfillHTLC o_conv;
18057 o_conv.inner = (void*)(o & (~1));
18058 o_conv.is_owned = (o & 1) || (o == 0);
18059 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18060 o_conv = UpdateFulfillHTLC_clone(&o_conv);
18061 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18062 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
18063 return (uintptr_t)ret_conv;
18066 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint32_t e) {
18067 LDKDecodeError e_conv;
18068 e_conv.inner = (void*)(e & (~1));
18069 e_conv.is_owned = (e & 1) || (e == 0);
18070 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18071 e_conv = DecodeError_clone(&e_conv);
18072 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18073 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
18074 return (uintptr_t)ret_conv;
18077 jboolean __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint32_t o) {
18078 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(o & ~1);
18079 jboolean ret_val = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
18083 void __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint32_t _res) {
18084 if ((_res & 1) != 0) return;
18085 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18086 CHECK_ACCESS(_res_ptr);
18087 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
18089 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
18092 static inline uintptr_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
18093 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18094 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
18095 return (uintptr_t)ret_conv;
18097 intptr_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
18098 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
18099 intptr_t ret_val = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
18103 uint32_t __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint32_t orig) {
18104 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
18105 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
18106 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
18107 return (uintptr_t)ret_conv;
18110 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint32_t o) {
18111 LDKUpdateAddHTLC o_conv;
18112 o_conv.inner = (void*)(o & (~1));
18113 o_conv.is_owned = (o & 1) || (o == 0);
18114 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18115 o_conv = UpdateAddHTLC_clone(&o_conv);
18116 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
18117 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
18118 return (uintptr_t)ret_conv;
18121 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint32_t e) {
18122 LDKDecodeError e_conv;
18123 e_conv.inner = (void*)(e & (~1));
18124 e_conv.is_owned = (e & 1) || (e == 0);
18125 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18126 e_conv = DecodeError_clone(&e_conv);
18127 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
18128 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
18129 return (uintptr_t)ret_conv;
18132 jboolean __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint32_t o) {
18133 LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(o & ~1);
18134 jboolean ret_val = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
18138 void __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_free"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint32_t _res) {
18139 if ((_res & 1) != 0) return;
18140 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18141 CHECK_ACCESS(_res_ptr);
18142 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
18144 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
18147 static inline uintptr_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
18148 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
18149 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
18150 return (uintptr_t)ret_conv;
18152 intptr_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint32_t arg) {
18153 LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
18154 intptr_t ret_val = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
18158 uint32_t __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint32_t orig) {
18159 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
18160 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
18161 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
18162 return (uintptr_t)ret_conv;
18165 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_ok"))) TS_CResult_PingDecodeErrorZ_ok(uint32_t o) {
18167 o_conv.inner = (void*)(o & (~1));
18168 o_conv.is_owned = (o & 1) || (o == 0);
18169 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18170 o_conv = Ping_clone(&o_conv);
18171 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
18172 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
18173 return (uintptr_t)ret_conv;
18176 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_err"))) TS_CResult_PingDecodeErrorZ_err(uint32_t e) {
18177 LDKDecodeError e_conv;
18178 e_conv.inner = (void*)(e & (~1));
18179 e_conv.is_owned = (e & 1) || (e == 0);
18180 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18181 e_conv = DecodeError_clone(&e_conv);
18182 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
18183 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
18184 return (uintptr_t)ret_conv;
18187 jboolean __attribute__((export_name("TS_CResult_PingDecodeErrorZ_is_ok"))) TS_CResult_PingDecodeErrorZ_is_ok(uint32_t o) {
18188 LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)(o & ~1);
18189 jboolean ret_val = CResult_PingDecodeErrorZ_is_ok(o_conv);
18193 void __attribute__((export_name("TS_CResult_PingDecodeErrorZ_free"))) TS_CResult_PingDecodeErrorZ_free(uint32_t _res) {
18194 if ((_res & 1) != 0) return;
18195 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18196 CHECK_ACCESS(_res_ptr);
18197 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
18199 CResult_PingDecodeErrorZ_free(_res_conv);
18202 static inline uintptr_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
18203 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
18204 *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
18205 return (uintptr_t)ret_conv;
18207 intptr_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone_ptr"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint32_t arg) {
18208 LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
18209 intptr_t ret_val = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
18213 uint32_t __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone"))) TS_CResult_PingDecodeErrorZ_clone(uint32_t orig) {
18214 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
18215 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
18216 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
18217 return (uintptr_t)ret_conv;
18220 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_ok"))) TS_CResult_PongDecodeErrorZ_ok(uint32_t o) {
18222 o_conv.inner = (void*)(o & (~1));
18223 o_conv.is_owned = (o & 1) || (o == 0);
18224 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18225 o_conv = Pong_clone(&o_conv);
18226 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
18227 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
18228 return (uintptr_t)ret_conv;
18231 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_err"))) TS_CResult_PongDecodeErrorZ_err(uint32_t e) {
18232 LDKDecodeError e_conv;
18233 e_conv.inner = (void*)(e & (~1));
18234 e_conv.is_owned = (e & 1) || (e == 0);
18235 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18236 e_conv = DecodeError_clone(&e_conv);
18237 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
18238 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
18239 return (uintptr_t)ret_conv;
18242 jboolean __attribute__((export_name("TS_CResult_PongDecodeErrorZ_is_ok"))) TS_CResult_PongDecodeErrorZ_is_ok(uint32_t o) {
18243 LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)(o & ~1);
18244 jboolean ret_val = CResult_PongDecodeErrorZ_is_ok(o_conv);
18248 void __attribute__((export_name("TS_CResult_PongDecodeErrorZ_free"))) TS_CResult_PongDecodeErrorZ_free(uint32_t _res) {
18249 if ((_res & 1) != 0) return;
18250 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18251 CHECK_ACCESS(_res_ptr);
18252 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
18254 CResult_PongDecodeErrorZ_free(_res_conv);
18257 static inline uintptr_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
18258 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
18259 *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
18260 return (uintptr_t)ret_conv;
18262 intptr_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone_ptr"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint32_t arg) {
18263 LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
18264 intptr_t ret_val = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
18268 uint32_t __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone"))) TS_CResult_PongDecodeErrorZ_clone(uint32_t orig) {
18269 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
18270 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
18271 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
18272 return (uintptr_t)ret_conv;
18275 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
18276 LDKUnsignedChannelAnnouncement o_conv;
18277 o_conv.inner = (void*)(o & (~1));
18278 o_conv.is_owned = (o & 1) || (o == 0);
18279 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18280 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
18281 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
18282 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
18283 return (uintptr_t)ret_conv;
18286 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
18287 LDKDecodeError e_conv;
18288 e_conv.inner = (void*)(e & (~1));
18289 e_conv.is_owned = (e & 1) || (e == 0);
18290 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18291 e_conv = DecodeError_clone(&e_conv);
18292 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
18293 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
18294 return (uintptr_t)ret_conv;
18297 jboolean __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
18298 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(o & ~1);
18299 jboolean ret_val = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
18303 void __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
18304 if ((_res & 1) != 0) return;
18305 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18306 CHECK_ACCESS(_res_ptr);
18307 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
18309 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
18312 static inline uintptr_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
18313 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
18314 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
18315 return (uintptr_t)ret_conv;
18317 intptr_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
18318 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
18319 intptr_t ret_val = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
18323 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
18324 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
18325 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
18326 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
18327 return (uintptr_t)ret_conv;
18330 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
18331 LDKChannelAnnouncement o_conv;
18332 o_conv.inner = (void*)(o & (~1));
18333 o_conv.is_owned = (o & 1) || (o == 0);
18334 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18335 o_conv = ChannelAnnouncement_clone(&o_conv);
18336 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
18337 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
18338 return (uintptr_t)ret_conv;
18341 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
18342 LDKDecodeError e_conv;
18343 e_conv.inner = (void*)(e & (~1));
18344 e_conv.is_owned = (e & 1) || (e == 0);
18345 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18346 e_conv = DecodeError_clone(&e_conv);
18347 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
18348 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
18349 return (uintptr_t)ret_conv;
18352 jboolean __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
18353 LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(o & ~1);
18354 jboolean ret_val = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
18358 void __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
18359 if ((_res & 1) != 0) return;
18360 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18361 CHECK_ACCESS(_res_ptr);
18362 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
18364 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
18367 static inline uintptr_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
18368 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
18369 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
18370 return (uintptr_t)ret_conv;
18372 intptr_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
18373 LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
18374 intptr_t ret_val = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
18378 uint32_t __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
18379 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
18380 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
18381 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
18382 return (uintptr_t)ret_conv;
18385 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint32_t o) {
18386 LDKUnsignedChannelUpdate o_conv;
18387 o_conv.inner = (void*)(o & (~1));
18388 o_conv.is_owned = (o & 1) || (o == 0);
18389 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18390 o_conv = UnsignedChannelUpdate_clone(&o_conv);
18391 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
18392 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
18393 return (uintptr_t)ret_conv;
18396 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint32_t e) {
18397 LDKDecodeError e_conv;
18398 e_conv.inner = (void*)(e & (~1));
18399 e_conv.is_owned = (e & 1) || (e == 0);
18400 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18401 e_conv = DecodeError_clone(&e_conv);
18402 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
18403 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
18404 return (uintptr_t)ret_conv;
18407 jboolean __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint32_t o) {
18408 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(o & ~1);
18409 jboolean ret_val = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
18413 void __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint32_t _res) {
18414 if ((_res & 1) != 0) return;
18415 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18416 CHECK_ACCESS(_res_ptr);
18417 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
18419 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
18422 static inline uintptr_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
18423 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
18424 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
18425 return (uintptr_t)ret_conv;
18427 intptr_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
18428 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
18429 intptr_t ret_val = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
18433 uint32_t __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
18434 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
18435 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
18436 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
18437 return (uintptr_t)ret_conv;
18440 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint32_t o) {
18441 LDKChannelUpdate o_conv;
18442 o_conv.inner = (void*)(o & (~1));
18443 o_conv.is_owned = (o & 1) || (o == 0);
18444 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18445 o_conv = ChannelUpdate_clone(&o_conv);
18446 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
18447 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
18448 return (uintptr_t)ret_conv;
18451 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint32_t e) {
18452 LDKDecodeError e_conv;
18453 e_conv.inner = (void*)(e & (~1));
18454 e_conv.is_owned = (e & 1) || (e == 0);
18455 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18456 e_conv = DecodeError_clone(&e_conv);
18457 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
18458 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
18459 return (uintptr_t)ret_conv;
18462 jboolean __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint32_t o) {
18463 LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(o & ~1);
18464 jboolean ret_val = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
18468 void __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_free"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint32_t _res) {
18469 if ((_res & 1) != 0) return;
18470 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18471 CHECK_ACCESS(_res_ptr);
18472 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
18474 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
18477 static inline uintptr_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
18478 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
18479 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
18480 return (uintptr_t)ret_conv;
18482 intptr_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint32_t arg) {
18483 LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
18484 intptr_t ret_val = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
18488 uint32_t __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
18489 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
18490 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
18491 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
18492 return (uintptr_t)ret_conv;
18495 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint32_t o) {
18496 LDKErrorMessage o_conv;
18497 o_conv.inner = (void*)(o & (~1));
18498 o_conv.is_owned = (o & 1) || (o == 0);
18499 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18500 o_conv = ErrorMessage_clone(&o_conv);
18501 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
18502 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
18503 return (uintptr_t)ret_conv;
18506 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_err"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint32_t e) {
18507 LDKDecodeError e_conv;
18508 e_conv.inner = (void*)(e & (~1));
18509 e_conv.is_owned = (e & 1) || (e == 0);
18510 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18511 e_conv = DecodeError_clone(&e_conv);
18512 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
18513 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
18514 return (uintptr_t)ret_conv;
18517 jboolean __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_is_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint32_t o) {
18518 LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(o & ~1);
18519 jboolean ret_val = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
18523 void __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_free"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint32_t _res) {
18524 if ((_res & 1) != 0) return;
18525 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18526 CHECK_ACCESS(_res_ptr);
18527 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
18529 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
18532 static inline uintptr_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
18533 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
18534 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
18535 return (uintptr_t)ret_conv;
18537 intptr_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint32_t arg) {
18538 LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
18539 intptr_t ret_val = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
18543 uint32_t __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint32_t orig) {
18544 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
18545 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
18546 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
18547 return (uintptr_t)ret_conv;
18550 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_ok"))) TS_CResult_WarningMessageDecodeErrorZ_ok(uint32_t o) {
18551 LDKWarningMessage o_conv;
18552 o_conv.inner = (void*)(o & (~1));
18553 o_conv.is_owned = (o & 1) || (o == 0);
18554 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18555 o_conv = WarningMessage_clone(&o_conv);
18556 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
18557 *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
18558 return (uintptr_t)ret_conv;
18561 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_err"))) TS_CResult_WarningMessageDecodeErrorZ_err(uint32_t e) {
18562 LDKDecodeError e_conv;
18563 e_conv.inner = (void*)(e & (~1));
18564 e_conv.is_owned = (e & 1) || (e == 0);
18565 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18566 e_conv = DecodeError_clone(&e_conv);
18567 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
18568 *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
18569 return (uintptr_t)ret_conv;
18572 jboolean __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_is_ok"))) TS_CResult_WarningMessageDecodeErrorZ_is_ok(uint32_t o) {
18573 LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(o & ~1);
18574 jboolean ret_val = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
18578 void __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_free"))) TS_CResult_WarningMessageDecodeErrorZ_free(uint32_t _res) {
18579 if ((_res & 1) != 0) return;
18580 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18581 CHECK_ACCESS(_res_ptr);
18582 LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
18584 CResult_WarningMessageDecodeErrorZ_free(_res_conv);
18587 static inline uintptr_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
18588 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
18589 *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
18590 return (uintptr_t)ret_conv;
18592 intptr_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone_ptr"))) TS_CResult_WarningMessageDecodeErrorZ_clone_ptr(uint32_t arg) {
18593 LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(arg & ~1);
18594 intptr_t ret_val = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
18598 uint32_t __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone"))) TS_CResult_WarningMessageDecodeErrorZ_clone(uint32_t orig) {
18599 LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(orig & ~1);
18600 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
18601 *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
18602 return (uintptr_t)ret_conv;
18605 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
18606 LDKUnsignedNodeAnnouncement o_conv;
18607 o_conv.inner = (void*)(o & (~1));
18608 o_conv.is_owned = (o & 1) || (o == 0);
18609 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18610 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
18611 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
18612 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
18613 return (uintptr_t)ret_conv;
18616 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint32_t e) {
18617 LDKDecodeError e_conv;
18618 e_conv.inner = (void*)(e & (~1));
18619 e_conv.is_owned = (e & 1) || (e == 0);
18620 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18621 e_conv = DecodeError_clone(&e_conv);
18622 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
18623 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
18624 return (uintptr_t)ret_conv;
18627 jboolean __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
18628 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(o & ~1);
18629 jboolean ret_val = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
18633 void __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
18634 if ((_res & 1) != 0) return;
18635 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18636 CHECK_ACCESS(_res_ptr);
18637 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
18639 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
18642 static inline uintptr_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
18643 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
18644 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
18645 return (uintptr_t)ret_conv;
18647 intptr_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
18648 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
18649 intptr_t ret_val = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
18653 uint32_t __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
18654 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
18655 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
18656 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
18657 return (uintptr_t)ret_conv;
18660 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
18661 LDKNodeAnnouncement o_conv;
18662 o_conv.inner = (void*)(o & (~1));
18663 o_conv.is_owned = (o & 1) || (o == 0);
18664 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18665 o_conv = NodeAnnouncement_clone(&o_conv);
18666 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
18667 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
18668 return (uintptr_t)ret_conv;
18671 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint32_t e) {
18672 LDKDecodeError e_conv;
18673 e_conv.inner = (void*)(e & (~1));
18674 e_conv.is_owned = (e & 1) || (e == 0);
18675 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18676 e_conv = DecodeError_clone(&e_conv);
18677 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
18678 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
18679 return (uintptr_t)ret_conv;
18682 jboolean __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint32_t o) {
18683 LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(o & ~1);
18684 jboolean ret_val = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
18688 void __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
18689 if ((_res & 1) != 0) return;
18690 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18691 CHECK_ACCESS(_res_ptr);
18692 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
18694 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
18697 static inline uintptr_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
18698 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
18699 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
18700 return (uintptr_t)ret_conv;
18702 intptr_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint32_t arg) {
18703 LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
18704 intptr_t ret_val = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
18708 uint32_t __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
18709 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
18710 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
18711 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
18712 return (uintptr_t)ret_conv;
18715 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint32_t o) {
18716 LDKQueryShortChannelIds o_conv;
18717 o_conv.inner = (void*)(o & (~1));
18718 o_conv.is_owned = (o & 1) || (o == 0);
18719 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18720 o_conv = QueryShortChannelIds_clone(&o_conv);
18721 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
18722 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
18723 return (uintptr_t)ret_conv;
18726 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint32_t e) {
18727 LDKDecodeError e_conv;
18728 e_conv.inner = (void*)(e & (~1));
18729 e_conv.is_owned = (e & 1) || (e == 0);
18730 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18731 e_conv = DecodeError_clone(&e_conv);
18732 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
18733 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
18734 return (uintptr_t)ret_conv;
18737 jboolean __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint32_t o) {
18738 LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(o & ~1);
18739 jboolean ret_val = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
18743 void __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_free"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint32_t _res) {
18744 if ((_res & 1) != 0) return;
18745 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18746 CHECK_ACCESS(_res_ptr);
18747 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
18749 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
18752 static inline uintptr_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
18753 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
18754 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
18755 return (uintptr_t)ret_conv;
18757 intptr_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint32_t arg) {
18758 LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
18759 intptr_t ret_val = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
18763 uint32_t __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint32_t orig) {
18764 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
18765 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
18766 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
18767 return (uintptr_t)ret_conv;
18770 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint32_t o) {
18771 LDKReplyShortChannelIdsEnd o_conv;
18772 o_conv.inner = (void*)(o & (~1));
18773 o_conv.is_owned = (o & 1) || (o == 0);
18774 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18775 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
18776 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
18777 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
18778 return (uintptr_t)ret_conv;
18781 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint32_t e) {
18782 LDKDecodeError e_conv;
18783 e_conv.inner = (void*)(e & (~1));
18784 e_conv.is_owned = (e & 1) || (e == 0);
18785 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18786 e_conv = DecodeError_clone(&e_conv);
18787 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
18788 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
18789 return (uintptr_t)ret_conv;
18792 jboolean __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint32_t o) {
18793 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(o & ~1);
18794 jboolean ret_val = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
18798 void __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint32_t _res) {
18799 if ((_res & 1) != 0) return;
18800 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18801 CHECK_ACCESS(_res_ptr);
18802 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
18804 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
18807 static inline uintptr_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
18808 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
18809 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
18810 return (uintptr_t)ret_conv;
18812 intptr_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint32_t arg) {
18813 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
18814 intptr_t ret_val = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
18818 uint32_t __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint32_t orig) {
18819 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
18820 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
18821 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
18822 return (uintptr_t)ret_conv;
18825 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint32_t o) {
18826 LDKQueryChannelRange o_conv;
18827 o_conv.inner = (void*)(o & (~1));
18828 o_conv.is_owned = (o & 1) || (o == 0);
18829 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18830 o_conv = QueryChannelRange_clone(&o_conv);
18831 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
18832 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
18833 return (uintptr_t)ret_conv;
18836 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint32_t e) {
18837 LDKDecodeError e_conv;
18838 e_conv.inner = (void*)(e & (~1));
18839 e_conv.is_owned = (e & 1) || (e == 0);
18840 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18841 e_conv = DecodeError_clone(&e_conv);
18842 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
18843 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
18844 return (uintptr_t)ret_conv;
18847 jboolean __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint32_t o) {
18848 LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(o & ~1);
18849 jboolean ret_val = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
18853 void __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_free"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint32_t _res) {
18854 if ((_res & 1) != 0) return;
18855 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18856 CHECK_ACCESS(_res_ptr);
18857 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
18859 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
18862 static inline uintptr_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
18863 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
18864 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
18865 return (uintptr_t)ret_conv;
18867 intptr_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
18868 LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
18869 intptr_t ret_val = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
18873 uint32_t __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint32_t orig) {
18874 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
18875 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
18876 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
18877 return (uintptr_t)ret_conv;
18880 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint32_t o) {
18881 LDKReplyChannelRange o_conv;
18882 o_conv.inner = (void*)(o & (~1));
18883 o_conv.is_owned = (o & 1) || (o == 0);
18884 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18885 o_conv = ReplyChannelRange_clone(&o_conv);
18886 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
18887 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
18888 return (uintptr_t)ret_conv;
18891 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint32_t e) {
18892 LDKDecodeError e_conv;
18893 e_conv.inner = (void*)(e & (~1));
18894 e_conv.is_owned = (e & 1) || (e == 0);
18895 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18896 e_conv = DecodeError_clone(&e_conv);
18897 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
18898 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
18899 return (uintptr_t)ret_conv;
18902 jboolean __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint32_t o) {
18903 LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(o & ~1);
18904 jboolean ret_val = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
18908 void __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_free"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint32_t _res) {
18909 if ((_res & 1) != 0) return;
18910 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18911 CHECK_ACCESS(_res_ptr);
18912 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
18914 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
18917 static inline uintptr_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
18918 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
18919 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
18920 return (uintptr_t)ret_conv;
18922 intptr_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint32_t arg) {
18923 LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
18924 intptr_t ret_val = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
18928 uint32_t __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint32_t orig) {
18929 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
18930 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
18931 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
18932 return (uintptr_t)ret_conv;
18935 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint32_t o) {
18936 LDKGossipTimestampFilter o_conv;
18937 o_conv.inner = (void*)(o & (~1));
18938 o_conv.is_owned = (o & 1) || (o == 0);
18939 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18940 o_conv = GossipTimestampFilter_clone(&o_conv);
18941 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
18942 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
18943 return (uintptr_t)ret_conv;
18946 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint32_t e) {
18947 LDKDecodeError e_conv;
18948 e_conv.inner = (void*)(e & (~1));
18949 e_conv.is_owned = (e & 1) || (e == 0);
18950 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18951 e_conv = DecodeError_clone(&e_conv);
18952 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
18953 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
18954 return (uintptr_t)ret_conv;
18957 jboolean __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint32_t o) {
18958 LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(o & ~1);
18959 jboolean ret_val = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
18963 void __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_free"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint32_t _res) {
18964 if ((_res & 1) != 0) return;
18965 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18966 CHECK_ACCESS(_res_ptr);
18967 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
18969 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
18972 static inline uintptr_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
18973 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
18974 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
18975 return (uintptr_t)ret_conv;
18977 intptr_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint32_t arg) {
18978 LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
18979 intptr_t ret_val = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
18983 uint32_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint32_t orig) {
18984 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
18985 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
18986 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
18987 return (uintptr_t)ret_conv;
18990 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint32_t o) {
18992 o_conv.inner = (void*)(o & (~1));
18993 o_conv.is_owned = (o & 1) || (o == 0);
18994 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18995 o_conv = Invoice_clone(&o_conv);
18996 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
18997 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
18998 return (uintptr_t)ret_conv;
19001 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint32_t e) {
19002 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
19003 CHECK_ACCESS(e_ptr);
19004 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
19005 e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uintptr_t)e) & ~1));
19006 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
19007 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
19008 return (uintptr_t)ret_conv;
19011 jboolean __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_is_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_is_ok(uint32_t o) {
19012 LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(o & ~1);
19013 jboolean ret_val = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
19017 void __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_free"))) TS_CResult_InvoiceSignOrCreationErrorZ_free(uint32_t _res) {
19018 if ((_res & 1) != 0) return;
19019 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19020 CHECK_ACCESS(_res_ptr);
19021 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
19023 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
19026 static inline uintptr_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
19027 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
19028 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
19029 return (uintptr_t)ret_conv;
19031 intptr_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr(uint32_t arg) {
19032 LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
19033 intptr_t ret_val = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
19037 uint32_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone(uint32_t orig) {
19038 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
19039 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
19040 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
19041 return (uintptr_t)ret_conv;
19044 uint32_t __attribute__((export_name("TS_COption_FilterZ_some"))) TS_COption_FilterZ_some(uint32_t o) {
19045 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
19046 CHECK_ACCESS(o_ptr);
19047 LDKFilter o_conv = *(LDKFilter*)(o_ptr);
19048 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
19049 *ret_copy = COption_FilterZ_some(o_conv);
19050 uintptr_t ret_ref = (uintptr_t)ret_copy;
19054 uint32_t __attribute__((export_name("TS_COption_FilterZ_none"))) TS_COption_FilterZ_none() {
19055 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
19056 *ret_copy = COption_FilterZ_none();
19057 uintptr_t ret_ref = (uintptr_t)ret_copy;
19061 void __attribute__((export_name("TS_COption_FilterZ_free"))) TS_COption_FilterZ_free(uint32_t _res) {
19062 if ((_res & 1) != 0) return;
19063 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19064 CHECK_ACCESS(_res_ptr);
19065 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
19067 COption_FilterZ_free(_res_conv);
19070 uint32_t __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_ok"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint32_t o) {
19071 LDKLockedChannelMonitor o_conv;
19072 o_conv.inner = (void*)(o & (~1));
19073 o_conv.is_owned = (o & 1) || (o == 0);
19074 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19075 // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
19076 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
19077 *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
19078 return (uintptr_t)ret_conv;
19081 uint32_t __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_err"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
19082 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
19083 *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
19084 return (uintptr_t)ret_conv;
19087 jboolean __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_is_ok"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint32_t o) {
19088 LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(o & ~1);
19089 jboolean ret_val = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
19093 void __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_free"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint32_t _res) {
19094 if ((_res & 1) != 0) return;
19095 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19096 CHECK_ACCESS(_res_ptr);
19097 LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
19099 CResult_LockedChannelMonitorNoneZ_free(_res_conv);
19102 void __attribute__((export_name("TS_CVec_OutPointZ_free"))) TS_CVec_OutPointZ_free(uint32_tArray _res) {
19103 LDKCVec_OutPointZ _res_constr;
19104 _res_constr.datalen = _res->arr_len;
19105 if (_res_constr.datalen > 0)
19106 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
19108 _res_constr.data = NULL;
19109 uint32_t* _res_vals = _res->elems /* XXX _res leaks */;
19110 for (size_t k = 0; k < _res_constr.datalen; k++) {
19111 uint32_t _res_conv_10 = _res_vals[k];
19112 LDKOutPoint _res_conv_10_conv;
19113 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
19114 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
19115 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
19116 _res_constr.data[k] = _res_conv_10_conv;
19118 CVec_OutPointZ_free(_res_constr);
19121 void __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint32_t this_ptr) {
19122 if ((this_ptr & 1) != 0) return;
19123 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
19124 CHECK_ACCESS(this_ptr_ptr);
19125 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
19126 FREE((void*)this_ptr);
19127 PaymentPurpose_free(this_ptr_conv);
19130 static inline uintptr_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
19131 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
19132 *ret_copy = PaymentPurpose_clone(arg);
19133 uintptr_t ret_ref = (uintptr_t)ret_copy;
19136 intptr_t __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint32_t arg) {
19137 LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)arg;
19138 intptr_t ret_val = PaymentPurpose_clone_ptr(arg_conv);
19142 uint32_t __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint32_t orig) {
19143 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
19144 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
19145 *ret_copy = PaymentPurpose_clone(orig_conv);
19146 uintptr_t ret_ref = (uintptr_t)ret_copy;
19150 uint32_t __attribute__((export_name("TS_PaymentPurpose_invoice_payment"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret) {
19151 LDKThirtyTwoBytes payment_preimage_ref;
19152 CHECK(payment_preimage->arr_len == 32);
19153 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
19154 LDKThirtyTwoBytes payment_secret_ref;
19155 CHECK(payment_secret->arr_len == 32);
19156 memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
19157 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
19158 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
19159 uintptr_t ret_ref = (uintptr_t)ret_copy;
19163 uint32_t __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
19164 LDKThirtyTwoBytes a_ref;
19165 CHECK(a->arr_len == 32);
19166 memcpy(a_ref.data, a->elems, 32); FREE(a);
19167 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
19168 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
19169 uintptr_t ret_ref = (uintptr_t)ret_copy;
19173 void __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint32_t this_ptr) {
19174 if ((this_ptr & 1) != 0) return;
19175 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
19176 CHECK_ACCESS(this_ptr_ptr);
19177 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
19178 FREE((void*)this_ptr);
19179 ClosureReason_free(this_ptr_conv);
19182 static inline uintptr_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
19183 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19184 *ret_copy = ClosureReason_clone(arg);
19185 uintptr_t ret_ref = (uintptr_t)ret_copy;
19188 intptr_t __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint32_t arg) {
19189 LDKClosureReason* arg_conv = (LDKClosureReason*)arg;
19190 intptr_t ret_val = ClosureReason_clone_ptr(arg_conv);
19194 uint32_t __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint32_t orig) {
19195 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
19196 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19197 *ret_copy = ClosureReason_clone(orig_conv);
19198 uintptr_t ret_ref = (uintptr_t)ret_copy;
19202 uint32_t __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(jstring peer_msg) {
19203 LDKStr peer_msg_conv = str_ref_to_owned_c(peer_msg);
19204 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19205 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
19206 uintptr_t ret_ref = (uintptr_t)ret_copy;
19210 uint32_t __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
19211 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19212 *ret_copy = ClosureReason_holder_force_closed();
19213 uintptr_t ret_ref = (uintptr_t)ret_copy;
19217 uint32_t __attribute__((export_name("TS_ClosureReason_cooperative_closure"))) TS_ClosureReason_cooperative_closure() {
19218 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19219 *ret_copy = ClosureReason_cooperative_closure();
19220 uintptr_t ret_ref = (uintptr_t)ret_copy;
19224 uint32_t __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
19225 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19226 *ret_copy = ClosureReason_commitment_tx_confirmed();
19227 uintptr_t ret_ref = (uintptr_t)ret_copy;
19231 uint32_t __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
19232 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19233 *ret_copy = ClosureReason_funding_timed_out();
19234 uintptr_t ret_ref = (uintptr_t)ret_copy;
19238 uint32_t __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
19239 LDKStr err_conv = str_ref_to_owned_c(err);
19240 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19241 *ret_copy = ClosureReason_processing_error(err_conv);
19242 uintptr_t ret_ref = (uintptr_t)ret_copy;
19246 uint32_t __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
19247 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19248 *ret_copy = ClosureReason_disconnected_peer();
19249 uintptr_t ret_ref = (uintptr_t)ret_copy;
19253 uint32_t __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
19254 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
19255 *ret_copy = ClosureReason_outdated_channel_manager();
19256 uintptr_t ret_ref = (uintptr_t)ret_copy;
19260 int8_tArray __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint32_t obj) {
19261 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
19262 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
19263 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
19264 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
19265 CVec_u8Z_free(ret_var);
19269 uint32_t __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
19270 LDKu8slice ser_ref;
19271 ser_ref.datalen = ser->arr_len;
19272 ser_ref.data = ser->elems /* XXX ser leaks */;
19273 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
19274 *ret_conv = ClosureReason_read(ser_ref);
19275 return (uintptr_t)ret_conv;
19278 void __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint32_t this_ptr) {
19279 if ((this_ptr & 1) != 0) return;
19280 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
19281 CHECK_ACCESS(this_ptr_ptr);
19282 LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
19283 FREE((void*)this_ptr);
19284 Event_free(this_ptr_conv);
19287 static inline uintptr_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
19288 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19289 *ret_copy = Event_clone(arg);
19290 uintptr_t ret_ref = (uintptr_t)ret_copy;
19293 intptr_t __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint32_t arg) {
19294 LDKEvent* arg_conv = (LDKEvent*)arg;
19295 intptr_t ret_val = Event_clone_ptr(arg_conv);
19299 uint32_t __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint32_t orig) {
19300 LDKEvent* orig_conv = (LDKEvent*)orig;
19301 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19302 *ret_copy = Event_clone(orig_conv);
19303 uintptr_t ret_ref = (uintptr_t)ret_copy;
19307 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) {
19308 LDKThirtyTwoBytes temporary_channel_id_ref;
19309 CHECK(temporary_channel_id->arr_len == 32);
19310 memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
19311 LDKCVec_u8Z output_script_ref;
19312 output_script_ref.datalen = output_script->arr_len;
19313 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
19314 memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
19315 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19316 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
19317 uintptr_t ret_ref = (uintptr_t)ret_copy;
19321 uint32_t __attribute__((export_name("TS_Event_payment_received"))) TS_Event_payment_received(int8_tArray payment_hash, int64_t amt, uint32_t purpose) {
19322 LDKThirtyTwoBytes payment_hash_ref;
19323 CHECK(payment_hash->arr_len == 32);
19324 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
19325 void* purpose_ptr = (void*)(((uintptr_t)purpose) & ~1);
19326 CHECK_ACCESS(purpose_ptr);
19327 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
19328 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uintptr_t)purpose) & ~1));
19329 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19330 *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
19331 uintptr_t ret_ref = (uintptr_t)ret_copy;
19335 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) {
19336 LDKThirtyTwoBytes payment_id_ref;
19337 CHECK(payment_id->arr_len == 32);
19338 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
19339 LDKThirtyTwoBytes payment_preimage_ref;
19340 CHECK(payment_preimage->arr_len == 32);
19341 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
19342 LDKThirtyTwoBytes payment_hash_ref;
19343 CHECK(payment_hash->arr_len == 32);
19344 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
19345 void* fee_paid_msat_ptr = (void*)(((uintptr_t)fee_paid_msat) & ~1);
19346 CHECK_ACCESS(fee_paid_msat_ptr);
19347 LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
19348 fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)fee_paid_msat) & ~1));
19349 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19350 *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
19351 uintptr_t ret_ref = (uintptr_t)ret_copy;
19355 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) {
19356 LDKThirtyTwoBytes payment_id_ref;
19357 CHECK(payment_id->arr_len == 32);
19358 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
19359 LDKThirtyTwoBytes payment_hash_ref;
19360 CHECK(payment_hash->arr_len == 32);
19361 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
19362 void* network_update_ptr = (void*)(((uintptr_t)network_update) & ~1);
19363 CHECK_ACCESS(network_update_ptr);
19364 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
19365 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uintptr_t)network_update) & ~1));
19366 LDKCVec_RouteHopZ path_constr;
19367 path_constr.datalen = path->arr_len;
19368 if (path_constr.datalen > 0)
19369 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
19371 path_constr.data = NULL;
19372 uint32_t* path_vals = path->elems /* XXX path leaks */;
19373 for (size_t k = 0; k < path_constr.datalen; k++) {
19374 uint32_t path_conv_10 = path_vals[k];
19375 LDKRouteHop path_conv_10_conv;
19376 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
19377 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
19378 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
19379 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
19380 path_constr.data[k] = path_conv_10_conv;
19382 void* short_channel_id_ptr = (void*)(((uintptr_t)short_channel_id) & ~1);
19383 CHECK_ACCESS(short_channel_id_ptr);
19384 LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
19385 short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id) & ~1));
19386 LDKRouteParameters retry_conv;
19387 retry_conv.inner = (void*)(retry & (~1));
19388 retry_conv.is_owned = (retry & 1) || (retry == 0);
19389 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
19390 retry_conv = RouteParameters_clone(&retry_conv);
19391 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19392 *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);
19393 uintptr_t ret_ref = (uintptr_t)ret_copy;
19397 uint32_t __attribute__((export_name("TS_Event_payment_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash) {
19398 LDKThirtyTwoBytes payment_id_ref;
19399 CHECK(payment_id->arr_len == 32);
19400 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
19401 LDKThirtyTwoBytes payment_hash_ref;
19402 CHECK(payment_hash->arr_len == 32);
19403 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
19404 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19405 *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
19406 uintptr_t ret_ref = (uintptr_t)ret_copy;
19410 uint32_t __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
19411 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19412 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
19413 uintptr_t ret_ref = (uintptr_t)ret_copy;
19417 uint32_t __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint32_tArray outputs) {
19418 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
19419 outputs_constr.datalen = outputs->arr_len;
19420 if (outputs_constr.datalen > 0)
19421 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
19423 outputs_constr.data = NULL;
19424 uint32_t* outputs_vals = outputs->elems /* XXX outputs leaks */;
19425 for (size_t b = 0; b < outputs_constr.datalen; b++) {
19426 uint32_t outputs_conv_27 = outputs_vals[b];
19427 void* outputs_conv_27_ptr = (void*)(((uintptr_t)outputs_conv_27) & ~1);
19428 CHECK_ACCESS(outputs_conv_27_ptr);
19429 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
19430 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)outputs_conv_27) & ~1));
19431 outputs_constr.data[b] = outputs_conv_27_conv;
19433 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19434 *ret_copy = Event_spendable_outputs(outputs_constr);
19435 uintptr_t ret_ref = (uintptr_t)ret_copy;
19439 uint32_t __attribute__((export_name("TS_Event_payment_forwarded"))) TS_Event_payment_forwarded(uint32_t fee_earned_msat, jboolean claim_from_onchain_tx) {
19440 void* fee_earned_msat_ptr = (void*)(((uintptr_t)fee_earned_msat) & ~1);
19441 CHECK_ACCESS(fee_earned_msat_ptr);
19442 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
19443 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)fee_earned_msat) & ~1));
19444 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19445 *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
19446 uintptr_t ret_ref = (uintptr_t)ret_copy;
19450 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) {
19451 LDKThirtyTwoBytes channel_id_ref;
19452 CHECK(channel_id->arr_len == 32);
19453 memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
19454 void* reason_ptr = (void*)(((uintptr_t)reason) & ~1);
19455 CHECK_ACCESS(reason_ptr);
19456 LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
19457 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uintptr_t)reason) & ~1));
19458 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19459 *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
19460 uintptr_t ret_ref = (uintptr_t)ret_copy;
19464 uint32_t __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
19465 LDKThirtyTwoBytes channel_id_ref;
19466 CHECK(channel_id->arr_len == 32);
19467 memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
19468 LDKTransaction transaction_ref;
19469 transaction_ref.datalen = transaction->arr_len;
19470 transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
19471 memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
19472 transaction_ref.data_is_owned = true;
19473 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19474 *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
19475 uintptr_t ret_ref = (uintptr_t)ret_copy;
19479 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) {
19480 LDKThirtyTwoBytes payment_id_ref;
19481 CHECK(payment_id->arr_len == 32);
19482 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
19483 LDKThirtyTwoBytes payment_hash_ref;
19484 CHECK(payment_hash->arr_len == 32);
19485 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
19486 LDKCVec_RouteHopZ path_constr;
19487 path_constr.datalen = path->arr_len;
19488 if (path_constr.datalen > 0)
19489 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
19491 path_constr.data = NULL;
19492 uint32_t* path_vals = path->elems /* XXX path leaks */;
19493 for (size_t k = 0; k < path_constr.datalen; k++) {
19494 uint32_t path_conv_10 = path_vals[k];
19495 LDKRouteHop path_conv_10_conv;
19496 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
19497 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
19498 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
19499 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
19500 path_constr.data[k] = path_conv_10_conv;
19502 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19503 *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
19504 uintptr_t ret_ref = (uintptr_t)ret_copy;
19508 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) {
19509 LDKThirtyTwoBytes temporary_channel_id_ref;
19510 CHECK(temporary_channel_id->arr_len == 32);
19511 memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
19512 LDKPublicKey counterparty_node_id_ref;
19513 CHECK(counterparty_node_id->arr_len == 33);
19514 memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
19515 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
19516 *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat);
19517 uintptr_t ret_ref = (uintptr_t)ret_copy;
19521 int8_tArray __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint32_t obj) {
19522 LDKEvent* obj_conv = (LDKEvent*)obj;
19523 LDKCVec_u8Z ret_var = Event_write(obj_conv);
19524 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
19525 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
19526 CVec_u8Z_free(ret_var);
19530 uint32_t __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
19531 LDKu8slice ser_ref;
19532 ser_ref.datalen = ser->arr_len;
19533 ser_ref.data = ser->elems /* XXX ser leaks */;
19534 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
19535 *ret_conv = Event_read(ser_ref);
19536 return (uintptr_t)ret_conv;
19539 void __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint32_t this_ptr) {
19540 if ((this_ptr & 1) != 0) return;
19541 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
19542 CHECK_ACCESS(this_ptr_ptr);
19543 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
19544 FREE((void*)this_ptr);
19545 MessageSendEvent_free(this_ptr_conv);
19548 static inline uintptr_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
19549 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19550 *ret_copy = MessageSendEvent_clone(arg);
19551 uintptr_t ret_ref = (uintptr_t)ret_copy;
19554 intptr_t __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint32_t arg) {
19555 LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)arg;
19556 intptr_t ret_val = MessageSendEvent_clone_ptr(arg_conv);
19560 uint32_t __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint32_t orig) {
19561 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
19562 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19563 *ret_copy = MessageSendEvent_clone(orig_conv);
19564 uintptr_t ret_ref = (uintptr_t)ret_copy;
19568 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint32_t msg) {
19569 LDKPublicKey node_id_ref;
19570 CHECK(node_id->arr_len == 33);
19571 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
19572 LDKAcceptChannel msg_conv;
19573 msg_conv.inner = (void*)(msg & (~1));
19574 msg_conv.is_owned = (msg & 1) || (msg == 0);
19575 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19576 msg_conv = AcceptChannel_clone(&msg_conv);
19577 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19578 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
19579 uintptr_t ret_ref = (uintptr_t)ret_copy;
19583 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint32_t msg) {
19584 LDKPublicKey node_id_ref;
19585 CHECK(node_id->arr_len == 33);
19586 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
19587 LDKOpenChannel msg_conv;
19588 msg_conv.inner = (void*)(msg & (~1));
19589 msg_conv.is_owned = (msg & 1) || (msg == 0);
19590 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19591 msg_conv = OpenChannel_clone(&msg_conv);
19592 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19593 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
19594 uintptr_t ret_ref = (uintptr_t)ret_copy;
19598 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_funding_created"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint32_t msg) {
19599 LDKPublicKey node_id_ref;
19600 CHECK(node_id->arr_len == 33);
19601 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
19602 LDKFundingCreated msg_conv;
19603 msg_conv.inner = (void*)(msg & (~1));
19604 msg_conv.is_owned = (msg & 1) || (msg == 0);
19605 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19606 msg_conv = FundingCreated_clone(&msg_conv);
19607 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19608 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
19609 uintptr_t ret_ref = (uintptr_t)ret_copy;
19613 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_funding_signed"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint32_t msg) {
19614 LDKPublicKey node_id_ref;
19615 CHECK(node_id->arr_len == 33);
19616 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
19617 LDKFundingSigned msg_conv;
19618 msg_conv.inner = (void*)(msg & (~1));
19619 msg_conv.is_owned = (msg & 1) || (msg == 0);
19620 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19621 msg_conv = FundingSigned_clone(&msg_conv);
19622 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19623 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
19624 uintptr_t ret_ref = (uintptr_t)ret_copy;
19628 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_funding_locked"))) TS_MessageSendEvent_send_funding_locked(int8_tArray node_id, uint32_t msg) {
19629 LDKPublicKey node_id_ref;
19630 CHECK(node_id->arr_len == 33);
19631 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
19632 LDKFundingLocked msg_conv;
19633 msg_conv.inner = (void*)(msg & (~1));
19634 msg_conv.is_owned = (msg & 1) || (msg == 0);
19635 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19636 msg_conv = FundingLocked_clone(&msg_conv);
19637 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19638 *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
19639 uintptr_t ret_ref = (uintptr_t)ret_copy;
19643 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_announcement_signatures"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint32_t msg) {
19644 LDKPublicKey node_id_ref;
19645 CHECK(node_id->arr_len == 33);
19646 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
19647 LDKAnnouncementSignatures msg_conv;
19648 msg_conv.inner = (void*)(msg & (~1));
19649 msg_conv.is_owned = (msg & 1) || (msg == 0);
19650 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19651 msg_conv = AnnouncementSignatures_clone(&msg_conv);
19652 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19653 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
19654 uintptr_t ret_ref = (uintptr_t)ret_copy;
19658 uint32_t __attribute__((export_name("TS_MessageSendEvent_update_htlcs"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint32_t updates) {
19659 LDKPublicKey node_id_ref;
19660 CHECK(node_id->arr_len == 33);
19661 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
19662 LDKCommitmentUpdate updates_conv;
19663 updates_conv.inner = (void*)(updates & (~1));
19664 updates_conv.is_owned = (updates & 1) || (updates == 0);
19665 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
19666 updates_conv = CommitmentUpdate_clone(&updates_conv);
19667 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19668 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
19669 uintptr_t ret_ref = (uintptr_t)ret_copy;
19673 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_revoke_and_ack"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint32_t msg) {
19674 LDKPublicKey node_id_ref;
19675 CHECK(node_id->arr_len == 33);
19676 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
19677 LDKRevokeAndACK msg_conv;
19678 msg_conv.inner = (void*)(msg & (~1));
19679 msg_conv.is_owned = (msg & 1) || (msg == 0);
19680 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19681 msg_conv = RevokeAndACK_clone(&msg_conv);
19682 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19683 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
19684 uintptr_t ret_ref = (uintptr_t)ret_copy;
19688 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_closing_signed"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint32_t msg) {
19689 LDKPublicKey node_id_ref;
19690 CHECK(node_id->arr_len == 33);
19691 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
19692 LDKClosingSigned msg_conv;
19693 msg_conv.inner = (void*)(msg & (~1));
19694 msg_conv.is_owned = (msg & 1) || (msg == 0);
19695 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19696 msg_conv = ClosingSigned_clone(&msg_conv);
19697 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19698 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
19699 uintptr_t ret_ref = (uintptr_t)ret_copy;
19703 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_shutdown"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint32_t msg) {
19704 LDKPublicKey node_id_ref;
19705 CHECK(node_id->arr_len == 33);
19706 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
19707 LDKShutdown msg_conv;
19708 msg_conv.inner = (void*)(msg & (~1));
19709 msg_conv.is_owned = (msg & 1) || (msg == 0);
19710 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19711 msg_conv = Shutdown_clone(&msg_conv);
19712 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19713 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
19714 uintptr_t ret_ref = (uintptr_t)ret_copy;
19718 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_channel_reestablish"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint32_t msg) {
19719 LDKPublicKey node_id_ref;
19720 CHECK(node_id->arr_len == 33);
19721 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
19722 LDKChannelReestablish msg_conv;
19723 msg_conv.inner = (void*)(msg & (~1));
19724 msg_conv.is_owned = (msg & 1) || (msg == 0);
19725 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19726 msg_conv = ChannelReestablish_clone(&msg_conv);
19727 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19728 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
19729 uintptr_t ret_ref = (uintptr_t)ret_copy;
19733 uint32_t __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_announcement"))) TS_MessageSendEvent_broadcast_channel_announcement(uint32_t msg, uint32_t update_msg) {
19734 LDKChannelAnnouncement msg_conv;
19735 msg_conv.inner = (void*)(msg & (~1));
19736 msg_conv.is_owned = (msg & 1) || (msg == 0);
19737 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19738 msg_conv = ChannelAnnouncement_clone(&msg_conv);
19739 LDKChannelUpdate update_msg_conv;
19740 update_msg_conv.inner = (void*)(update_msg & (~1));
19741 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
19742 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
19743 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
19744 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19745 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
19746 uintptr_t ret_ref = (uintptr_t)ret_copy;
19750 uint32_t __attribute__((export_name("TS_MessageSendEvent_broadcast_node_announcement"))) TS_MessageSendEvent_broadcast_node_announcement(uint32_t msg) {
19751 LDKNodeAnnouncement msg_conv;
19752 msg_conv.inner = (void*)(msg & (~1));
19753 msg_conv.is_owned = (msg & 1) || (msg == 0);
19754 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19755 msg_conv = NodeAnnouncement_clone(&msg_conv);
19756 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19757 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
19758 uintptr_t ret_ref = (uintptr_t)ret_copy;
19762 uint32_t __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_update"))) TS_MessageSendEvent_broadcast_channel_update(uint32_t msg) {
19763 LDKChannelUpdate 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 = ChannelUpdate_clone(&msg_conv);
19768 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19769 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
19770 uintptr_t ret_ref = (uintptr_t)ret_copy;
19774 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(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 LDKChannelUpdate 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 = ChannelUpdate_clone(&msg_conv);
19783 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19784 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
19785 uintptr_t ret_ref = (uintptr_t)ret_copy;
19789 uint32_t __attribute__((export_name("TS_MessageSendEvent_handle_error"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint32_t action) {
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 void* action_ptr = (void*)(((uintptr_t)action) & ~1);
19794 CHECK_ACCESS(action_ptr);
19795 LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
19796 action_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)action) & ~1));
19797 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19798 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
19799 uintptr_t ret_ref = (uintptr_t)ret_copy;
19803 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_channel_range_query"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint32_t msg) {
19804 LDKPublicKey node_id_ref;
19805 CHECK(node_id->arr_len == 33);
19806 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
19807 LDKQueryChannelRange msg_conv;
19808 msg_conv.inner = (void*)(msg & (~1));
19809 msg_conv.is_owned = (msg & 1) || (msg == 0);
19810 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19811 msg_conv = QueryChannelRange_clone(&msg_conv);
19812 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19813 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
19814 uintptr_t ret_ref = (uintptr_t)ret_copy;
19818 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_short_ids_query"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint32_t msg) {
19819 LDKPublicKey node_id_ref;
19820 CHECK(node_id->arr_len == 33);
19821 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
19822 LDKQueryShortChannelIds msg_conv;
19823 msg_conv.inner = (void*)(msg & (~1));
19824 msg_conv.is_owned = (msg & 1) || (msg == 0);
19825 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19826 msg_conv = QueryShortChannelIds_clone(&msg_conv);
19827 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19828 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
19829 uintptr_t ret_ref = (uintptr_t)ret_copy;
19833 uint32_t __attribute__((export_name("TS_MessageSendEvent_send_reply_channel_range"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint32_t msg) {
19834 LDKPublicKey node_id_ref;
19835 CHECK(node_id->arr_len == 33);
19836 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
19837 LDKReplyChannelRange msg_conv;
19838 msg_conv.inner = (void*)(msg & (~1));
19839 msg_conv.is_owned = (msg & 1) || (msg == 0);
19840 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
19841 msg_conv = ReplyChannelRange_clone(&msg_conv);
19842 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
19843 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
19844 uintptr_t ret_ref = (uintptr_t)ret_copy;
19848 void __attribute__((export_name("TS_MessageSendEventsProvider_free"))) TS_MessageSendEventsProvider_free(uint32_t this_ptr) {
19849 if ((this_ptr & 1) != 0) return;
19850 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
19851 CHECK_ACCESS(this_ptr_ptr);
19852 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
19853 FREE((void*)this_ptr);
19854 MessageSendEventsProvider_free(this_ptr_conv);
19857 void __attribute__((export_name("TS_EventsProvider_free"))) TS_EventsProvider_free(uint32_t this_ptr) {
19858 if ((this_ptr & 1) != 0) return;
19859 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
19860 CHECK_ACCESS(this_ptr_ptr);
19861 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
19862 FREE((void*)this_ptr);
19863 EventsProvider_free(this_ptr_conv);
19866 void __attribute__((export_name("TS_EventHandler_free"))) TS_EventHandler_free(uint32_t this_ptr) {
19867 if ((this_ptr & 1) != 0) return;
19868 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
19869 CHECK_ACCESS(this_ptr_ptr);
19870 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
19871 FREE((void*)this_ptr);
19872 EventHandler_free(this_ptr_conv);
19875 void __attribute__((export_name("TS_APIError_free"))) TS_APIError_free(uint32_t this_ptr) {
19876 if ((this_ptr & 1) != 0) return;
19877 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
19878 CHECK_ACCESS(this_ptr_ptr);
19879 LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
19880 FREE((void*)this_ptr);
19881 APIError_free(this_ptr_conv);
19884 static inline uintptr_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
19885 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
19886 *ret_copy = APIError_clone(arg);
19887 uintptr_t ret_ref = (uintptr_t)ret_copy;
19890 intptr_t __attribute__((export_name("TS_APIError_clone_ptr"))) TS_APIError_clone_ptr(uint32_t arg) {
19891 LDKAPIError* arg_conv = (LDKAPIError*)arg;
19892 intptr_t ret_val = APIError_clone_ptr(arg_conv);
19896 uint32_t __attribute__((export_name("TS_APIError_clone"))) TS_APIError_clone(uint32_t orig) {
19897 LDKAPIError* orig_conv = (LDKAPIError*)orig;
19898 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
19899 *ret_copy = APIError_clone(orig_conv);
19900 uintptr_t ret_ref = (uintptr_t)ret_copy;
19904 uint32_t __attribute__((export_name("TS_APIError_apimisuse_error"))) TS_APIError_apimisuse_error(jstring err) {
19905 LDKStr err_conv = str_ref_to_owned_c(err);
19906 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
19907 *ret_copy = APIError_apimisuse_error(err_conv);
19908 uintptr_t ret_ref = (uintptr_t)ret_copy;
19912 uint32_t __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
19913 LDKStr err_conv = str_ref_to_owned_c(err);
19914 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
19915 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
19916 uintptr_t ret_ref = (uintptr_t)ret_copy;
19920 uint32_t __attribute__((export_name("TS_APIError_route_error"))) TS_APIError_route_error(jstring err) {
19921 LDKStr err_conv = str_ref_to_owned_c(err);
19922 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
19923 *ret_copy = APIError_route_error(err_conv);
19924 uintptr_t ret_ref = (uintptr_t)ret_copy;
19928 uint32_t __attribute__((export_name("TS_APIError_channel_unavailable"))) TS_APIError_channel_unavailable(jstring err) {
19929 LDKStr err_conv = str_ref_to_owned_c(err);
19930 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
19931 *ret_copy = APIError_channel_unavailable(err_conv);
19932 uintptr_t ret_ref = (uintptr_t)ret_copy;
19936 uint32_t __attribute__((export_name("TS_APIError_monitor_update_failed"))) TS_APIError_monitor_update_failed() {
19937 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
19938 *ret_copy = APIError_monitor_update_failed();
19939 uintptr_t ret_ref = (uintptr_t)ret_copy;
19943 uint32_t __attribute__((export_name("TS_APIError_incompatible_shutdown_script"))) TS_APIError_incompatible_shutdown_script(uint32_t script) {
19944 LDKShutdownScript script_conv;
19945 script_conv.inner = (void*)(script & (~1));
19946 script_conv.is_owned = (script & 1) || (script == 0);
19947 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
19948 script_conv = ShutdownScript_clone(&script_conv);
19949 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
19950 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
19951 uintptr_t ret_ref = (uintptr_t)ret_copy;
19955 uint32_t __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_tArray sk) {
19956 LDKu8slice msg_ref;
19957 msg_ref.datalen = msg->arr_len;
19958 msg_ref.data = msg->elems /* XXX msg leaks */;
19959 unsigned char sk_arr[32];
19960 CHECK(sk->arr_len == 32);
19961 memcpy(sk_arr, sk->elems, 32); FREE(sk);
19962 unsigned char (*sk_ref)[32] = &sk_arr;
19963 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
19964 *ret_conv = sign(msg_ref, sk_ref);
19965 return (uintptr_t)ret_conv;
19968 uint32_t __attribute__((export_name("TS_recover_pk"))) TS_recover_pk(int8_tArray msg, jstring sig) {
19969 LDKu8slice msg_ref;
19970 msg_ref.datalen = msg->arr_len;
19971 msg_ref.data = msg->elems /* XXX msg leaks */;
19972 LDKStr sig_conv = str_ref_to_owned_c(sig);
19973 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
19974 *ret_conv = recover_pk(msg_ref, sig_conv);
19975 return (uintptr_t)ret_conv;
19978 jboolean __attribute__((export_name("TS_verify"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
19979 LDKu8slice msg_ref;
19980 msg_ref.datalen = msg->arr_len;
19981 msg_ref.data = msg->elems /* XXX msg leaks */;
19982 LDKStr sig_conv = str_ref_to_owned_c(sig);
19983 LDKPublicKey pk_ref;
19984 CHECK(pk->arr_len == 33);
19985 memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
19986 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
19990 int8_tArray __attribute__((export_name("TS_construct_invoice_preimage"))) TS_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
19991 LDKu8slice hrp_bytes_ref;
19992 hrp_bytes_ref.datalen = hrp_bytes->arr_len;
19993 hrp_bytes_ref.data = hrp_bytes->elems /* XXX hrp_bytes leaks */;
19994 LDKCVec_u5Z data_without_signature_constr;
19995 data_without_signature_constr.datalen = data_without_signature->arr_len;
19996 if (data_without_signature_constr.datalen > 0)
19997 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
19999 data_without_signature_constr.data = NULL;
20000 int8_t* data_without_signature_vals = (void*) data_without_signature->elems /* XXX data_without_signature leaks */;
20001 for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
20002 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
20004 data_without_signature_constr.data[h] = (LDKu5){ ._0 = data_without_signature_conv_7 };
20006 LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
20007 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
20008 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20009 CVec_u8Z_free(ret_var);
20013 uint32_t __attribute__((export_name("TS_Level_clone"))) TS_Level_clone(uint32_t orig) {
20014 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
20015 uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
20019 uint32_t __attribute__((export_name("TS_Level_gossip"))) TS_Level_gossip() {
20020 uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
20024 uint32_t __attribute__((export_name("TS_Level_trace"))) TS_Level_trace() {
20025 uint32_t ret_conv = LDKLevel_to_js(Level_trace());
20029 uint32_t __attribute__((export_name("TS_Level_debug"))) TS_Level_debug() {
20030 uint32_t ret_conv = LDKLevel_to_js(Level_debug());
20034 uint32_t __attribute__((export_name("TS_Level_info"))) TS_Level_info() {
20035 uint32_t ret_conv = LDKLevel_to_js(Level_info());
20039 uint32_t __attribute__((export_name("TS_Level_warn"))) TS_Level_warn() {
20040 uint32_t ret_conv = LDKLevel_to_js(Level_warn());
20044 uint32_t __attribute__((export_name("TS_Level_error"))) TS_Level_error() {
20045 uint32_t ret_conv = LDKLevel_to_js(Level_error());
20049 jboolean __attribute__((export_name("TS_Level_eq"))) TS_Level_eq(uint32_t a, uint32_t b) {
20050 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
20051 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
20052 jboolean ret_val = Level_eq(a_conv, b_conv);
20056 int64_t __attribute__((export_name("TS_Level_hash"))) TS_Level_hash(uint32_t o) {
20057 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
20058 int64_t ret_val = Level_hash(o_conv);
20062 uint32_t __attribute__((export_name("TS_Level_max"))) TS_Level_max() {
20063 uint32_t ret_conv = LDKLevel_to_js(Level_max());
20067 void __attribute__((export_name("TS_Record_free"))) TS_Record_free(uint32_t this_obj) {
20068 LDKRecord this_obj_conv;
20069 this_obj_conv.inner = (void*)(this_obj & (~1));
20070 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20071 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20072 Record_free(this_obj_conv);
20075 uint32_t __attribute__((export_name("TS_Record_get_level"))) TS_Record_get_level(uint32_t this_ptr) {
20076 LDKRecord this_ptr_conv;
20077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20078 this_ptr_conv.is_owned = false;
20079 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20080 uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
20084 void __attribute__((export_name("TS_Record_set_level"))) TS_Record_set_level(uint32_t this_ptr, uint32_t val) {
20085 LDKRecord this_ptr_conv;
20086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20087 this_ptr_conv.is_owned = false;
20088 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20089 LDKLevel val_conv = LDKLevel_from_js(val);
20090 Record_set_level(&this_ptr_conv, val_conv);
20093 jstring __attribute__((export_name("TS_Record_get_args"))) TS_Record_get_args(uint32_t this_ptr) {
20094 LDKRecord this_ptr_conv;
20095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20096 this_ptr_conv.is_owned = false;
20097 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20098 LDKStr ret_str = Record_get_args(&this_ptr_conv);
20099 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
20104 void __attribute__((export_name("TS_Record_set_args"))) TS_Record_set_args(uint32_t this_ptr, jstring val) {
20105 LDKRecord this_ptr_conv;
20106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20107 this_ptr_conv.is_owned = false;
20108 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20109 LDKStr val_conv = str_ref_to_owned_c(val);
20110 Record_set_args(&this_ptr_conv, val_conv);
20113 jstring __attribute__((export_name("TS_Record_get_module_path"))) TS_Record_get_module_path(uint32_t this_ptr) {
20114 LDKRecord this_ptr_conv;
20115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20116 this_ptr_conv.is_owned = false;
20117 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20118 LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
20119 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
20124 void __attribute__((export_name("TS_Record_set_module_path"))) TS_Record_set_module_path(uint32_t this_ptr, jstring val) {
20125 LDKRecord this_ptr_conv;
20126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20127 this_ptr_conv.is_owned = false;
20128 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20129 LDKStr val_conv = str_ref_to_owned_c(val);
20130 Record_set_module_path(&this_ptr_conv, val_conv);
20133 jstring __attribute__((export_name("TS_Record_get_file"))) TS_Record_get_file(uint32_t this_ptr) {
20134 LDKRecord this_ptr_conv;
20135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20136 this_ptr_conv.is_owned = false;
20137 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20138 LDKStr ret_str = Record_get_file(&this_ptr_conv);
20139 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
20144 void __attribute__((export_name("TS_Record_set_file"))) TS_Record_set_file(uint32_t this_ptr, jstring val) {
20145 LDKRecord this_ptr_conv;
20146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20147 this_ptr_conv.is_owned = false;
20148 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20149 LDKStr val_conv = str_ref_to_owned_c(val);
20150 Record_set_file(&this_ptr_conv, val_conv);
20153 int32_t __attribute__((export_name("TS_Record_get_line"))) TS_Record_get_line(uint32_t this_ptr) {
20154 LDKRecord this_ptr_conv;
20155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20156 this_ptr_conv.is_owned = false;
20157 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20158 int32_t ret_val = Record_get_line(&this_ptr_conv);
20162 void __attribute__((export_name("TS_Record_set_line"))) TS_Record_set_line(uint32_t this_ptr, int32_t val) {
20163 LDKRecord this_ptr_conv;
20164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20165 this_ptr_conv.is_owned = false;
20166 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20167 Record_set_line(&this_ptr_conv, val);
20170 static inline uintptr_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
20171 LDKRecord ret_var = Record_clone(arg);
20172 uintptr_t ret_ref = 0;
20173 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20174 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20175 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20176 ret_ref = (uintptr_t)ret_var.inner;
20177 if (ret_var.is_owned) {
20182 intptr_t __attribute__((export_name("TS_Record_clone_ptr"))) TS_Record_clone_ptr(uint32_t arg) {
20183 LDKRecord arg_conv;
20184 arg_conv.inner = (void*)(arg & (~1));
20185 arg_conv.is_owned = false;
20186 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20187 intptr_t ret_val = Record_clone_ptr(&arg_conv);
20191 uint32_t __attribute__((export_name("TS_Record_clone"))) TS_Record_clone(uint32_t orig) {
20192 LDKRecord orig_conv;
20193 orig_conv.inner = (void*)(orig & (~1));
20194 orig_conv.is_owned = false;
20195 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20196 LDKRecord ret_var = Record_clone(&orig_conv);
20197 uintptr_t ret_ref = 0;
20198 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20199 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20200 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20201 ret_ref = (uintptr_t)ret_var.inner;
20202 if (ret_var.is_owned) {
20208 void __attribute__((export_name("TS_Logger_free"))) TS_Logger_free(uint32_t this_ptr) {
20209 if ((this_ptr & 1) != 0) return;
20210 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
20211 CHECK_ACCESS(this_ptr_ptr);
20212 LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
20213 FREE((void*)this_ptr);
20214 Logger_free(this_ptr_conv);
20217 void __attribute__((export_name("TS_ChannelHandshakeConfig_free"))) TS_ChannelHandshakeConfig_free(uint32_t this_obj) {
20218 LDKChannelHandshakeConfig this_obj_conv;
20219 this_obj_conv.inner = (void*)(this_obj & (~1));
20220 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20221 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20222 ChannelHandshakeConfig_free(this_obj_conv);
20225 int32_t __attribute__((export_name("TS_ChannelHandshakeConfig_get_minimum_depth"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint32_t this_ptr) {
20226 LDKChannelHandshakeConfig this_ptr_conv;
20227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20228 this_ptr_conv.is_owned = false;
20229 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20230 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
20234 void __attribute__((export_name("TS_ChannelHandshakeConfig_set_minimum_depth"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint32_t this_ptr, int32_t val) {
20235 LDKChannelHandshakeConfig this_ptr_conv;
20236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20237 this_ptr_conv.is_owned = false;
20238 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20239 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
20242 int16_t __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_to_self_delay"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint32_t this_ptr) {
20243 LDKChannelHandshakeConfig this_ptr_conv;
20244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20245 this_ptr_conv.is_owned = false;
20246 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20247 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
20251 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) {
20252 LDKChannelHandshakeConfig this_ptr_conv;
20253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20254 this_ptr_conv.is_owned = false;
20255 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20256 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
20259 int64_t __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint32_t this_ptr) {
20260 LDKChannelHandshakeConfig 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 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
20268 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) {
20269 LDKChannelHandshakeConfig this_ptr_conv;
20270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20271 this_ptr_conv.is_owned = false;
20272 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20273 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
20276 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) {
20277 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
20278 uintptr_t ret_ref = 0;
20279 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20280 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20281 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20282 ret_ref = (uintptr_t)ret_var.inner;
20283 if (ret_var.is_owned) {
20289 static inline uintptr_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
20290 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
20291 uintptr_t ret_ref = 0;
20292 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20293 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20294 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20295 ret_ref = (uintptr_t)ret_var.inner;
20296 if (ret_var.is_owned) {
20301 intptr_t __attribute__((export_name("TS_ChannelHandshakeConfig_clone_ptr"))) TS_ChannelHandshakeConfig_clone_ptr(uint32_t arg) {
20302 LDKChannelHandshakeConfig arg_conv;
20303 arg_conv.inner = (void*)(arg & (~1));
20304 arg_conv.is_owned = false;
20305 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20306 intptr_t ret_val = ChannelHandshakeConfig_clone_ptr(&arg_conv);
20310 uint32_t __attribute__((export_name("TS_ChannelHandshakeConfig_clone"))) TS_ChannelHandshakeConfig_clone(uint32_t orig) {
20311 LDKChannelHandshakeConfig orig_conv;
20312 orig_conv.inner = (void*)(orig & (~1));
20313 orig_conv.is_owned = false;
20314 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20315 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
20316 uintptr_t ret_ref = 0;
20317 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20318 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20319 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20320 ret_ref = (uintptr_t)ret_var.inner;
20321 if (ret_var.is_owned) {
20327 uint32_t __attribute__((export_name("TS_ChannelHandshakeConfig_default"))) TS_ChannelHandshakeConfig_default() {
20328 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
20329 uintptr_t ret_ref = 0;
20330 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20331 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20332 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20333 ret_ref = (uintptr_t)ret_var.inner;
20334 if (ret_var.is_owned) {
20340 void __attribute__((export_name("TS_ChannelHandshakeLimits_free"))) TS_ChannelHandshakeLimits_free(uint32_t this_obj) {
20341 LDKChannelHandshakeLimits this_obj_conv;
20342 this_obj_conv.inner = (void*)(this_obj & (~1));
20343 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20344 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20345 ChannelHandshakeLimits_free(this_obj_conv);
20348 int64_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_funding_satoshis"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint32_t this_ptr) {
20349 LDKChannelHandshakeLimits this_ptr_conv;
20350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20351 this_ptr_conv.is_owned = false;
20352 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20353 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
20357 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_funding_satoshis"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint32_t this_ptr, int64_t val) {
20358 LDKChannelHandshakeLimits this_ptr_conv;
20359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20360 this_ptr_conv.is_owned = false;
20361 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20362 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
20365 int64_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint32_t this_ptr) {
20366 LDKChannelHandshakeLimits this_ptr_conv;
20367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20368 this_ptr_conv.is_owned = false;
20369 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20370 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
20374 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) {
20375 LDKChannelHandshakeLimits this_ptr_conv;
20376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20377 this_ptr_conv.is_owned = false;
20378 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20379 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
20382 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) {
20383 LDKChannelHandshakeLimits this_ptr_conv;
20384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20385 this_ptr_conv.is_owned = false;
20386 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20387 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
20391 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) {
20392 LDKChannelHandshakeLimits this_ptr_conv;
20393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20394 this_ptr_conv.is_owned = false;
20395 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20396 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
20399 int64_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint32_t this_ptr) {
20400 LDKChannelHandshakeLimits this_ptr_conv;
20401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20402 this_ptr_conv.is_owned = false;
20403 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20404 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
20408 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) {
20409 LDKChannelHandshakeLimits this_ptr_conv;
20410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20411 this_ptr_conv.is_owned = false;
20412 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20413 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
20416 int16_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint32_t this_ptr) {
20417 LDKChannelHandshakeLimits this_ptr_conv;
20418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20419 this_ptr_conv.is_owned = false;
20420 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20421 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
20425 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) {
20426 LDKChannelHandshakeLimits this_ptr_conv;
20427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20428 this_ptr_conv.is_owned = false;
20429 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20430 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
20433 int32_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_minimum_depth"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint32_t this_ptr) {
20434 LDKChannelHandshakeLimits this_ptr_conv;
20435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20436 this_ptr_conv.is_owned = false;
20437 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20438 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
20442 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_minimum_depth"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint32_t this_ptr, int32_t val) {
20443 LDKChannelHandshakeLimits this_ptr_conv;
20444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20445 this_ptr_conv.is_owned = false;
20446 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20447 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
20450 jboolean __attribute__((export_name("TS_ChannelHandshakeLimits_get_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint32_t this_ptr) {
20451 LDKChannelHandshakeLimits this_ptr_conv;
20452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20453 this_ptr_conv.is_owned = false;
20454 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20455 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
20459 void __attribute__((export_name("TS_ChannelHandshakeLimits_set_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint32_t this_ptr, jboolean val) {
20460 LDKChannelHandshakeLimits this_ptr_conv;
20461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20462 this_ptr_conv.is_owned = false;
20463 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20464 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
20467 int16_t __attribute__((export_name("TS_ChannelHandshakeLimits_get_their_to_self_delay"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint32_t this_ptr) {
20468 LDKChannelHandshakeLimits this_ptr_conv;
20469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20470 this_ptr_conv.is_owned = false;
20471 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20472 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
20476 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) {
20477 LDKChannelHandshakeLimits this_ptr_conv;
20478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20479 this_ptr_conv.is_owned = false;
20480 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20481 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
20484 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) {
20485 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);
20486 uintptr_t ret_ref = 0;
20487 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20488 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20489 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20490 ret_ref = (uintptr_t)ret_var.inner;
20491 if (ret_var.is_owned) {
20497 static inline uintptr_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
20498 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
20499 uintptr_t ret_ref = 0;
20500 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20501 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20502 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20503 ret_ref = (uintptr_t)ret_var.inner;
20504 if (ret_var.is_owned) {
20509 intptr_t __attribute__((export_name("TS_ChannelHandshakeLimits_clone_ptr"))) TS_ChannelHandshakeLimits_clone_ptr(uint32_t arg) {
20510 LDKChannelHandshakeLimits arg_conv;
20511 arg_conv.inner = (void*)(arg & (~1));
20512 arg_conv.is_owned = false;
20513 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20514 intptr_t ret_val = ChannelHandshakeLimits_clone_ptr(&arg_conv);
20518 uint32_t __attribute__((export_name("TS_ChannelHandshakeLimits_clone"))) TS_ChannelHandshakeLimits_clone(uint32_t orig) {
20519 LDKChannelHandshakeLimits orig_conv;
20520 orig_conv.inner = (void*)(orig & (~1));
20521 orig_conv.is_owned = false;
20522 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20523 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
20524 uintptr_t ret_ref = 0;
20525 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20526 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20527 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20528 ret_ref = (uintptr_t)ret_var.inner;
20529 if (ret_var.is_owned) {
20535 uint32_t __attribute__((export_name("TS_ChannelHandshakeLimits_default"))) TS_ChannelHandshakeLimits_default() {
20536 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
20537 uintptr_t ret_ref = 0;
20538 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20539 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20540 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20541 ret_ref = (uintptr_t)ret_var.inner;
20542 if (ret_var.is_owned) {
20548 void __attribute__((export_name("TS_ChannelConfig_free"))) TS_ChannelConfig_free(uint32_t this_obj) {
20549 LDKChannelConfig this_obj_conv;
20550 this_obj_conv.inner = (void*)(this_obj & (~1));
20551 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20552 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20553 ChannelConfig_free(this_obj_conv);
20556 int32_t __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint32_t this_ptr) {
20557 LDKChannelConfig this_ptr_conv;
20558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20559 this_ptr_conv.is_owned = false;
20560 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20561 int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
20565 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) {
20566 LDKChannelConfig this_ptr_conv;
20567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20568 this_ptr_conv.is_owned = false;
20569 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20570 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
20573 int32_t __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_base_msat"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint32_t this_ptr) {
20574 LDKChannelConfig this_ptr_conv;
20575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20576 this_ptr_conv.is_owned = false;
20577 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20578 int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
20582 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) {
20583 LDKChannelConfig this_ptr_conv;
20584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20585 this_ptr_conv.is_owned = false;
20586 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20587 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
20590 int16_t __attribute__((export_name("TS_ChannelConfig_get_cltv_expiry_delta"))) TS_ChannelConfig_get_cltv_expiry_delta(uint32_t this_ptr) {
20591 LDKChannelConfig this_ptr_conv;
20592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20593 this_ptr_conv.is_owned = false;
20594 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20595 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
20599 void __attribute__((export_name("TS_ChannelConfig_set_cltv_expiry_delta"))) TS_ChannelConfig_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
20600 LDKChannelConfig this_ptr_conv;
20601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20602 this_ptr_conv.is_owned = false;
20603 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20604 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
20607 jboolean __attribute__((export_name("TS_ChannelConfig_get_announced_channel"))) TS_ChannelConfig_get_announced_channel(uint32_t this_ptr) {
20608 LDKChannelConfig this_ptr_conv;
20609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20610 this_ptr_conv.is_owned = false;
20611 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20612 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
20616 void __attribute__((export_name("TS_ChannelConfig_set_announced_channel"))) TS_ChannelConfig_set_announced_channel(uint32_t this_ptr, jboolean val) {
20617 LDKChannelConfig this_ptr_conv;
20618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20619 this_ptr_conv.is_owned = false;
20620 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20621 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
20624 jboolean __attribute__((export_name("TS_ChannelConfig_get_commit_upfront_shutdown_pubkey"))) TS_ChannelConfig_get_commit_upfront_shutdown_pubkey(uint32_t this_ptr) {
20625 LDKChannelConfig this_ptr_conv;
20626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20627 this_ptr_conv.is_owned = false;
20628 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20629 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
20633 void __attribute__((export_name("TS_ChannelConfig_set_commit_upfront_shutdown_pubkey"))) TS_ChannelConfig_set_commit_upfront_shutdown_pubkey(uint32_t this_ptr, jboolean val) {
20634 LDKChannelConfig this_ptr_conv;
20635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20636 this_ptr_conv.is_owned = false;
20637 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20638 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
20641 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) {
20642 LDKChannelConfig this_ptr_conv;
20643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20644 this_ptr_conv.is_owned = false;
20645 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20646 int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
20650 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) {
20651 LDKChannelConfig this_ptr_conv;
20652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20653 this_ptr_conv.is_owned = false;
20654 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20655 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
20658 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) {
20659 LDKChannelConfig this_ptr_conv;
20660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20661 this_ptr_conv.is_owned = false;
20662 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20663 int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
20667 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) {
20668 LDKChannelConfig this_ptr_conv;
20669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20670 this_ptr_conv.is_owned = false;
20671 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20672 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
20675 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) {
20676 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);
20677 uintptr_t ret_ref = 0;
20678 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20679 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20680 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20681 ret_ref = (uintptr_t)ret_var.inner;
20682 if (ret_var.is_owned) {
20688 static inline uintptr_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
20689 LDKChannelConfig ret_var = ChannelConfig_clone(arg);
20690 uintptr_t ret_ref = 0;
20691 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20692 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20693 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20694 ret_ref = (uintptr_t)ret_var.inner;
20695 if (ret_var.is_owned) {
20700 intptr_t __attribute__((export_name("TS_ChannelConfig_clone_ptr"))) TS_ChannelConfig_clone_ptr(uint32_t arg) {
20701 LDKChannelConfig arg_conv;
20702 arg_conv.inner = (void*)(arg & (~1));
20703 arg_conv.is_owned = false;
20704 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20705 intptr_t ret_val = ChannelConfig_clone_ptr(&arg_conv);
20709 uint32_t __attribute__((export_name("TS_ChannelConfig_clone"))) TS_ChannelConfig_clone(uint32_t orig) {
20710 LDKChannelConfig orig_conv;
20711 orig_conv.inner = (void*)(orig & (~1));
20712 orig_conv.is_owned = false;
20713 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20714 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
20715 uintptr_t ret_ref = 0;
20716 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20717 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20718 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20719 ret_ref = (uintptr_t)ret_var.inner;
20720 if (ret_var.is_owned) {
20726 uint32_t __attribute__((export_name("TS_ChannelConfig_default"))) TS_ChannelConfig_default() {
20727 LDKChannelConfig ret_var = ChannelConfig_default();
20728 uintptr_t ret_ref = 0;
20729 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20730 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20731 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20732 ret_ref = (uintptr_t)ret_var.inner;
20733 if (ret_var.is_owned) {
20739 int8_tArray __attribute__((export_name("TS_ChannelConfig_write"))) TS_ChannelConfig_write(uint32_t obj) {
20740 LDKChannelConfig obj_conv;
20741 obj_conv.inner = (void*)(obj & (~1));
20742 obj_conv.is_owned = false;
20743 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
20744 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
20745 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
20746 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20747 CVec_u8Z_free(ret_var);
20751 uint32_t __attribute__((export_name("TS_ChannelConfig_read"))) TS_ChannelConfig_read(int8_tArray ser) {
20752 LDKu8slice ser_ref;
20753 ser_ref.datalen = ser->arr_len;
20754 ser_ref.data = ser->elems /* XXX ser leaks */;
20755 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
20756 *ret_conv = ChannelConfig_read(ser_ref);
20757 return (uintptr_t)ret_conv;
20760 void __attribute__((export_name("TS_UserConfig_free"))) TS_UserConfig_free(uint32_t this_obj) {
20761 LDKUserConfig this_obj_conv;
20762 this_obj_conv.inner = (void*)(this_obj & (~1));
20763 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20764 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20765 UserConfig_free(this_obj_conv);
20768 uint32_t __attribute__((export_name("TS_UserConfig_get_own_channel_config"))) TS_UserConfig_get_own_channel_config(uint32_t this_ptr) {
20769 LDKUserConfig this_ptr_conv;
20770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20771 this_ptr_conv.is_owned = false;
20772 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20773 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
20774 uintptr_t ret_ref = 0;
20775 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20776 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20777 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20778 ret_ref = (uintptr_t)ret_var.inner;
20779 if (ret_var.is_owned) {
20785 void __attribute__((export_name("TS_UserConfig_set_own_channel_config"))) TS_UserConfig_set_own_channel_config(uint32_t this_ptr, uint32_t val) {
20786 LDKUserConfig this_ptr_conv;
20787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20788 this_ptr_conv.is_owned = false;
20789 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20790 LDKChannelHandshakeConfig val_conv;
20791 val_conv.inner = (void*)(val & (~1));
20792 val_conv.is_owned = (val & 1) || (val == 0);
20793 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
20794 val_conv = ChannelHandshakeConfig_clone(&val_conv);
20795 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
20798 uint32_t __attribute__((export_name("TS_UserConfig_get_peer_channel_config_limits"))) TS_UserConfig_get_peer_channel_config_limits(uint32_t this_ptr) {
20799 LDKUserConfig this_ptr_conv;
20800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20801 this_ptr_conv.is_owned = false;
20802 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20803 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
20804 uintptr_t ret_ref = 0;
20805 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20806 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20807 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20808 ret_ref = (uintptr_t)ret_var.inner;
20809 if (ret_var.is_owned) {
20815 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) {
20816 LDKUserConfig this_ptr_conv;
20817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20818 this_ptr_conv.is_owned = false;
20819 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20820 LDKChannelHandshakeLimits val_conv;
20821 val_conv.inner = (void*)(val & (~1));
20822 val_conv.is_owned = (val & 1) || (val == 0);
20823 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
20824 val_conv = ChannelHandshakeLimits_clone(&val_conv);
20825 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
20828 uint32_t __attribute__((export_name("TS_UserConfig_get_channel_options"))) TS_UserConfig_get_channel_options(uint32_t this_ptr) {
20829 LDKUserConfig this_ptr_conv;
20830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20831 this_ptr_conv.is_owned = false;
20832 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20833 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
20834 uintptr_t ret_ref = 0;
20835 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20836 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20837 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20838 ret_ref = (uintptr_t)ret_var.inner;
20839 if (ret_var.is_owned) {
20845 void __attribute__((export_name("TS_UserConfig_set_channel_options"))) TS_UserConfig_set_channel_options(uint32_t this_ptr, uint32_t val) {
20846 LDKUserConfig this_ptr_conv;
20847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20848 this_ptr_conv.is_owned = false;
20849 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20850 LDKChannelConfig val_conv;
20851 val_conv.inner = (void*)(val & (~1));
20852 val_conv.is_owned = (val & 1) || (val == 0);
20853 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
20854 val_conv = ChannelConfig_clone(&val_conv);
20855 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
20858 jboolean __attribute__((export_name("TS_UserConfig_get_accept_forwards_to_priv_channels"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint32_t this_ptr) {
20859 LDKUserConfig this_ptr_conv;
20860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20861 this_ptr_conv.is_owned = false;
20862 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20863 jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
20867 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) {
20868 LDKUserConfig this_ptr_conv;
20869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20870 this_ptr_conv.is_owned = false;
20871 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20872 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
20875 jboolean __attribute__((export_name("TS_UserConfig_get_accept_inbound_channels"))) TS_UserConfig_get_accept_inbound_channels(uint32_t this_ptr) {
20876 LDKUserConfig this_ptr_conv;
20877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20878 this_ptr_conv.is_owned = false;
20879 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20880 jboolean ret_val = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
20884 void __attribute__((export_name("TS_UserConfig_set_accept_inbound_channels"))) TS_UserConfig_set_accept_inbound_channels(uint32_t this_ptr, jboolean val) {
20885 LDKUserConfig this_ptr_conv;
20886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20887 this_ptr_conv.is_owned = false;
20888 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20889 UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
20892 jboolean __attribute__((export_name("TS_UserConfig_get_manually_accept_inbound_channels"))) TS_UserConfig_get_manually_accept_inbound_channels(uint32_t this_ptr) {
20893 LDKUserConfig this_ptr_conv;
20894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20895 this_ptr_conv.is_owned = false;
20896 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20897 jboolean ret_val = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
20901 void __attribute__((export_name("TS_UserConfig_set_manually_accept_inbound_channels"))) TS_UserConfig_set_manually_accept_inbound_channels(uint32_t this_ptr, jboolean val) {
20902 LDKUserConfig this_ptr_conv;
20903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20904 this_ptr_conv.is_owned = false;
20905 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
20906 UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
20909 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) {
20910 LDKChannelHandshakeConfig own_channel_config_arg_conv;
20911 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
20912 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
20913 CHECK_INNER_FIELD_ACCESS_OR_NULL(own_channel_config_arg_conv);
20914 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
20915 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
20916 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
20917 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
20918 CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_channel_config_limits_arg_conv);
20919 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
20920 LDKChannelConfig channel_options_arg_conv;
20921 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
20922 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
20923 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_options_arg_conv);
20924 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
20925 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);
20926 uintptr_t ret_ref = 0;
20927 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20928 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20929 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20930 ret_ref = (uintptr_t)ret_var.inner;
20931 if (ret_var.is_owned) {
20937 static inline uintptr_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
20938 LDKUserConfig ret_var = UserConfig_clone(arg);
20939 uintptr_t ret_ref = 0;
20940 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20941 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20942 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20943 ret_ref = (uintptr_t)ret_var.inner;
20944 if (ret_var.is_owned) {
20949 intptr_t __attribute__((export_name("TS_UserConfig_clone_ptr"))) TS_UserConfig_clone_ptr(uint32_t arg) {
20950 LDKUserConfig arg_conv;
20951 arg_conv.inner = (void*)(arg & (~1));
20952 arg_conv.is_owned = false;
20953 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
20954 intptr_t ret_val = UserConfig_clone_ptr(&arg_conv);
20958 uint32_t __attribute__((export_name("TS_UserConfig_clone"))) TS_UserConfig_clone(uint32_t orig) {
20959 LDKUserConfig orig_conv;
20960 orig_conv.inner = (void*)(orig & (~1));
20961 orig_conv.is_owned = false;
20962 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
20963 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
20964 uintptr_t ret_ref = 0;
20965 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20966 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20967 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20968 ret_ref = (uintptr_t)ret_var.inner;
20969 if (ret_var.is_owned) {
20975 uint32_t __attribute__((export_name("TS_UserConfig_default"))) TS_UserConfig_default() {
20976 LDKUserConfig ret_var = UserConfig_default();
20977 uintptr_t ret_ref = 0;
20978 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20979 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20980 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20981 ret_ref = (uintptr_t)ret_var.inner;
20982 if (ret_var.is_owned) {
20988 void __attribute__((export_name("TS_BestBlock_free"))) TS_BestBlock_free(uint32_t this_obj) {
20989 LDKBestBlock this_obj_conv;
20990 this_obj_conv.inner = (void*)(this_obj & (~1));
20991 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20992 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
20993 BestBlock_free(this_obj_conv);
20996 static inline uintptr_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
20997 LDKBestBlock ret_var = BestBlock_clone(arg);
20998 uintptr_t ret_ref = 0;
20999 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21000 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21001 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21002 ret_ref = (uintptr_t)ret_var.inner;
21003 if (ret_var.is_owned) {
21008 intptr_t __attribute__((export_name("TS_BestBlock_clone_ptr"))) TS_BestBlock_clone_ptr(uint32_t arg) {
21009 LDKBestBlock arg_conv;
21010 arg_conv.inner = (void*)(arg & (~1));
21011 arg_conv.is_owned = false;
21012 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21013 intptr_t ret_val = BestBlock_clone_ptr(&arg_conv);
21017 uint32_t __attribute__((export_name("TS_BestBlock_clone"))) TS_BestBlock_clone(uint32_t orig) {
21018 LDKBestBlock orig_conv;
21019 orig_conv.inner = (void*)(orig & (~1));
21020 orig_conv.is_owned = false;
21021 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21022 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
21023 uintptr_t ret_ref = 0;
21024 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21025 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21026 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21027 ret_ref = (uintptr_t)ret_var.inner;
21028 if (ret_var.is_owned) {
21034 uint32_t __attribute__((export_name("TS_BestBlock_from_genesis"))) TS_BestBlock_from_genesis(uint32_t network) {
21035 LDKNetwork network_conv = LDKNetwork_from_js(network);
21036 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
21037 uintptr_t ret_ref = 0;
21038 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21039 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21040 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21041 ret_ref = (uintptr_t)ret_var.inner;
21042 if (ret_var.is_owned) {
21048 uint32_t __attribute__((export_name("TS_BestBlock_new"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
21049 LDKThirtyTwoBytes block_hash_ref;
21050 CHECK(block_hash->arr_len == 32);
21051 memcpy(block_hash_ref.data, block_hash->elems, 32); FREE(block_hash);
21052 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
21053 uintptr_t ret_ref = 0;
21054 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21055 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21056 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21057 ret_ref = (uintptr_t)ret_var.inner;
21058 if (ret_var.is_owned) {
21064 int8_tArray __attribute__((export_name("TS_BestBlock_block_hash"))) TS_BestBlock_block_hash(uint32_t this_arg) {
21065 LDKBestBlock this_arg_conv;
21066 this_arg_conv.inner = (void*)(this_arg & (~1));
21067 this_arg_conv.is_owned = false;
21068 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21069 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
21070 memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
21074 int32_t __attribute__((export_name("TS_BestBlock_height"))) TS_BestBlock_height(uint32_t this_arg) {
21075 LDKBestBlock this_arg_conv;
21076 this_arg_conv.inner = (void*)(this_arg & (~1));
21077 this_arg_conv.is_owned = false;
21078 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21079 int32_t ret_val = BestBlock_height(&this_arg_conv);
21083 uint32_t __attribute__((export_name("TS_AccessError_clone"))) TS_AccessError_clone(uint32_t orig) {
21084 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
21085 uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
21089 uint32_t __attribute__((export_name("TS_AccessError_unknown_chain"))) TS_AccessError_unknown_chain() {
21090 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_chain());
21094 uint32_t __attribute__((export_name("TS_AccessError_unknown_tx"))) TS_AccessError_unknown_tx() {
21095 uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_tx());
21099 void __attribute__((export_name("TS_Access_free"))) TS_Access_free(uint32_t this_ptr) {
21100 if ((this_ptr & 1) != 0) return;
21101 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
21102 CHECK_ACCESS(this_ptr_ptr);
21103 LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
21104 FREE((void*)this_ptr);
21105 Access_free(this_ptr_conv);
21108 void __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint32_t this_ptr) {
21109 if ((this_ptr & 1) != 0) return;
21110 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
21111 CHECK_ACCESS(this_ptr_ptr);
21112 LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
21113 FREE((void*)this_ptr);
21114 Listen_free(this_ptr_conv);
21117 void __attribute__((export_name("TS_Confirm_free"))) TS_Confirm_free(uint32_t this_ptr) {
21118 if ((this_ptr & 1) != 0) return;
21119 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
21120 CHECK_ACCESS(this_ptr_ptr);
21121 LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
21122 FREE((void*)this_ptr);
21123 Confirm_free(this_ptr_conv);
21126 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdateErr_clone"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) {
21127 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
21128 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
21132 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdateErr_temporary_failure"))) TS_ChannelMonitorUpdateErr_temporary_failure() {
21133 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_temporary_failure());
21137 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdateErr_permanent_failure"))) TS_ChannelMonitorUpdateErr_permanent_failure() {
21138 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_permanent_failure());
21142 void __attribute__((export_name("TS_Watch_free"))) TS_Watch_free(uint32_t this_ptr) {
21143 if ((this_ptr & 1) != 0) return;
21144 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
21145 CHECK_ACCESS(this_ptr_ptr);
21146 LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
21147 FREE((void*)this_ptr);
21148 Watch_free(this_ptr_conv);
21151 void __attribute__((export_name("TS_Filter_free"))) TS_Filter_free(uint32_t this_ptr) {
21152 if ((this_ptr & 1) != 0) return;
21153 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
21154 CHECK_ACCESS(this_ptr_ptr);
21155 LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
21156 FREE((void*)this_ptr);
21157 Filter_free(this_ptr_conv);
21160 void __attribute__((export_name("TS_WatchedOutput_free"))) TS_WatchedOutput_free(uint32_t this_obj) {
21161 LDKWatchedOutput this_obj_conv;
21162 this_obj_conv.inner = (void*)(this_obj & (~1));
21163 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21164 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21165 WatchedOutput_free(this_obj_conv);
21168 int8_tArray __attribute__((export_name("TS_WatchedOutput_get_block_hash"))) TS_WatchedOutput_get_block_hash(uint32_t this_ptr) {
21169 LDKWatchedOutput this_ptr_conv;
21170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21171 this_ptr_conv.is_owned = false;
21172 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21173 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
21174 memcpy(ret_arr->elems, WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
21178 void __attribute__((export_name("TS_WatchedOutput_set_block_hash"))) TS_WatchedOutput_set_block_hash(uint32_t this_ptr, int8_tArray val) {
21179 LDKWatchedOutput this_ptr_conv;
21180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21181 this_ptr_conv.is_owned = false;
21182 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21183 LDKThirtyTwoBytes val_ref;
21184 CHECK(val->arr_len == 32);
21185 memcpy(val_ref.data, val->elems, 32); FREE(val);
21186 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
21189 uint32_t __attribute__((export_name("TS_WatchedOutput_get_outpoint"))) TS_WatchedOutput_get_outpoint(uint32_t this_ptr) {
21190 LDKWatchedOutput this_ptr_conv;
21191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21192 this_ptr_conv.is_owned = false;
21193 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21194 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
21195 uintptr_t ret_ref = 0;
21196 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21197 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21198 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21199 ret_ref = (uintptr_t)ret_var.inner;
21200 if (ret_var.is_owned) {
21206 void __attribute__((export_name("TS_WatchedOutput_set_outpoint"))) TS_WatchedOutput_set_outpoint(uint32_t this_ptr, uint32_t val) {
21207 LDKWatchedOutput this_ptr_conv;
21208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21209 this_ptr_conv.is_owned = false;
21210 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21211 LDKOutPoint val_conv;
21212 val_conv.inner = (void*)(val & (~1));
21213 val_conv.is_owned = (val & 1) || (val == 0);
21214 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
21215 val_conv = OutPoint_clone(&val_conv);
21216 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
21219 int8_tArray __attribute__((export_name("TS_WatchedOutput_get_script_pubkey"))) TS_WatchedOutput_get_script_pubkey(uint32_t this_ptr) {
21220 LDKWatchedOutput this_ptr_conv;
21221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21222 this_ptr_conv.is_owned = false;
21223 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21224 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
21225 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21226 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21230 void __attribute__((export_name("TS_WatchedOutput_set_script_pubkey"))) TS_WatchedOutput_set_script_pubkey(uint32_t this_ptr, int8_tArray val) {
21231 LDKWatchedOutput this_ptr_conv;
21232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21233 this_ptr_conv.is_owned = false;
21234 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21235 LDKCVec_u8Z val_ref;
21236 val_ref.datalen = val->arr_len;
21237 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
21238 memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
21239 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
21242 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) {
21243 LDKThirtyTwoBytes block_hash_arg_ref;
21244 CHECK(block_hash_arg->arr_len == 32);
21245 memcpy(block_hash_arg_ref.data, block_hash_arg->elems, 32); FREE(block_hash_arg);
21246 LDKOutPoint outpoint_arg_conv;
21247 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
21248 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
21249 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
21250 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
21251 LDKCVec_u8Z script_pubkey_arg_ref;
21252 script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
21253 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
21254 memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
21255 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
21256 uintptr_t ret_ref = 0;
21257 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21258 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21259 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21260 ret_ref = (uintptr_t)ret_var.inner;
21261 if (ret_var.is_owned) {
21267 static inline uintptr_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
21268 LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
21269 uintptr_t ret_ref = 0;
21270 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21271 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21272 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21273 ret_ref = (uintptr_t)ret_var.inner;
21274 if (ret_var.is_owned) {
21279 intptr_t __attribute__((export_name("TS_WatchedOutput_clone_ptr"))) TS_WatchedOutput_clone_ptr(uint32_t arg) {
21280 LDKWatchedOutput arg_conv;
21281 arg_conv.inner = (void*)(arg & (~1));
21282 arg_conv.is_owned = false;
21283 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21284 intptr_t ret_val = WatchedOutput_clone_ptr(&arg_conv);
21288 uint32_t __attribute__((export_name("TS_WatchedOutput_clone"))) TS_WatchedOutput_clone(uint32_t orig) {
21289 LDKWatchedOutput orig_conv;
21290 orig_conv.inner = (void*)(orig & (~1));
21291 orig_conv.is_owned = false;
21292 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21293 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
21294 uintptr_t ret_ref = 0;
21295 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21296 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21297 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21298 ret_ref = (uintptr_t)ret_var.inner;
21299 if (ret_var.is_owned) {
21305 int64_t __attribute__((export_name("TS_WatchedOutput_hash"))) TS_WatchedOutput_hash(uint32_t o) {
21306 LDKWatchedOutput o_conv;
21307 o_conv.inner = (void*)(o & (~1));
21308 o_conv.is_owned = false;
21309 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21310 int64_t ret_val = WatchedOutput_hash(&o_conv);
21314 void __attribute__((export_name("TS_BroadcasterInterface_free"))) TS_BroadcasterInterface_free(uint32_t this_ptr) {
21315 if ((this_ptr & 1) != 0) return;
21316 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
21317 CHECK_ACCESS(this_ptr_ptr);
21318 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
21319 FREE((void*)this_ptr);
21320 BroadcasterInterface_free(this_ptr_conv);
21323 uint32_t __attribute__((export_name("TS_ConfirmationTarget_clone"))) TS_ConfirmationTarget_clone(uint32_t orig) {
21324 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
21325 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
21329 uint32_t __attribute__((export_name("TS_ConfirmationTarget_background"))) TS_ConfirmationTarget_background() {
21330 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
21334 uint32_t __attribute__((export_name("TS_ConfirmationTarget_normal"))) TS_ConfirmationTarget_normal() {
21335 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
21339 uint32_t __attribute__((export_name("TS_ConfirmationTarget_high_priority"))) TS_ConfirmationTarget_high_priority() {
21340 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
21344 jboolean __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint32_t a, uint32_t b) {
21345 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
21346 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
21347 jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
21351 void __attribute__((export_name("TS_FeeEstimator_free"))) TS_FeeEstimator_free(uint32_t this_ptr) {
21352 if ((this_ptr & 1) != 0) return;
21353 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
21354 CHECK_ACCESS(this_ptr_ptr);
21355 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
21356 FREE((void*)this_ptr);
21357 FeeEstimator_free(this_ptr_conv);
21360 void __attribute__((export_name("TS_MonitorUpdateId_free"))) TS_MonitorUpdateId_free(uint32_t this_obj) {
21361 LDKMonitorUpdateId this_obj_conv;
21362 this_obj_conv.inner = (void*)(this_obj & (~1));
21363 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21364 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21365 MonitorUpdateId_free(this_obj_conv);
21368 static inline uintptr_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
21369 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
21370 uintptr_t ret_ref = 0;
21371 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21372 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21373 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21374 ret_ref = (uintptr_t)ret_var.inner;
21375 if (ret_var.is_owned) {
21380 intptr_t __attribute__((export_name("TS_MonitorUpdateId_clone_ptr"))) TS_MonitorUpdateId_clone_ptr(uint32_t arg) {
21381 LDKMonitorUpdateId arg_conv;
21382 arg_conv.inner = (void*)(arg & (~1));
21383 arg_conv.is_owned = false;
21384 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21385 intptr_t ret_val = MonitorUpdateId_clone_ptr(&arg_conv);
21389 uint32_t __attribute__((export_name("TS_MonitorUpdateId_clone"))) TS_MonitorUpdateId_clone(uint32_t orig) {
21390 LDKMonitorUpdateId orig_conv;
21391 orig_conv.inner = (void*)(orig & (~1));
21392 orig_conv.is_owned = false;
21393 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21394 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
21395 uintptr_t ret_ref = 0;
21396 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21397 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21398 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21399 ret_ref = (uintptr_t)ret_var.inner;
21400 if (ret_var.is_owned) {
21406 int64_t __attribute__((export_name("TS_MonitorUpdateId_hash"))) TS_MonitorUpdateId_hash(uint32_t o) {
21407 LDKMonitorUpdateId o_conv;
21408 o_conv.inner = (void*)(o & (~1));
21409 o_conv.is_owned = false;
21410 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21411 int64_t ret_val = MonitorUpdateId_hash(&o_conv);
21415 jboolean __attribute__((export_name("TS_MonitorUpdateId_eq"))) TS_MonitorUpdateId_eq(uint32_t a, uint32_t b) {
21416 LDKMonitorUpdateId a_conv;
21417 a_conv.inner = (void*)(a & (~1));
21418 a_conv.is_owned = false;
21419 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
21420 LDKMonitorUpdateId b_conv;
21421 b_conv.inner = (void*)(b & (~1));
21422 b_conv.is_owned = false;
21423 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
21424 jboolean ret_val = MonitorUpdateId_eq(&a_conv, &b_conv);
21428 void __attribute__((export_name("TS_Persist_free"))) TS_Persist_free(uint32_t this_ptr) {
21429 if ((this_ptr & 1) != 0) return;
21430 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
21431 CHECK_ACCESS(this_ptr_ptr);
21432 LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
21433 FREE((void*)this_ptr);
21434 Persist_free(this_ptr_conv);
21437 void __attribute__((export_name("TS_LockedChannelMonitor_free"))) TS_LockedChannelMonitor_free(uint32_t this_obj) {
21438 LDKLockedChannelMonitor this_obj_conv;
21439 this_obj_conv.inner = (void*)(this_obj & (~1));
21440 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21441 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21442 LockedChannelMonitor_free(this_obj_conv);
21445 void __attribute__((export_name("TS_ChainMonitor_free"))) TS_ChainMonitor_free(uint32_t this_obj) {
21446 LDKChainMonitor this_obj_conv;
21447 this_obj_conv.inner = (void*)(this_obj & (~1));
21448 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21449 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21450 ChainMonitor_free(this_obj_conv);
21453 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) {
21454 void* chain_source_ptr = (void*)(((uintptr_t)chain_source) & ~1);
21455 CHECK_ACCESS(chain_source_ptr);
21456 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
21457 // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
21458 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
21459 // Manually implement clone for Java trait instances
21461 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
21462 CHECK_ACCESS(broadcaster_ptr);
21463 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
21464 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
21465 CHECK_ACCESS(logger_ptr);
21466 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
21467 void* feeest_ptr = (void*)(((uintptr_t)feeest) & ~1);
21468 CHECK_ACCESS(feeest_ptr);
21469 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
21470 void* persister_ptr = (void*)(((uintptr_t)persister) & ~1);
21471 CHECK_ACCESS(persister_ptr);
21472 LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
21473 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
21474 uintptr_t ret_ref = 0;
21475 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21476 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21477 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21478 ret_ref = (uintptr_t)ret_var.inner;
21479 if (ret_var.is_owned) {
21485 uint32_tArray __attribute__((export_name("TS_ChainMonitor_get_claimable_balances"))) TS_ChainMonitor_get_claimable_balances(uint32_t this_arg, uint32_tArray ignored_channels) {
21486 LDKChainMonitor this_arg_conv;
21487 this_arg_conv.inner = (void*)(this_arg & (~1));
21488 this_arg_conv.is_owned = false;
21489 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21490 LDKCVec_ChannelDetailsZ ignored_channels_constr;
21491 ignored_channels_constr.datalen = ignored_channels->arr_len;
21492 if (ignored_channels_constr.datalen > 0)
21493 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
21495 ignored_channels_constr.data = NULL;
21496 uint32_t* ignored_channels_vals = ignored_channels->elems /* XXX ignored_channels leaks */;
21497 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
21498 uint32_t ignored_channels_conv_16 = ignored_channels_vals[q];
21499 LDKChannelDetails ignored_channels_conv_16_conv;
21500 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
21501 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
21502 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
21503 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
21504 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
21506 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
21507 uint32_tArray ret_arr = NULL;
21508 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
21509 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
21510 for (size_t j = 0; j < ret_var.datalen; j++) {
21511 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
21512 *ret_conv_9_copy = ret_var.data[j];
21513 uintptr_t ret_conv_9_ref = (uintptr_t)ret_conv_9_copy;
21514 ret_arr_ptr[j] = ret_conv_9_ref;
21517 FREE(ret_var.data);
21521 uint32_t __attribute__((export_name("TS_ChainMonitor_get_monitor"))) TS_ChainMonitor_get_monitor(uint32_t this_arg, uint32_t funding_txo) {
21522 LDKChainMonitor this_arg_conv;
21523 this_arg_conv.inner = (void*)(this_arg & (~1));
21524 this_arg_conv.is_owned = false;
21525 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21526 LDKOutPoint funding_txo_conv;
21527 funding_txo_conv.inner = (void*)(funding_txo & (~1));
21528 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
21529 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
21530 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
21531 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
21532 *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
21533 return (uintptr_t)ret_conv;
21536 uint32_tArray __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ChainMonitor_list_monitors(uint32_t this_arg) {
21537 LDKChainMonitor this_arg_conv;
21538 this_arg_conv.inner = (void*)(this_arg & (~1));
21539 this_arg_conv.is_owned = false;
21540 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21541 LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
21542 uint32_tArray ret_arr = NULL;
21543 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
21544 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
21545 for (size_t k = 0; k < ret_var.datalen; k++) {
21546 LDKOutPoint ret_conv_10_var = ret_var.data[k];
21547 uintptr_t ret_conv_10_ref = 0;
21548 CHECK((((uintptr_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21549 CHECK((((uintptr_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21550 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
21551 ret_conv_10_ref = (uintptr_t)ret_conv_10_var.inner;
21552 if (ret_conv_10_var.is_owned) {
21553 ret_conv_10_ref |= 1;
21555 ret_arr_ptr[k] = ret_conv_10_ref;
21558 FREE(ret_var.data);
21562 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) {
21563 LDKChainMonitor this_arg_conv;
21564 this_arg_conv.inner = (void*)(this_arg & (~1));
21565 this_arg_conv.is_owned = false;
21566 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21567 LDKOutPoint funding_txo_conv;
21568 funding_txo_conv.inner = (void*)(funding_txo & (~1));
21569 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
21570 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
21571 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
21572 LDKMonitorUpdateId completed_update_id_conv;
21573 completed_update_id_conv.inner = (void*)(completed_update_id & (~1));
21574 completed_update_id_conv.is_owned = (completed_update_id & 1) || (completed_update_id == 0);
21575 CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
21576 completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
21577 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
21578 *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
21579 return (uintptr_t)ret_conv;
21582 uint32_t __attribute__((export_name("TS_ChainMonitor_as_Listen"))) TS_ChainMonitor_as_Listen(uint32_t this_arg) {
21583 LDKChainMonitor this_arg_conv;
21584 this_arg_conv.inner = (void*)(this_arg & (~1));
21585 this_arg_conv.is_owned = false;
21586 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21587 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
21588 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
21589 return (uintptr_t)ret_ret;
21592 uint32_t __attribute__((export_name("TS_ChainMonitor_as_Confirm"))) TS_ChainMonitor_as_Confirm(uint32_t this_arg) {
21593 LDKChainMonitor this_arg_conv;
21594 this_arg_conv.inner = (void*)(this_arg & (~1));
21595 this_arg_conv.is_owned = false;
21596 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21597 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
21598 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
21599 return (uintptr_t)ret_ret;
21602 uint32_t __attribute__((export_name("TS_ChainMonitor_as_Watch"))) TS_ChainMonitor_as_Watch(uint32_t this_arg) {
21603 LDKChainMonitor this_arg_conv;
21604 this_arg_conv.inner = (void*)(this_arg & (~1));
21605 this_arg_conv.is_owned = false;
21606 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21607 LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
21608 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
21609 return (uintptr_t)ret_ret;
21612 uint32_t __attribute__((export_name("TS_ChainMonitor_as_EventsProvider"))) TS_ChainMonitor_as_EventsProvider(uint32_t this_arg) {
21613 LDKChainMonitor this_arg_conv;
21614 this_arg_conv.inner = (void*)(this_arg & (~1));
21615 this_arg_conv.is_owned = false;
21616 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21617 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
21618 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
21619 return (uintptr_t)ret_ret;
21622 void __attribute__((export_name("TS_ChannelMonitorUpdate_free"))) TS_ChannelMonitorUpdate_free(uint32_t this_obj) {
21623 LDKChannelMonitorUpdate this_obj_conv;
21624 this_obj_conv.inner = (void*)(this_obj & (~1));
21625 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21626 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21627 ChannelMonitorUpdate_free(this_obj_conv);
21630 int64_t __attribute__((export_name("TS_ChannelMonitorUpdate_get_update_id"))) TS_ChannelMonitorUpdate_get_update_id(uint32_t this_ptr) {
21631 LDKChannelMonitorUpdate this_ptr_conv;
21632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21633 this_ptr_conv.is_owned = false;
21634 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21635 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
21639 void __attribute__((export_name("TS_ChannelMonitorUpdate_set_update_id"))) TS_ChannelMonitorUpdate_set_update_id(uint32_t this_ptr, int64_t val) {
21640 LDKChannelMonitorUpdate this_ptr_conv;
21641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21642 this_ptr_conv.is_owned = false;
21643 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21644 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
21647 static inline uintptr_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
21648 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
21649 uintptr_t ret_ref = 0;
21650 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21651 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21652 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21653 ret_ref = (uintptr_t)ret_var.inner;
21654 if (ret_var.is_owned) {
21659 intptr_t __attribute__((export_name("TS_ChannelMonitorUpdate_clone_ptr"))) TS_ChannelMonitorUpdate_clone_ptr(uint32_t arg) {
21660 LDKChannelMonitorUpdate arg_conv;
21661 arg_conv.inner = (void*)(arg & (~1));
21662 arg_conv.is_owned = false;
21663 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21664 intptr_t ret_val = ChannelMonitorUpdate_clone_ptr(&arg_conv);
21668 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdate_clone"))) TS_ChannelMonitorUpdate_clone(uint32_t orig) {
21669 LDKChannelMonitorUpdate orig_conv;
21670 orig_conv.inner = (void*)(orig & (~1));
21671 orig_conv.is_owned = false;
21672 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21673 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
21674 uintptr_t ret_ref = 0;
21675 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21676 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21677 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21678 ret_ref = (uintptr_t)ret_var.inner;
21679 if (ret_var.is_owned) {
21685 int8_tArray __attribute__((export_name("TS_ChannelMonitorUpdate_write"))) TS_ChannelMonitorUpdate_write(uint32_t obj) {
21686 LDKChannelMonitorUpdate obj_conv;
21687 obj_conv.inner = (void*)(obj & (~1));
21688 obj_conv.is_owned = false;
21689 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
21690 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
21691 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21692 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21693 CVec_u8Z_free(ret_var);
21697 uint32_t __attribute__((export_name("TS_ChannelMonitorUpdate_read"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
21698 LDKu8slice ser_ref;
21699 ser_ref.datalen = ser->arr_len;
21700 ser_ref.data = ser->elems /* XXX ser leaks */;
21701 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
21702 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
21703 return (uintptr_t)ret_conv;
21706 void __attribute__((export_name("TS_MonitorEvent_free"))) TS_MonitorEvent_free(uint32_t this_ptr) {
21707 if ((this_ptr & 1) != 0) return;
21708 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
21709 CHECK_ACCESS(this_ptr_ptr);
21710 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
21711 FREE((void*)this_ptr);
21712 MonitorEvent_free(this_ptr_conv);
21715 static inline uintptr_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
21716 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
21717 *ret_copy = MonitorEvent_clone(arg);
21718 uintptr_t ret_ref = (uintptr_t)ret_copy;
21721 intptr_t __attribute__((export_name("TS_MonitorEvent_clone_ptr"))) TS_MonitorEvent_clone_ptr(uint32_t arg) {
21722 LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)arg;
21723 intptr_t ret_val = MonitorEvent_clone_ptr(arg_conv);
21727 uint32_t __attribute__((export_name("TS_MonitorEvent_clone"))) TS_MonitorEvent_clone(uint32_t orig) {
21728 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
21729 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
21730 *ret_copy = MonitorEvent_clone(orig_conv);
21731 uintptr_t ret_ref = (uintptr_t)ret_copy;
21735 uint32_t __attribute__((export_name("TS_MonitorEvent_htlcevent"))) TS_MonitorEvent_htlcevent(uint32_t a) {
21736 LDKHTLCUpdate a_conv;
21737 a_conv.inner = (void*)(a & (~1));
21738 a_conv.is_owned = (a & 1) || (a == 0);
21739 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
21740 a_conv = HTLCUpdate_clone(&a_conv);
21741 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
21742 *ret_copy = MonitorEvent_htlcevent(a_conv);
21743 uintptr_t ret_ref = (uintptr_t)ret_copy;
21747 uint32_t __attribute__((export_name("TS_MonitorEvent_commitment_tx_confirmed"))) TS_MonitorEvent_commitment_tx_confirmed(uint32_t a) {
21748 LDKOutPoint a_conv;
21749 a_conv.inner = (void*)(a & (~1));
21750 a_conv.is_owned = (a & 1) || (a == 0);
21751 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
21752 a_conv = OutPoint_clone(&a_conv);
21753 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
21754 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
21755 uintptr_t ret_ref = (uintptr_t)ret_copy;
21759 uint32_t __attribute__((export_name("TS_MonitorEvent_update_completed"))) TS_MonitorEvent_update_completed(uint32_t funding_txo, int64_t monitor_update_id) {
21760 LDKOutPoint funding_txo_conv;
21761 funding_txo_conv.inner = (void*)(funding_txo & (~1));
21762 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
21763 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
21764 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
21765 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
21766 *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id);
21767 uintptr_t ret_ref = (uintptr_t)ret_copy;
21771 uint32_t __attribute__((export_name("TS_MonitorEvent_update_failed"))) TS_MonitorEvent_update_failed(uint32_t a) {
21772 LDKOutPoint a_conv;
21773 a_conv.inner = (void*)(a & (~1));
21774 a_conv.is_owned = (a & 1) || (a == 0);
21775 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
21776 a_conv = OutPoint_clone(&a_conv);
21777 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
21778 *ret_copy = MonitorEvent_update_failed(a_conv);
21779 uintptr_t ret_ref = (uintptr_t)ret_copy;
21783 int8_tArray __attribute__((export_name("TS_MonitorEvent_write"))) TS_MonitorEvent_write(uint32_t obj) {
21784 LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)obj;
21785 LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
21786 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21787 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21788 CVec_u8Z_free(ret_var);
21792 uint32_t __attribute__((export_name("TS_MonitorEvent_read"))) TS_MonitorEvent_read(int8_tArray ser) {
21793 LDKu8slice ser_ref;
21794 ser_ref.datalen = ser->arr_len;
21795 ser_ref.data = ser->elems /* XXX ser leaks */;
21796 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
21797 *ret_conv = MonitorEvent_read(ser_ref);
21798 return (uintptr_t)ret_conv;
21801 void __attribute__((export_name("TS_HTLCUpdate_free"))) TS_HTLCUpdate_free(uint32_t this_obj) {
21802 LDKHTLCUpdate this_obj_conv;
21803 this_obj_conv.inner = (void*)(this_obj & (~1));
21804 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21805 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21806 HTLCUpdate_free(this_obj_conv);
21809 static inline uintptr_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
21810 LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
21811 uintptr_t ret_ref = 0;
21812 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21813 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21814 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21815 ret_ref = (uintptr_t)ret_var.inner;
21816 if (ret_var.is_owned) {
21821 intptr_t __attribute__((export_name("TS_HTLCUpdate_clone_ptr"))) TS_HTLCUpdate_clone_ptr(uint32_t arg) {
21822 LDKHTLCUpdate arg_conv;
21823 arg_conv.inner = (void*)(arg & (~1));
21824 arg_conv.is_owned = false;
21825 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21826 intptr_t ret_val = HTLCUpdate_clone_ptr(&arg_conv);
21830 uint32_t __attribute__((export_name("TS_HTLCUpdate_clone"))) TS_HTLCUpdate_clone(uint32_t orig) {
21831 LDKHTLCUpdate orig_conv;
21832 orig_conv.inner = (void*)(orig & (~1));
21833 orig_conv.is_owned = false;
21834 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21835 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
21836 uintptr_t ret_ref = 0;
21837 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21838 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21839 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21840 ret_ref = (uintptr_t)ret_var.inner;
21841 if (ret_var.is_owned) {
21847 int8_tArray __attribute__((export_name("TS_HTLCUpdate_write"))) TS_HTLCUpdate_write(uint32_t obj) {
21848 LDKHTLCUpdate obj_conv;
21849 obj_conv.inner = (void*)(obj & (~1));
21850 obj_conv.is_owned = false;
21851 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
21852 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
21853 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21854 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21855 CVec_u8Z_free(ret_var);
21859 uint32_t __attribute__((export_name("TS_HTLCUpdate_read"))) TS_HTLCUpdate_read(int8_tArray ser) {
21860 LDKu8slice ser_ref;
21861 ser_ref.datalen = ser->arr_len;
21862 ser_ref.data = ser->elems /* XXX ser leaks */;
21863 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
21864 *ret_conv = HTLCUpdate_read(ser_ref);
21865 return (uintptr_t)ret_conv;
21868 void __attribute__((export_name("TS_Balance_free"))) TS_Balance_free(uint32_t this_ptr) {
21869 if ((this_ptr & 1) != 0) return;
21870 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
21871 CHECK_ACCESS(this_ptr_ptr);
21872 LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
21873 FREE((void*)this_ptr);
21874 Balance_free(this_ptr_conv);
21877 static inline uintptr_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
21878 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
21879 *ret_copy = Balance_clone(arg);
21880 uintptr_t ret_ref = (uintptr_t)ret_copy;
21883 intptr_t __attribute__((export_name("TS_Balance_clone_ptr"))) TS_Balance_clone_ptr(uint32_t arg) {
21884 LDKBalance* arg_conv = (LDKBalance*)arg;
21885 intptr_t ret_val = Balance_clone_ptr(arg_conv);
21889 uint32_t __attribute__((export_name("TS_Balance_clone"))) TS_Balance_clone(uint32_t orig) {
21890 LDKBalance* orig_conv = (LDKBalance*)orig;
21891 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
21892 *ret_copy = Balance_clone(orig_conv);
21893 uintptr_t ret_ref = (uintptr_t)ret_copy;
21897 uint32_t __attribute__((export_name("TS_Balance_claimable_on_channel_close"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
21898 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
21899 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
21900 uintptr_t ret_ref = (uintptr_t)ret_copy;
21904 uint32_t __attribute__((export_name("TS_Balance_claimable_awaiting_confirmations"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
21905 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
21906 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
21907 uintptr_t ret_ref = (uintptr_t)ret_copy;
21911 uint32_t __attribute__((export_name("TS_Balance_contentious_claimable"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
21912 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
21913 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
21914 uintptr_t ret_ref = (uintptr_t)ret_copy;
21918 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) {
21919 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
21920 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
21921 uintptr_t ret_ref = (uintptr_t)ret_copy;
21925 jboolean __attribute__((export_name("TS_Balance_eq"))) TS_Balance_eq(uint32_t a, uint32_t b) {
21926 LDKBalance* a_conv = (LDKBalance*)a;
21927 LDKBalance* b_conv = (LDKBalance*)b;
21928 jboolean ret_val = Balance_eq(a_conv, b_conv);
21932 void __attribute__((export_name("TS_ChannelMonitor_free"))) TS_ChannelMonitor_free(uint32_t this_obj) {
21933 LDKChannelMonitor this_obj_conv;
21934 this_obj_conv.inner = (void*)(this_obj & (~1));
21935 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21936 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21937 ChannelMonitor_free(this_obj_conv);
21940 static inline uintptr_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
21941 LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
21942 uintptr_t ret_ref = 0;
21943 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21944 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21945 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21946 ret_ref = (uintptr_t)ret_var.inner;
21947 if (ret_var.is_owned) {
21952 intptr_t __attribute__((export_name("TS_ChannelMonitor_clone_ptr"))) TS_ChannelMonitor_clone_ptr(uint32_t arg) {
21953 LDKChannelMonitor arg_conv;
21954 arg_conv.inner = (void*)(arg & (~1));
21955 arg_conv.is_owned = false;
21956 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21957 intptr_t ret_val = ChannelMonitor_clone_ptr(&arg_conv);
21961 uint32_t __attribute__((export_name("TS_ChannelMonitor_clone"))) TS_ChannelMonitor_clone(uint32_t orig) {
21962 LDKChannelMonitor orig_conv;
21963 orig_conv.inner = (void*)(orig & (~1));
21964 orig_conv.is_owned = false;
21965 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21966 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
21967 uintptr_t ret_ref = 0;
21968 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21969 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21970 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21971 ret_ref = (uintptr_t)ret_var.inner;
21972 if (ret_var.is_owned) {
21978 int8_tArray __attribute__((export_name("TS_ChannelMonitor_write"))) TS_ChannelMonitor_write(uint32_t obj) {
21979 LDKChannelMonitor obj_conv;
21980 obj_conv.inner = (void*)(obj & (~1));
21981 obj_conv.is_owned = false;
21982 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
21983 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
21984 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21985 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21986 CVec_u8Z_free(ret_var);
21990 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) {
21991 LDKChannelMonitor this_arg_conv;
21992 this_arg_conv.inner = (void*)(this_arg & (~1));
21993 this_arg_conv.is_owned = false;
21994 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21995 LDKChannelMonitorUpdate updates_conv;
21996 updates_conv.inner = (void*)(updates & (~1));
21997 updates_conv.is_owned = false;
21998 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
21999 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
22000 if (!(broadcaster & 1)) { CHECK_ACCESS(broadcaster_ptr); }
22001 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
22002 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
22003 if (!(fee_estimator & 1)) { CHECK_ACCESS(fee_estimator_ptr); }
22004 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
22005 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
22006 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
22007 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
22008 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
22009 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
22010 return (uintptr_t)ret_conv;
22013 int64_t __attribute__((export_name("TS_ChannelMonitor_get_latest_update_id"))) TS_ChannelMonitor_get_latest_update_id(uint32_t this_arg) {
22014 LDKChannelMonitor this_arg_conv;
22015 this_arg_conv.inner = (void*)(this_arg & (~1));
22016 this_arg_conv.is_owned = false;
22017 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22018 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
22022 uint32_t __attribute__((export_name("TS_ChannelMonitor_get_funding_txo"))) TS_ChannelMonitor_get_funding_txo(uint32_t this_arg) {
22023 LDKChannelMonitor this_arg_conv;
22024 this_arg_conv.inner = (void*)(this_arg & (~1));
22025 this_arg_conv.is_owned = false;
22026 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22027 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
22028 *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
22029 return ((uintptr_t)ret_conv);
22032 uint32_tArray __attribute__((export_name("TS_ChannelMonitor_get_outputs_to_watch"))) TS_ChannelMonitor_get_outputs_to_watch(uint32_t this_arg) {
22033 LDKChannelMonitor this_arg_conv;
22034 this_arg_conv.inner = (void*)(this_arg & (~1));
22035 this_arg_conv.is_owned = false;
22036 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22037 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
22038 uint32_tArray ret_arr = NULL;
22039 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
22040 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
22041 for (size_t o = 0; o < ret_var.datalen; o++) {
22042 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
22043 *ret_conv_40_conv = ret_var.data[o];
22044 ret_arr_ptr[o] = ((uintptr_t)ret_conv_40_conv);
22047 FREE(ret_var.data);
22051 void __attribute__((export_name("TS_ChannelMonitor_load_outputs_to_watch"))) TS_ChannelMonitor_load_outputs_to_watch(uint32_t this_arg, uint32_t filter) {
22052 LDKChannelMonitor this_arg_conv;
22053 this_arg_conv.inner = (void*)(this_arg & (~1));
22054 this_arg_conv.is_owned = false;
22055 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22056 void* filter_ptr = (void*)(((uintptr_t)filter) & ~1);
22057 if (!(filter & 1)) { CHECK_ACCESS(filter_ptr); }
22058 LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
22059 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
22062 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) {
22063 LDKChannelMonitor this_arg_conv;
22064 this_arg_conv.inner = (void*)(this_arg & (~1));
22065 this_arg_conv.is_owned = false;
22066 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22067 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
22068 uint32_tArray ret_arr = NULL;
22069 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
22070 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
22071 for (size_t o = 0; o < ret_var.datalen; o++) {
22072 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
22073 *ret_conv_14_copy = ret_var.data[o];
22074 uintptr_t ret_conv_14_ref = (uintptr_t)ret_conv_14_copy;
22075 ret_arr_ptr[o] = ret_conv_14_ref;
22078 FREE(ret_var.data);
22082 uint32_tArray __attribute__((export_name("TS_ChannelMonitor_get_and_clear_pending_events"))) TS_ChannelMonitor_get_and_clear_pending_events(uint32_t this_arg) {
22083 LDKChannelMonitor this_arg_conv;
22084 this_arg_conv.inner = (void*)(this_arg & (~1));
22085 this_arg_conv.is_owned = false;
22086 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22087 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
22088 uint32_tArray ret_arr = NULL;
22089 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
22090 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
22091 for (size_t h = 0; h < ret_var.datalen; h++) {
22092 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22093 *ret_conv_7_copy = ret_var.data[h];
22094 uintptr_t ret_conv_7_ref = (uintptr_t)ret_conv_7_copy;
22095 ret_arr_ptr[h] = ret_conv_7_ref;
22098 FREE(ret_var.data);
22102 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) {
22103 LDKChannelMonitor this_arg_conv;
22104 this_arg_conv.inner = (void*)(this_arg & (~1));
22105 this_arg_conv.is_owned = false;
22106 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22107 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
22108 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
22109 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
22110 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
22111 ptrArray ret_arr = NULL;
22112 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
22113 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
22114 for (size_t m = 0; m < ret_var.datalen; m++) {
22115 LDKTransaction ret_conv_12_var = ret_var.data[m];
22116 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
22117 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
22118 Transaction_free(ret_conv_12_var);
22119 ret_arr_ptr[m] = ret_conv_12_arr;
22122 FREE(ret_var.data);
22126 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) {
22127 LDKChannelMonitor this_arg_conv;
22128 this_arg_conv.inner = (void*)(this_arg & (~1));
22129 this_arg_conv.is_owned = false;
22130 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22131 unsigned char header_arr[80];
22132 CHECK(header->arr_len == 80);
22133 memcpy(header_arr, header->elems, 80); FREE(header);
22134 unsigned char (*header_ref)[80] = &header_arr;
22135 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
22136 txdata_constr.datalen = txdata->arr_len;
22137 if (txdata_constr.datalen > 0)
22138 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
22140 txdata_constr.data = NULL;
22141 uint32_t* txdata_vals = txdata->elems /* XXX txdata leaks */;
22142 for (size_t c = 0; c < txdata_constr.datalen; c++) {
22143 uint32_t txdata_conv_28 = txdata_vals[c];
22144 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
22145 CHECK_ACCESS(txdata_conv_28_ptr);
22146 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
22147 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
22148 txdata_constr.data[c] = txdata_conv_28_conv;
22150 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
22151 CHECK_ACCESS(broadcaster_ptr);
22152 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
22153 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
22154 CHECK_ACCESS(fee_estimator_ptr);
22155 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
22156 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
22157 CHECK_ACCESS(logger_ptr);
22158 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
22159 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);
22160 uint32_tArray ret_arr = NULL;
22161 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
22162 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
22163 for (size_t n = 0; n < ret_var.datalen; n++) {
22164 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
22165 *ret_conv_39_conv = ret_var.data[n];
22166 ret_arr_ptr[n] = ((uintptr_t)ret_conv_39_conv);
22169 FREE(ret_var.data);
22173 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) {
22174 LDKChannelMonitor this_arg_conv;
22175 this_arg_conv.inner = (void*)(this_arg & (~1));
22176 this_arg_conv.is_owned = false;
22177 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22178 unsigned char header_arr[80];
22179 CHECK(header->arr_len == 80);
22180 memcpy(header_arr, header->elems, 80); FREE(header);
22181 unsigned char (*header_ref)[80] = &header_arr;
22182 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
22183 CHECK_ACCESS(broadcaster_ptr);
22184 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
22185 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
22186 CHECK_ACCESS(fee_estimator_ptr);
22187 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
22188 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
22189 CHECK_ACCESS(logger_ptr);
22190 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
22191 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
22194 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) {
22195 LDKChannelMonitor this_arg_conv;
22196 this_arg_conv.inner = (void*)(this_arg & (~1));
22197 this_arg_conv.is_owned = false;
22198 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22199 unsigned char header_arr[80];
22200 CHECK(header->arr_len == 80);
22201 memcpy(header_arr, header->elems, 80); FREE(header);
22202 unsigned char (*header_ref)[80] = &header_arr;
22203 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
22204 txdata_constr.datalen = txdata->arr_len;
22205 if (txdata_constr.datalen > 0)
22206 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
22208 txdata_constr.data = NULL;
22209 uint32_t* txdata_vals = txdata->elems /* XXX txdata leaks */;
22210 for (size_t c = 0; c < txdata_constr.datalen; c++) {
22211 uint32_t txdata_conv_28 = txdata_vals[c];
22212 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
22213 CHECK_ACCESS(txdata_conv_28_ptr);
22214 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
22215 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
22216 txdata_constr.data[c] = txdata_conv_28_conv;
22218 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
22219 CHECK_ACCESS(broadcaster_ptr);
22220 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
22221 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
22222 CHECK_ACCESS(fee_estimator_ptr);
22223 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
22224 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
22225 CHECK_ACCESS(logger_ptr);
22226 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
22227 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);
22228 uint32_tArray ret_arr = NULL;
22229 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
22230 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
22231 for (size_t n = 0; n < ret_var.datalen; n++) {
22232 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
22233 *ret_conv_39_conv = ret_var.data[n];
22234 ret_arr_ptr[n] = ((uintptr_t)ret_conv_39_conv);
22237 FREE(ret_var.data);
22241 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) {
22242 LDKChannelMonitor this_arg_conv;
22243 this_arg_conv.inner = (void*)(this_arg & (~1));
22244 this_arg_conv.is_owned = false;
22245 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22246 unsigned char txid_arr[32];
22247 CHECK(txid->arr_len == 32);
22248 memcpy(txid_arr, txid->elems, 32); FREE(txid);
22249 unsigned char (*txid_ref)[32] = &txid_arr;
22250 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
22251 CHECK_ACCESS(broadcaster_ptr);
22252 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
22253 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
22254 CHECK_ACCESS(fee_estimator_ptr);
22255 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
22256 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
22257 CHECK_ACCESS(logger_ptr);
22258 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
22259 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
22262 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) {
22263 LDKChannelMonitor this_arg_conv;
22264 this_arg_conv.inner = (void*)(this_arg & (~1));
22265 this_arg_conv.is_owned = false;
22266 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22267 unsigned char header_arr[80];
22268 CHECK(header->arr_len == 80);
22269 memcpy(header_arr, header->elems, 80); FREE(header);
22270 unsigned char (*header_ref)[80] = &header_arr;
22271 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
22272 CHECK_ACCESS(broadcaster_ptr);
22273 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
22274 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
22275 CHECK_ACCESS(fee_estimator_ptr);
22276 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
22277 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
22278 CHECK_ACCESS(logger_ptr);
22279 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
22280 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
22281 uint32_tArray ret_arr = NULL;
22282 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
22283 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
22284 for (size_t n = 0; n < ret_var.datalen; n++) {
22285 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
22286 *ret_conv_39_conv = ret_var.data[n];
22287 ret_arr_ptr[n] = ((uintptr_t)ret_conv_39_conv);
22290 FREE(ret_var.data);
22294 ptrArray __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint32_t this_arg) {
22295 LDKChannelMonitor this_arg_conv;
22296 this_arg_conv.inner = (void*)(this_arg & (~1));
22297 this_arg_conv.is_owned = false;
22298 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22299 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
22300 ptrArray ret_arr = NULL;
22301 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
22302 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
22303 for (size_t m = 0; m < ret_var.datalen; m++) {
22304 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
22305 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
22306 ret_arr_ptr[m] = ret_conv_12_arr;
22309 FREE(ret_var.data);
22313 uint32_t __attribute__((export_name("TS_ChannelMonitor_current_best_block"))) TS_ChannelMonitor_current_best_block(uint32_t this_arg) {
22314 LDKChannelMonitor this_arg_conv;
22315 this_arg_conv.inner = (void*)(this_arg & (~1));
22316 this_arg_conv.is_owned = false;
22317 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22318 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
22319 uintptr_t ret_ref = 0;
22320 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22321 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22322 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22323 ret_ref = (uintptr_t)ret_var.inner;
22324 if (ret_var.is_owned) {
22330 uint32_tArray __attribute__((export_name("TS_ChannelMonitor_get_claimable_balances"))) TS_ChannelMonitor_get_claimable_balances(uint32_t this_arg) {
22331 LDKChannelMonitor this_arg_conv;
22332 this_arg_conv.inner = (void*)(this_arg & (~1));
22333 this_arg_conv.is_owned = false;
22334 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22335 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
22336 uint32_tArray ret_arr = NULL;
22337 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
22338 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
22339 for (size_t j = 0; j < ret_var.datalen; j++) {
22340 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
22341 *ret_conv_9_copy = ret_var.data[j];
22342 uintptr_t ret_conv_9_ref = (uintptr_t)ret_conv_9_copy;
22343 ret_arr_ptr[j] = ret_conv_9_ref;
22346 FREE(ret_var.data);
22350 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_read"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint32_t arg) {
22351 LDKu8slice ser_ref;
22352 ser_ref.datalen = ser->arr_len;
22353 ser_ref.data = ser->elems /* XXX ser leaks */;
22354 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
22355 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
22356 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
22357 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
22358 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
22359 return (uintptr_t)ret_conv;
22362 void __attribute__((export_name("TS_OutPoint_free"))) TS_OutPoint_free(uint32_t this_obj) {
22363 LDKOutPoint this_obj_conv;
22364 this_obj_conv.inner = (void*)(this_obj & (~1));
22365 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22366 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22367 OutPoint_free(this_obj_conv);
22370 int8_tArray __attribute__((export_name("TS_OutPoint_get_txid"))) TS_OutPoint_get_txid(uint32_t this_ptr) {
22371 LDKOutPoint this_ptr_conv;
22372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22373 this_ptr_conv.is_owned = false;
22374 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22375 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
22376 memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
22380 void __attribute__((export_name("TS_OutPoint_set_txid"))) TS_OutPoint_set_txid(uint32_t this_ptr, int8_tArray val) {
22381 LDKOutPoint this_ptr_conv;
22382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22383 this_ptr_conv.is_owned = false;
22384 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22385 LDKThirtyTwoBytes val_ref;
22386 CHECK(val->arr_len == 32);
22387 memcpy(val_ref.data, val->elems, 32); FREE(val);
22388 OutPoint_set_txid(&this_ptr_conv, val_ref);
22391 int16_t __attribute__((export_name("TS_OutPoint_get_index"))) TS_OutPoint_get_index(uint32_t this_ptr) {
22392 LDKOutPoint this_ptr_conv;
22393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22394 this_ptr_conv.is_owned = false;
22395 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22396 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
22400 void __attribute__((export_name("TS_OutPoint_set_index"))) TS_OutPoint_set_index(uint32_t this_ptr, int16_t val) {
22401 LDKOutPoint this_ptr_conv;
22402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22403 this_ptr_conv.is_owned = false;
22404 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22405 OutPoint_set_index(&this_ptr_conv, val);
22408 uint32_t __attribute__((export_name("TS_OutPoint_new"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
22409 LDKThirtyTwoBytes txid_arg_ref;
22410 CHECK(txid_arg->arr_len == 32);
22411 memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
22412 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
22413 uintptr_t ret_ref = 0;
22414 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22415 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22416 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22417 ret_ref = (uintptr_t)ret_var.inner;
22418 if (ret_var.is_owned) {
22424 static inline uintptr_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
22425 LDKOutPoint ret_var = OutPoint_clone(arg);
22426 uintptr_t ret_ref = 0;
22427 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22428 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22429 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22430 ret_ref = (uintptr_t)ret_var.inner;
22431 if (ret_var.is_owned) {
22436 intptr_t __attribute__((export_name("TS_OutPoint_clone_ptr"))) TS_OutPoint_clone_ptr(uint32_t arg) {
22437 LDKOutPoint arg_conv;
22438 arg_conv.inner = (void*)(arg & (~1));
22439 arg_conv.is_owned = false;
22440 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22441 intptr_t ret_val = OutPoint_clone_ptr(&arg_conv);
22445 uint32_t __attribute__((export_name("TS_OutPoint_clone"))) TS_OutPoint_clone(uint32_t orig) {
22446 LDKOutPoint orig_conv;
22447 orig_conv.inner = (void*)(orig & (~1));
22448 orig_conv.is_owned = false;
22449 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22450 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
22451 uintptr_t ret_ref = 0;
22452 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22453 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22454 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22455 ret_ref = (uintptr_t)ret_var.inner;
22456 if (ret_var.is_owned) {
22462 jboolean __attribute__((export_name("TS_OutPoint_eq"))) TS_OutPoint_eq(uint32_t a, uint32_t b) {
22463 LDKOutPoint a_conv;
22464 a_conv.inner = (void*)(a & (~1));
22465 a_conv.is_owned = false;
22466 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22467 LDKOutPoint b_conv;
22468 b_conv.inner = (void*)(b & (~1));
22469 b_conv.is_owned = false;
22470 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
22471 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
22475 int64_t __attribute__((export_name("TS_OutPoint_hash"))) TS_OutPoint_hash(uint32_t o) {
22476 LDKOutPoint o_conv;
22477 o_conv.inner = (void*)(o & (~1));
22478 o_conv.is_owned = false;
22479 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22480 int64_t ret_val = OutPoint_hash(&o_conv);
22484 int8_tArray __attribute__((export_name("TS_OutPoint_to_channel_id"))) TS_OutPoint_to_channel_id(uint32_t this_arg) {
22485 LDKOutPoint this_arg_conv;
22486 this_arg_conv.inner = (void*)(this_arg & (~1));
22487 this_arg_conv.is_owned = false;
22488 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22489 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
22490 memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
22494 int8_tArray __attribute__((export_name("TS_OutPoint_write"))) TS_OutPoint_write(uint32_t obj) {
22495 LDKOutPoint obj_conv;
22496 obj_conv.inner = (void*)(obj & (~1));
22497 obj_conv.is_owned = false;
22498 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
22499 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
22500 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22501 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22502 CVec_u8Z_free(ret_var);
22506 uint32_t __attribute__((export_name("TS_OutPoint_read"))) TS_OutPoint_read(int8_tArray ser) {
22507 LDKu8slice ser_ref;
22508 ser_ref.datalen = ser->arr_len;
22509 ser_ref.data = ser->elems /* XXX ser leaks */;
22510 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
22511 *ret_conv = OutPoint_read(ser_ref);
22512 return (uintptr_t)ret_conv;
22515 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_free"))) TS_DelayedPaymentOutputDescriptor_free(uint32_t this_obj) {
22516 LDKDelayedPaymentOutputDescriptor this_obj_conv;
22517 this_obj_conv.inner = (void*)(this_obj & (~1));
22518 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22519 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22520 DelayedPaymentOutputDescriptor_free(this_obj_conv);
22523 uint32_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_outpoint"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
22524 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
22525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22526 this_ptr_conv.is_owned = false;
22527 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22528 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
22529 uintptr_t ret_ref = 0;
22530 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22531 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22532 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22533 ret_ref = (uintptr_t)ret_var.inner;
22534 if (ret_var.is_owned) {
22540 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_outpoint"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
22541 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
22542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22543 this_ptr_conv.is_owned = false;
22544 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22545 LDKOutPoint val_conv;
22546 val_conv.inner = (void*)(val & (~1));
22547 val_conv.is_owned = (val & 1) || (val == 0);
22548 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
22549 val_conv = OutPoint_clone(&val_conv);
22550 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
22553 int8_tArray __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint32_t this_ptr) {
22554 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
22555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22556 this_ptr_conv.is_owned = false;
22557 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22558 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
22559 memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
22563 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
22564 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
22565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22566 this_ptr_conv.is_owned = false;
22567 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22568 LDKPublicKey val_ref;
22569 CHECK(val->arr_len == 33);
22570 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
22571 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
22574 int16_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint32_t this_ptr) {
22575 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
22576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22577 this_ptr_conv.is_owned = false;
22578 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22579 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
22583 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint32_t this_ptr, int16_t val) {
22584 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
22585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22586 this_ptr_conv.is_owned = false;
22587 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22588 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
22591 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_output"))) TS_DelayedPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
22592 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
22593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22594 this_ptr_conv.is_owned = false;
22595 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22596 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
22597 CHECK_ACCESS(val_ptr);
22598 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
22599 val_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)val) & ~1));
22600 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
22603 int8_tArray __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint32_t this_ptr) {
22604 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
22605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22606 this_ptr_conv.is_owned = false;
22607 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22608 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
22609 memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
22613 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint32_t this_ptr, int8_tArray val) {
22614 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
22615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22616 this_ptr_conv.is_owned = false;
22617 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22618 LDKPublicKey val_ref;
22619 CHECK(val->arr_len == 33);
22620 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
22621 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
22624 int8_tArray __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
22625 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
22626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22627 this_ptr_conv.is_owned = false;
22628 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22629 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
22630 memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
22634 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
22635 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
22636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22637 this_ptr_conv.is_owned = false;
22638 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22639 LDKThirtyTwoBytes val_ref;
22640 CHECK(val->arr_len == 32);
22641 memcpy(val_ref.data, val->elems, 32); FREE(val);
22642 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
22645 int64_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
22646 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
22647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22648 this_ptr_conv.is_owned = false;
22649 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22650 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
22654 void __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
22655 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
22656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22657 this_ptr_conv.is_owned = false;
22658 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22659 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
22662 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) {
22663 LDKOutPoint outpoint_arg_conv;
22664 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
22665 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
22666 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
22667 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
22668 LDKPublicKey per_commitment_point_arg_ref;
22669 CHECK(per_commitment_point_arg->arr_len == 33);
22670 memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
22671 void* output_arg_ptr = (void*)(((uintptr_t)output_arg) & ~1);
22672 CHECK_ACCESS(output_arg_ptr);
22673 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
22674 output_arg_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output_arg) & ~1));
22675 LDKPublicKey revocation_pubkey_arg_ref;
22676 CHECK(revocation_pubkey_arg->arr_len == 33);
22677 memcpy(revocation_pubkey_arg_ref.compressed_form, revocation_pubkey_arg->elems, 33); FREE(revocation_pubkey_arg);
22678 LDKThirtyTwoBytes channel_keys_id_arg_ref;
22679 CHECK(channel_keys_id_arg->arr_len == 32);
22680 memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
22681 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);
22682 uintptr_t ret_ref = 0;
22683 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22684 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22685 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22686 ret_ref = (uintptr_t)ret_var.inner;
22687 if (ret_var.is_owned) {
22693 static inline uintptr_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
22694 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
22695 uintptr_t ret_ref = 0;
22696 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22697 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22698 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22699 ret_ref = (uintptr_t)ret_var.inner;
22700 if (ret_var.is_owned) {
22705 intptr_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone_ptr"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint32_t arg) {
22706 LDKDelayedPaymentOutputDescriptor arg_conv;
22707 arg_conv.inner = (void*)(arg & (~1));
22708 arg_conv.is_owned = false;
22709 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22710 intptr_t ret_val = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
22714 uint32_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone"))) TS_DelayedPaymentOutputDescriptor_clone(uint32_t orig) {
22715 LDKDelayedPaymentOutputDescriptor orig_conv;
22716 orig_conv.inner = (void*)(orig & (~1));
22717 orig_conv.is_owned = false;
22718 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22719 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
22720 uintptr_t ret_ref = 0;
22721 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22722 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22723 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22724 ret_ref = (uintptr_t)ret_var.inner;
22725 if (ret_var.is_owned) {
22731 int8_tArray __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_write"))) TS_DelayedPaymentOutputDescriptor_write(uint32_t obj) {
22732 LDKDelayedPaymentOutputDescriptor obj_conv;
22733 obj_conv.inner = (void*)(obj & (~1));
22734 obj_conv.is_owned = false;
22735 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
22736 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
22737 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22738 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22739 CVec_u8Z_free(ret_var);
22743 uint32_t __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_read"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
22744 LDKu8slice ser_ref;
22745 ser_ref.datalen = ser->arr_len;
22746 ser_ref.data = ser->elems /* XXX ser leaks */;
22747 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
22748 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
22749 return (uintptr_t)ret_conv;
22752 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_free"))) TS_StaticPaymentOutputDescriptor_free(uint32_t this_obj) {
22753 LDKStaticPaymentOutputDescriptor this_obj_conv;
22754 this_obj_conv.inner = (void*)(this_obj & (~1));
22755 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22756 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22757 StaticPaymentOutputDescriptor_free(this_obj_conv);
22760 uint32_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_outpoint"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
22761 LDKStaticPaymentOutputDescriptor this_ptr_conv;
22762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22763 this_ptr_conv.is_owned = false;
22764 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22765 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
22766 uintptr_t ret_ref = 0;
22767 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22768 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22769 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22770 ret_ref = (uintptr_t)ret_var.inner;
22771 if (ret_var.is_owned) {
22777 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_outpoint"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
22778 LDKStaticPaymentOutputDescriptor this_ptr_conv;
22779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22780 this_ptr_conv.is_owned = false;
22781 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22782 LDKOutPoint val_conv;
22783 val_conv.inner = (void*)(val & (~1));
22784 val_conv.is_owned = (val & 1) || (val == 0);
22785 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
22786 val_conv = OutPoint_clone(&val_conv);
22787 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
22790 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_output"))) TS_StaticPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
22791 LDKStaticPaymentOutputDescriptor this_ptr_conv;
22792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22793 this_ptr_conv.is_owned = false;
22794 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22795 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
22796 CHECK_ACCESS(val_ptr);
22797 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
22798 val_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)val) & ~1));
22799 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
22802 int8_tArray __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
22803 LDKStaticPaymentOutputDescriptor this_ptr_conv;
22804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22805 this_ptr_conv.is_owned = false;
22806 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22807 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
22808 memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
22812 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
22813 LDKStaticPaymentOutputDescriptor this_ptr_conv;
22814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22815 this_ptr_conv.is_owned = false;
22816 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22817 LDKThirtyTwoBytes val_ref;
22818 CHECK(val->arr_len == 32);
22819 memcpy(val_ref.data, val->elems, 32); FREE(val);
22820 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
22823 int64_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
22824 LDKStaticPaymentOutputDescriptor this_ptr_conv;
22825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22826 this_ptr_conv.is_owned = false;
22827 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22828 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
22832 void __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
22833 LDKStaticPaymentOutputDescriptor this_ptr_conv;
22834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22835 this_ptr_conv.is_owned = false;
22836 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22837 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
22840 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) {
22841 LDKOutPoint outpoint_arg_conv;
22842 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
22843 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
22844 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
22845 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
22846 void* output_arg_ptr = (void*)(((uintptr_t)output_arg) & ~1);
22847 CHECK_ACCESS(output_arg_ptr);
22848 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
22849 output_arg_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output_arg) & ~1));
22850 LDKThirtyTwoBytes channel_keys_id_arg_ref;
22851 CHECK(channel_keys_id_arg->arr_len == 32);
22852 memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
22853 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
22854 uintptr_t ret_ref = 0;
22855 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22856 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22857 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22858 ret_ref = (uintptr_t)ret_var.inner;
22859 if (ret_var.is_owned) {
22865 static inline uintptr_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
22866 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
22867 uintptr_t ret_ref = 0;
22868 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22869 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22870 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22871 ret_ref = (uintptr_t)ret_var.inner;
22872 if (ret_var.is_owned) {
22877 intptr_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone_ptr"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint32_t arg) {
22878 LDKStaticPaymentOutputDescriptor arg_conv;
22879 arg_conv.inner = (void*)(arg & (~1));
22880 arg_conv.is_owned = false;
22881 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22882 intptr_t ret_val = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
22886 uint32_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone"))) TS_StaticPaymentOutputDescriptor_clone(uint32_t orig) {
22887 LDKStaticPaymentOutputDescriptor orig_conv;
22888 orig_conv.inner = (void*)(orig & (~1));
22889 orig_conv.is_owned = false;
22890 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22891 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
22892 uintptr_t ret_ref = 0;
22893 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22894 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22895 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22896 ret_ref = (uintptr_t)ret_var.inner;
22897 if (ret_var.is_owned) {
22903 int8_tArray __attribute__((export_name("TS_StaticPaymentOutputDescriptor_write"))) TS_StaticPaymentOutputDescriptor_write(uint32_t obj) {
22904 LDKStaticPaymentOutputDescriptor obj_conv;
22905 obj_conv.inner = (void*)(obj & (~1));
22906 obj_conv.is_owned = false;
22907 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
22908 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
22909 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22910 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22911 CVec_u8Z_free(ret_var);
22915 uint32_t __attribute__((export_name("TS_StaticPaymentOutputDescriptor_read"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
22916 LDKu8slice ser_ref;
22917 ser_ref.datalen = ser->arr_len;
22918 ser_ref.data = ser->elems /* XXX ser leaks */;
22919 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
22920 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
22921 return (uintptr_t)ret_conv;
22924 void __attribute__((export_name("TS_SpendableOutputDescriptor_free"))) TS_SpendableOutputDescriptor_free(uint32_t this_ptr) {
22925 if ((this_ptr & 1) != 0) return;
22926 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22927 CHECK_ACCESS(this_ptr_ptr);
22928 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
22929 FREE((void*)this_ptr);
22930 SpendableOutputDescriptor_free(this_ptr_conv);
22933 static inline uintptr_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
22934 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
22935 *ret_copy = SpendableOutputDescriptor_clone(arg);
22936 uintptr_t ret_ref = (uintptr_t)ret_copy;
22939 intptr_t __attribute__((export_name("TS_SpendableOutputDescriptor_clone_ptr"))) TS_SpendableOutputDescriptor_clone_ptr(uint32_t arg) {
22940 LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)arg;
22941 intptr_t ret_val = SpendableOutputDescriptor_clone_ptr(arg_conv);
22945 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_clone"))) TS_SpendableOutputDescriptor_clone(uint32_t orig) {
22946 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
22947 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
22948 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
22949 uintptr_t ret_ref = (uintptr_t)ret_copy;
22953 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_static_output"))) TS_SpendableOutputDescriptor_static_output(uint32_t outpoint, uint32_t output) {
22954 LDKOutPoint outpoint_conv;
22955 outpoint_conv.inner = (void*)(outpoint & (~1));
22956 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
22957 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
22958 outpoint_conv = OutPoint_clone(&outpoint_conv);
22959 void* output_ptr = (void*)(((uintptr_t)output) & ~1);
22960 CHECK_ACCESS(output_ptr);
22961 LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
22962 output_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output) & ~1));
22963 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
22964 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
22965 uintptr_t ret_ref = (uintptr_t)ret_copy;
22969 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_delayed_payment_output"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint32_t a) {
22970 LDKDelayedPaymentOutputDescriptor a_conv;
22971 a_conv.inner = (void*)(a & (~1));
22972 a_conv.is_owned = (a & 1) || (a == 0);
22973 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22974 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
22975 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
22976 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
22977 uintptr_t ret_ref = (uintptr_t)ret_copy;
22981 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_static_payment_output"))) TS_SpendableOutputDescriptor_static_payment_output(uint32_t a) {
22982 LDKStaticPaymentOutputDescriptor a_conv;
22983 a_conv.inner = (void*)(a & (~1));
22984 a_conv.is_owned = (a & 1) || (a == 0);
22985 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22986 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
22987 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
22988 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
22989 uintptr_t ret_ref = (uintptr_t)ret_copy;
22993 int8_tArray __attribute__((export_name("TS_SpendableOutputDescriptor_write"))) TS_SpendableOutputDescriptor_write(uint32_t obj) {
22994 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
22995 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
22996 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22997 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22998 CVec_u8Z_free(ret_var);
23002 uint32_t __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
23003 LDKu8slice ser_ref;
23004 ser_ref.datalen = ser->arr_len;
23005 ser_ref.data = ser->elems /* XXX ser leaks */;
23006 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
23007 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
23008 return (uintptr_t)ret_conv;
23011 void __attribute__((export_name("TS_BaseSign_free"))) TS_BaseSign_free(uint32_t this_ptr) {
23012 if ((this_ptr & 1) != 0) return;
23013 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23014 CHECK_ACCESS(this_ptr_ptr);
23015 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
23016 FREE((void*)this_ptr);
23017 BaseSign_free(this_ptr_conv);
23020 static inline uintptr_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
23021 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
23022 *ret_ret = Sign_clone(arg);
23023 return (uintptr_t)ret_ret;
23025 intptr_t __attribute__((export_name("TS_Sign_clone_ptr"))) TS_Sign_clone_ptr(uint32_t arg) {
23026 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
23027 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
23028 LDKSign* arg_conv = (LDKSign*)arg_ptr;
23029 intptr_t ret_val = Sign_clone_ptr(arg_conv);
23033 uint32_t __attribute__((export_name("TS_Sign_clone"))) TS_Sign_clone(uint32_t orig) {
23034 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
23035 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
23036 LDKSign* orig_conv = (LDKSign*)orig_ptr;
23037 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
23038 *ret_ret = Sign_clone(orig_conv);
23039 return (uintptr_t)ret_ret;
23042 void __attribute__((export_name("TS_Sign_free"))) TS_Sign_free(uint32_t this_ptr) {
23043 if ((this_ptr & 1) != 0) return;
23044 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23045 CHECK_ACCESS(this_ptr_ptr);
23046 LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
23047 FREE((void*)this_ptr);
23048 Sign_free(this_ptr_conv);
23051 uint32_t __attribute__((export_name("TS_Recipient_clone"))) TS_Recipient_clone(uint32_t orig) {
23052 LDKRecipient* orig_conv = (LDKRecipient*)(orig & ~1);
23053 uint32_t ret_conv = LDKRecipient_to_js(Recipient_clone(orig_conv));
23057 uint32_t __attribute__((export_name("TS_Recipient_node"))) TS_Recipient_node() {
23058 uint32_t ret_conv = LDKRecipient_to_js(Recipient_node());
23062 uint32_t __attribute__((export_name("TS_Recipient_phantom_node"))) TS_Recipient_phantom_node() {
23063 uint32_t ret_conv = LDKRecipient_to_js(Recipient_phantom_node());
23067 void __attribute__((export_name("TS_KeysInterface_free"))) TS_KeysInterface_free(uint32_t this_ptr) {
23068 if ((this_ptr & 1) != 0) return;
23069 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23070 CHECK_ACCESS(this_ptr_ptr);
23071 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
23072 FREE((void*)this_ptr);
23073 KeysInterface_free(this_ptr_conv);
23076 void __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint32_t this_obj) {
23077 LDKInMemorySigner this_obj_conv;
23078 this_obj_conv.inner = (void*)(this_obj & (~1));
23079 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23080 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23081 InMemorySigner_free(this_obj_conv);
23084 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_funding_key"))) TS_InMemorySigner_get_funding_key(uint32_t this_ptr) {
23085 LDKInMemorySigner this_ptr_conv;
23086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23087 this_ptr_conv.is_owned = false;
23088 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23089 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23090 memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
23094 void __attribute__((export_name("TS_InMemorySigner_set_funding_key"))) TS_InMemorySigner_set_funding_key(uint32_t this_ptr, int8_tArray val) {
23095 LDKInMemorySigner this_ptr_conv;
23096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23097 this_ptr_conv.is_owned = false;
23098 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23099 LDKSecretKey val_ref;
23100 CHECK(val->arr_len == 32);
23101 memcpy(val_ref.bytes, val->elems, 32); FREE(val);
23102 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
23105 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_revocation_base_key"))) TS_InMemorySigner_get_revocation_base_key(uint32_t this_ptr) {
23106 LDKInMemorySigner this_ptr_conv;
23107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23108 this_ptr_conv.is_owned = false;
23109 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23110 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23111 memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
23115 void __attribute__((export_name("TS_InMemorySigner_set_revocation_base_key"))) TS_InMemorySigner_set_revocation_base_key(uint32_t this_ptr, int8_tArray val) {
23116 LDKInMemorySigner this_ptr_conv;
23117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23118 this_ptr_conv.is_owned = false;
23119 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23120 LDKSecretKey val_ref;
23121 CHECK(val->arr_len == 32);
23122 memcpy(val_ref.bytes, val->elems, 32); FREE(val);
23123 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
23126 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_payment_key"))) TS_InMemorySigner_get_payment_key(uint32_t this_ptr) {
23127 LDKInMemorySigner this_ptr_conv;
23128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23129 this_ptr_conv.is_owned = false;
23130 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23131 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23132 memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
23136 void __attribute__((export_name("TS_InMemorySigner_set_payment_key"))) TS_InMemorySigner_set_payment_key(uint32_t this_ptr, int8_tArray val) {
23137 LDKInMemorySigner this_ptr_conv;
23138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23139 this_ptr_conv.is_owned = false;
23140 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23141 LDKSecretKey val_ref;
23142 CHECK(val->arr_len == 32);
23143 memcpy(val_ref.bytes, val->elems, 32); FREE(val);
23144 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
23147 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_delayed_payment_base_key"))) TS_InMemorySigner_get_delayed_payment_base_key(uint32_t this_ptr) {
23148 LDKInMemorySigner this_ptr_conv;
23149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23150 this_ptr_conv.is_owned = false;
23151 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23152 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23153 memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
23157 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) {
23158 LDKInMemorySigner this_ptr_conv;
23159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23160 this_ptr_conv.is_owned = false;
23161 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23162 LDKSecretKey val_ref;
23163 CHECK(val->arr_len == 32);
23164 memcpy(val_ref.bytes, val->elems, 32); FREE(val);
23165 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
23168 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_htlc_base_key"))) TS_InMemorySigner_get_htlc_base_key(uint32_t this_ptr) {
23169 LDKInMemorySigner this_ptr_conv;
23170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23171 this_ptr_conv.is_owned = false;
23172 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23173 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23174 memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
23178 void __attribute__((export_name("TS_InMemorySigner_set_htlc_base_key"))) TS_InMemorySigner_set_htlc_base_key(uint32_t this_ptr, int8_tArray val) {
23179 LDKInMemorySigner this_ptr_conv;
23180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23181 this_ptr_conv.is_owned = false;
23182 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23183 LDKSecretKey val_ref;
23184 CHECK(val->arr_len == 32);
23185 memcpy(val_ref.bytes, val->elems, 32); FREE(val);
23186 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
23189 int8_tArray __attribute__((export_name("TS_InMemorySigner_get_commitment_seed"))) TS_InMemorySigner_get_commitment_seed(uint32_t this_ptr) {
23190 LDKInMemorySigner this_ptr_conv;
23191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23192 this_ptr_conv.is_owned = false;
23193 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23194 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23195 memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
23199 void __attribute__((export_name("TS_InMemorySigner_set_commitment_seed"))) TS_InMemorySigner_set_commitment_seed(uint32_t this_ptr, int8_tArray val) {
23200 LDKInMemorySigner this_ptr_conv;
23201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23202 this_ptr_conv.is_owned = false;
23203 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23204 LDKThirtyTwoBytes val_ref;
23205 CHECK(val->arr_len == 32);
23206 memcpy(val_ref.data, val->elems, 32); FREE(val);
23207 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
23210 static inline uintptr_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
23211 LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
23212 uintptr_t ret_ref = 0;
23213 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23214 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23215 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23216 ret_ref = (uintptr_t)ret_var.inner;
23217 if (ret_var.is_owned) {
23222 intptr_t __attribute__((export_name("TS_InMemorySigner_clone_ptr"))) TS_InMemorySigner_clone_ptr(uint32_t arg) {
23223 LDKInMemorySigner arg_conv;
23224 arg_conv.inner = (void*)(arg & (~1));
23225 arg_conv.is_owned = false;
23226 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23227 intptr_t ret_val = InMemorySigner_clone_ptr(&arg_conv);
23231 uint32_t __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySigner_clone(uint32_t orig) {
23232 LDKInMemorySigner orig_conv;
23233 orig_conv.inner = (void*)(orig & (~1));
23234 orig_conv.is_owned = false;
23235 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23236 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
23237 uintptr_t ret_ref = 0;
23238 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23239 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23240 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23241 ret_ref = (uintptr_t)ret_var.inner;
23242 if (ret_var.is_owned) {
23248 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) {
23249 LDKSecretKey node_secret_ref;
23250 CHECK(node_secret->arr_len == 32);
23251 memcpy(node_secret_ref.bytes, node_secret->elems, 32); FREE(node_secret);
23252 LDKSecretKey funding_key_ref;
23253 CHECK(funding_key->arr_len == 32);
23254 memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
23255 LDKSecretKey revocation_base_key_ref;
23256 CHECK(revocation_base_key->arr_len == 32);
23257 memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
23258 LDKSecretKey payment_key_ref;
23259 CHECK(payment_key->arr_len == 32);
23260 memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
23261 LDKSecretKey delayed_payment_base_key_ref;
23262 CHECK(delayed_payment_base_key->arr_len == 32);
23263 memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
23264 LDKSecretKey htlc_base_key_ref;
23265 CHECK(htlc_base_key->arr_len == 32);
23266 memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
23267 LDKThirtyTwoBytes commitment_seed_ref;
23268 CHECK(commitment_seed->arr_len == 32);
23269 memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
23270 LDKThirtyTwoBytes channel_keys_id_ref;
23271 CHECK(channel_keys_id->arr_len == 32);
23272 memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
23273 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);
23274 uintptr_t ret_ref = 0;
23275 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23276 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23277 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23278 ret_ref = (uintptr_t)ret_var.inner;
23279 if (ret_var.is_owned) {
23285 uint32_t __attribute__((export_name("TS_InMemorySigner_counterparty_pubkeys"))) TS_InMemorySigner_counterparty_pubkeys(uint32_t this_arg) {
23286 LDKInMemorySigner this_arg_conv;
23287 this_arg_conv.inner = (void*)(this_arg & (~1));
23288 this_arg_conv.is_owned = false;
23289 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23290 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
23291 uintptr_t ret_ref = 0;
23292 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23293 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23294 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23295 ret_ref = (uintptr_t)ret_var.inner;
23296 if (ret_var.is_owned) {
23302 int16_t __attribute__((export_name("TS_InMemorySigner_counterparty_selected_contest_delay"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint32_t this_arg) {
23303 LDKInMemorySigner this_arg_conv;
23304 this_arg_conv.inner = (void*)(this_arg & (~1));
23305 this_arg_conv.is_owned = false;
23306 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23307 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
23311 int16_t __attribute__((export_name("TS_InMemorySigner_holder_selected_contest_delay"))) TS_InMemorySigner_holder_selected_contest_delay(uint32_t this_arg) {
23312 LDKInMemorySigner this_arg_conv;
23313 this_arg_conv.inner = (void*)(this_arg & (~1));
23314 this_arg_conv.is_owned = false;
23315 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23316 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
23320 jboolean __attribute__((export_name("TS_InMemorySigner_is_outbound"))) TS_InMemorySigner_is_outbound(uint32_t this_arg) {
23321 LDKInMemorySigner this_arg_conv;
23322 this_arg_conv.inner = (void*)(this_arg & (~1));
23323 this_arg_conv.is_owned = false;
23324 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23325 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
23329 uint32_t __attribute__((export_name("TS_InMemorySigner_funding_outpoint"))) TS_InMemorySigner_funding_outpoint(uint32_t this_arg) {
23330 LDKInMemorySigner this_arg_conv;
23331 this_arg_conv.inner = (void*)(this_arg & (~1));
23332 this_arg_conv.is_owned = false;
23333 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23334 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
23335 uintptr_t ret_ref = 0;
23336 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23337 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23338 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23339 ret_ref = (uintptr_t)ret_var.inner;
23340 if (ret_var.is_owned) {
23346 uint32_t __attribute__((export_name("TS_InMemorySigner_get_channel_parameters"))) TS_InMemorySigner_get_channel_parameters(uint32_t this_arg) {
23347 LDKInMemorySigner this_arg_conv;
23348 this_arg_conv.inner = (void*)(this_arg & (~1));
23349 this_arg_conv.is_owned = false;
23350 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23351 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
23352 uintptr_t ret_ref = 0;
23353 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23354 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23355 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23356 ret_ref = (uintptr_t)ret_var.inner;
23357 if (ret_var.is_owned) {
23363 jboolean __attribute__((export_name("TS_InMemorySigner_opt_anchors"))) TS_InMemorySigner_opt_anchors(uint32_t this_arg) {
23364 LDKInMemorySigner this_arg_conv;
23365 this_arg_conv.inner = (void*)(this_arg & (~1));
23366 this_arg_conv.is_owned = false;
23367 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23368 jboolean ret_val = InMemorySigner_opt_anchors(&this_arg_conv);
23372 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, intptr_t input_idx, uint32_t descriptor) {
23373 LDKInMemorySigner this_arg_conv;
23374 this_arg_conv.inner = (void*)(this_arg & (~1));
23375 this_arg_conv.is_owned = false;
23376 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23377 LDKTransaction spend_tx_ref;
23378 spend_tx_ref.datalen = spend_tx->arr_len;
23379 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
23380 memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
23381 spend_tx_ref.data_is_owned = true;
23382 LDKStaticPaymentOutputDescriptor descriptor_conv;
23383 descriptor_conv.inner = (void*)(descriptor & (~1));
23384 descriptor_conv.is_owned = false;
23385 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
23386 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
23387 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
23388 return (uintptr_t)ret_conv;
23391 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, intptr_t input_idx, uint32_t descriptor) {
23392 LDKInMemorySigner this_arg_conv;
23393 this_arg_conv.inner = (void*)(this_arg & (~1));
23394 this_arg_conv.is_owned = false;
23395 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23396 LDKTransaction spend_tx_ref;
23397 spend_tx_ref.datalen = spend_tx->arr_len;
23398 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
23399 memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
23400 spend_tx_ref.data_is_owned = true;
23401 LDKDelayedPaymentOutputDescriptor descriptor_conv;
23402 descriptor_conv.inner = (void*)(descriptor & (~1));
23403 descriptor_conv.is_owned = false;
23404 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
23405 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
23406 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
23407 return (uintptr_t)ret_conv;
23410 uint32_t __attribute__((export_name("TS_InMemorySigner_as_BaseSign"))) TS_InMemorySigner_as_BaseSign(uint32_t this_arg) {
23411 LDKInMemorySigner this_arg_conv;
23412 this_arg_conv.inner = (void*)(this_arg & (~1));
23413 this_arg_conv.is_owned = false;
23414 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23415 LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
23416 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
23417 return (uintptr_t)ret_ret;
23420 uint32_t __attribute__((export_name("TS_InMemorySigner_as_Sign"))) TS_InMemorySigner_as_Sign(uint32_t this_arg) {
23421 LDKInMemorySigner this_arg_conv;
23422 this_arg_conv.inner = (void*)(this_arg & (~1));
23423 this_arg_conv.is_owned = false;
23424 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23425 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
23426 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
23427 return (uintptr_t)ret_ret;
23430 int8_tArray __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemorySigner_write(uint32_t obj) {
23431 LDKInMemorySigner obj_conv;
23432 obj_conv.inner = (void*)(obj & (~1));
23433 obj_conv.is_owned = false;
23434 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23435 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
23436 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23437 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23438 CVec_u8Z_free(ret_var);
23442 uint32_t __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser, int8_tArray arg) {
23443 LDKu8slice ser_ref;
23444 ser_ref.datalen = ser->arr_len;
23445 ser_ref.data = ser->elems /* XXX ser leaks */;
23446 LDKSecretKey arg_ref;
23447 CHECK(arg->arr_len == 32);
23448 memcpy(arg_ref.bytes, arg->elems, 32); FREE(arg);
23449 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
23450 *ret_conv = InMemorySigner_read(ser_ref, arg_ref);
23451 return (uintptr_t)ret_conv;
23454 void __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(uint32_t this_obj) {
23455 LDKKeysManager this_obj_conv;
23456 this_obj_conv.inner = (void*)(this_obj & (~1));
23457 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23458 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23459 KeysManager_free(this_obj_conv);
23462 uint32_t __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
23463 unsigned char seed_arr[32];
23464 CHECK(seed->arr_len == 32);
23465 memcpy(seed_arr, seed->elems, 32); FREE(seed);
23466 unsigned char (*seed_ref)[32] = &seed_arr;
23467 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
23468 uintptr_t ret_ref = 0;
23469 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23470 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23471 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23472 ret_ref = (uintptr_t)ret_var.inner;
23473 if (ret_var.is_owned) {
23479 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) {
23480 LDKKeysManager this_arg_conv;
23481 this_arg_conv.inner = (void*)(this_arg & (~1));
23482 this_arg_conv.is_owned = false;
23483 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23484 unsigned char params_arr[32];
23485 CHECK(params->arr_len == 32);
23486 memcpy(params_arr, params->elems, 32); FREE(params);
23487 unsigned char (*params_ref)[32] = ¶ms_arr;
23488 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
23489 uintptr_t ret_ref = 0;
23490 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23491 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23492 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23493 ret_ref = (uintptr_t)ret_var.inner;
23494 if (ret_var.is_owned) {
23500 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) {
23501 LDKKeysManager this_arg_conv;
23502 this_arg_conv.inner = (void*)(this_arg & (~1));
23503 this_arg_conv.is_owned = false;
23504 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23505 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
23506 descriptors_constr.datalen = descriptors->arr_len;
23507 if (descriptors_constr.datalen > 0)
23508 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
23510 descriptors_constr.data = NULL;
23511 uint32_t* descriptors_vals = descriptors->elems /* XXX descriptors leaks */;
23512 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
23513 uint32_t descriptors_conv_27 = descriptors_vals[b];
23514 void* descriptors_conv_27_ptr = (void*)(((uintptr_t)descriptors_conv_27) & ~1);
23515 CHECK_ACCESS(descriptors_conv_27_ptr);
23516 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
23517 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)descriptors_conv_27) & ~1));
23518 descriptors_constr.data[b] = descriptors_conv_27_conv;
23520 LDKCVec_TxOutZ outputs_constr;
23521 outputs_constr.datalen = outputs->arr_len;
23522 if (outputs_constr.datalen > 0)
23523 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
23525 outputs_constr.data = NULL;
23526 uint32_t* outputs_vals = outputs->elems /* XXX outputs leaks */;
23527 for (size_t h = 0; h < outputs_constr.datalen; h++) {
23528 uint32_t outputs_conv_7 = outputs_vals[h];
23529 void* outputs_conv_7_ptr = (void*)(((uintptr_t)outputs_conv_7) & ~1);
23530 CHECK_ACCESS(outputs_conv_7_ptr);
23531 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
23532 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)outputs_conv_7) & ~1));
23533 outputs_constr.data[h] = outputs_conv_7_conv;
23535 LDKCVec_u8Z change_destination_script_ref;
23536 change_destination_script_ref.datalen = change_destination_script->arr_len;
23537 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
23538 memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
23539 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
23540 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
23541 return (uintptr_t)ret_conv;
23544 uint32_t __attribute__((export_name("TS_KeysManager_as_KeysInterface"))) TS_KeysManager_as_KeysInterface(uint32_t this_arg) {
23545 LDKKeysManager this_arg_conv;
23546 this_arg_conv.inner = (void*)(this_arg & (~1));
23547 this_arg_conv.is_owned = false;
23548 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23549 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
23550 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
23551 return (uintptr_t)ret_ret;
23554 void __attribute__((export_name("TS_PhantomKeysManager_free"))) TS_PhantomKeysManager_free(uint32_t this_obj) {
23555 LDKPhantomKeysManager this_obj_conv;
23556 this_obj_conv.inner = (void*)(this_obj & (~1));
23557 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23558 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23559 PhantomKeysManager_free(this_obj_conv);
23562 uint32_t __attribute__((export_name("TS_PhantomKeysManager_as_KeysInterface"))) TS_PhantomKeysManager_as_KeysInterface(uint32_t this_arg) {
23563 LDKPhantomKeysManager this_arg_conv;
23564 this_arg_conv.inner = (void*)(this_arg & (~1));
23565 this_arg_conv.is_owned = false;
23566 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23567 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
23568 *ret_ret = PhantomKeysManager_as_KeysInterface(&this_arg_conv);
23569 return (uintptr_t)ret_ret;
23572 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) {
23573 unsigned char seed_arr[32];
23574 CHECK(seed->arr_len == 32);
23575 memcpy(seed_arr, seed->elems, 32); FREE(seed);
23576 unsigned char (*seed_ref)[32] = &seed_arr;
23577 unsigned char cross_node_seed_arr[32];
23578 CHECK(cross_node_seed->arr_len == 32);
23579 memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
23580 unsigned char (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
23581 LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
23582 uintptr_t ret_ref = 0;
23583 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23584 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23585 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23586 ret_ref = (uintptr_t)ret_var.inner;
23587 if (ret_var.is_owned) {
23593 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) {
23594 LDKPhantomKeysManager this_arg_conv;
23595 this_arg_conv.inner = (void*)(this_arg & (~1));
23596 this_arg_conv.is_owned = false;
23597 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23598 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
23599 descriptors_constr.datalen = descriptors->arr_len;
23600 if (descriptors_constr.datalen > 0)
23601 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
23603 descriptors_constr.data = NULL;
23604 uint32_t* descriptors_vals = descriptors->elems /* XXX descriptors leaks */;
23605 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
23606 uint32_t descriptors_conv_27 = descriptors_vals[b];
23607 void* descriptors_conv_27_ptr = (void*)(((uintptr_t)descriptors_conv_27) & ~1);
23608 CHECK_ACCESS(descriptors_conv_27_ptr);
23609 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
23610 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)descriptors_conv_27) & ~1));
23611 descriptors_constr.data[b] = descriptors_conv_27_conv;
23613 LDKCVec_TxOutZ outputs_constr;
23614 outputs_constr.datalen = outputs->arr_len;
23615 if (outputs_constr.datalen > 0)
23616 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
23618 outputs_constr.data = NULL;
23619 uint32_t* outputs_vals = outputs->elems /* XXX outputs leaks */;
23620 for (size_t h = 0; h < outputs_constr.datalen; h++) {
23621 uint32_t outputs_conv_7 = outputs_vals[h];
23622 void* outputs_conv_7_ptr = (void*)(((uintptr_t)outputs_conv_7) & ~1);
23623 CHECK_ACCESS(outputs_conv_7_ptr);
23624 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
23625 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)outputs_conv_7) & ~1));
23626 outputs_constr.data[h] = outputs_conv_7_conv;
23628 LDKCVec_u8Z change_destination_script_ref;
23629 change_destination_script_ref.datalen = change_destination_script->arr_len;
23630 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
23631 memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
23632 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
23633 *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
23634 return (uintptr_t)ret_conv;
23637 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) {
23638 LDKPhantomKeysManager this_arg_conv;
23639 this_arg_conv.inner = (void*)(this_arg & (~1));
23640 this_arg_conv.is_owned = false;
23641 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23642 unsigned char params_arr[32];
23643 CHECK(params->arr_len == 32);
23644 memcpy(params_arr, params->elems, 32); FREE(params);
23645 unsigned char (*params_ref)[32] = ¶ms_arr;
23646 LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
23647 uintptr_t ret_ref = 0;
23648 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23649 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23650 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23651 ret_ref = (uintptr_t)ret_var.inner;
23652 if (ret_var.is_owned) {
23658 void __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint32_t this_obj) {
23659 LDKChannelManager this_obj_conv;
23660 this_obj_conv.inner = (void*)(this_obj & (~1));
23661 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23662 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23663 ChannelManager_free(this_obj_conv);
23666 void __attribute__((export_name("TS_ChainParameters_free"))) TS_ChainParameters_free(uint32_t this_obj) {
23667 LDKChainParameters this_obj_conv;
23668 this_obj_conv.inner = (void*)(this_obj & (~1));
23669 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23670 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23671 ChainParameters_free(this_obj_conv);
23674 uint32_t __attribute__((export_name("TS_ChainParameters_get_network"))) TS_ChainParameters_get_network(uint32_t this_ptr) {
23675 LDKChainParameters this_ptr_conv;
23676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23677 this_ptr_conv.is_owned = false;
23678 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23679 uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
23683 void __attribute__((export_name("TS_ChainParameters_set_network"))) TS_ChainParameters_set_network(uint32_t this_ptr, uint32_t val) {
23684 LDKChainParameters this_ptr_conv;
23685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23686 this_ptr_conv.is_owned = false;
23687 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23688 LDKNetwork val_conv = LDKNetwork_from_js(val);
23689 ChainParameters_set_network(&this_ptr_conv, val_conv);
23692 uint32_t __attribute__((export_name("TS_ChainParameters_get_best_block"))) TS_ChainParameters_get_best_block(uint32_t this_ptr) {
23693 LDKChainParameters this_ptr_conv;
23694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23695 this_ptr_conv.is_owned = false;
23696 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23697 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
23698 uintptr_t ret_ref = 0;
23699 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23700 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23701 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23702 ret_ref = (uintptr_t)ret_var.inner;
23703 if (ret_var.is_owned) {
23709 void __attribute__((export_name("TS_ChainParameters_set_best_block"))) TS_ChainParameters_set_best_block(uint32_t this_ptr, uint32_t val) {
23710 LDKChainParameters this_ptr_conv;
23711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23712 this_ptr_conv.is_owned = false;
23713 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23714 LDKBestBlock val_conv;
23715 val_conv.inner = (void*)(val & (~1));
23716 val_conv.is_owned = (val & 1) || (val == 0);
23717 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23718 val_conv = BestBlock_clone(&val_conv);
23719 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
23722 uint32_t __attribute__((export_name("TS_ChainParameters_new"))) TS_ChainParameters_new(uint32_t network_arg, uint32_t best_block_arg) {
23723 LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
23724 LDKBestBlock best_block_arg_conv;
23725 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
23726 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
23727 CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
23728 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
23729 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
23730 uintptr_t ret_ref = 0;
23731 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23732 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23733 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23734 ret_ref = (uintptr_t)ret_var.inner;
23735 if (ret_var.is_owned) {
23741 static inline uintptr_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
23742 LDKChainParameters ret_var = ChainParameters_clone(arg);
23743 uintptr_t ret_ref = 0;
23744 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23745 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23746 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23747 ret_ref = (uintptr_t)ret_var.inner;
23748 if (ret_var.is_owned) {
23753 intptr_t __attribute__((export_name("TS_ChainParameters_clone_ptr"))) TS_ChainParameters_clone_ptr(uint32_t arg) {
23754 LDKChainParameters arg_conv;
23755 arg_conv.inner = (void*)(arg & (~1));
23756 arg_conv.is_owned = false;
23757 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23758 intptr_t ret_val = ChainParameters_clone_ptr(&arg_conv);
23762 uint32_t __attribute__((export_name("TS_ChainParameters_clone"))) TS_ChainParameters_clone(uint32_t orig) {
23763 LDKChainParameters orig_conv;
23764 orig_conv.inner = (void*)(orig & (~1));
23765 orig_conv.is_owned = false;
23766 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23767 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
23768 uintptr_t ret_ref = 0;
23769 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23770 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23771 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23772 ret_ref = (uintptr_t)ret_var.inner;
23773 if (ret_var.is_owned) {
23779 void __attribute__((export_name("TS_CounterpartyForwardingInfo_free"))) TS_CounterpartyForwardingInfo_free(uint32_t this_obj) {
23780 LDKCounterpartyForwardingInfo this_obj_conv;
23781 this_obj_conv.inner = (void*)(this_obj & (~1));
23782 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23783 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23784 CounterpartyForwardingInfo_free(this_obj_conv);
23787 int32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_base_msat"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint32_t this_ptr) {
23788 LDKCounterpartyForwardingInfo this_ptr_conv;
23789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23790 this_ptr_conv.is_owned = false;
23791 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23792 int32_t ret_val = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
23796 void __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_base_msat"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
23797 LDKCounterpartyForwardingInfo this_ptr_conv;
23798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23799 this_ptr_conv.is_owned = false;
23800 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23801 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
23804 int32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint32_t this_ptr) {
23805 LDKCounterpartyForwardingInfo this_ptr_conv;
23806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23807 this_ptr_conv.is_owned = false;
23808 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23809 int32_t ret_val = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
23813 void __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
23814 LDKCounterpartyForwardingInfo this_ptr_conv;
23815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23816 this_ptr_conv.is_owned = false;
23817 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23818 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
23821 int16_t __attribute__((export_name("TS_CounterpartyForwardingInfo_get_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
23822 LDKCounterpartyForwardingInfo this_ptr_conv;
23823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23824 this_ptr_conv.is_owned = false;
23825 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23826 int16_t ret_val = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
23830 void __attribute__((export_name("TS_CounterpartyForwardingInfo_set_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
23831 LDKCounterpartyForwardingInfo this_ptr_conv;
23832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23833 this_ptr_conv.is_owned = false;
23834 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23835 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
23838 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) {
23839 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
23840 uintptr_t ret_ref = 0;
23841 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23842 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23843 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23844 ret_ref = (uintptr_t)ret_var.inner;
23845 if (ret_var.is_owned) {
23851 static inline uintptr_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
23852 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
23853 uintptr_t ret_ref = 0;
23854 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23855 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23856 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23857 ret_ref = (uintptr_t)ret_var.inner;
23858 if (ret_var.is_owned) {
23863 intptr_t __attribute__((export_name("TS_CounterpartyForwardingInfo_clone_ptr"))) TS_CounterpartyForwardingInfo_clone_ptr(uint32_t arg) {
23864 LDKCounterpartyForwardingInfo arg_conv;
23865 arg_conv.inner = (void*)(arg & (~1));
23866 arg_conv.is_owned = false;
23867 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23868 intptr_t ret_val = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
23872 uint32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_clone"))) TS_CounterpartyForwardingInfo_clone(uint32_t orig) {
23873 LDKCounterpartyForwardingInfo orig_conv;
23874 orig_conv.inner = (void*)(orig & (~1));
23875 orig_conv.is_owned = false;
23876 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23877 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
23878 uintptr_t ret_ref = 0;
23879 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23880 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23881 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23882 ret_ref = (uintptr_t)ret_var.inner;
23883 if (ret_var.is_owned) {
23889 void __attribute__((export_name("TS_ChannelCounterparty_free"))) TS_ChannelCounterparty_free(uint32_t this_obj) {
23890 LDKChannelCounterparty this_obj_conv;
23891 this_obj_conv.inner = (void*)(this_obj & (~1));
23892 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23893 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23894 ChannelCounterparty_free(this_obj_conv);
23897 int8_tArray __attribute__((export_name("TS_ChannelCounterparty_get_node_id"))) TS_ChannelCounterparty_get_node_id(uint32_t this_ptr) {
23898 LDKChannelCounterparty this_ptr_conv;
23899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23900 this_ptr_conv.is_owned = false;
23901 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23902 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
23903 memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
23907 void __attribute__((export_name("TS_ChannelCounterparty_set_node_id"))) TS_ChannelCounterparty_set_node_id(uint32_t this_ptr, int8_tArray val) {
23908 LDKChannelCounterparty this_ptr_conv;
23909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23910 this_ptr_conv.is_owned = false;
23911 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23912 LDKPublicKey val_ref;
23913 CHECK(val->arr_len == 33);
23914 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
23915 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
23918 uint32_t __attribute__((export_name("TS_ChannelCounterparty_get_features"))) TS_ChannelCounterparty_get_features(uint32_t this_ptr) {
23919 LDKChannelCounterparty this_ptr_conv;
23920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23921 this_ptr_conv.is_owned = false;
23922 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23923 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
23924 uintptr_t ret_ref = 0;
23925 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23926 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23927 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23928 ret_ref = (uintptr_t)ret_var.inner;
23929 if (ret_var.is_owned) {
23935 void __attribute__((export_name("TS_ChannelCounterparty_set_features"))) TS_ChannelCounterparty_set_features(uint32_t this_ptr, uint32_t val) {
23936 LDKChannelCounterparty this_ptr_conv;
23937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23938 this_ptr_conv.is_owned = false;
23939 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23940 LDKInitFeatures val_conv;
23941 val_conv.inner = (void*)(val & (~1));
23942 val_conv.is_owned = (val & 1) || (val == 0);
23943 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23944 val_conv = InitFeatures_clone(&val_conv);
23945 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
23948 int64_t __attribute__((export_name("TS_ChannelCounterparty_get_unspendable_punishment_reserve"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint32_t this_ptr) {
23949 LDKChannelCounterparty this_ptr_conv;
23950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23951 this_ptr_conv.is_owned = false;
23952 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23953 int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
23957 void __attribute__((export_name("TS_ChannelCounterparty_set_unspendable_punishment_reserve"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint32_t this_ptr, int64_t val) {
23958 LDKChannelCounterparty this_ptr_conv;
23959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23960 this_ptr_conv.is_owned = false;
23961 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23962 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
23965 uint32_t __attribute__((export_name("TS_ChannelCounterparty_get_forwarding_info"))) TS_ChannelCounterparty_get_forwarding_info(uint32_t this_ptr) {
23966 LDKChannelCounterparty this_ptr_conv;
23967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23968 this_ptr_conv.is_owned = false;
23969 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23970 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
23971 uintptr_t ret_ref = 0;
23972 if ((uintptr_t)ret_var.inner > 4096) {
23973 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23974 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23975 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23976 ret_ref = (uintptr_t)ret_var.inner;
23977 if (ret_var.is_owned) {
23984 void __attribute__((export_name("TS_ChannelCounterparty_set_forwarding_info"))) TS_ChannelCounterparty_set_forwarding_info(uint32_t this_ptr, uint32_t val) {
23985 LDKChannelCounterparty this_ptr_conv;
23986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23987 this_ptr_conv.is_owned = false;
23988 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23989 LDKCounterpartyForwardingInfo val_conv;
23990 val_conv.inner = (void*)(val & (~1));
23991 val_conv.is_owned = (val & 1) || (val == 0);
23992 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23993 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
23994 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
23997 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) {
23998 LDKPublicKey node_id_arg_ref;
23999 CHECK(node_id_arg->arr_len == 33);
24000 memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
24001 LDKInitFeatures features_arg_conv;
24002 features_arg_conv.inner = (void*)(features_arg & (~1));
24003 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
24004 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
24005 features_arg_conv = InitFeatures_clone(&features_arg_conv);
24006 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
24007 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
24008 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
24009 CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
24010 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
24011 LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv);
24012 uintptr_t ret_ref = 0;
24013 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24014 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24015 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24016 ret_ref = (uintptr_t)ret_var.inner;
24017 if (ret_var.is_owned) {
24023 static inline uintptr_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
24024 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
24025 uintptr_t ret_ref = 0;
24026 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24027 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24028 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24029 ret_ref = (uintptr_t)ret_var.inner;
24030 if (ret_var.is_owned) {
24035 intptr_t __attribute__((export_name("TS_ChannelCounterparty_clone_ptr"))) TS_ChannelCounterparty_clone_ptr(uint32_t arg) {
24036 LDKChannelCounterparty arg_conv;
24037 arg_conv.inner = (void*)(arg & (~1));
24038 arg_conv.is_owned = false;
24039 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24040 intptr_t ret_val = ChannelCounterparty_clone_ptr(&arg_conv);
24044 uint32_t __attribute__((export_name("TS_ChannelCounterparty_clone"))) TS_ChannelCounterparty_clone(uint32_t orig) {
24045 LDKChannelCounterparty orig_conv;
24046 orig_conv.inner = (void*)(orig & (~1));
24047 orig_conv.is_owned = false;
24048 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24049 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
24050 uintptr_t ret_ref = 0;
24051 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24052 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24053 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24054 ret_ref = (uintptr_t)ret_var.inner;
24055 if (ret_var.is_owned) {
24061 void __attribute__((export_name("TS_ChannelDetails_free"))) TS_ChannelDetails_free(uint32_t this_obj) {
24062 LDKChannelDetails this_obj_conv;
24063 this_obj_conv.inner = (void*)(this_obj & (~1));
24064 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24065 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24066 ChannelDetails_free(this_obj_conv);
24069 int8_tArray __attribute__((export_name("TS_ChannelDetails_get_channel_id"))) TS_ChannelDetails_get_channel_id(uint32_t this_ptr) {
24070 LDKChannelDetails this_ptr_conv;
24071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24072 this_ptr_conv.is_owned = false;
24073 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24074 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24075 memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
24079 void __attribute__((export_name("TS_ChannelDetails_set_channel_id"))) TS_ChannelDetails_set_channel_id(uint32_t this_ptr, int8_tArray val) {
24080 LDKChannelDetails this_ptr_conv;
24081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24082 this_ptr_conv.is_owned = false;
24083 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24084 LDKThirtyTwoBytes val_ref;
24085 CHECK(val->arr_len == 32);
24086 memcpy(val_ref.data, val->elems, 32); FREE(val);
24087 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
24090 uint32_t __attribute__((export_name("TS_ChannelDetails_get_counterparty"))) TS_ChannelDetails_get_counterparty(uint32_t this_ptr) {
24091 LDKChannelDetails this_ptr_conv;
24092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24093 this_ptr_conv.is_owned = false;
24094 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24095 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
24096 uintptr_t ret_ref = 0;
24097 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24098 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24099 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24100 ret_ref = (uintptr_t)ret_var.inner;
24101 if (ret_var.is_owned) {
24107 void __attribute__((export_name("TS_ChannelDetails_set_counterparty"))) TS_ChannelDetails_set_counterparty(uint32_t this_ptr, uint32_t val) {
24108 LDKChannelDetails this_ptr_conv;
24109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24110 this_ptr_conv.is_owned = false;
24111 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24112 LDKChannelCounterparty val_conv;
24113 val_conv.inner = (void*)(val & (~1));
24114 val_conv.is_owned = (val & 1) || (val == 0);
24115 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24116 val_conv = ChannelCounterparty_clone(&val_conv);
24117 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
24120 uint32_t __attribute__((export_name("TS_ChannelDetails_get_funding_txo"))) TS_ChannelDetails_get_funding_txo(uint32_t this_ptr) {
24121 LDKChannelDetails this_ptr_conv;
24122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24123 this_ptr_conv.is_owned = false;
24124 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24125 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
24126 uintptr_t ret_ref = 0;
24127 if ((uintptr_t)ret_var.inner > 4096) {
24128 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24129 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24130 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24131 ret_ref = (uintptr_t)ret_var.inner;
24132 if (ret_var.is_owned) {
24139 void __attribute__((export_name("TS_ChannelDetails_set_funding_txo"))) TS_ChannelDetails_set_funding_txo(uint32_t this_ptr, uint32_t val) {
24140 LDKChannelDetails this_ptr_conv;
24141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24142 this_ptr_conv.is_owned = false;
24143 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24144 LDKOutPoint val_conv;
24145 val_conv.inner = (void*)(val & (~1));
24146 val_conv.is_owned = (val & 1) || (val == 0);
24147 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24148 val_conv = OutPoint_clone(&val_conv);
24149 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
24152 uint32_t __attribute__((export_name("TS_ChannelDetails_get_short_channel_id"))) TS_ChannelDetails_get_short_channel_id(uint32_t this_ptr) {
24153 LDKChannelDetails this_ptr_conv;
24154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24155 this_ptr_conv.is_owned = false;
24156 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24157 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24158 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
24159 uintptr_t ret_ref = (uintptr_t)ret_copy;
24163 void __attribute__((export_name("TS_ChannelDetails_set_short_channel_id"))) TS_ChannelDetails_set_short_channel_id(uint32_t this_ptr, uint32_t val) {
24164 LDKChannelDetails this_ptr_conv;
24165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24166 this_ptr_conv.is_owned = false;
24167 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24168 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
24169 CHECK_ACCESS(val_ptr);
24170 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
24171 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
24172 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
24175 int64_t __attribute__((export_name("TS_ChannelDetails_get_channel_value_satoshis"))) TS_ChannelDetails_get_channel_value_satoshis(uint32_t this_ptr) {
24176 LDKChannelDetails this_ptr_conv;
24177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24178 this_ptr_conv.is_owned = false;
24179 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24180 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
24184 void __attribute__((export_name("TS_ChannelDetails_set_channel_value_satoshis"))) TS_ChannelDetails_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
24185 LDKChannelDetails this_ptr_conv;
24186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24187 this_ptr_conv.is_owned = false;
24188 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24189 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
24192 uint32_t __attribute__((export_name("TS_ChannelDetails_get_unspendable_punishment_reserve"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint32_t this_ptr) {
24193 LDKChannelDetails this_ptr_conv;
24194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24195 this_ptr_conv.is_owned = false;
24196 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24197 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24198 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
24199 uintptr_t ret_ref = (uintptr_t)ret_copy;
24203 void __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_reserve"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint32_t this_ptr, uint32_t val) {
24204 LDKChannelDetails this_ptr_conv;
24205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24206 this_ptr_conv.is_owned = false;
24207 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24208 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
24209 CHECK_ACCESS(val_ptr);
24210 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
24211 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
24212 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
24215 int64_t __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_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 int64_t ret_val = ChannelDetails_get_user_channel_id(&this_ptr_conv);
24224 void __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint32_t this_ptr, int64_t val) {
24225 LDKChannelDetails this_ptr_conv;
24226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24227 this_ptr_conv.is_owned = false;
24228 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24229 ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
24232 int64_t __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint32_t this_ptr) {
24233 LDKChannelDetails this_ptr_conv;
24234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24235 this_ptr_conv.is_owned = false;
24236 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24237 int64_t ret_val = ChannelDetails_get_balance_msat(&this_ptr_conv);
24241 void __attribute__((export_name("TS_ChannelDetails_set_balance_msat"))) TS_ChannelDetails_set_balance_msat(uint32_t this_ptr, int64_t val) {
24242 LDKChannelDetails this_ptr_conv;
24243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24244 this_ptr_conv.is_owned = false;
24245 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24246 ChannelDetails_set_balance_msat(&this_ptr_conv, val);
24249 int64_t __attribute__((export_name("TS_ChannelDetails_get_outbound_capacity_msat"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) {
24250 LDKChannelDetails this_ptr_conv;
24251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24252 this_ptr_conv.is_owned = false;
24253 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24254 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
24258 void __attribute__((export_name("TS_ChannelDetails_set_outbound_capacity_msat"))) TS_ChannelDetails_set_outbound_capacity_msat(uint32_t this_ptr, int64_t val) {
24259 LDKChannelDetails this_ptr_conv;
24260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24261 this_ptr_conv.is_owned = false;
24262 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24263 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
24266 int64_t __attribute__((export_name("TS_ChannelDetails_get_inbound_capacity_msat"))) TS_ChannelDetails_get_inbound_capacity_msat(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 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
24275 void __attribute__((export_name("TS_ChannelDetails_set_inbound_capacity_msat"))) TS_ChannelDetails_set_inbound_capacity_msat(uint32_t this_ptr, int64_t val) {
24276 LDKChannelDetails this_ptr_conv;
24277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24278 this_ptr_conv.is_owned = false;
24279 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24280 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
24283 uint32_t __attribute__((export_name("TS_ChannelDetails_get_confirmations_required"))) TS_ChannelDetails_get_confirmations_required(uint32_t this_ptr) {
24284 LDKChannelDetails this_ptr_conv;
24285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24286 this_ptr_conv.is_owned = false;
24287 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24288 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
24289 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
24290 uintptr_t ret_ref = (uintptr_t)ret_copy;
24294 void __attribute__((export_name("TS_ChannelDetails_set_confirmations_required"))) TS_ChannelDetails_set_confirmations_required(uint32_t this_ptr, uint32_t val) {
24295 LDKChannelDetails this_ptr_conv;
24296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24297 this_ptr_conv.is_owned = false;
24298 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24299 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
24300 CHECK_ACCESS(val_ptr);
24301 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
24302 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)val) & ~1));
24303 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
24306 uint32_t __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint32_t this_ptr) {
24307 LDKChannelDetails this_ptr_conv;
24308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24309 this_ptr_conv.is_owned = false;
24310 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24311 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
24312 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
24313 uintptr_t ret_ref = (uintptr_t)ret_copy;
24317 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) {
24318 LDKChannelDetails this_ptr_conv;
24319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24320 this_ptr_conv.is_owned = false;
24321 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24322 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
24323 CHECK_ACCESS(val_ptr);
24324 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
24325 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uintptr_t)val) & ~1));
24326 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
24329 jboolean __attribute__((export_name("TS_ChannelDetails_get_is_outbound"))) TS_ChannelDetails_get_is_outbound(uint32_t this_ptr) {
24330 LDKChannelDetails this_ptr_conv;
24331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24332 this_ptr_conv.is_owned = false;
24333 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24334 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
24338 void __attribute__((export_name("TS_ChannelDetails_set_is_outbound"))) TS_ChannelDetails_set_is_outbound(uint32_t this_ptr, jboolean val) {
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 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
24346 jboolean __attribute__((export_name("TS_ChannelDetails_get_is_funding_locked"))) TS_ChannelDetails_get_is_funding_locked(uint32_t this_ptr) {
24347 LDKChannelDetails this_ptr_conv;
24348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24349 this_ptr_conv.is_owned = false;
24350 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24351 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
24355 void __attribute__((export_name("TS_ChannelDetails_set_is_funding_locked"))) TS_ChannelDetails_set_is_funding_locked(uint32_t this_ptr, jboolean val) {
24356 LDKChannelDetails this_ptr_conv;
24357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24358 this_ptr_conv.is_owned = false;
24359 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24360 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
24363 jboolean __attribute__((export_name("TS_ChannelDetails_get_is_usable"))) TS_ChannelDetails_get_is_usable(uint32_t this_ptr) {
24364 LDKChannelDetails this_ptr_conv;
24365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24366 this_ptr_conv.is_owned = false;
24367 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24368 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
24372 void __attribute__((export_name("TS_ChannelDetails_set_is_usable"))) TS_ChannelDetails_set_is_usable(uint32_t this_ptr, jboolean val) {
24373 LDKChannelDetails this_ptr_conv;
24374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24375 this_ptr_conv.is_owned = false;
24376 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24377 ChannelDetails_set_is_usable(&this_ptr_conv, val);
24380 jboolean __attribute__((export_name("TS_ChannelDetails_get_is_public"))) TS_ChannelDetails_get_is_public(uint32_t this_ptr) {
24381 LDKChannelDetails this_ptr_conv;
24382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24383 this_ptr_conv.is_owned = false;
24384 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24385 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
24389 void __attribute__((export_name("TS_ChannelDetails_set_is_public"))) TS_ChannelDetails_set_is_public(uint32_t this_ptr, jboolean val) {
24390 LDKChannelDetails this_ptr_conv;
24391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24392 this_ptr_conv.is_owned = false;
24393 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24394 ChannelDetails_set_is_public(&this_ptr_conv, val);
24397 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) {
24398 LDKThirtyTwoBytes channel_id_arg_ref;
24399 CHECK(channel_id_arg->arr_len == 32);
24400 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
24401 LDKChannelCounterparty counterparty_arg_conv;
24402 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
24403 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
24404 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
24405 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
24406 LDKOutPoint funding_txo_arg_conv;
24407 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
24408 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
24409 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
24410 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
24411 void* short_channel_id_arg_ptr = (void*)(((uintptr_t)short_channel_id_arg) & ~1);
24412 CHECK_ACCESS(short_channel_id_arg_ptr);
24413 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
24414 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id_arg) & ~1));
24415 void* unspendable_punishment_reserve_arg_ptr = (void*)(((uintptr_t)unspendable_punishment_reserve_arg) & ~1);
24416 CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
24417 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
24418 void* confirmations_required_arg_ptr = (void*)(((uintptr_t)confirmations_required_arg) & ~1);
24419 CHECK_ACCESS(confirmations_required_arg_ptr);
24420 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
24421 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)confirmations_required_arg) & ~1));
24422 void* force_close_spend_delay_arg_ptr = (void*)(((uintptr_t)force_close_spend_delay_arg) & ~1);
24423 CHECK_ACCESS(force_close_spend_delay_arg_ptr);
24424 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
24425 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uintptr_t)force_close_spend_delay_arg) & ~1));
24426 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);
24427 uintptr_t ret_ref = 0;
24428 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24429 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24430 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24431 ret_ref = (uintptr_t)ret_var.inner;
24432 if (ret_var.is_owned) {
24438 static inline uintptr_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
24439 LDKChannelDetails ret_var = ChannelDetails_clone(arg);
24440 uintptr_t ret_ref = 0;
24441 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24442 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24443 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24444 ret_ref = (uintptr_t)ret_var.inner;
24445 if (ret_var.is_owned) {
24450 intptr_t __attribute__((export_name("TS_ChannelDetails_clone_ptr"))) TS_ChannelDetails_clone_ptr(uint32_t arg) {
24451 LDKChannelDetails arg_conv;
24452 arg_conv.inner = (void*)(arg & (~1));
24453 arg_conv.is_owned = false;
24454 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24455 intptr_t ret_val = ChannelDetails_clone_ptr(&arg_conv);
24459 uint32_t __attribute__((export_name("TS_ChannelDetails_clone"))) TS_ChannelDetails_clone(uint32_t orig) {
24460 LDKChannelDetails orig_conv;
24461 orig_conv.inner = (void*)(orig & (~1));
24462 orig_conv.is_owned = false;
24463 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24464 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
24465 uintptr_t ret_ref = 0;
24466 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24467 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24468 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24469 ret_ref = (uintptr_t)ret_var.inner;
24470 if (ret_var.is_owned) {
24476 void __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint32_t this_ptr) {
24477 if ((this_ptr & 1) != 0) return;
24478 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24479 CHECK_ACCESS(this_ptr_ptr);
24480 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
24481 FREE((void*)this_ptr);
24482 PaymentSendFailure_free(this_ptr_conv);
24485 static inline uintptr_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
24486 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
24487 *ret_copy = PaymentSendFailure_clone(arg);
24488 uintptr_t ret_ref = (uintptr_t)ret_copy;
24491 intptr_t __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint32_t arg) {
24492 LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)arg;
24493 intptr_t ret_val = PaymentSendFailure_clone_ptr(arg_conv);
24497 uint32_t __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint32_t orig) {
24498 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
24499 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
24500 *ret_copy = PaymentSendFailure_clone(orig_conv);
24501 uintptr_t ret_ref = (uintptr_t)ret_copy;
24505 uint32_t __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint32_t a) {
24506 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
24507 CHECK_ACCESS(a_ptr);
24508 LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
24509 a_conv = APIError_clone((LDKAPIError*)(((uintptr_t)a) & ~1));
24510 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
24511 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
24512 uintptr_t ret_ref = (uintptr_t)ret_copy;
24516 uint32_t __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint32_tArray a) {
24517 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
24518 a_constr.datalen = a->arr_len;
24519 if (a_constr.datalen > 0)
24520 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
24522 a_constr.data = NULL;
24523 uint32_t* a_vals = a->elems /* XXX a leaks */;
24524 for (size_t w = 0; w < a_constr.datalen; w++) {
24525 uint32_t a_conv_22 = a_vals[w];
24526 void* a_conv_22_ptr = (void*)(((uintptr_t)a_conv_22) & ~1);
24527 CHECK_ACCESS(a_conv_22_ptr);
24528 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
24529 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uintptr_t)a_conv_22) & ~1));
24530 a_constr.data[w] = a_conv_22_conv;
24532 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
24533 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
24534 uintptr_t ret_ref = (uintptr_t)ret_copy;
24538 uint32_t __attribute__((export_name("TS_PaymentSendFailure_all_failed_retry_safe"))) TS_PaymentSendFailure_all_failed_retry_safe(uint32_tArray a) {
24539 LDKCVec_APIErrorZ a_constr;
24540 a_constr.datalen = a->arr_len;
24541 if (a_constr.datalen > 0)
24542 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
24544 a_constr.data = NULL;
24545 uint32_t* a_vals = a->elems /* XXX a leaks */;
24546 for (size_t k = 0; k < a_constr.datalen; k++) {
24547 uint32_t a_conv_10 = a_vals[k];
24548 void* a_conv_10_ptr = (void*)(((uintptr_t)a_conv_10) & ~1);
24549 CHECK_ACCESS(a_conv_10_ptr);
24550 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
24551 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uintptr_t)a_conv_10) & ~1));
24552 a_constr.data[k] = a_conv_10_conv;
24554 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
24555 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
24556 uintptr_t ret_ref = (uintptr_t)ret_copy;
24560 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) {
24561 LDKCVec_CResult_NoneAPIErrorZZ results_constr;
24562 results_constr.datalen = results->arr_len;
24563 if (results_constr.datalen > 0)
24564 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
24566 results_constr.data = NULL;
24567 uint32_t* results_vals = results->elems /* XXX results leaks */;
24568 for (size_t w = 0; w < results_constr.datalen; w++) {
24569 uint32_t results_conv_22 = results_vals[w];
24570 void* results_conv_22_ptr = (void*)(((uintptr_t)results_conv_22) & ~1);
24571 CHECK_ACCESS(results_conv_22_ptr);
24572 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
24573 results_constr.data[w] = results_conv_22_conv;
24575 LDKRouteParameters failed_paths_retry_conv;
24576 failed_paths_retry_conv.inner = (void*)(failed_paths_retry & (~1));
24577 failed_paths_retry_conv.is_owned = (failed_paths_retry & 1) || (failed_paths_retry == 0);
24578 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
24579 failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
24580 LDKThirtyTwoBytes payment_id_ref;
24581 CHECK(payment_id->arr_len == 32);
24582 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
24583 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
24584 *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
24585 uintptr_t ret_ref = (uintptr_t)ret_copy;
24589 void __attribute__((export_name("TS_PhantomRouteHints_free"))) TS_PhantomRouteHints_free(uint32_t this_obj) {
24590 LDKPhantomRouteHints this_obj_conv;
24591 this_obj_conv.inner = (void*)(this_obj & (~1));
24592 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24593 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24594 PhantomRouteHints_free(this_obj_conv);
24597 uint32_tArray __attribute__((export_name("TS_PhantomRouteHints_get_channels"))) TS_PhantomRouteHints_get_channels(uint32_t this_ptr) {
24598 LDKPhantomRouteHints this_ptr_conv;
24599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24600 this_ptr_conv.is_owned = false;
24601 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24602 LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
24603 uint32_tArray ret_arr = NULL;
24604 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
24605 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
24606 for (size_t q = 0; q < ret_var.datalen; q++) {
24607 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
24608 uintptr_t ret_conv_16_ref = 0;
24609 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24610 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24611 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
24612 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
24613 if (ret_conv_16_var.is_owned) {
24614 ret_conv_16_ref |= 1;
24616 ret_arr_ptr[q] = ret_conv_16_ref;
24619 FREE(ret_var.data);
24623 void __attribute__((export_name("TS_PhantomRouteHints_set_channels"))) TS_PhantomRouteHints_set_channels(uint32_t this_ptr, uint32_tArray val) {
24624 LDKPhantomRouteHints this_ptr_conv;
24625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24626 this_ptr_conv.is_owned = false;
24627 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24628 LDKCVec_ChannelDetailsZ val_constr;
24629 val_constr.datalen = val->arr_len;
24630 if (val_constr.datalen > 0)
24631 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
24633 val_constr.data = NULL;
24634 uint32_t* val_vals = val->elems /* XXX val leaks */;
24635 for (size_t q = 0; q < val_constr.datalen; q++) {
24636 uint32_t val_conv_16 = val_vals[q];
24637 LDKChannelDetails val_conv_16_conv;
24638 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
24639 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
24640 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
24641 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
24642 val_constr.data[q] = val_conv_16_conv;
24644 PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
24647 int64_t __attribute__((export_name("TS_PhantomRouteHints_get_phantom_scid"))) TS_PhantomRouteHints_get_phantom_scid(uint32_t this_ptr) {
24648 LDKPhantomRouteHints this_ptr_conv;
24649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24650 this_ptr_conv.is_owned = false;
24651 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24652 int64_t ret_val = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
24656 void __attribute__((export_name("TS_PhantomRouteHints_set_phantom_scid"))) TS_PhantomRouteHints_set_phantom_scid(uint32_t this_ptr, int64_t val) {
24657 LDKPhantomRouteHints this_ptr_conv;
24658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24659 this_ptr_conv.is_owned = false;
24660 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24661 PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
24664 int8_tArray __attribute__((export_name("TS_PhantomRouteHints_get_real_node_pubkey"))) TS_PhantomRouteHints_get_real_node_pubkey(uint32_t this_ptr) {
24665 LDKPhantomRouteHints this_ptr_conv;
24666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24667 this_ptr_conv.is_owned = false;
24668 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24669 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
24670 memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
24674 void __attribute__((export_name("TS_PhantomRouteHints_set_real_node_pubkey"))) TS_PhantomRouteHints_set_real_node_pubkey(uint32_t this_ptr, int8_tArray val) {
24675 LDKPhantomRouteHints this_ptr_conv;
24676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24677 this_ptr_conv.is_owned = false;
24678 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24679 LDKPublicKey val_ref;
24680 CHECK(val->arr_len == 33);
24681 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
24682 PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
24685 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) {
24686 LDKCVec_ChannelDetailsZ channels_arg_constr;
24687 channels_arg_constr.datalen = channels_arg->arr_len;
24688 if (channels_arg_constr.datalen > 0)
24689 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
24691 channels_arg_constr.data = NULL;
24692 uint32_t* channels_arg_vals = channels_arg->elems /* XXX channels_arg leaks */;
24693 for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
24694 uint32_t channels_arg_conv_16 = channels_arg_vals[q];
24695 LDKChannelDetails channels_arg_conv_16_conv;
24696 channels_arg_conv_16_conv.inner = (void*)(channels_arg_conv_16 & (~1));
24697 channels_arg_conv_16_conv.is_owned = (channels_arg_conv_16 & 1) || (channels_arg_conv_16 == 0);
24698 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
24699 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
24700 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
24702 LDKPublicKey real_node_pubkey_arg_ref;
24703 CHECK(real_node_pubkey_arg->arr_len == 33);
24704 memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
24705 LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
24706 uintptr_t ret_ref = 0;
24707 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24708 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24709 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24710 ret_ref = (uintptr_t)ret_var.inner;
24711 if (ret_var.is_owned) {
24717 static inline uintptr_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
24718 LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
24719 uintptr_t ret_ref = 0;
24720 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24721 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24722 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24723 ret_ref = (uintptr_t)ret_var.inner;
24724 if (ret_var.is_owned) {
24729 intptr_t __attribute__((export_name("TS_PhantomRouteHints_clone_ptr"))) TS_PhantomRouteHints_clone_ptr(uint32_t arg) {
24730 LDKPhantomRouteHints arg_conv;
24731 arg_conv.inner = (void*)(arg & (~1));
24732 arg_conv.is_owned = false;
24733 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24734 intptr_t ret_val = PhantomRouteHints_clone_ptr(&arg_conv);
24738 uint32_t __attribute__((export_name("TS_PhantomRouteHints_clone"))) TS_PhantomRouteHints_clone(uint32_t orig) {
24739 LDKPhantomRouteHints orig_conv;
24740 orig_conv.inner = (void*)(orig & (~1));
24741 orig_conv.is_owned = false;
24742 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24743 LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
24744 uintptr_t ret_ref = 0;
24745 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24746 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24747 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24748 ret_ref = (uintptr_t)ret_var.inner;
24749 if (ret_var.is_owned) {
24755 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) {
24756 void* fee_est_ptr = (void*)(((uintptr_t)fee_est) & ~1);
24757 CHECK_ACCESS(fee_est_ptr);
24758 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
24759 void* chain_monitor_ptr = (void*)(((uintptr_t)chain_monitor) & ~1);
24760 CHECK_ACCESS(chain_monitor_ptr);
24761 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
24762 void* tx_broadcaster_ptr = (void*)(((uintptr_t)tx_broadcaster) & ~1);
24763 CHECK_ACCESS(tx_broadcaster_ptr);
24764 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
24765 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
24766 CHECK_ACCESS(logger_ptr);
24767 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24768 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
24769 CHECK_ACCESS(keys_manager_ptr);
24770 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
24771 LDKUserConfig config_conv;
24772 config_conv.inner = (void*)(config & (~1));
24773 config_conv.is_owned = (config & 1) || (config == 0);
24774 CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
24775 config_conv = UserConfig_clone(&config_conv);
24776 LDKChainParameters params_conv;
24777 params_conv.inner = (void*)(params & (~1));
24778 params_conv.is_owned = (params & 1) || (params == 0);
24779 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
24780 params_conv = ChainParameters_clone(¶ms_conv);
24781 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
24782 uintptr_t ret_ref = 0;
24783 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24784 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24785 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24786 ret_ref = (uintptr_t)ret_var.inner;
24787 if (ret_var.is_owned) {
24793 uint32_t __attribute__((export_name("TS_ChannelManager_get_current_default_configuration"))) TS_ChannelManager_get_current_default_configuration(uint32_t this_arg) {
24794 LDKChannelManager this_arg_conv;
24795 this_arg_conv.inner = (void*)(this_arg & (~1));
24796 this_arg_conv.is_owned = false;
24797 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24798 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
24799 uintptr_t ret_ref = 0;
24800 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24801 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24802 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24803 ret_ref = (uintptr_t)ret_var.inner;
24804 if (ret_var.is_owned) {
24810 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) {
24811 LDKChannelManager this_arg_conv;
24812 this_arg_conv.inner = (void*)(this_arg & (~1));
24813 this_arg_conv.is_owned = false;
24814 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24815 LDKPublicKey their_network_key_ref;
24816 CHECK(their_network_key->arr_len == 33);
24817 memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
24818 LDKUserConfig override_config_conv;
24819 override_config_conv.inner = (void*)(override_config & (~1));
24820 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
24821 CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
24822 override_config_conv = UserConfig_clone(&override_config_conv);
24823 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
24824 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
24825 return (uintptr_t)ret_conv;
24828 uint32_tArray __attribute__((export_name("TS_ChannelManager_list_channels"))) TS_ChannelManager_list_channels(uint32_t this_arg) {
24829 LDKChannelManager this_arg_conv;
24830 this_arg_conv.inner = (void*)(this_arg & (~1));
24831 this_arg_conv.is_owned = false;
24832 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24833 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
24834 uint32_tArray ret_arr = NULL;
24835 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
24836 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
24837 for (size_t q = 0; q < ret_var.datalen; q++) {
24838 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
24839 uintptr_t ret_conv_16_ref = 0;
24840 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24841 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24842 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
24843 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
24844 if (ret_conv_16_var.is_owned) {
24845 ret_conv_16_ref |= 1;
24847 ret_arr_ptr[q] = ret_conv_16_ref;
24850 FREE(ret_var.data);
24854 uint32_tArray __attribute__((export_name("TS_ChannelManager_list_usable_channels"))) TS_ChannelManager_list_usable_channels(uint32_t this_arg) {
24855 LDKChannelManager this_arg_conv;
24856 this_arg_conv.inner = (void*)(this_arg & (~1));
24857 this_arg_conv.is_owned = false;
24858 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24859 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
24860 uint32_tArray ret_arr = NULL;
24861 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
24862 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
24863 for (size_t q = 0; q < ret_var.datalen; q++) {
24864 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
24865 uintptr_t ret_conv_16_ref = 0;
24866 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24867 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24868 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
24869 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
24870 if (ret_conv_16_var.is_owned) {
24871 ret_conv_16_ref |= 1;
24873 ret_arr_ptr[q] = ret_conv_16_ref;
24876 FREE(ret_var.data);
24880 uint32_t __attribute__((export_name("TS_ChannelManager_close_channel"))) TS_ChannelManager_close_channel(uint32_t this_arg, int8_tArray channel_id) {
24881 LDKChannelManager this_arg_conv;
24882 this_arg_conv.inner = (void*)(this_arg & (~1));
24883 this_arg_conv.is_owned = false;
24884 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24885 unsigned char channel_id_arr[32];
24886 CHECK(channel_id->arr_len == 32);
24887 memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
24888 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
24889 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
24890 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
24891 return (uintptr_t)ret_conv;
24894 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) {
24895 LDKChannelManager this_arg_conv;
24896 this_arg_conv.inner = (void*)(this_arg & (~1));
24897 this_arg_conv.is_owned = false;
24898 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24899 unsigned char channel_id_arr[32];
24900 CHECK(channel_id->arr_len == 32);
24901 memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
24902 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
24903 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
24904 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
24905 return (uintptr_t)ret_conv;
24908 uint32_t __attribute__((export_name("TS_ChannelManager_force_close_channel"))) TS_ChannelManager_force_close_channel(uint32_t this_arg, int8_tArray channel_id) {
24909 LDKChannelManager this_arg_conv;
24910 this_arg_conv.inner = (void*)(this_arg & (~1));
24911 this_arg_conv.is_owned = false;
24912 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24913 unsigned char channel_id_arr[32];
24914 CHECK(channel_id->arr_len == 32);
24915 memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
24916 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
24917 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
24918 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
24919 return (uintptr_t)ret_conv;
24922 void __attribute__((export_name("TS_ChannelManager_force_close_all_channels"))) TS_ChannelManager_force_close_all_channels(uint32_t this_arg) {
24923 LDKChannelManager this_arg_conv;
24924 this_arg_conv.inner = (void*)(this_arg & (~1));
24925 this_arg_conv.is_owned = false;
24926 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24927 ChannelManager_force_close_all_channels(&this_arg_conv);
24930 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) {
24931 LDKChannelManager this_arg_conv;
24932 this_arg_conv.inner = (void*)(this_arg & (~1));
24933 this_arg_conv.is_owned = false;
24934 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24935 LDKRoute route_conv;
24936 route_conv.inner = (void*)(route & (~1));
24937 route_conv.is_owned = false;
24938 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
24939 LDKThirtyTwoBytes payment_hash_ref;
24940 CHECK(payment_hash->arr_len == 32);
24941 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
24942 LDKThirtyTwoBytes payment_secret_ref;
24943 CHECK(payment_secret->arr_len == 32);
24944 memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
24945 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
24946 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
24947 return (uintptr_t)ret_conv;
24950 uint32_t __attribute__((export_name("TS_ChannelManager_retry_payment"))) TS_ChannelManager_retry_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_id) {
24951 LDKChannelManager this_arg_conv;
24952 this_arg_conv.inner = (void*)(this_arg & (~1));
24953 this_arg_conv.is_owned = false;
24954 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24955 LDKRoute route_conv;
24956 route_conv.inner = (void*)(route & (~1));
24957 route_conv.is_owned = false;
24958 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
24959 LDKThirtyTwoBytes payment_id_ref;
24960 CHECK(payment_id->arr_len == 32);
24961 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
24962 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
24963 *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
24964 return (uintptr_t)ret_conv;
24967 void __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_ChannelManager_abandon_payment(uint32_t this_arg, int8_tArray payment_id) {
24968 LDKChannelManager this_arg_conv;
24969 this_arg_conv.inner = (void*)(this_arg & (~1));
24970 this_arg_conv.is_owned = false;
24971 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24972 LDKThirtyTwoBytes payment_id_ref;
24973 CHECK(payment_id->arr_len == 32);
24974 memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
24975 ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
24978 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) {
24979 LDKChannelManager this_arg_conv;
24980 this_arg_conv.inner = (void*)(this_arg & (~1));
24981 this_arg_conv.is_owned = false;
24982 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24983 LDKRoute route_conv;
24984 route_conv.inner = (void*)(route & (~1));
24985 route_conv.is_owned = false;
24986 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
24987 LDKThirtyTwoBytes payment_preimage_ref;
24988 CHECK(payment_preimage->arr_len == 32);
24989 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
24990 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
24991 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
24992 return (uintptr_t)ret_conv;
24995 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) {
24996 LDKChannelManager this_arg_conv;
24997 this_arg_conv.inner = (void*)(this_arg & (~1));
24998 this_arg_conv.is_owned = false;
24999 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25000 unsigned char temporary_channel_id_arr[32];
25001 CHECK(temporary_channel_id->arr_len == 32);
25002 memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
25003 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
25004 LDKTransaction funding_transaction_ref;
25005 funding_transaction_ref.datalen = funding_transaction->arr_len;
25006 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
25007 memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
25008 funding_transaction_ref.data_is_owned = true;
25009 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
25010 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
25011 return (uintptr_t)ret_conv;
25014 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) {
25015 LDKChannelManager this_arg_conv;
25016 this_arg_conv.inner = (void*)(this_arg & (~1));
25017 this_arg_conv.is_owned = false;
25018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25019 LDKThreeBytes rgb_ref;
25020 CHECK(rgb->arr_len == 3);
25021 memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
25022 LDKThirtyTwoBytes alias_ref;
25023 CHECK(alias->arr_len == 32);
25024 memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
25025 LDKCVec_NetAddressZ addresses_constr;
25026 addresses_constr.datalen = addresses->arr_len;
25027 if (addresses_constr.datalen > 0)
25028 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
25030 addresses_constr.data = NULL;
25031 uint32_t* addresses_vals = addresses->elems /* XXX addresses leaks */;
25032 for (size_t m = 0; m < addresses_constr.datalen; m++) {
25033 uint32_t addresses_conv_12 = addresses_vals[m];
25034 void* addresses_conv_12_ptr = (void*)(((uintptr_t)addresses_conv_12) & ~1);
25035 CHECK_ACCESS(addresses_conv_12_ptr);
25036 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
25037 addresses_constr.data[m] = addresses_conv_12_conv;
25039 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
25042 void __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint32_t this_arg) {
25043 LDKChannelManager this_arg_conv;
25044 this_arg_conv.inner = (void*)(this_arg & (~1));
25045 this_arg_conv.is_owned = false;
25046 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25047 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
25050 void __attribute__((export_name("TS_ChannelManager_timer_tick_occurred"))) TS_ChannelManager_timer_tick_occurred(uint32_t this_arg) {
25051 LDKChannelManager this_arg_conv;
25052 this_arg_conv.inner = (void*)(this_arg & (~1));
25053 this_arg_conv.is_owned = false;
25054 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25055 ChannelManager_timer_tick_occurred(&this_arg_conv);
25058 jboolean __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_ChannelManager_fail_htlc_backwards(uint32_t this_arg, int8_tArray payment_hash) {
25059 LDKChannelManager this_arg_conv;
25060 this_arg_conv.inner = (void*)(this_arg & (~1));
25061 this_arg_conv.is_owned = false;
25062 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25063 unsigned char payment_hash_arr[32];
25064 CHECK(payment_hash->arr_len == 32);
25065 memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
25066 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
25067 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
25071 jboolean __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint32_t this_arg, int8_tArray payment_preimage) {
25072 LDKChannelManager this_arg_conv;
25073 this_arg_conv.inner = (void*)(this_arg & (~1));
25074 this_arg_conv.is_owned = false;
25075 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25076 LDKThirtyTwoBytes payment_preimage_ref;
25077 CHECK(payment_preimage->arr_len == 32);
25078 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
25079 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
25083 int8_tArray __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) TS_ChannelManager_get_our_node_id(uint32_t this_arg) {
25084 LDKChannelManager this_arg_conv;
25085 this_arg_conv.inner = (void*)(this_arg & (~1));
25086 this_arg_conv.is_owned = false;
25087 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25088 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
25089 memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
25093 uint32_t __attribute__((export_name("TS_ChannelManager_accept_inbound_channel"))) TS_ChannelManager_accept_inbound_channel(uint32_t this_arg, int8_tArray temporary_channel_id) {
25094 LDKChannelManager this_arg_conv;
25095 this_arg_conv.inner = (void*)(this_arg & (~1));
25096 this_arg_conv.is_owned = false;
25097 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25098 unsigned char temporary_channel_id_arr[32];
25099 CHECK(temporary_channel_id->arr_len == 32);
25100 memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
25101 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
25102 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
25103 *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref);
25104 return (uintptr_t)ret_conv;
25107 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) {
25108 LDKChannelManager this_arg_conv;
25109 this_arg_conv.inner = (void*)(this_arg & (~1));
25110 this_arg_conv.is_owned = false;
25111 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25112 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
25113 CHECK_ACCESS(min_value_msat_ptr);
25114 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
25115 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
25116 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
25117 *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
25118 return (uintptr_t)ret_conv;
25121 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) {
25122 LDKChannelManager this_arg_conv;
25123 this_arg_conv.inner = (void*)(this_arg & (~1));
25124 this_arg_conv.is_owned = false;
25125 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25126 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
25127 CHECK_ACCESS(min_value_msat_ptr);
25128 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
25129 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
25130 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
25131 *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
25132 return (uintptr_t)ret_conv;
25135 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) {
25136 LDKChannelManager this_arg_conv;
25137 this_arg_conv.inner = (void*)(this_arg & (~1));
25138 this_arg_conv.is_owned = false;
25139 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25140 LDKThirtyTwoBytes payment_hash_ref;
25141 CHECK(payment_hash->arr_len == 32);
25142 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
25143 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
25144 CHECK_ACCESS(min_value_msat_ptr);
25145 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
25146 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
25147 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
25148 *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
25149 return (uintptr_t)ret_conv;
25152 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) {
25153 LDKChannelManager this_arg_conv;
25154 this_arg_conv.inner = (void*)(this_arg & (~1));
25155 this_arg_conv.is_owned = false;
25156 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25157 LDKThirtyTwoBytes payment_hash_ref;
25158 CHECK(payment_hash->arr_len == 32);
25159 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
25160 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
25161 CHECK_ACCESS(min_value_msat_ptr);
25162 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
25163 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
25164 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
25165 *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
25166 return (uintptr_t)ret_conv;
25169 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) {
25170 LDKChannelManager this_arg_conv;
25171 this_arg_conv.inner = (void*)(this_arg & (~1));
25172 this_arg_conv.is_owned = false;
25173 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25174 LDKThirtyTwoBytes payment_hash_ref;
25175 CHECK(payment_hash->arr_len == 32);
25176 memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
25177 LDKThirtyTwoBytes payment_secret_ref;
25178 CHECK(payment_secret->arr_len == 32);
25179 memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
25180 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
25181 *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
25182 return (uintptr_t)ret_conv;
25185 int64_t __attribute__((export_name("TS_ChannelManager_get_phantom_scid"))) TS_ChannelManager_get_phantom_scid(uint32_t this_arg) {
25186 LDKChannelManager this_arg_conv;
25187 this_arg_conv.inner = (void*)(this_arg & (~1));
25188 this_arg_conv.is_owned = false;
25189 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25190 int64_t ret_val = ChannelManager_get_phantom_scid(&this_arg_conv);
25194 uint32_t __attribute__((export_name("TS_ChannelManager_get_phantom_route_hints"))) TS_ChannelManager_get_phantom_route_hints(uint32_t this_arg) {
25195 LDKChannelManager this_arg_conv;
25196 this_arg_conv.inner = (void*)(this_arg & (~1));
25197 this_arg_conv.is_owned = false;
25198 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25199 LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
25200 uintptr_t ret_ref = 0;
25201 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25202 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25203 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25204 ret_ref = (uintptr_t)ret_var.inner;
25205 if (ret_var.is_owned) {
25211 uint32_t __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint32_t this_arg) {
25212 LDKChannelManager this_arg_conv;
25213 this_arg_conv.inner = (void*)(this_arg & (~1));
25214 this_arg_conv.is_owned = false;
25215 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25216 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
25217 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
25218 return (uintptr_t)ret_ret;
25221 uint32_t __attribute__((export_name("TS_ChannelManager_as_EventsProvider"))) TS_ChannelManager_as_EventsProvider(uint32_t this_arg) {
25222 LDKChannelManager this_arg_conv;
25223 this_arg_conv.inner = (void*)(this_arg & (~1));
25224 this_arg_conv.is_owned = false;
25225 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25226 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
25227 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
25228 return (uintptr_t)ret_ret;
25231 uint32_t __attribute__((export_name("TS_ChannelManager_as_Listen"))) TS_ChannelManager_as_Listen(uint32_t this_arg) {
25232 LDKChannelManager this_arg_conv;
25233 this_arg_conv.inner = (void*)(this_arg & (~1));
25234 this_arg_conv.is_owned = false;
25235 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25236 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
25237 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
25238 return (uintptr_t)ret_ret;
25241 uint32_t __attribute__((export_name("TS_ChannelManager_as_Confirm"))) TS_ChannelManager_as_Confirm(uint32_t this_arg) {
25242 LDKChannelManager this_arg_conv;
25243 this_arg_conv.inner = (void*)(this_arg & (~1));
25244 this_arg_conv.is_owned = false;
25245 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25246 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
25247 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
25248 return (uintptr_t)ret_ret;
25251 void __attribute__((export_name("TS_ChannelManager_await_persistable_update"))) TS_ChannelManager_await_persistable_update(uint32_t this_arg) {
25252 LDKChannelManager this_arg_conv;
25253 this_arg_conv.inner = (void*)(this_arg & (~1));
25254 this_arg_conv.is_owned = false;
25255 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25256 ChannelManager_await_persistable_update(&this_arg_conv);
25259 uint32_t __attribute__((export_name("TS_ChannelManager_current_best_block"))) TS_ChannelManager_current_best_block(uint32_t this_arg) {
25260 LDKChannelManager this_arg_conv;
25261 this_arg_conv.inner = (void*)(this_arg & (~1));
25262 this_arg_conv.is_owned = false;
25263 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25264 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
25265 uintptr_t ret_ref = 0;
25266 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25267 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25268 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25269 ret_ref = (uintptr_t)ret_var.inner;
25270 if (ret_var.is_owned) {
25276 uint32_t __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(uint32_t this_arg) {
25277 LDKChannelManager this_arg_conv;
25278 this_arg_conv.inner = (void*)(this_arg & (~1));
25279 this_arg_conv.is_owned = false;
25280 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25281 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
25282 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
25283 return (uintptr_t)ret_ret;
25286 int8_tArray __attribute__((export_name("TS_CounterpartyForwardingInfo_write"))) TS_CounterpartyForwardingInfo_write(uint32_t obj) {
25287 LDKCounterpartyForwardingInfo obj_conv;
25288 obj_conv.inner = (void*)(obj & (~1));
25289 obj_conv.is_owned = false;
25290 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25291 LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
25292 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25293 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25294 CVec_u8Z_free(ret_var);
25298 uint32_t __attribute__((export_name("TS_CounterpartyForwardingInfo_read"))) TS_CounterpartyForwardingInfo_read(int8_tArray ser) {
25299 LDKu8slice ser_ref;
25300 ser_ref.datalen = ser->arr_len;
25301 ser_ref.data = ser->elems /* XXX ser leaks */;
25302 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
25303 *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
25304 return (uintptr_t)ret_conv;
25307 int8_tArray __attribute__((export_name("TS_ChannelCounterparty_write"))) TS_ChannelCounterparty_write(uint32_t obj) {
25308 LDKChannelCounterparty obj_conv;
25309 obj_conv.inner = (void*)(obj & (~1));
25310 obj_conv.is_owned = false;
25311 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25312 LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
25313 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25314 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25315 CVec_u8Z_free(ret_var);
25319 uint32_t __attribute__((export_name("TS_ChannelCounterparty_read"))) TS_ChannelCounterparty_read(int8_tArray ser) {
25320 LDKu8slice ser_ref;
25321 ser_ref.datalen = ser->arr_len;
25322 ser_ref.data = ser->elems /* XXX ser leaks */;
25323 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
25324 *ret_conv = ChannelCounterparty_read(ser_ref);
25325 return (uintptr_t)ret_conv;
25328 int8_tArray __attribute__((export_name("TS_ChannelDetails_write"))) TS_ChannelDetails_write(uint32_t obj) {
25329 LDKChannelDetails obj_conv;
25330 obj_conv.inner = (void*)(obj & (~1));
25331 obj_conv.is_owned = false;
25332 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25333 LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
25334 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25335 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25336 CVec_u8Z_free(ret_var);
25340 uint32_t __attribute__((export_name("TS_ChannelDetails_read"))) TS_ChannelDetails_read(int8_tArray ser) {
25341 LDKu8slice ser_ref;
25342 ser_ref.datalen = ser->arr_len;
25343 ser_ref.data = ser->elems /* XXX ser leaks */;
25344 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
25345 *ret_conv = ChannelDetails_read(ser_ref);
25346 return (uintptr_t)ret_conv;
25349 int8_tArray __attribute__((export_name("TS_PhantomRouteHints_write"))) TS_PhantomRouteHints_write(uint32_t obj) {
25350 LDKPhantomRouteHints obj_conv;
25351 obj_conv.inner = (void*)(obj & (~1));
25352 obj_conv.is_owned = false;
25353 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25354 LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
25355 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25356 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25357 CVec_u8Z_free(ret_var);
25361 uint32_t __attribute__((export_name("TS_PhantomRouteHints_read"))) TS_PhantomRouteHints_read(int8_tArray ser) {
25362 LDKu8slice ser_ref;
25363 ser_ref.datalen = ser->arr_len;
25364 ser_ref.data = ser->elems /* XXX ser leaks */;
25365 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
25366 *ret_conv = PhantomRouteHints_read(ser_ref);
25367 return (uintptr_t)ret_conv;
25370 int8_tArray __attribute__((export_name("TS_ChannelManager_write"))) TS_ChannelManager_write(uint32_t obj) {
25371 LDKChannelManager obj_conv;
25372 obj_conv.inner = (void*)(obj & (~1));
25373 obj_conv.is_owned = false;
25374 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25375 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
25376 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25377 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25378 CVec_u8Z_free(ret_var);
25382 void __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelManagerReadArgs_free(uint32_t this_obj) {
25383 LDKChannelManagerReadArgs this_obj_conv;
25384 this_obj_conv.inner = (void*)(this_obj & (~1));
25385 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25386 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25387 ChannelManagerReadArgs_free(this_obj_conv);
25390 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_keys_manager"))) TS_ChannelManagerReadArgs_get_keys_manager(uint32_t this_ptr) {
25391 LDKChannelManagerReadArgs this_ptr_conv;
25392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25393 this_ptr_conv.is_owned = false;
25394 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25395 // WARNING: This object doesn't live past this scope, needs clone!
25396 uintptr_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv)) | 1;
25400 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_keys_manager"))) TS_ChannelManagerReadArgs_set_keys_manager(uint32_t this_ptr, uint32_t val) {
25401 LDKChannelManagerReadArgs this_ptr_conv;
25402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25403 this_ptr_conv.is_owned = false;
25404 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25405 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25406 CHECK_ACCESS(val_ptr);
25407 LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
25408 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
25411 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint32_t this_ptr) {
25412 LDKChannelManagerReadArgs this_ptr_conv;
25413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25414 this_ptr_conv.is_owned = false;
25415 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25416 // WARNING: This object doesn't live past this scope, needs clone!
25417 uintptr_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv)) | 1;
25421 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_fee_estimator"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint32_t this_ptr, uint32_t val) {
25422 LDKChannelManagerReadArgs this_ptr_conv;
25423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25424 this_ptr_conv.is_owned = false;
25425 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25426 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25427 CHECK_ACCESS(val_ptr);
25428 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
25429 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
25432 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_chain_monitor"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint32_t this_ptr) {
25433 LDKChannelManagerReadArgs this_ptr_conv;
25434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25435 this_ptr_conv.is_owned = false;
25436 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25437 // WARNING: This object doesn't live past this scope, needs clone!
25438 uintptr_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv)) | 1;
25442 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_chain_monitor"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint32_t this_ptr, uint32_t val) {
25443 LDKChannelManagerReadArgs this_ptr_conv;
25444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25445 this_ptr_conv.is_owned = false;
25446 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25447 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25448 CHECK_ACCESS(val_ptr);
25449 LDKWatch val_conv = *(LDKWatch*)(val_ptr);
25450 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
25453 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_tx_broadcaster"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint32_t this_ptr) {
25454 LDKChannelManagerReadArgs this_ptr_conv;
25455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25456 this_ptr_conv.is_owned = false;
25457 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25458 // WARNING: This object doesn't live past this scope, needs clone!
25459 uintptr_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv)) | 1;
25463 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint32_t this_ptr, uint32_t val) {
25464 LDKChannelManagerReadArgs this_ptr_conv;
25465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25466 this_ptr_conv.is_owned = false;
25467 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25468 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25469 CHECK_ACCESS(val_ptr);
25470 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
25471 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
25474 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint32_t this_ptr) {
25475 LDKChannelManagerReadArgs this_ptr_conv;
25476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25477 this_ptr_conv.is_owned = false;
25478 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25479 // WARNING: This object doesn't live past this scope, needs clone!
25480 uintptr_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv)) | 1;
25484 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_logger"))) TS_ChannelManagerReadArgs_set_logger(uint32_t this_ptr, uint32_t val) {
25485 LDKChannelManagerReadArgs this_ptr_conv;
25486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25487 this_ptr_conv.is_owned = false;
25488 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25489 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25490 CHECK_ACCESS(val_ptr);
25491 LDKLogger val_conv = *(LDKLogger*)(val_ptr);
25492 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
25495 uint32_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_default_config"))) TS_ChannelManagerReadArgs_get_default_config(uint32_t this_ptr) {
25496 LDKChannelManagerReadArgs this_ptr_conv;
25497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25498 this_ptr_conv.is_owned = false;
25499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25500 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
25501 uintptr_t ret_ref = 0;
25502 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25503 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25504 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25505 ret_ref = (uintptr_t)ret_var.inner;
25506 if (ret_var.is_owned) {
25512 void __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config"))) TS_ChannelManagerReadArgs_set_default_config(uint32_t this_ptr, uint32_t val) {
25513 LDKChannelManagerReadArgs this_ptr_conv;
25514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25515 this_ptr_conv.is_owned = false;
25516 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25517 LDKUserConfig val_conv;
25518 val_conv.inner = (void*)(val & (~1));
25519 val_conv.is_owned = (val & 1) || (val == 0);
25520 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25521 val_conv = UserConfig_clone(&val_conv);
25522 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
25525 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) {
25526 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
25527 CHECK_ACCESS(keys_manager_ptr);
25528 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
25529 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
25530 CHECK_ACCESS(fee_estimator_ptr);
25531 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25532 void* chain_monitor_ptr = (void*)(((uintptr_t)chain_monitor) & ~1);
25533 CHECK_ACCESS(chain_monitor_ptr);
25534 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
25535 void* tx_broadcaster_ptr = (void*)(((uintptr_t)tx_broadcaster) & ~1);
25536 CHECK_ACCESS(tx_broadcaster_ptr);
25537 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
25538 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
25539 CHECK_ACCESS(logger_ptr);
25540 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25541 LDKUserConfig default_config_conv;
25542 default_config_conv.inner = (void*)(default_config & (~1));
25543 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
25544 CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
25545 default_config_conv = UserConfig_clone(&default_config_conv);
25546 LDKCVec_ChannelMonitorZ channel_monitors_constr;
25547 channel_monitors_constr.datalen = channel_monitors->arr_len;
25548 if (channel_monitors_constr.datalen > 0)
25549 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
25551 channel_monitors_constr.data = NULL;
25552 uint32_t* channel_monitors_vals = channel_monitors->elems /* XXX channel_monitors leaks */;
25553 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
25554 uint32_t channel_monitors_conv_16 = channel_monitors_vals[q];
25555 LDKChannelMonitor channel_monitors_conv_16_conv;
25556 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
25557 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
25558 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
25559 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
25561 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);
25562 uintptr_t ret_ref = 0;
25563 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25564 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25565 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25566 ret_ref = (uintptr_t)ret_var.inner;
25567 if (ret_var.is_owned) {
25573 uint32_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_read"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint32_t arg) {
25574 LDKu8slice ser_ref;
25575 ser_ref.datalen = ser->arr_len;
25576 ser_ref.data = ser->elems /* XXX ser leaks */;
25577 LDKChannelManagerReadArgs arg_conv;
25578 arg_conv.inner = (void*)(arg & (~1));
25579 arg_conv.is_owned = (arg & 1) || (arg == 0);
25580 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25581 // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
25582 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
25583 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
25584 return (uintptr_t)ret_conv;
25587 void __attribute__((export_name("TS_DecodeError_free"))) TS_DecodeError_free(uint32_t this_obj) {
25588 LDKDecodeError this_obj_conv;
25589 this_obj_conv.inner = (void*)(this_obj & (~1));
25590 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25591 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25592 DecodeError_free(this_obj_conv);
25595 static inline uintptr_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
25596 LDKDecodeError ret_var = DecodeError_clone(arg);
25597 uintptr_t ret_ref = 0;
25598 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25599 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25600 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25601 ret_ref = (uintptr_t)ret_var.inner;
25602 if (ret_var.is_owned) {
25607 intptr_t __attribute__((export_name("TS_DecodeError_clone_ptr"))) TS_DecodeError_clone_ptr(uint32_t arg) {
25608 LDKDecodeError arg_conv;
25609 arg_conv.inner = (void*)(arg & (~1));
25610 arg_conv.is_owned = false;
25611 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25612 intptr_t ret_val = DecodeError_clone_ptr(&arg_conv);
25616 uint32_t __attribute__((export_name("TS_DecodeError_clone"))) TS_DecodeError_clone(uint32_t orig) {
25617 LDKDecodeError orig_conv;
25618 orig_conv.inner = (void*)(orig & (~1));
25619 orig_conv.is_owned = false;
25620 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25621 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
25622 uintptr_t ret_ref = 0;
25623 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25624 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25625 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25626 ret_ref = (uintptr_t)ret_var.inner;
25627 if (ret_var.is_owned) {
25633 void __attribute__((export_name("TS_Init_free"))) TS_Init_free(uint32_t this_obj) {
25634 LDKInit this_obj_conv;
25635 this_obj_conv.inner = (void*)(this_obj & (~1));
25636 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25637 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25638 Init_free(this_obj_conv);
25641 uint32_t __attribute__((export_name("TS_Init_get_features"))) TS_Init_get_features(uint32_t this_ptr) {
25642 LDKInit 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 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
25647 uintptr_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_Init_set_features"))) TS_Init_set_features(uint32_t this_ptr, uint32_t val) {
25659 LDKInit 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 LDKInitFeatures 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 = InitFeatures_clone(&val_conv);
25668 Init_set_features(&this_ptr_conv, val_conv);
25671 uint32_t __attribute__((export_name("TS_Init_new"))) TS_Init_new(uint32_t features_arg) {
25672 LDKInitFeatures features_arg_conv;
25673 features_arg_conv.inner = (void*)(features_arg & (~1));
25674 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
25675 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
25676 features_arg_conv = InitFeatures_clone(&features_arg_conv);
25677 LDKInit ret_var = Init_new(features_arg_conv);
25678 uintptr_t ret_ref = 0;
25679 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25680 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25681 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25682 ret_ref = (uintptr_t)ret_var.inner;
25683 if (ret_var.is_owned) {
25689 static inline uintptr_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
25690 LDKInit ret_var = Init_clone(arg);
25691 uintptr_t ret_ref = 0;
25692 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25693 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25694 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25695 ret_ref = (uintptr_t)ret_var.inner;
25696 if (ret_var.is_owned) {
25701 intptr_t __attribute__((export_name("TS_Init_clone_ptr"))) TS_Init_clone_ptr(uint32_t arg) {
25703 arg_conv.inner = (void*)(arg & (~1));
25704 arg_conv.is_owned = false;
25705 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25706 intptr_t ret_val = Init_clone_ptr(&arg_conv);
25710 uint32_t __attribute__((export_name("TS_Init_clone"))) TS_Init_clone(uint32_t orig) {
25712 orig_conv.inner = (void*)(orig & (~1));
25713 orig_conv.is_owned = false;
25714 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25715 LDKInit ret_var = Init_clone(&orig_conv);
25716 uintptr_t ret_ref = 0;
25717 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25718 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25719 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25720 ret_ref = (uintptr_t)ret_var.inner;
25721 if (ret_var.is_owned) {
25727 void __attribute__((export_name("TS_ErrorMessage_free"))) TS_ErrorMessage_free(uint32_t this_obj) {
25728 LDKErrorMessage this_obj_conv;
25729 this_obj_conv.inner = (void*)(this_obj & (~1));
25730 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25731 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25732 ErrorMessage_free(this_obj_conv);
25735 int8_tArray __attribute__((export_name("TS_ErrorMessage_get_channel_id"))) TS_ErrorMessage_get_channel_id(uint32_t this_ptr) {
25736 LDKErrorMessage this_ptr_conv;
25737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25738 this_ptr_conv.is_owned = false;
25739 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25740 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25741 memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
25745 void __attribute__((export_name("TS_ErrorMessage_set_channel_id"))) TS_ErrorMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
25746 LDKErrorMessage this_ptr_conv;
25747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25748 this_ptr_conv.is_owned = false;
25749 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25750 LDKThirtyTwoBytes val_ref;
25751 CHECK(val->arr_len == 32);
25752 memcpy(val_ref.data, val->elems, 32); FREE(val);
25753 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
25756 jstring __attribute__((export_name("TS_ErrorMessage_get_data"))) TS_ErrorMessage_get_data(uint32_t this_ptr) {
25757 LDKErrorMessage this_ptr_conv;
25758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25759 this_ptr_conv.is_owned = false;
25760 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25761 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
25762 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
25767 void __attribute__((export_name("TS_ErrorMessage_set_data"))) TS_ErrorMessage_set_data(uint32_t this_ptr, jstring val) {
25768 LDKErrorMessage this_ptr_conv;
25769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25770 this_ptr_conv.is_owned = false;
25771 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25772 LDKStr val_conv = str_ref_to_owned_c(val);
25773 ErrorMessage_set_data(&this_ptr_conv, val_conv);
25776 uint32_t __attribute__((export_name("TS_ErrorMessage_new"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
25777 LDKThirtyTwoBytes channel_id_arg_ref;
25778 CHECK(channel_id_arg->arr_len == 32);
25779 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
25780 LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
25781 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
25782 uintptr_t ret_ref = 0;
25783 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25784 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25785 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25786 ret_ref = (uintptr_t)ret_var.inner;
25787 if (ret_var.is_owned) {
25793 static inline uintptr_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
25794 LDKErrorMessage ret_var = ErrorMessage_clone(arg);
25795 uintptr_t ret_ref = 0;
25796 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25797 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25798 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25799 ret_ref = (uintptr_t)ret_var.inner;
25800 if (ret_var.is_owned) {
25805 intptr_t __attribute__((export_name("TS_ErrorMessage_clone_ptr"))) TS_ErrorMessage_clone_ptr(uint32_t arg) {
25806 LDKErrorMessage arg_conv;
25807 arg_conv.inner = (void*)(arg & (~1));
25808 arg_conv.is_owned = false;
25809 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25810 intptr_t ret_val = ErrorMessage_clone_ptr(&arg_conv);
25814 uint32_t __attribute__((export_name("TS_ErrorMessage_clone"))) TS_ErrorMessage_clone(uint32_t orig) {
25815 LDKErrorMessage orig_conv;
25816 orig_conv.inner = (void*)(orig & (~1));
25817 orig_conv.is_owned = false;
25818 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25819 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
25820 uintptr_t ret_ref = 0;
25821 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25822 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25823 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25824 ret_ref = (uintptr_t)ret_var.inner;
25825 if (ret_var.is_owned) {
25831 void __attribute__((export_name("TS_WarningMessage_free"))) TS_WarningMessage_free(uint32_t this_obj) {
25832 LDKWarningMessage this_obj_conv;
25833 this_obj_conv.inner = (void*)(this_obj & (~1));
25834 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25835 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25836 WarningMessage_free(this_obj_conv);
25839 int8_tArray __attribute__((export_name("TS_WarningMessage_get_channel_id"))) TS_WarningMessage_get_channel_id(uint32_t this_ptr) {
25840 LDKWarningMessage this_ptr_conv;
25841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25842 this_ptr_conv.is_owned = false;
25843 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25844 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25845 memcpy(ret_arr->elems, *WarningMessage_get_channel_id(&this_ptr_conv), 32);
25849 void __attribute__((export_name("TS_WarningMessage_set_channel_id"))) TS_WarningMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
25850 LDKWarningMessage this_ptr_conv;
25851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25852 this_ptr_conv.is_owned = false;
25853 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25854 LDKThirtyTwoBytes val_ref;
25855 CHECK(val->arr_len == 32);
25856 memcpy(val_ref.data, val->elems, 32); FREE(val);
25857 WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
25860 jstring __attribute__((export_name("TS_WarningMessage_get_data"))) TS_WarningMessage_get_data(uint32_t this_ptr) {
25861 LDKWarningMessage this_ptr_conv;
25862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25863 this_ptr_conv.is_owned = false;
25864 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25865 LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
25866 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
25871 void __attribute__((export_name("TS_WarningMessage_set_data"))) TS_WarningMessage_set_data(uint32_t this_ptr, jstring val) {
25872 LDKWarningMessage this_ptr_conv;
25873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25874 this_ptr_conv.is_owned = false;
25875 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25876 LDKStr val_conv = str_ref_to_owned_c(val);
25877 WarningMessage_set_data(&this_ptr_conv, val_conv);
25880 uint32_t __attribute__((export_name("TS_WarningMessage_new"))) TS_WarningMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
25881 LDKThirtyTwoBytes channel_id_arg_ref;
25882 CHECK(channel_id_arg->arr_len == 32);
25883 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
25884 LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
25885 LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
25886 uintptr_t ret_ref = 0;
25887 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25888 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25889 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25890 ret_ref = (uintptr_t)ret_var.inner;
25891 if (ret_var.is_owned) {
25897 static inline uintptr_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
25898 LDKWarningMessage ret_var = WarningMessage_clone(arg);
25899 uintptr_t ret_ref = 0;
25900 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25901 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25902 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25903 ret_ref = (uintptr_t)ret_var.inner;
25904 if (ret_var.is_owned) {
25909 intptr_t __attribute__((export_name("TS_WarningMessage_clone_ptr"))) TS_WarningMessage_clone_ptr(uint32_t arg) {
25910 LDKWarningMessage arg_conv;
25911 arg_conv.inner = (void*)(arg & (~1));
25912 arg_conv.is_owned = false;
25913 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25914 intptr_t ret_val = WarningMessage_clone_ptr(&arg_conv);
25918 uint32_t __attribute__((export_name("TS_WarningMessage_clone"))) TS_WarningMessage_clone(uint32_t orig) {
25919 LDKWarningMessage orig_conv;
25920 orig_conv.inner = (void*)(orig & (~1));
25921 orig_conv.is_owned = false;
25922 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25923 LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
25924 uintptr_t ret_ref = 0;
25925 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25926 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25927 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25928 ret_ref = (uintptr_t)ret_var.inner;
25929 if (ret_var.is_owned) {
25935 void __attribute__((export_name("TS_Ping_free"))) TS_Ping_free(uint32_t this_obj) {
25936 LDKPing this_obj_conv;
25937 this_obj_conv.inner = (void*)(this_obj & (~1));
25938 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25939 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25940 Ping_free(this_obj_conv);
25943 int16_t __attribute__((export_name("TS_Ping_get_ponglen"))) TS_Ping_get_ponglen(uint32_t this_ptr) {
25944 LDKPing this_ptr_conv;
25945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25946 this_ptr_conv.is_owned = false;
25947 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25948 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
25952 void __attribute__((export_name("TS_Ping_set_ponglen"))) TS_Ping_set_ponglen(uint32_t this_ptr, int16_t val) {
25953 LDKPing this_ptr_conv;
25954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25955 this_ptr_conv.is_owned = false;
25956 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25957 Ping_set_ponglen(&this_ptr_conv, val);
25960 int16_t __attribute__((export_name("TS_Ping_get_byteslen"))) TS_Ping_get_byteslen(uint32_t this_ptr) {
25961 LDKPing this_ptr_conv;
25962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25963 this_ptr_conv.is_owned = false;
25964 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25965 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
25969 void __attribute__((export_name("TS_Ping_set_byteslen"))) TS_Ping_set_byteslen(uint32_t this_ptr, int16_t val) {
25970 LDKPing this_ptr_conv;
25971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25972 this_ptr_conv.is_owned = false;
25973 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25974 Ping_set_byteslen(&this_ptr_conv, val);
25977 uint32_t __attribute__((export_name("TS_Ping_new"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
25978 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
25979 uintptr_t ret_ref = 0;
25980 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25981 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25982 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25983 ret_ref = (uintptr_t)ret_var.inner;
25984 if (ret_var.is_owned) {
25990 static inline uintptr_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
25991 LDKPing ret_var = Ping_clone(arg);
25992 uintptr_t ret_ref = 0;
25993 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25994 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25995 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25996 ret_ref = (uintptr_t)ret_var.inner;
25997 if (ret_var.is_owned) {
26002 intptr_t __attribute__((export_name("TS_Ping_clone_ptr"))) TS_Ping_clone_ptr(uint32_t arg) {
26004 arg_conv.inner = (void*)(arg & (~1));
26005 arg_conv.is_owned = false;
26006 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26007 intptr_t ret_val = Ping_clone_ptr(&arg_conv);
26011 uint32_t __attribute__((export_name("TS_Ping_clone"))) TS_Ping_clone(uint32_t orig) {
26013 orig_conv.inner = (void*)(orig & (~1));
26014 orig_conv.is_owned = false;
26015 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26016 LDKPing ret_var = Ping_clone(&orig_conv);
26017 uintptr_t ret_ref = 0;
26018 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26019 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26020 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26021 ret_ref = (uintptr_t)ret_var.inner;
26022 if (ret_var.is_owned) {
26028 void __attribute__((export_name("TS_Pong_free"))) TS_Pong_free(uint32_t this_obj) {
26029 LDKPong this_obj_conv;
26030 this_obj_conv.inner = (void*)(this_obj & (~1));
26031 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26032 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26033 Pong_free(this_obj_conv);
26036 int16_t __attribute__((export_name("TS_Pong_get_byteslen"))) TS_Pong_get_byteslen(uint32_t this_ptr) {
26037 LDKPong this_ptr_conv;
26038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26039 this_ptr_conv.is_owned = false;
26040 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26041 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
26045 void __attribute__((export_name("TS_Pong_set_byteslen"))) TS_Pong_set_byteslen(uint32_t this_ptr, int16_t val) {
26046 LDKPong this_ptr_conv;
26047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26048 this_ptr_conv.is_owned = false;
26049 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26050 Pong_set_byteslen(&this_ptr_conv, val);
26053 uint32_t __attribute__((export_name("TS_Pong_new"))) TS_Pong_new(int16_t byteslen_arg) {
26054 LDKPong ret_var = Pong_new(byteslen_arg);
26055 uintptr_t ret_ref = 0;
26056 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26057 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26058 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26059 ret_ref = (uintptr_t)ret_var.inner;
26060 if (ret_var.is_owned) {
26066 static inline uintptr_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
26067 LDKPong ret_var = Pong_clone(arg);
26068 uintptr_t ret_ref = 0;
26069 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26070 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26071 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26072 ret_ref = (uintptr_t)ret_var.inner;
26073 if (ret_var.is_owned) {
26078 intptr_t __attribute__((export_name("TS_Pong_clone_ptr"))) TS_Pong_clone_ptr(uint32_t arg) {
26080 arg_conv.inner = (void*)(arg & (~1));
26081 arg_conv.is_owned = false;
26082 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26083 intptr_t ret_val = Pong_clone_ptr(&arg_conv);
26087 uint32_t __attribute__((export_name("TS_Pong_clone"))) TS_Pong_clone(uint32_t orig) {
26089 orig_conv.inner = (void*)(orig & (~1));
26090 orig_conv.is_owned = false;
26091 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26092 LDKPong ret_var = Pong_clone(&orig_conv);
26093 uintptr_t ret_ref = 0;
26094 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26095 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26096 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26097 ret_ref = (uintptr_t)ret_var.inner;
26098 if (ret_var.is_owned) {
26104 void __attribute__((export_name("TS_OpenChannel_free"))) TS_OpenChannel_free(uint32_t this_obj) {
26105 LDKOpenChannel this_obj_conv;
26106 this_obj_conv.inner = (void*)(this_obj & (~1));
26107 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26108 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26109 OpenChannel_free(this_obj_conv);
26112 int8_tArray __attribute__((export_name("TS_OpenChannel_get_chain_hash"))) TS_OpenChannel_get_chain_hash(uint32_t this_ptr) {
26113 LDKOpenChannel this_ptr_conv;
26114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26115 this_ptr_conv.is_owned = false;
26116 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26117 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26118 memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
26122 void __attribute__((export_name("TS_OpenChannel_set_chain_hash"))) TS_OpenChannel_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
26123 LDKOpenChannel this_ptr_conv;
26124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26125 this_ptr_conv.is_owned = false;
26126 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26127 LDKThirtyTwoBytes val_ref;
26128 CHECK(val->arr_len == 32);
26129 memcpy(val_ref.data, val->elems, 32); FREE(val);
26130 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
26133 int8_tArray __attribute__((export_name("TS_OpenChannel_get_temporary_channel_id"))) TS_OpenChannel_get_temporary_channel_id(uint32_t this_ptr) {
26134 LDKOpenChannel this_ptr_conv;
26135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26136 this_ptr_conv.is_owned = false;
26137 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26138 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26139 memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
26143 void __attribute__((export_name("TS_OpenChannel_set_temporary_channel_id"))) TS_OpenChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
26144 LDKOpenChannel this_ptr_conv;
26145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26146 this_ptr_conv.is_owned = false;
26147 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26148 LDKThirtyTwoBytes val_ref;
26149 CHECK(val->arr_len == 32);
26150 memcpy(val_ref.data, val->elems, 32); FREE(val);
26151 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
26154 int64_t __attribute__((export_name("TS_OpenChannel_get_funding_satoshis"))) TS_OpenChannel_get_funding_satoshis(uint32_t this_ptr) {
26155 LDKOpenChannel this_ptr_conv;
26156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26157 this_ptr_conv.is_owned = false;
26158 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26159 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
26163 void __attribute__((export_name("TS_OpenChannel_set_funding_satoshis"))) TS_OpenChannel_set_funding_satoshis(uint32_t this_ptr, int64_t val) {
26164 LDKOpenChannel this_ptr_conv;
26165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26166 this_ptr_conv.is_owned = false;
26167 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26168 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
26171 int64_t __attribute__((export_name("TS_OpenChannel_get_push_msat"))) TS_OpenChannel_get_push_msat(uint32_t this_ptr) {
26172 LDKOpenChannel this_ptr_conv;
26173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26174 this_ptr_conv.is_owned = false;
26175 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26176 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
26180 void __attribute__((export_name("TS_OpenChannel_set_push_msat"))) TS_OpenChannel_set_push_msat(uint32_t this_ptr, int64_t val) {
26181 LDKOpenChannel this_ptr_conv;
26182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26183 this_ptr_conv.is_owned = false;
26184 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26185 OpenChannel_set_push_msat(&this_ptr_conv, val);
26188 int64_t __attribute__((export_name("TS_OpenChannel_get_dust_limit_satoshis"))) TS_OpenChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
26189 LDKOpenChannel this_ptr_conv;
26190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26191 this_ptr_conv.is_owned = false;
26192 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26193 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
26197 void __attribute__((export_name("TS_OpenChannel_set_dust_limit_satoshis"))) TS_OpenChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
26198 LDKOpenChannel this_ptr_conv;
26199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26200 this_ptr_conv.is_owned = false;
26201 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26202 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
26205 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) {
26206 LDKOpenChannel this_ptr_conv;
26207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26208 this_ptr_conv.is_owned = false;
26209 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26210 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
26214 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) {
26215 LDKOpenChannel this_ptr_conv;
26216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26217 this_ptr_conv.is_owned = false;
26218 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26219 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
26222 int64_t __attribute__((export_name("TS_OpenChannel_get_channel_reserve_satoshis"))) TS_OpenChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
26223 LDKOpenChannel this_ptr_conv;
26224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26225 this_ptr_conv.is_owned = false;
26226 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26227 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
26231 void __attribute__((export_name("TS_OpenChannel_set_channel_reserve_satoshis"))) TS_OpenChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
26232 LDKOpenChannel this_ptr_conv;
26233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26234 this_ptr_conv.is_owned = false;
26235 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26236 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
26239 int64_t __attribute__((export_name("TS_OpenChannel_get_htlc_minimum_msat"))) TS_OpenChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
26240 LDKOpenChannel this_ptr_conv;
26241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26242 this_ptr_conv.is_owned = false;
26243 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26244 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
26248 void __attribute__((export_name("TS_OpenChannel_set_htlc_minimum_msat"))) TS_OpenChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
26249 LDKOpenChannel this_ptr_conv;
26250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26251 this_ptr_conv.is_owned = false;
26252 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26253 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
26256 int32_t __attribute__((export_name("TS_OpenChannel_get_feerate_per_kw"))) TS_OpenChannel_get_feerate_per_kw(uint32_t this_ptr) {
26257 LDKOpenChannel this_ptr_conv;
26258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26259 this_ptr_conv.is_owned = false;
26260 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26261 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
26265 void __attribute__((export_name("TS_OpenChannel_set_feerate_per_kw"))) TS_OpenChannel_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
26266 LDKOpenChannel this_ptr_conv;
26267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26268 this_ptr_conv.is_owned = false;
26269 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26270 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
26273 int16_t __attribute__((export_name("TS_OpenChannel_get_to_self_delay"))) TS_OpenChannel_get_to_self_delay(uint32_t this_ptr) {
26274 LDKOpenChannel this_ptr_conv;
26275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26276 this_ptr_conv.is_owned = false;
26277 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26278 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
26282 void __attribute__((export_name("TS_OpenChannel_set_to_self_delay"))) TS_OpenChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
26283 LDKOpenChannel this_ptr_conv;
26284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26285 this_ptr_conv.is_owned = false;
26286 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26287 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
26290 int16_t __attribute__((export_name("TS_OpenChannel_get_max_accepted_htlcs"))) TS_OpenChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
26291 LDKOpenChannel this_ptr_conv;
26292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26293 this_ptr_conv.is_owned = false;
26294 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26295 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
26299 void __attribute__((export_name("TS_OpenChannel_set_max_accepted_htlcs"))) TS_OpenChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
26300 LDKOpenChannel this_ptr_conv;
26301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26302 this_ptr_conv.is_owned = false;
26303 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26304 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
26307 int8_tArray __attribute__((export_name("TS_OpenChannel_get_funding_pubkey"))) TS_OpenChannel_get_funding_pubkey(uint32_t this_ptr) {
26308 LDKOpenChannel this_ptr_conv;
26309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26310 this_ptr_conv.is_owned = false;
26311 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26312 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26313 memcpy(ret_arr->elems, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
26317 void __attribute__((export_name("TS_OpenChannel_set_funding_pubkey"))) TS_OpenChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
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 LDKPublicKey val_ref;
26323 CHECK(val->arr_len == 33);
26324 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26325 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
26328 int8_tArray __attribute__((export_name("TS_OpenChannel_get_revocation_basepoint"))) TS_OpenChannel_get_revocation_basepoint(uint32_t this_ptr) {
26329 LDKOpenChannel this_ptr_conv;
26330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26331 this_ptr_conv.is_owned = false;
26332 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26333 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26334 memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
26338 void __attribute__((export_name("TS_OpenChannel_set_revocation_basepoint"))) TS_OpenChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
26339 LDKOpenChannel this_ptr_conv;
26340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26341 this_ptr_conv.is_owned = false;
26342 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26343 LDKPublicKey val_ref;
26344 CHECK(val->arr_len == 33);
26345 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26346 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
26349 int8_tArray __attribute__((export_name("TS_OpenChannel_get_payment_point"))) TS_OpenChannel_get_payment_point(uint32_t this_ptr) {
26350 LDKOpenChannel this_ptr_conv;
26351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26352 this_ptr_conv.is_owned = false;
26353 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26354 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26355 memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
26359 void __attribute__((export_name("TS_OpenChannel_set_payment_point"))) TS_OpenChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
26360 LDKOpenChannel this_ptr_conv;
26361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26362 this_ptr_conv.is_owned = false;
26363 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26364 LDKPublicKey val_ref;
26365 CHECK(val->arr_len == 33);
26366 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26367 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
26370 int8_tArray __attribute__((export_name("TS_OpenChannel_get_delayed_payment_basepoint"))) TS_OpenChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
26371 LDKOpenChannel this_ptr_conv;
26372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26373 this_ptr_conv.is_owned = false;
26374 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26375 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26376 memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
26380 void __attribute__((export_name("TS_OpenChannel_set_delayed_payment_basepoint"))) TS_OpenChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
26381 LDKOpenChannel this_ptr_conv;
26382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26383 this_ptr_conv.is_owned = false;
26384 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26385 LDKPublicKey val_ref;
26386 CHECK(val->arr_len == 33);
26387 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26388 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
26391 int8_tArray __attribute__((export_name("TS_OpenChannel_get_htlc_basepoint"))) TS_OpenChannel_get_htlc_basepoint(uint32_t this_ptr) {
26392 LDKOpenChannel this_ptr_conv;
26393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26394 this_ptr_conv.is_owned = false;
26395 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26396 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26397 memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
26401 void __attribute__((export_name("TS_OpenChannel_set_htlc_basepoint"))) TS_OpenChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
26402 LDKOpenChannel this_ptr_conv;
26403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26404 this_ptr_conv.is_owned = false;
26405 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26406 LDKPublicKey val_ref;
26407 CHECK(val->arr_len == 33);
26408 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26409 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
26412 int8_tArray __attribute__((export_name("TS_OpenChannel_get_first_per_commitment_point"))) TS_OpenChannel_get_first_per_commitment_point(uint32_t this_ptr) {
26413 LDKOpenChannel this_ptr_conv;
26414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26415 this_ptr_conv.is_owned = false;
26416 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26417 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26418 memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
26422 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) {
26423 LDKOpenChannel this_ptr_conv;
26424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26425 this_ptr_conv.is_owned = false;
26426 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26427 LDKPublicKey val_ref;
26428 CHECK(val->arr_len == 33);
26429 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26430 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
26433 int8_t __attribute__((export_name("TS_OpenChannel_get_channel_flags"))) TS_OpenChannel_get_channel_flags(uint32_t this_ptr) {
26434 LDKOpenChannel this_ptr_conv;
26435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26436 this_ptr_conv.is_owned = false;
26437 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26438 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
26442 void __attribute__((export_name("TS_OpenChannel_set_channel_flags"))) TS_OpenChannel_set_channel_flags(uint32_t this_ptr, int8_t val) {
26443 LDKOpenChannel this_ptr_conv;
26444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26445 this_ptr_conv.is_owned = false;
26446 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26447 OpenChannel_set_channel_flags(&this_ptr_conv, val);
26450 uint32_t __attribute__((export_name("TS_OpenChannel_get_channel_type"))) TS_OpenChannel_get_channel_type(uint32_t this_ptr) {
26451 LDKOpenChannel this_ptr_conv;
26452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26453 this_ptr_conv.is_owned = false;
26454 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26455 LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
26456 uintptr_t ret_ref = 0;
26457 if ((uintptr_t)ret_var.inner > 4096) {
26458 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26459 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26460 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26461 ret_ref = (uintptr_t)ret_var.inner;
26462 if (ret_var.is_owned) {
26469 void __attribute__((export_name("TS_OpenChannel_set_channel_type"))) TS_OpenChannel_set_channel_type(uint32_t this_ptr, uint32_t val) {
26470 LDKOpenChannel this_ptr_conv;
26471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26472 this_ptr_conv.is_owned = false;
26473 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26474 LDKChannelTypeFeatures val_conv;
26475 val_conv.inner = (void*)(val & (~1));
26476 val_conv.is_owned = (val & 1) || (val == 0);
26477 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26478 val_conv = ChannelTypeFeatures_clone(&val_conv);
26479 OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
26482 static inline uintptr_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
26483 LDKOpenChannel ret_var = OpenChannel_clone(arg);
26484 uintptr_t ret_ref = 0;
26485 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26486 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26487 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26488 ret_ref = (uintptr_t)ret_var.inner;
26489 if (ret_var.is_owned) {
26494 intptr_t __attribute__((export_name("TS_OpenChannel_clone_ptr"))) TS_OpenChannel_clone_ptr(uint32_t arg) {
26495 LDKOpenChannel arg_conv;
26496 arg_conv.inner = (void*)(arg & (~1));
26497 arg_conv.is_owned = false;
26498 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26499 intptr_t ret_val = OpenChannel_clone_ptr(&arg_conv);
26503 uint32_t __attribute__((export_name("TS_OpenChannel_clone"))) TS_OpenChannel_clone(uint32_t orig) {
26504 LDKOpenChannel orig_conv;
26505 orig_conv.inner = (void*)(orig & (~1));
26506 orig_conv.is_owned = false;
26507 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26508 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
26509 uintptr_t ret_ref = 0;
26510 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26511 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26512 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26513 ret_ref = (uintptr_t)ret_var.inner;
26514 if (ret_var.is_owned) {
26520 void __attribute__((export_name("TS_AcceptChannel_free"))) TS_AcceptChannel_free(uint32_t this_obj) {
26521 LDKAcceptChannel this_obj_conv;
26522 this_obj_conv.inner = (void*)(this_obj & (~1));
26523 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26524 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26525 AcceptChannel_free(this_obj_conv);
26528 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_temporary_channel_id"))) TS_AcceptChannel_get_temporary_channel_id(uint32_t this_ptr) {
26529 LDKAcceptChannel this_ptr_conv;
26530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26531 this_ptr_conv.is_owned = false;
26532 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26533 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26534 memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
26538 void __attribute__((export_name("TS_AcceptChannel_set_temporary_channel_id"))) TS_AcceptChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
26539 LDKAcceptChannel this_ptr_conv;
26540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26541 this_ptr_conv.is_owned = false;
26542 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26543 LDKThirtyTwoBytes val_ref;
26544 CHECK(val->arr_len == 32);
26545 memcpy(val_ref.data, val->elems, 32); FREE(val);
26546 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
26549 int64_t __attribute__((export_name("TS_AcceptChannel_get_dust_limit_satoshis"))) TS_AcceptChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
26550 LDKAcceptChannel this_ptr_conv;
26551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26552 this_ptr_conv.is_owned = false;
26553 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26554 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
26558 void __attribute__((export_name("TS_AcceptChannel_set_dust_limit_satoshis"))) TS_AcceptChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
26559 LDKAcceptChannel 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 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
26566 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) {
26567 LDKAcceptChannel this_ptr_conv;
26568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26569 this_ptr_conv.is_owned = false;
26570 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26571 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
26575 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) {
26576 LDKAcceptChannel this_ptr_conv;
26577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26578 this_ptr_conv.is_owned = false;
26579 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26580 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
26583 int64_t __attribute__((export_name("TS_AcceptChannel_get_channel_reserve_satoshis"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
26584 LDKAcceptChannel this_ptr_conv;
26585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26586 this_ptr_conv.is_owned = false;
26587 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26588 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
26592 void __attribute__((export_name("TS_AcceptChannel_set_channel_reserve_satoshis"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
26593 LDKAcceptChannel this_ptr_conv;
26594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26595 this_ptr_conv.is_owned = false;
26596 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26597 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
26600 int64_t __attribute__((export_name("TS_AcceptChannel_get_htlc_minimum_msat"))) TS_AcceptChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
26601 LDKAcceptChannel this_ptr_conv;
26602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26603 this_ptr_conv.is_owned = false;
26604 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26605 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
26609 void __attribute__((export_name("TS_AcceptChannel_set_htlc_minimum_msat"))) TS_AcceptChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
26610 LDKAcceptChannel this_ptr_conv;
26611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26612 this_ptr_conv.is_owned = false;
26613 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26614 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
26617 int32_t __attribute__((export_name("TS_AcceptChannel_get_minimum_depth"))) TS_AcceptChannel_get_minimum_depth(uint32_t this_ptr) {
26618 LDKAcceptChannel this_ptr_conv;
26619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26620 this_ptr_conv.is_owned = false;
26621 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26622 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
26626 void __attribute__((export_name("TS_AcceptChannel_set_minimum_depth"))) TS_AcceptChannel_set_minimum_depth(uint32_t this_ptr, int32_t val) {
26627 LDKAcceptChannel this_ptr_conv;
26628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26629 this_ptr_conv.is_owned = false;
26630 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26631 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
26634 int16_t __attribute__((export_name("TS_AcceptChannel_get_to_self_delay"))) TS_AcceptChannel_get_to_self_delay(uint32_t this_ptr) {
26635 LDKAcceptChannel this_ptr_conv;
26636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26637 this_ptr_conv.is_owned = false;
26638 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26639 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
26643 void __attribute__((export_name("TS_AcceptChannel_set_to_self_delay"))) TS_AcceptChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
26644 LDKAcceptChannel this_ptr_conv;
26645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26646 this_ptr_conv.is_owned = false;
26647 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26648 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
26651 int16_t __attribute__((export_name("TS_AcceptChannel_get_max_accepted_htlcs"))) TS_AcceptChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
26652 LDKAcceptChannel this_ptr_conv;
26653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26654 this_ptr_conv.is_owned = false;
26655 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26656 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
26660 void __attribute__((export_name("TS_AcceptChannel_set_max_accepted_htlcs"))) TS_AcceptChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
26661 LDKAcceptChannel this_ptr_conv;
26662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26663 this_ptr_conv.is_owned = false;
26664 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26665 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
26668 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_funding_pubkey"))) TS_AcceptChannel_get_funding_pubkey(uint32_t this_ptr) {
26669 LDKAcceptChannel this_ptr_conv;
26670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26671 this_ptr_conv.is_owned = false;
26672 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26673 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26674 memcpy(ret_arr->elems, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
26678 void __attribute__((export_name("TS_AcceptChannel_set_funding_pubkey"))) TS_AcceptChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
26679 LDKAcceptChannel this_ptr_conv;
26680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26681 this_ptr_conv.is_owned = false;
26682 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26683 LDKPublicKey val_ref;
26684 CHECK(val->arr_len == 33);
26685 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26686 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
26689 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_revocation_basepoint"))) TS_AcceptChannel_get_revocation_basepoint(uint32_t this_ptr) {
26690 LDKAcceptChannel this_ptr_conv;
26691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26692 this_ptr_conv.is_owned = false;
26693 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26694 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26695 memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
26699 void __attribute__((export_name("TS_AcceptChannel_set_revocation_basepoint"))) TS_AcceptChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
26700 LDKAcceptChannel this_ptr_conv;
26701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26702 this_ptr_conv.is_owned = false;
26703 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26704 LDKPublicKey val_ref;
26705 CHECK(val->arr_len == 33);
26706 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26707 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
26710 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_payment_point"))) TS_AcceptChannel_get_payment_point(uint32_t this_ptr) {
26711 LDKAcceptChannel this_ptr_conv;
26712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26713 this_ptr_conv.is_owned = false;
26714 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26715 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26716 memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
26720 void __attribute__((export_name("TS_AcceptChannel_set_payment_point"))) TS_AcceptChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
26721 LDKAcceptChannel this_ptr_conv;
26722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26723 this_ptr_conv.is_owned = false;
26724 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26725 LDKPublicKey val_ref;
26726 CHECK(val->arr_len == 33);
26727 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26728 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
26731 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_delayed_payment_basepoint"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
26732 LDKAcceptChannel this_ptr_conv;
26733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26734 this_ptr_conv.is_owned = false;
26735 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26736 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26737 memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
26741 void __attribute__((export_name("TS_AcceptChannel_set_delayed_payment_basepoint"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
26742 LDKAcceptChannel this_ptr_conv;
26743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26744 this_ptr_conv.is_owned = false;
26745 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26746 LDKPublicKey val_ref;
26747 CHECK(val->arr_len == 33);
26748 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26749 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
26752 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_htlc_basepoint"))) TS_AcceptChannel_get_htlc_basepoint(uint32_t this_ptr) {
26753 LDKAcceptChannel this_ptr_conv;
26754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26755 this_ptr_conv.is_owned = false;
26756 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26757 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26758 memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
26762 void __attribute__((export_name("TS_AcceptChannel_set_htlc_basepoint"))) TS_AcceptChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
26763 LDKAcceptChannel this_ptr_conv;
26764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26765 this_ptr_conv.is_owned = false;
26766 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26767 LDKPublicKey val_ref;
26768 CHECK(val->arr_len == 33);
26769 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26770 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
26773 int8_tArray __attribute__((export_name("TS_AcceptChannel_get_first_per_commitment_point"))) TS_AcceptChannel_get_first_per_commitment_point(uint32_t this_ptr) {
26774 LDKAcceptChannel this_ptr_conv;
26775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26776 this_ptr_conv.is_owned = false;
26777 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26778 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26779 memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
26783 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) {
26784 LDKAcceptChannel this_ptr_conv;
26785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26786 this_ptr_conv.is_owned = false;
26787 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26788 LDKPublicKey val_ref;
26789 CHECK(val->arr_len == 33);
26790 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26791 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
26794 uint32_t __attribute__((export_name("TS_AcceptChannel_get_channel_type"))) TS_AcceptChannel_get_channel_type(uint32_t this_ptr) {
26795 LDKAcceptChannel this_ptr_conv;
26796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26797 this_ptr_conv.is_owned = false;
26798 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26799 LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
26800 uintptr_t ret_ref = 0;
26801 if ((uintptr_t)ret_var.inner > 4096) {
26802 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26803 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26804 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26805 ret_ref = (uintptr_t)ret_var.inner;
26806 if (ret_var.is_owned) {
26813 void __attribute__((export_name("TS_AcceptChannel_set_channel_type"))) TS_AcceptChannel_set_channel_type(uint32_t this_ptr, uint32_t val) {
26814 LDKAcceptChannel this_ptr_conv;
26815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26816 this_ptr_conv.is_owned = false;
26817 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26818 LDKChannelTypeFeatures val_conv;
26819 val_conv.inner = (void*)(val & (~1));
26820 val_conv.is_owned = (val & 1) || (val == 0);
26821 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26822 val_conv = ChannelTypeFeatures_clone(&val_conv);
26823 AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
26826 static inline uintptr_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
26827 LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
26828 uintptr_t ret_ref = 0;
26829 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26830 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26831 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26832 ret_ref = (uintptr_t)ret_var.inner;
26833 if (ret_var.is_owned) {
26838 intptr_t __attribute__((export_name("TS_AcceptChannel_clone_ptr"))) TS_AcceptChannel_clone_ptr(uint32_t arg) {
26839 LDKAcceptChannel arg_conv;
26840 arg_conv.inner = (void*)(arg & (~1));
26841 arg_conv.is_owned = false;
26842 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26843 intptr_t ret_val = AcceptChannel_clone_ptr(&arg_conv);
26847 uint32_t __attribute__((export_name("TS_AcceptChannel_clone"))) TS_AcceptChannel_clone(uint32_t orig) {
26848 LDKAcceptChannel orig_conv;
26849 orig_conv.inner = (void*)(orig & (~1));
26850 orig_conv.is_owned = false;
26851 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26852 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
26853 uintptr_t ret_ref = 0;
26854 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26855 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26856 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26857 ret_ref = (uintptr_t)ret_var.inner;
26858 if (ret_var.is_owned) {
26864 void __attribute__((export_name("TS_FundingCreated_free"))) TS_FundingCreated_free(uint32_t this_obj) {
26865 LDKFundingCreated this_obj_conv;
26866 this_obj_conv.inner = (void*)(this_obj & (~1));
26867 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26868 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26869 FundingCreated_free(this_obj_conv);
26872 int8_tArray __attribute__((export_name("TS_FundingCreated_get_temporary_channel_id"))) TS_FundingCreated_get_temporary_channel_id(uint32_t this_ptr) {
26873 LDKFundingCreated this_ptr_conv;
26874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26875 this_ptr_conv.is_owned = false;
26876 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26877 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26878 memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
26882 void __attribute__((export_name("TS_FundingCreated_set_temporary_channel_id"))) TS_FundingCreated_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
26883 LDKFundingCreated this_ptr_conv;
26884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26885 this_ptr_conv.is_owned = false;
26886 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26887 LDKThirtyTwoBytes val_ref;
26888 CHECK(val->arr_len == 32);
26889 memcpy(val_ref.data, val->elems, 32); FREE(val);
26890 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
26893 int8_tArray __attribute__((export_name("TS_FundingCreated_get_funding_txid"))) TS_FundingCreated_get_funding_txid(uint32_t this_ptr) {
26894 LDKFundingCreated this_ptr_conv;
26895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26896 this_ptr_conv.is_owned = false;
26897 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26898 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26899 memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
26903 void __attribute__((export_name("TS_FundingCreated_set_funding_txid"))) TS_FundingCreated_set_funding_txid(uint32_t this_ptr, int8_tArray val) {
26904 LDKFundingCreated this_ptr_conv;
26905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26906 this_ptr_conv.is_owned = false;
26907 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26908 LDKThirtyTwoBytes val_ref;
26909 CHECK(val->arr_len == 32);
26910 memcpy(val_ref.data, val->elems, 32); FREE(val);
26911 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
26914 int16_t __attribute__((export_name("TS_FundingCreated_get_funding_output_index"))) TS_FundingCreated_get_funding_output_index(uint32_t this_ptr) {
26915 LDKFundingCreated this_ptr_conv;
26916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26917 this_ptr_conv.is_owned = false;
26918 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26919 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
26923 void __attribute__((export_name("TS_FundingCreated_set_funding_output_index"))) TS_FundingCreated_set_funding_output_index(uint32_t this_ptr, int16_t val) {
26924 LDKFundingCreated this_ptr_conv;
26925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26926 this_ptr_conv.is_owned = false;
26927 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26928 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
26931 int8_tArray __attribute__((export_name("TS_FundingCreated_get_signature"))) TS_FundingCreated_get_signature(uint32_t this_ptr) {
26932 LDKFundingCreated this_ptr_conv;
26933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26934 this_ptr_conv.is_owned = false;
26935 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26936 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
26937 memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
26941 void __attribute__((export_name("TS_FundingCreated_set_signature"))) TS_FundingCreated_set_signature(uint32_t this_ptr, int8_tArray val) {
26942 LDKFundingCreated this_ptr_conv;
26943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26944 this_ptr_conv.is_owned = false;
26945 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26946 LDKSignature val_ref;
26947 CHECK(val->arr_len == 64);
26948 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
26949 FundingCreated_set_signature(&this_ptr_conv, val_ref);
26952 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) {
26953 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
26954 CHECK(temporary_channel_id_arg->arr_len == 32);
26955 memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
26956 LDKThirtyTwoBytes funding_txid_arg_ref;
26957 CHECK(funding_txid_arg->arr_len == 32);
26958 memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
26959 LDKSignature signature_arg_ref;
26960 CHECK(signature_arg->arr_len == 64);
26961 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
26962 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
26963 uintptr_t ret_ref = 0;
26964 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26965 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26966 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26967 ret_ref = (uintptr_t)ret_var.inner;
26968 if (ret_var.is_owned) {
26974 static inline uintptr_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
26975 LDKFundingCreated ret_var = FundingCreated_clone(arg);
26976 uintptr_t ret_ref = 0;
26977 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26978 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26979 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26980 ret_ref = (uintptr_t)ret_var.inner;
26981 if (ret_var.is_owned) {
26986 intptr_t __attribute__((export_name("TS_FundingCreated_clone_ptr"))) TS_FundingCreated_clone_ptr(uint32_t arg) {
26987 LDKFundingCreated arg_conv;
26988 arg_conv.inner = (void*)(arg & (~1));
26989 arg_conv.is_owned = false;
26990 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26991 intptr_t ret_val = FundingCreated_clone_ptr(&arg_conv);
26995 uint32_t __attribute__((export_name("TS_FundingCreated_clone"))) TS_FundingCreated_clone(uint32_t orig) {
26996 LDKFundingCreated orig_conv;
26997 orig_conv.inner = (void*)(orig & (~1));
26998 orig_conv.is_owned = false;
26999 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27000 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
27001 uintptr_t ret_ref = 0;
27002 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27003 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27004 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27005 ret_ref = (uintptr_t)ret_var.inner;
27006 if (ret_var.is_owned) {
27012 void __attribute__((export_name("TS_FundingSigned_free"))) TS_FundingSigned_free(uint32_t this_obj) {
27013 LDKFundingSigned this_obj_conv;
27014 this_obj_conv.inner = (void*)(this_obj & (~1));
27015 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27016 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27017 FundingSigned_free(this_obj_conv);
27020 int8_tArray __attribute__((export_name("TS_FundingSigned_get_channel_id"))) TS_FundingSigned_get_channel_id(uint32_t this_ptr) {
27021 LDKFundingSigned this_ptr_conv;
27022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27023 this_ptr_conv.is_owned = false;
27024 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27025 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27026 memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
27030 void __attribute__((export_name("TS_FundingSigned_set_channel_id"))) TS_FundingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
27031 LDKFundingSigned this_ptr_conv;
27032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27033 this_ptr_conv.is_owned = false;
27034 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27035 LDKThirtyTwoBytes val_ref;
27036 CHECK(val->arr_len == 32);
27037 memcpy(val_ref.data, val->elems, 32); FREE(val);
27038 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
27041 int8_tArray __attribute__((export_name("TS_FundingSigned_get_signature"))) TS_FundingSigned_get_signature(uint32_t this_ptr) {
27042 LDKFundingSigned this_ptr_conv;
27043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27044 this_ptr_conv.is_owned = false;
27045 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27046 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
27047 memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
27051 void __attribute__((export_name("TS_FundingSigned_set_signature"))) TS_FundingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
27052 LDKFundingSigned this_ptr_conv;
27053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27054 this_ptr_conv.is_owned = false;
27055 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27056 LDKSignature val_ref;
27057 CHECK(val->arr_len == 64);
27058 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
27059 FundingSigned_set_signature(&this_ptr_conv, val_ref);
27062 uint32_t __attribute__((export_name("TS_FundingSigned_new"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
27063 LDKThirtyTwoBytes channel_id_arg_ref;
27064 CHECK(channel_id_arg->arr_len == 32);
27065 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
27066 LDKSignature signature_arg_ref;
27067 CHECK(signature_arg->arr_len == 64);
27068 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
27069 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
27070 uintptr_t ret_ref = 0;
27071 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27072 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27073 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27074 ret_ref = (uintptr_t)ret_var.inner;
27075 if (ret_var.is_owned) {
27081 static inline uintptr_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
27082 LDKFundingSigned ret_var = FundingSigned_clone(arg);
27083 uintptr_t ret_ref = 0;
27084 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27085 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27086 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27087 ret_ref = (uintptr_t)ret_var.inner;
27088 if (ret_var.is_owned) {
27093 intptr_t __attribute__((export_name("TS_FundingSigned_clone_ptr"))) TS_FundingSigned_clone_ptr(uint32_t arg) {
27094 LDKFundingSigned arg_conv;
27095 arg_conv.inner = (void*)(arg & (~1));
27096 arg_conv.is_owned = false;
27097 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27098 intptr_t ret_val = FundingSigned_clone_ptr(&arg_conv);
27102 uint32_t __attribute__((export_name("TS_FundingSigned_clone"))) TS_FundingSigned_clone(uint32_t orig) {
27103 LDKFundingSigned orig_conv;
27104 orig_conv.inner = (void*)(orig & (~1));
27105 orig_conv.is_owned = false;
27106 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27107 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
27108 uintptr_t ret_ref = 0;
27109 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27110 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27111 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27112 ret_ref = (uintptr_t)ret_var.inner;
27113 if (ret_var.is_owned) {
27119 void __attribute__((export_name("TS_FundingLocked_free"))) TS_FundingLocked_free(uint32_t this_obj) {
27120 LDKFundingLocked this_obj_conv;
27121 this_obj_conv.inner = (void*)(this_obj & (~1));
27122 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27123 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27124 FundingLocked_free(this_obj_conv);
27127 int8_tArray __attribute__((export_name("TS_FundingLocked_get_channel_id"))) TS_FundingLocked_get_channel_id(uint32_t this_ptr) {
27128 LDKFundingLocked this_ptr_conv;
27129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27130 this_ptr_conv.is_owned = false;
27131 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27132 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27133 memcpy(ret_arr->elems, *FundingLocked_get_channel_id(&this_ptr_conv), 32);
27137 void __attribute__((export_name("TS_FundingLocked_set_channel_id"))) TS_FundingLocked_set_channel_id(uint32_t this_ptr, int8_tArray val) {
27138 LDKFundingLocked this_ptr_conv;
27139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27140 this_ptr_conv.is_owned = false;
27141 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27142 LDKThirtyTwoBytes val_ref;
27143 CHECK(val->arr_len == 32);
27144 memcpy(val_ref.data, val->elems, 32); FREE(val);
27145 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
27148 int8_tArray __attribute__((export_name("TS_FundingLocked_get_next_per_commitment_point"))) TS_FundingLocked_get_next_per_commitment_point(uint32_t this_ptr) {
27149 LDKFundingLocked this_ptr_conv;
27150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27151 this_ptr_conv.is_owned = false;
27152 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27153 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27154 memcpy(ret_arr->elems, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
27158 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) {
27159 LDKFundingLocked this_ptr_conv;
27160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27161 this_ptr_conv.is_owned = false;
27162 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27163 LDKPublicKey val_ref;
27164 CHECK(val->arr_len == 33);
27165 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27166 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
27169 uint32_t __attribute__((export_name("TS_FundingLocked_new"))) TS_FundingLocked_new(int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
27170 LDKThirtyTwoBytes channel_id_arg_ref;
27171 CHECK(channel_id_arg->arr_len == 32);
27172 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
27173 LDKPublicKey next_per_commitment_point_arg_ref;
27174 CHECK(next_per_commitment_point_arg->arr_len == 33);
27175 memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
27176 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
27177 uintptr_t ret_ref = 0;
27178 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27179 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27180 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27181 ret_ref = (uintptr_t)ret_var.inner;
27182 if (ret_var.is_owned) {
27188 static inline uintptr_t FundingLocked_clone_ptr(LDKFundingLocked *NONNULL_PTR arg) {
27189 LDKFundingLocked ret_var = FundingLocked_clone(arg);
27190 uintptr_t ret_ref = 0;
27191 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27192 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27193 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27194 ret_ref = (uintptr_t)ret_var.inner;
27195 if (ret_var.is_owned) {
27200 intptr_t __attribute__((export_name("TS_FundingLocked_clone_ptr"))) TS_FundingLocked_clone_ptr(uint32_t arg) {
27201 LDKFundingLocked arg_conv;
27202 arg_conv.inner = (void*)(arg & (~1));
27203 arg_conv.is_owned = false;
27204 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27205 intptr_t ret_val = FundingLocked_clone_ptr(&arg_conv);
27209 uint32_t __attribute__((export_name("TS_FundingLocked_clone"))) TS_FundingLocked_clone(uint32_t orig) {
27210 LDKFundingLocked orig_conv;
27211 orig_conv.inner = (void*)(orig & (~1));
27212 orig_conv.is_owned = false;
27213 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27214 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
27215 uintptr_t ret_ref = 0;
27216 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27217 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27218 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27219 ret_ref = (uintptr_t)ret_var.inner;
27220 if (ret_var.is_owned) {
27226 void __attribute__((export_name("TS_Shutdown_free"))) TS_Shutdown_free(uint32_t this_obj) {
27227 LDKShutdown this_obj_conv;
27228 this_obj_conv.inner = (void*)(this_obj & (~1));
27229 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27231 Shutdown_free(this_obj_conv);
27234 int8_tArray __attribute__((export_name("TS_Shutdown_get_channel_id"))) TS_Shutdown_get_channel_id(uint32_t this_ptr) {
27235 LDKShutdown this_ptr_conv;
27236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27237 this_ptr_conv.is_owned = false;
27238 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27239 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27240 memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
27244 void __attribute__((export_name("TS_Shutdown_set_channel_id"))) TS_Shutdown_set_channel_id(uint32_t this_ptr, int8_tArray val) {
27245 LDKShutdown this_ptr_conv;
27246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27247 this_ptr_conv.is_owned = false;
27248 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27249 LDKThirtyTwoBytes val_ref;
27250 CHECK(val->arr_len == 32);
27251 memcpy(val_ref.data, val->elems, 32); FREE(val);
27252 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
27255 int8_tArray __attribute__((export_name("TS_Shutdown_get_scriptpubkey"))) TS_Shutdown_get_scriptpubkey(uint32_t this_ptr) {
27256 LDKShutdown this_ptr_conv;
27257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27258 this_ptr_conv.is_owned = false;
27259 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27260 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
27261 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27262 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27266 void __attribute__((export_name("TS_Shutdown_set_scriptpubkey"))) TS_Shutdown_set_scriptpubkey(uint32_t this_ptr, int8_tArray val) {
27267 LDKShutdown this_ptr_conv;
27268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27269 this_ptr_conv.is_owned = false;
27270 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27271 LDKCVec_u8Z val_ref;
27272 val_ref.datalen = val->arr_len;
27273 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
27274 memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
27275 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
27278 uint32_t __attribute__((export_name("TS_Shutdown_new"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
27279 LDKThirtyTwoBytes channel_id_arg_ref;
27280 CHECK(channel_id_arg->arr_len == 32);
27281 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
27282 LDKCVec_u8Z scriptpubkey_arg_ref;
27283 scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
27284 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
27285 memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
27286 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
27287 uintptr_t ret_ref = 0;
27288 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27289 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27290 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27291 ret_ref = (uintptr_t)ret_var.inner;
27292 if (ret_var.is_owned) {
27298 static inline uintptr_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
27299 LDKShutdown ret_var = Shutdown_clone(arg);
27300 uintptr_t ret_ref = 0;
27301 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27302 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27303 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27304 ret_ref = (uintptr_t)ret_var.inner;
27305 if (ret_var.is_owned) {
27310 intptr_t __attribute__((export_name("TS_Shutdown_clone_ptr"))) TS_Shutdown_clone_ptr(uint32_t arg) {
27311 LDKShutdown arg_conv;
27312 arg_conv.inner = (void*)(arg & (~1));
27313 arg_conv.is_owned = false;
27314 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27315 intptr_t ret_val = Shutdown_clone_ptr(&arg_conv);
27319 uint32_t __attribute__((export_name("TS_Shutdown_clone"))) TS_Shutdown_clone(uint32_t orig) {
27320 LDKShutdown orig_conv;
27321 orig_conv.inner = (void*)(orig & (~1));
27322 orig_conv.is_owned = false;
27323 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27324 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
27325 uintptr_t ret_ref = 0;
27326 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27327 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27328 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27329 ret_ref = (uintptr_t)ret_var.inner;
27330 if (ret_var.is_owned) {
27336 void __attribute__((export_name("TS_ClosingSignedFeeRange_free"))) TS_ClosingSignedFeeRange_free(uint32_t this_obj) {
27337 LDKClosingSignedFeeRange this_obj_conv;
27338 this_obj_conv.inner = (void*)(this_obj & (~1));
27339 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27340 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27341 ClosingSignedFeeRange_free(this_obj_conv);
27344 int64_t __attribute__((export_name("TS_ClosingSignedFeeRange_get_min_fee_satoshis"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint32_t this_ptr) {
27345 LDKClosingSignedFeeRange this_ptr_conv;
27346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27347 this_ptr_conv.is_owned = false;
27348 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27349 int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
27353 void __attribute__((export_name("TS_ClosingSignedFeeRange_set_min_fee_satoshis"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint32_t this_ptr, int64_t val) {
27354 LDKClosingSignedFeeRange this_ptr_conv;
27355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27356 this_ptr_conv.is_owned = false;
27357 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27358 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
27361 int64_t __attribute__((export_name("TS_ClosingSignedFeeRange_get_max_fee_satoshis"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint32_t this_ptr) {
27362 LDKClosingSignedFeeRange this_ptr_conv;
27363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27364 this_ptr_conv.is_owned = false;
27365 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27366 int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
27370 void __attribute__((export_name("TS_ClosingSignedFeeRange_set_max_fee_satoshis"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
27371 LDKClosingSignedFeeRange this_ptr_conv;
27372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27373 this_ptr_conv.is_owned = false;
27374 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27375 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
27378 uint32_t __attribute__((export_name("TS_ClosingSignedFeeRange_new"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
27379 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
27380 uintptr_t ret_ref = 0;
27381 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27382 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27383 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27384 ret_ref = (uintptr_t)ret_var.inner;
27385 if (ret_var.is_owned) {
27391 static inline uintptr_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
27392 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
27393 uintptr_t ret_ref = 0;
27394 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27395 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27396 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27397 ret_ref = (uintptr_t)ret_var.inner;
27398 if (ret_var.is_owned) {
27403 intptr_t __attribute__((export_name("TS_ClosingSignedFeeRange_clone_ptr"))) TS_ClosingSignedFeeRange_clone_ptr(uint32_t arg) {
27404 LDKClosingSignedFeeRange arg_conv;
27405 arg_conv.inner = (void*)(arg & (~1));
27406 arg_conv.is_owned = false;
27407 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27408 intptr_t ret_val = ClosingSignedFeeRange_clone_ptr(&arg_conv);
27412 uint32_t __attribute__((export_name("TS_ClosingSignedFeeRange_clone"))) TS_ClosingSignedFeeRange_clone(uint32_t orig) {
27413 LDKClosingSignedFeeRange orig_conv;
27414 orig_conv.inner = (void*)(orig & (~1));
27415 orig_conv.is_owned = false;
27416 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27417 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
27418 uintptr_t ret_ref = 0;
27419 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27420 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27421 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27422 ret_ref = (uintptr_t)ret_var.inner;
27423 if (ret_var.is_owned) {
27429 void __attribute__((export_name("TS_ClosingSigned_free"))) TS_ClosingSigned_free(uint32_t this_obj) {
27430 LDKClosingSigned this_obj_conv;
27431 this_obj_conv.inner = (void*)(this_obj & (~1));
27432 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27433 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27434 ClosingSigned_free(this_obj_conv);
27437 int8_tArray __attribute__((export_name("TS_ClosingSigned_get_channel_id"))) TS_ClosingSigned_get_channel_id(uint32_t this_ptr) {
27438 LDKClosingSigned this_ptr_conv;
27439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27440 this_ptr_conv.is_owned = false;
27441 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27442 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27443 memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
27447 void __attribute__((export_name("TS_ClosingSigned_set_channel_id"))) TS_ClosingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
27448 LDKClosingSigned this_ptr_conv;
27449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27450 this_ptr_conv.is_owned = false;
27451 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27452 LDKThirtyTwoBytes val_ref;
27453 CHECK(val->arr_len == 32);
27454 memcpy(val_ref.data, val->elems, 32); FREE(val);
27455 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
27458 int64_t __attribute__((export_name("TS_ClosingSigned_get_fee_satoshis"))) TS_ClosingSigned_get_fee_satoshis(uint32_t this_ptr) {
27459 LDKClosingSigned this_ptr_conv;
27460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27461 this_ptr_conv.is_owned = false;
27462 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27463 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
27467 void __attribute__((export_name("TS_ClosingSigned_set_fee_satoshis"))) TS_ClosingSigned_set_fee_satoshis(uint32_t this_ptr, int64_t val) {
27468 LDKClosingSigned this_ptr_conv;
27469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27470 this_ptr_conv.is_owned = false;
27471 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27472 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
27475 int8_tArray __attribute__((export_name("TS_ClosingSigned_get_signature"))) TS_ClosingSigned_get_signature(uint32_t this_ptr) {
27476 LDKClosingSigned this_ptr_conv;
27477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27478 this_ptr_conv.is_owned = false;
27479 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27480 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
27481 memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
27485 void __attribute__((export_name("TS_ClosingSigned_set_signature"))) TS_ClosingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
27486 LDKClosingSigned this_ptr_conv;
27487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27488 this_ptr_conv.is_owned = false;
27489 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27490 LDKSignature val_ref;
27491 CHECK(val->arr_len == 64);
27492 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
27493 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
27496 uint32_t __attribute__((export_name("TS_ClosingSigned_get_fee_range"))) TS_ClosingSigned_get_fee_range(uint32_t this_ptr) {
27497 LDKClosingSigned this_ptr_conv;
27498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27499 this_ptr_conv.is_owned = false;
27500 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27501 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
27502 uintptr_t ret_ref = 0;
27503 if ((uintptr_t)ret_var.inner > 4096) {
27504 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27505 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27506 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27507 ret_ref = (uintptr_t)ret_var.inner;
27508 if (ret_var.is_owned) {
27515 void __attribute__((export_name("TS_ClosingSigned_set_fee_range"))) TS_ClosingSigned_set_fee_range(uint32_t this_ptr, uint32_t val) {
27516 LDKClosingSigned this_ptr_conv;
27517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27518 this_ptr_conv.is_owned = false;
27519 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27520 LDKClosingSignedFeeRange val_conv;
27521 val_conv.inner = (void*)(val & (~1));
27522 val_conv.is_owned = (val & 1) || (val == 0);
27523 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27524 val_conv = ClosingSignedFeeRange_clone(&val_conv);
27525 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
27528 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) {
27529 LDKThirtyTwoBytes channel_id_arg_ref;
27530 CHECK(channel_id_arg->arr_len == 32);
27531 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
27532 LDKSignature signature_arg_ref;
27533 CHECK(signature_arg->arr_len == 64);
27534 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
27535 LDKClosingSignedFeeRange fee_range_arg_conv;
27536 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
27537 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
27538 CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
27539 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
27540 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
27541 uintptr_t ret_ref = 0;
27542 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27543 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27544 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27545 ret_ref = (uintptr_t)ret_var.inner;
27546 if (ret_var.is_owned) {
27552 static inline uintptr_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
27553 LDKClosingSigned ret_var = ClosingSigned_clone(arg);
27554 uintptr_t ret_ref = 0;
27555 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27556 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27557 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27558 ret_ref = (uintptr_t)ret_var.inner;
27559 if (ret_var.is_owned) {
27564 intptr_t __attribute__((export_name("TS_ClosingSigned_clone_ptr"))) TS_ClosingSigned_clone_ptr(uint32_t arg) {
27565 LDKClosingSigned arg_conv;
27566 arg_conv.inner = (void*)(arg & (~1));
27567 arg_conv.is_owned = false;
27568 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27569 intptr_t ret_val = ClosingSigned_clone_ptr(&arg_conv);
27573 uint32_t __attribute__((export_name("TS_ClosingSigned_clone"))) TS_ClosingSigned_clone(uint32_t orig) {
27574 LDKClosingSigned orig_conv;
27575 orig_conv.inner = (void*)(orig & (~1));
27576 orig_conv.is_owned = false;
27577 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27578 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
27579 uintptr_t ret_ref = 0;
27580 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27581 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27582 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27583 ret_ref = (uintptr_t)ret_var.inner;
27584 if (ret_var.is_owned) {
27590 void __attribute__((export_name("TS_UpdateAddHTLC_free"))) TS_UpdateAddHTLC_free(uint32_t this_obj) {
27591 LDKUpdateAddHTLC this_obj_conv;
27592 this_obj_conv.inner = (void*)(this_obj & (~1));
27593 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27594 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27595 UpdateAddHTLC_free(this_obj_conv);
27598 int8_tArray __attribute__((export_name("TS_UpdateAddHTLC_get_channel_id"))) TS_UpdateAddHTLC_get_channel_id(uint32_t this_ptr) {
27599 LDKUpdateAddHTLC this_ptr_conv;
27600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27601 this_ptr_conv.is_owned = false;
27602 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27603 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27604 memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
27608 void __attribute__((export_name("TS_UpdateAddHTLC_set_channel_id"))) TS_UpdateAddHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
27609 LDKUpdateAddHTLC this_ptr_conv;
27610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27611 this_ptr_conv.is_owned = false;
27612 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27613 LDKThirtyTwoBytes val_ref;
27614 CHECK(val->arr_len == 32);
27615 memcpy(val_ref.data, val->elems, 32); FREE(val);
27616 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
27619 int64_t __attribute__((export_name("TS_UpdateAddHTLC_get_htlc_id"))) TS_UpdateAddHTLC_get_htlc_id(uint32_t this_ptr) {
27620 LDKUpdateAddHTLC this_ptr_conv;
27621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27622 this_ptr_conv.is_owned = false;
27623 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27624 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
27628 void __attribute__((export_name("TS_UpdateAddHTLC_set_htlc_id"))) TS_UpdateAddHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
27629 LDKUpdateAddHTLC this_ptr_conv;
27630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27631 this_ptr_conv.is_owned = false;
27632 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27633 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
27636 int64_t __attribute__((export_name("TS_UpdateAddHTLC_get_amount_msat"))) TS_UpdateAddHTLC_get_amount_msat(uint32_t this_ptr) {
27637 LDKUpdateAddHTLC this_ptr_conv;
27638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27639 this_ptr_conv.is_owned = false;
27640 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27641 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
27645 void __attribute__((export_name("TS_UpdateAddHTLC_set_amount_msat"))) TS_UpdateAddHTLC_set_amount_msat(uint32_t this_ptr, int64_t val) {
27646 LDKUpdateAddHTLC this_ptr_conv;
27647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27648 this_ptr_conv.is_owned = false;
27649 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27650 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
27653 int8_tArray __attribute__((export_name("TS_UpdateAddHTLC_get_payment_hash"))) TS_UpdateAddHTLC_get_payment_hash(uint32_t this_ptr) {
27654 LDKUpdateAddHTLC this_ptr_conv;
27655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27656 this_ptr_conv.is_owned = false;
27657 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27658 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27659 memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
27663 void __attribute__((export_name("TS_UpdateAddHTLC_set_payment_hash"))) TS_UpdateAddHTLC_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
27664 LDKUpdateAddHTLC this_ptr_conv;
27665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27666 this_ptr_conv.is_owned = false;
27667 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27668 LDKThirtyTwoBytes val_ref;
27669 CHECK(val->arr_len == 32);
27670 memcpy(val_ref.data, val->elems, 32); FREE(val);
27671 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
27674 int32_t __attribute__((export_name("TS_UpdateAddHTLC_get_cltv_expiry"))) TS_UpdateAddHTLC_get_cltv_expiry(uint32_t this_ptr) {
27675 LDKUpdateAddHTLC this_ptr_conv;
27676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27677 this_ptr_conv.is_owned = false;
27678 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27679 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
27683 void __attribute__((export_name("TS_UpdateAddHTLC_set_cltv_expiry"))) TS_UpdateAddHTLC_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
27684 LDKUpdateAddHTLC this_ptr_conv;
27685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27686 this_ptr_conv.is_owned = false;
27687 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27688 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
27691 static inline uintptr_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
27692 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
27693 uintptr_t ret_ref = 0;
27694 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27695 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27696 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27697 ret_ref = (uintptr_t)ret_var.inner;
27698 if (ret_var.is_owned) {
27703 intptr_t __attribute__((export_name("TS_UpdateAddHTLC_clone_ptr"))) TS_UpdateAddHTLC_clone_ptr(uint32_t arg) {
27704 LDKUpdateAddHTLC arg_conv;
27705 arg_conv.inner = (void*)(arg & (~1));
27706 arg_conv.is_owned = false;
27707 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27708 intptr_t ret_val = UpdateAddHTLC_clone_ptr(&arg_conv);
27712 uint32_t __attribute__((export_name("TS_UpdateAddHTLC_clone"))) TS_UpdateAddHTLC_clone(uint32_t orig) {
27713 LDKUpdateAddHTLC orig_conv;
27714 orig_conv.inner = (void*)(orig & (~1));
27715 orig_conv.is_owned = false;
27716 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27717 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
27718 uintptr_t ret_ref = 0;
27719 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27720 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27721 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27722 ret_ref = (uintptr_t)ret_var.inner;
27723 if (ret_var.is_owned) {
27729 void __attribute__((export_name("TS_UpdateFulfillHTLC_free"))) TS_UpdateFulfillHTLC_free(uint32_t this_obj) {
27730 LDKUpdateFulfillHTLC this_obj_conv;
27731 this_obj_conv.inner = (void*)(this_obj & (~1));
27732 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27733 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27734 UpdateFulfillHTLC_free(this_obj_conv);
27737 int8_tArray __attribute__((export_name("TS_UpdateFulfillHTLC_get_channel_id"))) TS_UpdateFulfillHTLC_get_channel_id(uint32_t this_ptr) {
27738 LDKUpdateFulfillHTLC this_ptr_conv;
27739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27740 this_ptr_conv.is_owned = false;
27741 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27742 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27743 memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
27747 void __attribute__((export_name("TS_UpdateFulfillHTLC_set_channel_id"))) TS_UpdateFulfillHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
27748 LDKUpdateFulfillHTLC this_ptr_conv;
27749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27750 this_ptr_conv.is_owned = false;
27751 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27752 LDKThirtyTwoBytes val_ref;
27753 CHECK(val->arr_len == 32);
27754 memcpy(val_ref.data, val->elems, 32); FREE(val);
27755 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
27758 int64_t __attribute__((export_name("TS_UpdateFulfillHTLC_get_htlc_id"))) TS_UpdateFulfillHTLC_get_htlc_id(uint32_t this_ptr) {
27759 LDKUpdateFulfillHTLC this_ptr_conv;
27760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27761 this_ptr_conv.is_owned = false;
27762 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27763 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
27767 void __attribute__((export_name("TS_UpdateFulfillHTLC_set_htlc_id"))) TS_UpdateFulfillHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
27768 LDKUpdateFulfillHTLC this_ptr_conv;
27769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27770 this_ptr_conv.is_owned = false;
27771 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27772 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
27775 int8_tArray __attribute__((export_name("TS_UpdateFulfillHTLC_get_payment_preimage"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint32_t this_ptr) {
27776 LDKUpdateFulfillHTLC this_ptr_conv;
27777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27778 this_ptr_conv.is_owned = false;
27779 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27780 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27781 memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
27785 void __attribute__((export_name("TS_UpdateFulfillHTLC_set_payment_preimage"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint32_t this_ptr, int8_tArray val) {
27786 LDKUpdateFulfillHTLC this_ptr_conv;
27787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27788 this_ptr_conv.is_owned = false;
27789 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27790 LDKThirtyTwoBytes val_ref;
27791 CHECK(val->arr_len == 32);
27792 memcpy(val_ref.data, val->elems, 32); FREE(val);
27793 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
27796 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) {
27797 LDKThirtyTwoBytes channel_id_arg_ref;
27798 CHECK(channel_id_arg->arr_len == 32);
27799 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
27800 LDKThirtyTwoBytes payment_preimage_arg_ref;
27801 CHECK(payment_preimage_arg->arr_len == 32);
27802 memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
27803 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
27804 uintptr_t ret_ref = 0;
27805 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27806 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27807 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27808 ret_ref = (uintptr_t)ret_var.inner;
27809 if (ret_var.is_owned) {
27815 static inline uintptr_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
27816 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
27817 uintptr_t ret_ref = 0;
27818 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27819 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27820 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27821 ret_ref = (uintptr_t)ret_var.inner;
27822 if (ret_var.is_owned) {
27827 intptr_t __attribute__((export_name("TS_UpdateFulfillHTLC_clone_ptr"))) TS_UpdateFulfillHTLC_clone_ptr(uint32_t arg) {
27828 LDKUpdateFulfillHTLC arg_conv;
27829 arg_conv.inner = (void*)(arg & (~1));
27830 arg_conv.is_owned = false;
27831 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27832 intptr_t ret_val = UpdateFulfillHTLC_clone_ptr(&arg_conv);
27836 uint32_t __attribute__((export_name("TS_UpdateFulfillHTLC_clone"))) TS_UpdateFulfillHTLC_clone(uint32_t orig) {
27837 LDKUpdateFulfillHTLC orig_conv;
27838 orig_conv.inner = (void*)(orig & (~1));
27839 orig_conv.is_owned = false;
27840 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27841 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
27842 uintptr_t ret_ref = 0;
27843 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27844 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27845 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27846 ret_ref = (uintptr_t)ret_var.inner;
27847 if (ret_var.is_owned) {
27853 void __attribute__((export_name("TS_UpdateFailHTLC_free"))) TS_UpdateFailHTLC_free(uint32_t this_obj) {
27854 LDKUpdateFailHTLC this_obj_conv;
27855 this_obj_conv.inner = (void*)(this_obj & (~1));
27856 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27857 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27858 UpdateFailHTLC_free(this_obj_conv);
27861 int8_tArray __attribute__((export_name("TS_UpdateFailHTLC_get_channel_id"))) TS_UpdateFailHTLC_get_channel_id(uint32_t this_ptr) {
27862 LDKUpdateFailHTLC this_ptr_conv;
27863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27864 this_ptr_conv.is_owned = false;
27865 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27866 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27867 memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
27871 void __attribute__((export_name("TS_UpdateFailHTLC_set_channel_id"))) TS_UpdateFailHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
27872 LDKUpdateFailHTLC this_ptr_conv;
27873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27874 this_ptr_conv.is_owned = false;
27875 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27876 LDKThirtyTwoBytes val_ref;
27877 CHECK(val->arr_len == 32);
27878 memcpy(val_ref.data, val->elems, 32); FREE(val);
27879 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
27882 int64_t __attribute__((export_name("TS_UpdateFailHTLC_get_htlc_id"))) TS_UpdateFailHTLC_get_htlc_id(uint32_t this_ptr) {
27883 LDKUpdateFailHTLC this_ptr_conv;
27884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27885 this_ptr_conv.is_owned = false;
27886 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27887 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
27891 void __attribute__((export_name("TS_UpdateFailHTLC_set_htlc_id"))) TS_UpdateFailHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
27892 LDKUpdateFailHTLC this_ptr_conv;
27893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27894 this_ptr_conv.is_owned = false;
27895 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27896 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
27899 static inline uintptr_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
27900 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
27901 uintptr_t ret_ref = 0;
27902 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27903 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27904 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27905 ret_ref = (uintptr_t)ret_var.inner;
27906 if (ret_var.is_owned) {
27911 intptr_t __attribute__((export_name("TS_UpdateFailHTLC_clone_ptr"))) TS_UpdateFailHTLC_clone_ptr(uint32_t arg) {
27912 LDKUpdateFailHTLC arg_conv;
27913 arg_conv.inner = (void*)(arg & (~1));
27914 arg_conv.is_owned = false;
27915 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27916 intptr_t ret_val = UpdateFailHTLC_clone_ptr(&arg_conv);
27920 uint32_t __attribute__((export_name("TS_UpdateFailHTLC_clone"))) TS_UpdateFailHTLC_clone(uint32_t orig) {
27921 LDKUpdateFailHTLC orig_conv;
27922 orig_conv.inner = (void*)(orig & (~1));
27923 orig_conv.is_owned = false;
27924 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27925 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
27926 uintptr_t ret_ref = 0;
27927 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27928 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27929 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27930 ret_ref = (uintptr_t)ret_var.inner;
27931 if (ret_var.is_owned) {
27937 void __attribute__((export_name("TS_UpdateFailMalformedHTLC_free"))) TS_UpdateFailMalformedHTLC_free(uint32_t this_obj) {
27938 LDKUpdateFailMalformedHTLC this_obj_conv;
27939 this_obj_conv.inner = (void*)(this_obj & (~1));
27940 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27941 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27942 UpdateFailMalformedHTLC_free(this_obj_conv);
27945 int8_tArray __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_channel_id"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint32_t this_ptr) {
27946 LDKUpdateFailMalformedHTLC this_ptr_conv;
27947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27948 this_ptr_conv.is_owned = false;
27949 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27950 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27951 memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
27955 void __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_channel_id"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
27956 LDKUpdateFailMalformedHTLC this_ptr_conv;
27957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27958 this_ptr_conv.is_owned = false;
27959 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27960 LDKThirtyTwoBytes val_ref;
27961 CHECK(val->arr_len == 32);
27962 memcpy(val_ref.data, val->elems, 32); FREE(val);
27963 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
27966 int64_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_htlc_id"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint32_t this_ptr) {
27967 LDKUpdateFailMalformedHTLC this_ptr_conv;
27968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27969 this_ptr_conv.is_owned = false;
27970 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27971 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
27975 void __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_htlc_id"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
27976 LDKUpdateFailMalformedHTLC this_ptr_conv;
27977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27978 this_ptr_conv.is_owned = false;
27979 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27980 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
27983 int16_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_failure_code"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint32_t this_ptr) {
27984 LDKUpdateFailMalformedHTLC this_ptr_conv;
27985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27986 this_ptr_conv.is_owned = false;
27987 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27988 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
27992 void __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_failure_code"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint32_t this_ptr, int16_t val) {
27993 LDKUpdateFailMalformedHTLC this_ptr_conv;
27994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27995 this_ptr_conv.is_owned = false;
27996 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27997 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
28000 static inline uintptr_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
28001 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
28002 uintptr_t ret_ref = 0;
28003 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28004 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28005 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28006 ret_ref = (uintptr_t)ret_var.inner;
28007 if (ret_var.is_owned) {
28012 intptr_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone_ptr"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint32_t arg) {
28013 LDKUpdateFailMalformedHTLC arg_conv;
28014 arg_conv.inner = (void*)(arg & (~1));
28015 arg_conv.is_owned = false;
28016 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28017 intptr_t ret_val = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
28021 uint32_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone"))) TS_UpdateFailMalformedHTLC_clone(uint32_t orig) {
28022 LDKUpdateFailMalformedHTLC orig_conv;
28023 orig_conv.inner = (void*)(orig & (~1));
28024 orig_conv.is_owned = false;
28025 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28026 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
28027 uintptr_t ret_ref = 0;
28028 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28029 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28030 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28031 ret_ref = (uintptr_t)ret_var.inner;
28032 if (ret_var.is_owned) {
28038 void __attribute__((export_name("TS_CommitmentSigned_free"))) TS_CommitmentSigned_free(uint32_t this_obj) {
28039 LDKCommitmentSigned this_obj_conv;
28040 this_obj_conv.inner = (void*)(this_obj & (~1));
28041 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28042 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28043 CommitmentSigned_free(this_obj_conv);
28046 int8_tArray __attribute__((export_name("TS_CommitmentSigned_get_channel_id"))) TS_CommitmentSigned_get_channel_id(uint32_t this_ptr) {
28047 LDKCommitmentSigned this_ptr_conv;
28048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28049 this_ptr_conv.is_owned = false;
28050 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28051 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28052 memcpy(ret_arr->elems, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
28056 void __attribute__((export_name("TS_CommitmentSigned_set_channel_id"))) TS_CommitmentSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
28057 LDKCommitmentSigned this_ptr_conv;
28058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28059 this_ptr_conv.is_owned = false;
28060 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28061 LDKThirtyTwoBytes val_ref;
28062 CHECK(val->arr_len == 32);
28063 memcpy(val_ref.data, val->elems, 32); FREE(val);
28064 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
28067 int8_tArray __attribute__((export_name("TS_CommitmentSigned_get_signature"))) TS_CommitmentSigned_get_signature(uint32_t this_ptr) {
28068 LDKCommitmentSigned this_ptr_conv;
28069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28070 this_ptr_conv.is_owned = false;
28071 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28072 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
28073 memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
28077 void __attribute__((export_name("TS_CommitmentSigned_set_signature"))) TS_CommitmentSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
28078 LDKCommitmentSigned this_ptr_conv;
28079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28080 this_ptr_conv.is_owned = false;
28081 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28082 LDKSignature val_ref;
28083 CHECK(val->arr_len == 64);
28084 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
28085 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
28088 void __attribute__((export_name("TS_CommitmentSigned_set_htlc_signatures"))) TS_CommitmentSigned_set_htlc_signatures(uint32_t this_ptr, ptrArray val) {
28089 LDKCommitmentSigned this_ptr_conv;
28090 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28091 this_ptr_conv.is_owned = false;
28092 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28093 LDKCVec_SignatureZ val_constr;
28094 val_constr.datalen = val->arr_len;
28095 if (val_constr.datalen > 0)
28096 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
28098 val_constr.data = NULL;
28099 int8_tArray* val_vals = (void*) val->elems /* XXX val leaks */;
28100 for (size_t m = 0; m < val_constr.datalen; m++) {
28101 int8_tArray val_conv_12 = val_vals[m];
28102 LDKSignature val_conv_12_ref;
28103 CHECK(val_conv_12->arr_len == 64);
28104 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
28105 val_constr.data[m] = val_conv_12_ref;
28107 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
28110 uint32_t __attribute__((export_name("TS_CommitmentSigned_new"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
28111 LDKThirtyTwoBytes channel_id_arg_ref;
28112 CHECK(channel_id_arg->arr_len == 32);
28113 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28114 LDKSignature signature_arg_ref;
28115 CHECK(signature_arg->arr_len == 64);
28116 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
28117 LDKCVec_SignatureZ htlc_signatures_arg_constr;
28118 htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
28119 if (htlc_signatures_arg_constr.datalen > 0)
28120 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
28122 htlc_signatures_arg_constr.data = NULL;
28123 int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems /* XXX htlc_signatures_arg leaks */;
28124 for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
28125 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
28126 LDKSignature htlc_signatures_arg_conv_12_ref;
28127 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
28128 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64); FREE(htlc_signatures_arg_conv_12);
28129 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
28131 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
28132 uintptr_t ret_ref = 0;
28133 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28134 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28135 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28136 ret_ref = (uintptr_t)ret_var.inner;
28137 if (ret_var.is_owned) {
28143 static inline uintptr_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
28144 LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
28145 uintptr_t ret_ref = 0;
28146 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28147 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28148 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28149 ret_ref = (uintptr_t)ret_var.inner;
28150 if (ret_var.is_owned) {
28155 intptr_t __attribute__((export_name("TS_CommitmentSigned_clone_ptr"))) TS_CommitmentSigned_clone_ptr(uint32_t arg) {
28156 LDKCommitmentSigned arg_conv;
28157 arg_conv.inner = (void*)(arg & (~1));
28158 arg_conv.is_owned = false;
28159 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28160 intptr_t ret_val = CommitmentSigned_clone_ptr(&arg_conv);
28164 uint32_t __attribute__((export_name("TS_CommitmentSigned_clone"))) TS_CommitmentSigned_clone(uint32_t orig) {
28165 LDKCommitmentSigned orig_conv;
28166 orig_conv.inner = (void*)(orig & (~1));
28167 orig_conv.is_owned = false;
28168 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28169 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
28170 uintptr_t ret_ref = 0;
28171 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28172 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28173 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28174 ret_ref = (uintptr_t)ret_var.inner;
28175 if (ret_var.is_owned) {
28181 void __attribute__((export_name("TS_RevokeAndACK_free"))) TS_RevokeAndACK_free(uint32_t this_obj) {
28182 LDKRevokeAndACK this_obj_conv;
28183 this_obj_conv.inner = (void*)(this_obj & (~1));
28184 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28185 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28186 RevokeAndACK_free(this_obj_conv);
28189 int8_tArray __attribute__((export_name("TS_RevokeAndACK_get_channel_id"))) TS_RevokeAndACK_get_channel_id(uint32_t this_ptr) {
28190 LDKRevokeAndACK this_ptr_conv;
28191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28192 this_ptr_conv.is_owned = false;
28193 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28194 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28195 memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
28199 void __attribute__((export_name("TS_RevokeAndACK_set_channel_id"))) TS_RevokeAndACK_set_channel_id(uint32_t this_ptr, int8_tArray val) {
28200 LDKRevokeAndACK this_ptr_conv;
28201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28202 this_ptr_conv.is_owned = false;
28203 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28204 LDKThirtyTwoBytes val_ref;
28205 CHECK(val->arr_len == 32);
28206 memcpy(val_ref.data, val->elems, 32); FREE(val);
28207 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
28210 int8_tArray __attribute__((export_name("TS_RevokeAndACK_get_per_commitment_secret"))) TS_RevokeAndACK_get_per_commitment_secret(uint32_t this_ptr) {
28211 LDKRevokeAndACK this_ptr_conv;
28212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28213 this_ptr_conv.is_owned = false;
28214 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28215 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28216 memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
28220 void __attribute__((export_name("TS_RevokeAndACK_set_per_commitment_secret"))) TS_RevokeAndACK_set_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
28221 LDKRevokeAndACK this_ptr_conv;
28222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28223 this_ptr_conv.is_owned = false;
28224 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28225 LDKThirtyTwoBytes val_ref;
28226 CHECK(val->arr_len == 32);
28227 memcpy(val_ref.data, val->elems, 32); FREE(val);
28228 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
28231 int8_tArray __attribute__((export_name("TS_RevokeAndACK_get_next_per_commitment_point"))) TS_RevokeAndACK_get_next_per_commitment_point(uint32_t this_ptr) {
28232 LDKRevokeAndACK this_ptr_conv;
28233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28234 this_ptr_conv.is_owned = false;
28235 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28236 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28237 memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
28241 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) {
28242 LDKRevokeAndACK this_ptr_conv;
28243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28244 this_ptr_conv.is_owned = false;
28245 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28246 LDKPublicKey val_ref;
28247 CHECK(val->arr_len == 33);
28248 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28249 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
28252 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) {
28253 LDKThirtyTwoBytes channel_id_arg_ref;
28254 CHECK(channel_id_arg->arr_len == 32);
28255 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28256 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
28257 CHECK(per_commitment_secret_arg->arr_len == 32);
28258 memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
28259 LDKPublicKey next_per_commitment_point_arg_ref;
28260 CHECK(next_per_commitment_point_arg->arr_len == 33);
28261 memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
28262 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
28263 uintptr_t ret_ref = 0;
28264 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28265 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28266 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28267 ret_ref = (uintptr_t)ret_var.inner;
28268 if (ret_var.is_owned) {
28274 static inline uintptr_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
28275 LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
28276 uintptr_t ret_ref = 0;
28277 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28278 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28279 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28280 ret_ref = (uintptr_t)ret_var.inner;
28281 if (ret_var.is_owned) {
28286 intptr_t __attribute__((export_name("TS_RevokeAndACK_clone_ptr"))) TS_RevokeAndACK_clone_ptr(uint32_t arg) {
28287 LDKRevokeAndACK arg_conv;
28288 arg_conv.inner = (void*)(arg & (~1));
28289 arg_conv.is_owned = false;
28290 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28291 intptr_t ret_val = RevokeAndACK_clone_ptr(&arg_conv);
28295 uint32_t __attribute__((export_name("TS_RevokeAndACK_clone"))) TS_RevokeAndACK_clone(uint32_t orig) {
28296 LDKRevokeAndACK orig_conv;
28297 orig_conv.inner = (void*)(orig & (~1));
28298 orig_conv.is_owned = false;
28299 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28300 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
28301 uintptr_t ret_ref = 0;
28302 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28303 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28304 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28305 ret_ref = (uintptr_t)ret_var.inner;
28306 if (ret_var.is_owned) {
28312 void __attribute__((export_name("TS_UpdateFee_free"))) TS_UpdateFee_free(uint32_t this_obj) {
28313 LDKUpdateFee this_obj_conv;
28314 this_obj_conv.inner = (void*)(this_obj & (~1));
28315 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28316 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28317 UpdateFee_free(this_obj_conv);
28320 int8_tArray __attribute__((export_name("TS_UpdateFee_get_channel_id"))) TS_UpdateFee_get_channel_id(uint32_t this_ptr) {
28321 LDKUpdateFee this_ptr_conv;
28322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28323 this_ptr_conv.is_owned = false;
28324 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28325 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28326 memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
28330 void __attribute__((export_name("TS_UpdateFee_set_channel_id"))) TS_UpdateFee_set_channel_id(uint32_t this_ptr, int8_tArray val) {
28331 LDKUpdateFee this_ptr_conv;
28332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28333 this_ptr_conv.is_owned = false;
28334 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28335 LDKThirtyTwoBytes val_ref;
28336 CHECK(val->arr_len == 32);
28337 memcpy(val_ref.data, val->elems, 32); FREE(val);
28338 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
28341 int32_t __attribute__((export_name("TS_UpdateFee_get_feerate_per_kw"))) TS_UpdateFee_get_feerate_per_kw(uint32_t this_ptr) {
28342 LDKUpdateFee this_ptr_conv;
28343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28344 this_ptr_conv.is_owned = false;
28345 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28346 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
28350 void __attribute__((export_name("TS_UpdateFee_set_feerate_per_kw"))) TS_UpdateFee_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
28351 LDKUpdateFee this_ptr_conv;
28352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28353 this_ptr_conv.is_owned = false;
28354 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28355 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
28358 uint32_t __attribute__((export_name("TS_UpdateFee_new"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
28359 LDKThirtyTwoBytes channel_id_arg_ref;
28360 CHECK(channel_id_arg->arr_len == 32);
28361 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28362 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
28363 uintptr_t ret_ref = 0;
28364 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28365 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28366 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28367 ret_ref = (uintptr_t)ret_var.inner;
28368 if (ret_var.is_owned) {
28374 static inline uintptr_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
28375 LDKUpdateFee ret_var = UpdateFee_clone(arg);
28376 uintptr_t ret_ref = 0;
28377 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28378 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28379 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28380 ret_ref = (uintptr_t)ret_var.inner;
28381 if (ret_var.is_owned) {
28386 intptr_t __attribute__((export_name("TS_UpdateFee_clone_ptr"))) TS_UpdateFee_clone_ptr(uint32_t arg) {
28387 LDKUpdateFee arg_conv;
28388 arg_conv.inner = (void*)(arg & (~1));
28389 arg_conv.is_owned = false;
28390 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28391 intptr_t ret_val = UpdateFee_clone_ptr(&arg_conv);
28395 uint32_t __attribute__((export_name("TS_UpdateFee_clone"))) TS_UpdateFee_clone(uint32_t orig) {
28396 LDKUpdateFee orig_conv;
28397 orig_conv.inner = (void*)(orig & (~1));
28398 orig_conv.is_owned = false;
28399 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28400 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
28401 uintptr_t ret_ref = 0;
28402 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28403 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28404 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28405 ret_ref = (uintptr_t)ret_var.inner;
28406 if (ret_var.is_owned) {
28412 void __attribute__((export_name("TS_DataLossProtect_free"))) TS_DataLossProtect_free(uint32_t this_obj) {
28413 LDKDataLossProtect this_obj_conv;
28414 this_obj_conv.inner = (void*)(this_obj & (~1));
28415 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28416 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28417 DataLossProtect_free(this_obj_conv);
28420 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) {
28421 LDKDataLossProtect this_ptr_conv;
28422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28423 this_ptr_conv.is_owned = false;
28424 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28425 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28426 memcpy(ret_arr->elems, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
28430 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) {
28431 LDKDataLossProtect this_ptr_conv;
28432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28433 this_ptr_conv.is_owned = false;
28434 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28435 LDKThirtyTwoBytes val_ref;
28436 CHECK(val->arr_len == 32);
28437 memcpy(val_ref.data, val->elems, 32); FREE(val);
28438 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
28441 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) {
28442 LDKDataLossProtect this_ptr_conv;
28443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28444 this_ptr_conv.is_owned = false;
28445 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28446 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28447 memcpy(ret_arr->elems, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
28451 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) {
28452 LDKDataLossProtect this_ptr_conv;
28453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28454 this_ptr_conv.is_owned = false;
28455 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28456 LDKPublicKey val_ref;
28457 CHECK(val->arr_len == 33);
28458 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28459 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
28462 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) {
28463 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
28464 CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
28465 memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
28466 LDKPublicKey my_current_per_commitment_point_arg_ref;
28467 CHECK(my_current_per_commitment_point_arg->arr_len == 33);
28468 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);
28469 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
28470 uintptr_t ret_ref = 0;
28471 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28472 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28473 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28474 ret_ref = (uintptr_t)ret_var.inner;
28475 if (ret_var.is_owned) {
28481 static inline uintptr_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
28482 LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
28483 uintptr_t ret_ref = 0;
28484 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28485 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28486 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28487 ret_ref = (uintptr_t)ret_var.inner;
28488 if (ret_var.is_owned) {
28493 intptr_t __attribute__((export_name("TS_DataLossProtect_clone_ptr"))) TS_DataLossProtect_clone_ptr(uint32_t arg) {
28494 LDKDataLossProtect arg_conv;
28495 arg_conv.inner = (void*)(arg & (~1));
28496 arg_conv.is_owned = false;
28497 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28498 intptr_t ret_val = DataLossProtect_clone_ptr(&arg_conv);
28502 uint32_t __attribute__((export_name("TS_DataLossProtect_clone"))) TS_DataLossProtect_clone(uint32_t orig) {
28503 LDKDataLossProtect orig_conv;
28504 orig_conv.inner = (void*)(orig & (~1));
28505 orig_conv.is_owned = false;
28506 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28507 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
28508 uintptr_t ret_ref = 0;
28509 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28510 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28511 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28512 ret_ref = (uintptr_t)ret_var.inner;
28513 if (ret_var.is_owned) {
28519 void __attribute__((export_name("TS_ChannelReestablish_free"))) TS_ChannelReestablish_free(uint32_t this_obj) {
28520 LDKChannelReestablish this_obj_conv;
28521 this_obj_conv.inner = (void*)(this_obj & (~1));
28522 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28523 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28524 ChannelReestablish_free(this_obj_conv);
28527 int8_tArray __attribute__((export_name("TS_ChannelReestablish_get_channel_id"))) TS_ChannelReestablish_get_channel_id(uint32_t this_ptr) {
28528 LDKChannelReestablish this_ptr_conv;
28529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28530 this_ptr_conv.is_owned = false;
28531 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28532 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28533 memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
28537 void __attribute__((export_name("TS_ChannelReestablish_set_channel_id"))) TS_ChannelReestablish_set_channel_id(uint32_t this_ptr, int8_tArray val) {
28538 LDKChannelReestablish this_ptr_conv;
28539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28540 this_ptr_conv.is_owned = false;
28541 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28542 LDKThirtyTwoBytes val_ref;
28543 CHECK(val->arr_len == 32);
28544 memcpy(val_ref.data, val->elems, 32); FREE(val);
28545 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
28548 int64_t __attribute__((export_name("TS_ChannelReestablish_get_next_local_commitment_number"))) TS_ChannelReestablish_get_next_local_commitment_number(uint32_t this_ptr) {
28549 LDKChannelReestablish this_ptr_conv;
28550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28551 this_ptr_conv.is_owned = false;
28552 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28553 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
28557 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) {
28558 LDKChannelReestablish this_ptr_conv;
28559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28560 this_ptr_conv.is_owned = false;
28561 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28562 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
28565 int64_t __attribute__((export_name("TS_ChannelReestablish_get_next_remote_commitment_number"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint32_t this_ptr) {
28566 LDKChannelReestablish this_ptr_conv;
28567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28568 this_ptr_conv.is_owned = false;
28569 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28570 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
28574 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) {
28575 LDKChannelReestablish this_ptr_conv;
28576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28577 this_ptr_conv.is_owned = false;
28578 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28579 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
28582 static inline uintptr_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
28583 LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
28584 uintptr_t ret_ref = 0;
28585 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28586 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28587 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28588 ret_ref = (uintptr_t)ret_var.inner;
28589 if (ret_var.is_owned) {
28594 intptr_t __attribute__((export_name("TS_ChannelReestablish_clone_ptr"))) TS_ChannelReestablish_clone_ptr(uint32_t arg) {
28595 LDKChannelReestablish arg_conv;
28596 arg_conv.inner = (void*)(arg & (~1));
28597 arg_conv.is_owned = false;
28598 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28599 intptr_t ret_val = ChannelReestablish_clone_ptr(&arg_conv);
28603 uint32_t __attribute__((export_name("TS_ChannelReestablish_clone"))) TS_ChannelReestablish_clone(uint32_t orig) {
28604 LDKChannelReestablish orig_conv;
28605 orig_conv.inner = (void*)(orig & (~1));
28606 orig_conv.is_owned = false;
28607 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28608 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
28609 uintptr_t ret_ref = 0;
28610 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28611 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28612 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28613 ret_ref = (uintptr_t)ret_var.inner;
28614 if (ret_var.is_owned) {
28620 void __attribute__((export_name("TS_AnnouncementSignatures_free"))) TS_AnnouncementSignatures_free(uint32_t this_obj) {
28621 LDKAnnouncementSignatures this_obj_conv;
28622 this_obj_conv.inner = (void*)(this_obj & (~1));
28623 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28624 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28625 AnnouncementSignatures_free(this_obj_conv);
28628 int8_tArray __attribute__((export_name("TS_AnnouncementSignatures_get_channel_id"))) TS_AnnouncementSignatures_get_channel_id(uint32_t this_ptr) {
28629 LDKAnnouncementSignatures this_ptr_conv;
28630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28631 this_ptr_conv.is_owned = false;
28632 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28633 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28634 memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
28638 void __attribute__((export_name("TS_AnnouncementSignatures_set_channel_id"))) TS_AnnouncementSignatures_set_channel_id(uint32_t this_ptr, int8_tArray val) {
28639 LDKAnnouncementSignatures this_ptr_conv;
28640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28641 this_ptr_conv.is_owned = false;
28642 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28643 LDKThirtyTwoBytes val_ref;
28644 CHECK(val->arr_len == 32);
28645 memcpy(val_ref.data, val->elems, 32); FREE(val);
28646 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
28649 int64_t __attribute__((export_name("TS_AnnouncementSignatures_get_short_channel_id"))) TS_AnnouncementSignatures_get_short_channel_id(uint32_t this_ptr) {
28650 LDKAnnouncementSignatures this_ptr_conv;
28651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28652 this_ptr_conv.is_owned = false;
28653 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28654 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
28658 void __attribute__((export_name("TS_AnnouncementSignatures_set_short_channel_id"))) TS_AnnouncementSignatures_set_short_channel_id(uint32_t this_ptr, int64_t val) {
28659 LDKAnnouncementSignatures this_ptr_conv;
28660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28661 this_ptr_conv.is_owned = false;
28662 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28663 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
28666 int8_tArray __attribute__((export_name("TS_AnnouncementSignatures_get_node_signature"))) TS_AnnouncementSignatures_get_node_signature(uint32_t this_ptr) {
28667 LDKAnnouncementSignatures this_ptr_conv;
28668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28669 this_ptr_conv.is_owned = false;
28670 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28671 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
28672 memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
28676 void __attribute__((export_name("TS_AnnouncementSignatures_set_node_signature"))) TS_AnnouncementSignatures_set_node_signature(uint32_t this_ptr, int8_tArray val) {
28677 LDKAnnouncementSignatures this_ptr_conv;
28678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28679 this_ptr_conv.is_owned = false;
28680 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28681 LDKSignature val_ref;
28682 CHECK(val->arr_len == 64);
28683 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
28684 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
28687 int8_tArray __attribute__((export_name("TS_AnnouncementSignatures_get_bitcoin_signature"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint32_t this_ptr) {
28688 LDKAnnouncementSignatures this_ptr_conv;
28689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28690 this_ptr_conv.is_owned = false;
28691 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28692 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
28693 memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
28697 void __attribute__((export_name("TS_AnnouncementSignatures_set_bitcoin_signature"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint32_t this_ptr, int8_tArray val) {
28698 LDKAnnouncementSignatures this_ptr_conv;
28699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28700 this_ptr_conv.is_owned = false;
28701 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28702 LDKSignature val_ref;
28703 CHECK(val->arr_len == 64);
28704 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
28705 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
28708 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) {
28709 LDKThirtyTwoBytes channel_id_arg_ref;
28710 CHECK(channel_id_arg->arr_len == 32);
28711 memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28712 LDKSignature node_signature_arg_ref;
28713 CHECK(node_signature_arg->arr_len == 64);
28714 memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
28715 LDKSignature bitcoin_signature_arg_ref;
28716 CHECK(bitcoin_signature_arg->arr_len == 64);
28717 memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
28718 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
28719 uintptr_t ret_ref = 0;
28720 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28721 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28722 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28723 ret_ref = (uintptr_t)ret_var.inner;
28724 if (ret_var.is_owned) {
28730 static inline uintptr_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
28731 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
28732 uintptr_t ret_ref = 0;
28733 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28734 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28735 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28736 ret_ref = (uintptr_t)ret_var.inner;
28737 if (ret_var.is_owned) {
28742 intptr_t __attribute__((export_name("TS_AnnouncementSignatures_clone_ptr"))) TS_AnnouncementSignatures_clone_ptr(uint32_t arg) {
28743 LDKAnnouncementSignatures arg_conv;
28744 arg_conv.inner = (void*)(arg & (~1));
28745 arg_conv.is_owned = false;
28746 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28747 intptr_t ret_val = AnnouncementSignatures_clone_ptr(&arg_conv);
28751 uint32_t __attribute__((export_name("TS_AnnouncementSignatures_clone"))) TS_AnnouncementSignatures_clone(uint32_t orig) {
28752 LDKAnnouncementSignatures orig_conv;
28753 orig_conv.inner = (void*)(orig & (~1));
28754 orig_conv.is_owned = false;
28755 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28756 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
28757 uintptr_t ret_ref = 0;
28758 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28759 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28760 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28761 ret_ref = (uintptr_t)ret_var.inner;
28762 if (ret_var.is_owned) {
28768 void __attribute__((export_name("TS_NetAddress_free"))) TS_NetAddress_free(uint32_t this_ptr) {
28769 if ((this_ptr & 1) != 0) return;
28770 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
28771 CHECK_ACCESS(this_ptr_ptr);
28772 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
28773 FREE((void*)this_ptr);
28774 NetAddress_free(this_ptr_conv);
28777 static inline uintptr_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
28778 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
28779 *ret_copy = NetAddress_clone(arg);
28780 uintptr_t ret_ref = (uintptr_t)ret_copy;
28783 intptr_t __attribute__((export_name("TS_NetAddress_clone_ptr"))) TS_NetAddress_clone_ptr(uint32_t arg) {
28784 LDKNetAddress* arg_conv = (LDKNetAddress*)arg;
28785 intptr_t ret_val = NetAddress_clone_ptr(arg_conv);
28789 uint32_t __attribute__((export_name("TS_NetAddress_clone"))) TS_NetAddress_clone(uint32_t orig) {
28790 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
28791 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
28792 *ret_copy = NetAddress_clone(orig_conv);
28793 uintptr_t ret_ref = (uintptr_t)ret_copy;
28797 uint32_t __attribute__((export_name("TS_NetAddress_ipv4"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
28798 LDKFourBytes addr_ref;
28799 CHECK(addr->arr_len == 4);
28800 memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
28801 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
28802 *ret_copy = NetAddress_ipv4(addr_ref, port);
28803 uintptr_t ret_ref = (uintptr_t)ret_copy;
28807 uint32_t __attribute__((export_name("TS_NetAddress_ipv6"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
28808 LDKSixteenBytes addr_ref;
28809 CHECK(addr->arr_len == 16);
28810 memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
28811 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
28812 *ret_copy = NetAddress_ipv6(addr_ref, port);
28813 uintptr_t ret_ref = (uintptr_t)ret_copy;
28817 uint32_t __attribute__((export_name("TS_NetAddress_onion_v2"))) TS_NetAddress_onion_v2(int8_tArray a) {
28818 LDKTwelveBytes a_ref;
28819 CHECK(a->arr_len == 12);
28820 memcpy(a_ref.data, a->elems, 12); FREE(a);
28821 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
28822 *ret_copy = NetAddress_onion_v2(a_ref);
28823 uintptr_t ret_ref = (uintptr_t)ret_copy;
28827 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) {
28828 LDKThirtyTwoBytes ed25519_pubkey_ref;
28829 CHECK(ed25519_pubkey->arr_len == 32);
28830 memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
28831 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
28832 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
28833 uintptr_t ret_ref = (uintptr_t)ret_copy;
28837 int8_tArray __attribute__((export_name("TS_NetAddress_write"))) TS_NetAddress_write(uint32_t obj) {
28838 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
28839 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
28840 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
28841 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28842 CVec_u8Z_free(ret_var);
28846 uint32_t __attribute__((export_name("TS_NetAddress_read"))) TS_NetAddress_read(int8_tArray ser) {
28847 LDKu8slice ser_ref;
28848 ser_ref.datalen = ser->arr_len;
28849 ser_ref.data = ser->elems /* XXX ser leaks */;
28850 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
28851 *ret_conv = NetAddress_read(ser_ref);
28852 return (uintptr_t)ret_conv;
28855 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint32_t this_obj) {
28856 LDKUnsignedNodeAnnouncement this_obj_conv;
28857 this_obj_conv.inner = (void*)(this_obj & (~1));
28858 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28859 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28860 UnsignedNodeAnnouncement_free(this_obj_conv);
28863 uint32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_features"))) TS_UnsignedNodeAnnouncement_get_features(uint32_t this_ptr) {
28864 LDKUnsignedNodeAnnouncement this_ptr_conv;
28865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28866 this_ptr_conv.is_owned = false;
28867 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28868 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
28869 uintptr_t ret_ref = 0;
28870 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28871 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28872 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28873 ret_ref = (uintptr_t)ret_var.inner;
28874 if (ret_var.is_owned) {
28880 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_features"))) TS_UnsignedNodeAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
28881 LDKUnsignedNodeAnnouncement this_ptr_conv;
28882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28883 this_ptr_conv.is_owned = false;
28884 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28885 LDKNodeFeatures val_conv;
28886 val_conv.inner = (void*)(val & (~1));
28887 val_conv.is_owned = (val & 1) || (val == 0);
28888 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28889 val_conv = NodeFeatures_clone(&val_conv);
28890 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
28893 int32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_timestamp"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint32_t this_ptr) {
28894 LDKUnsignedNodeAnnouncement this_ptr_conv;
28895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28896 this_ptr_conv.is_owned = false;
28897 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28898 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
28902 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint32_t this_ptr, int32_t val) {
28903 LDKUnsignedNodeAnnouncement this_ptr_conv;
28904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28905 this_ptr_conv.is_owned = false;
28906 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28907 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
28910 int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint32_t this_ptr) {
28911 LDKUnsignedNodeAnnouncement this_ptr_conv;
28912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28913 this_ptr_conv.is_owned = false;
28914 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28915 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28916 memcpy(ret_arr->elems, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
28920 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint32_t this_ptr, int8_tArray val) {
28921 LDKUnsignedNodeAnnouncement this_ptr_conv;
28922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28923 this_ptr_conv.is_owned = false;
28924 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28925 LDKPublicKey val_ref;
28926 CHECK(val->arr_len == 33);
28927 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28928 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
28931 int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint32_t this_ptr) {
28932 LDKUnsignedNodeAnnouncement this_ptr_conv;
28933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28934 this_ptr_conv.is_owned = false;
28935 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28936 int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
28937 memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
28941 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_rgb"))) TS_UnsignedNodeAnnouncement_set_rgb(uint32_t this_ptr, int8_tArray val) {
28942 LDKUnsignedNodeAnnouncement this_ptr_conv;
28943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28944 this_ptr_conv.is_owned = false;
28945 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28946 LDKThreeBytes val_ref;
28947 CHECK(val->arr_len == 3);
28948 memcpy(val_ref.data, val->elems, 3); FREE(val);
28949 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
28952 int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_alias"))) TS_UnsignedNodeAnnouncement_get_alias(uint32_t this_ptr) {
28953 LDKUnsignedNodeAnnouncement this_ptr_conv;
28954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28955 this_ptr_conv.is_owned = false;
28956 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28957 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28958 memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
28962 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_alias"))) TS_UnsignedNodeAnnouncement_set_alias(uint32_t this_ptr, int8_tArray val) {
28963 LDKUnsignedNodeAnnouncement this_ptr_conv;
28964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28965 this_ptr_conv.is_owned = false;
28966 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28967 LDKThirtyTwoBytes val_ref;
28968 CHECK(val->arr_len == 32);
28969 memcpy(val_ref.data, val->elems, 32); FREE(val);
28970 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
28973 void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_addresses"))) TS_UnsignedNodeAnnouncement_set_addresses(uint32_t this_ptr, uint32_tArray val) {
28974 LDKUnsignedNodeAnnouncement this_ptr_conv;
28975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28976 this_ptr_conv.is_owned = false;
28977 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28978 LDKCVec_NetAddressZ val_constr;
28979 val_constr.datalen = val->arr_len;
28980 if (val_constr.datalen > 0)
28981 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
28983 val_constr.data = NULL;
28984 uint32_t* val_vals = val->elems /* XXX val leaks */;
28985 for (size_t m = 0; m < val_constr.datalen; m++) {
28986 uint32_t val_conv_12 = val_vals[m];
28987 void* val_conv_12_ptr = (void*)(((uintptr_t)val_conv_12) & ~1);
28988 CHECK_ACCESS(val_conv_12_ptr);
28989 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
28990 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)val_conv_12) & ~1));
28991 val_constr.data[m] = val_conv_12_conv;
28993 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
28996 static inline uintptr_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
28997 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
28998 uintptr_t ret_ref = 0;
28999 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29000 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29001 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29002 ret_ref = (uintptr_t)ret_var.inner;
29003 if (ret_var.is_owned) {
29008 intptr_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone_ptr"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint32_t arg) {
29009 LDKUnsignedNodeAnnouncement arg_conv;
29010 arg_conv.inner = (void*)(arg & (~1));
29011 arg_conv.is_owned = false;
29012 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29013 intptr_t ret_val = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
29017 uint32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone"))) TS_UnsignedNodeAnnouncement_clone(uint32_t orig) {
29018 LDKUnsignedNodeAnnouncement orig_conv;
29019 orig_conv.inner = (void*)(orig & (~1));
29020 orig_conv.is_owned = false;
29021 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29022 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
29023 uintptr_t ret_ref = 0;
29024 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29025 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29026 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29027 ret_ref = (uintptr_t)ret_var.inner;
29028 if (ret_var.is_owned) {
29034 void __attribute__((export_name("TS_NodeAnnouncement_free"))) TS_NodeAnnouncement_free(uint32_t this_obj) {
29035 LDKNodeAnnouncement this_obj_conv;
29036 this_obj_conv.inner = (void*)(this_obj & (~1));
29037 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29038 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29039 NodeAnnouncement_free(this_obj_conv);
29042 int8_tArray __attribute__((export_name("TS_NodeAnnouncement_get_signature"))) TS_NodeAnnouncement_get_signature(uint32_t this_ptr) {
29043 LDKNodeAnnouncement this_ptr_conv;
29044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29045 this_ptr_conv.is_owned = false;
29046 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29047 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
29048 memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
29052 void __attribute__((export_name("TS_NodeAnnouncement_set_signature"))) TS_NodeAnnouncement_set_signature(uint32_t this_ptr, int8_tArray val) {
29053 LDKNodeAnnouncement this_ptr_conv;
29054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29055 this_ptr_conv.is_owned = false;
29056 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29057 LDKSignature val_ref;
29058 CHECK(val->arr_len == 64);
29059 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
29060 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
29063 uint32_t __attribute__((export_name("TS_NodeAnnouncement_get_contents"))) TS_NodeAnnouncement_get_contents(uint32_t this_ptr) {
29064 LDKNodeAnnouncement this_ptr_conv;
29065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29066 this_ptr_conv.is_owned = false;
29067 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29068 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
29069 uintptr_t ret_ref = 0;
29070 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29071 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29072 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29073 ret_ref = (uintptr_t)ret_var.inner;
29074 if (ret_var.is_owned) {
29080 void __attribute__((export_name("TS_NodeAnnouncement_set_contents"))) TS_NodeAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
29081 LDKNodeAnnouncement this_ptr_conv;
29082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29083 this_ptr_conv.is_owned = false;
29084 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29085 LDKUnsignedNodeAnnouncement val_conv;
29086 val_conv.inner = (void*)(val & (~1));
29087 val_conv.is_owned = (val & 1) || (val == 0);
29088 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29089 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
29090 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
29093 uint32_t __attribute__((export_name("TS_NodeAnnouncement_new"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint32_t contents_arg) {
29094 LDKSignature signature_arg_ref;
29095 CHECK(signature_arg->arr_len == 64);
29096 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
29097 LDKUnsignedNodeAnnouncement contents_arg_conv;
29098 contents_arg_conv.inner = (void*)(contents_arg & (~1));
29099 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
29100 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
29101 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
29102 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
29103 uintptr_t ret_ref = 0;
29104 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29105 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29106 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29107 ret_ref = (uintptr_t)ret_var.inner;
29108 if (ret_var.is_owned) {
29114 static inline uintptr_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
29115 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
29116 uintptr_t ret_ref = 0;
29117 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29118 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29119 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29120 ret_ref = (uintptr_t)ret_var.inner;
29121 if (ret_var.is_owned) {
29126 intptr_t __attribute__((export_name("TS_NodeAnnouncement_clone_ptr"))) TS_NodeAnnouncement_clone_ptr(uint32_t arg) {
29127 LDKNodeAnnouncement arg_conv;
29128 arg_conv.inner = (void*)(arg & (~1));
29129 arg_conv.is_owned = false;
29130 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29131 intptr_t ret_val = NodeAnnouncement_clone_ptr(&arg_conv);
29135 uint32_t __attribute__((export_name("TS_NodeAnnouncement_clone"))) TS_NodeAnnouncement_clone(uint32_t orig) {
29136 LDKNodeAnnouncement orig_conv;
29137 orig_conv.inner = (void*)(orig & (~1));
29138 orig_conv.is_owned = false;
29139 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29140 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
29141 uintptr_t ret_ref = 0;
29142 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29143 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29144 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29145 ret_ref = (uintptr_t)ret_var.inner;
29146 if (ret_var.is_owned) {
29152 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_free"))) TS_UnsignedChannelAnnouncement_free(uint32_t this_obj) {
29153 LDKUnsignedChannelAnnouncement this_obj_conv;
29154 this_obj_conv.inner = (void*)(this_obj & (~1));
29155 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29156 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29157 UnsignedChannelAnnouncement_free(this_obj_conv);
29160 uint32_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_features"))) TS_UnsignedChannelAnnouncement_get_features(uint32_t this_ptr) {
29161 LDKUnsignedChannelAnnouncement this_ptr_conv;
29162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29163 this_ptr_conv.is_owned = false;
29164 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29165 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
29166 uintptr_t ret_ref = 0;
29167 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29168 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29169 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29170 ret_ref = (uintptr_t)ret_var.inner;
29171 if (ret_var.is_owned) {
29177 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_features"))) TS_UnsignedChannelAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
29178 LDKUnsignedChannelAnnouncement this_ptr_conv;
29179 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29180 this_ptr_conv.is_owned = false;
29181 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29182 LDKChannelFeatures val_conv;
29183 val_conv.inner = (void*)(val & (~1));
29184 val_conv.is_owned = (val & 1) || (val == 0);
29185 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29186 val_conv = ChannelFeatures_clone(&val_conv);
29187 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
29190 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_chain_hash"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint32_t this_ptr) {
29191 LDKUnsignedChannelAnnouncement this_ptr_conv;
29192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29193 this_ptr_conv.is_owned = false;
29194 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29195 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29196 memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
29200 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_chain_hash"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
29201 LDKUnsignedChannelAnnouncement this_ptr_conv;
29202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29203 this_ptr_conv.is_owned = false;
29204 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29205 LDKThirtyTwoBytes val_ref;
29206 CHECK(val->arr_len == 32);
29207 memcpy(val_ref.data, val->elems, 32); FREE(val);
29208 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
29211 int64_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_short_channel_id"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint32_t this_ptr) {
29212 LDKUnsignedChannelAnnouncement this_ptr_conv;
29213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29214 this_ptr_conv.is_owned = false;
29215 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29216 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
29220 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_channel_id"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint32_t this_ptr, int64_t val) {
29221 LDKUnsignedChannelAnnouncement this_ptr_conv;
29222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29223 this_ptr_conv.is_owned = false;
29224 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29225 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
29228 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint32_t this_ptr) {
29229 LDKUnsignedChannelAnnouncement this_ptr_conv;
29230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29231 this_ptr_conv.is_owned = false;
29232 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29233 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29234 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
29238 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint32_t this_ptr, int8_tArray val) {
29239 LDKUnsignedChannelAnnouncement this_ptr_conv;
29240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29241 this_ptr_conv.is_owned = false;
29242 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29243 LDKPublicKey val_ref;
29244 CHECK(val->arr_len == 33);
29245 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29246 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
29249 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint32_t this_ptr) {
29250 LDKUnsignedChannelAnnouncement this_ptr_conv;
29251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29252 this_ptr_conv.is_owned = false;
29253 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29254 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29255 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
29259 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint32_t this_ptr, int8_tArray val) {
29260 LDKUnsignedChannelAnnouncement this_ptr_conv;
29261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29262 this_ptr_conv.is_owned = false;
29263 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29264 LDKPublicKey val_ref;
29265 CHECK(val->arr_len == 33);
29266 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29267 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
29270 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint32_t this_ptr) {
29271 LDKUnsignedChannelAnnouncement this_ptr_conv;
29272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29273 this_ptr_conv.is_owned = false;
29274 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29275 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29276 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
29280 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint32_t this_ptr, int8_tArray val) {
29281 LDKUnsignedChannelAnnouncement this_ptr_conv;
29282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29283 this_ptr_conv.is_owned = false;
29284 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29285 LDKPublicKey val_ref;
29286 CHECK(val->arr_len == 33);
29287 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29288 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
29291 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint32_t this_ptr) {
29292 LDKUnsignedChannelAnnouncement this_ptr_conv;
29293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29294 this_ptr_conv.is_owned = false;
29295 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29296 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29297 memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
29301 void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint32_t this_ptr, int8_tArray val) {
29302 LDKUnsignedChannelAnnouncement this_ptr_conv;
29303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29304 this_ptr_conv.is_owned = false;
29305 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29306 LDKPublicKey val_ref;
29307 CHECK(val->arr_len == 33);
29308 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29309 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
29312 static inline uintptr_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
29313 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
29314 uintptr_t ret_ref = 0;
29315 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29316 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29317 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29318 ret_ref = (uintptr_t)ret_var.inner;
29319 if (ret_var.is_owned) {
29324 intptr_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone_ptr"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint32_t arg) {
29325 LDKUnsignedChannelAnnouncement arg_conv;
29326 arg_conv.inner = (void*)(arg & (~1));
29327 arg_conv.is_owned = false;
29328 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29329 intptr_t ret_val = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
29333 uint32_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone"))) TS_UnsignedChannelAnnouncement_clone(uint32_t orig) {
29334 LDKUnsignedChannelAnnouncement orig_conv;
29335 orig_conv.inner = (void*)(orig & (~1));
29336 orig_conv.is_owned = false;
29337 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29338 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
29339 uintptr_t ret_ref = 0;
29340 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29341 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29342 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29343 ret_ref = (uintptr_t)ret_var.inner;
29344 if (ret_var.is_owned) {
29350 void __attribute__((export_name("TS_ChannelAnnouncement_free"))) TS_ChannelAnnouncement_free(uint32_t this_obj) {
29351 LDKChannelAnnouncement this_obj_conv;
29352 this_obj_conv.inner = (void*)(this_obj & (~1));
29353 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29354 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29355 ChannelAnnouncement_free(this_obj_conv);
29358 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_1"))) TS_ChannelAnnouncement_get_node_signature_1(uint32_t this_ptr) {
29359 LDKChannelAnnouncement this_ptr_conv;
29360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29361 this_ptr_conv.is_owned = false;
29362 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29363 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
29364 memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
29368 void __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_1"))) TS_ChannelAnnouncement_set_node_signature_1(uint32_t this_ptr, int8_tArray val) {
29369 LDKChannelAnnouncement this_ptr_conv;
29370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29371 this_ptr_conv.is_owned = false;
29372 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29373 LDKSignature val_ref;
29374 CHECK(val->arr_len == 64);
29375 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
29376 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
29379 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_2"))) TS_ChannelAnnouncement_get_node_signature_2(uint32_t this_ptr) {
29380 LDKChannelAnnouncement this_ptr_conv;
29381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29382 this_ptr_conv.is_owned = false;
29383 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29384 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
29385 memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
29389 void __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_2"))) TS_ChannelAnnouncement_set_node_signature_2(uint32_t this_ptr, int8_tArray val) {
29390 LDKChannelAnnouncement this_ptr_conv;
29391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29392 this_ptr_conv.is_owned = false;
29393 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29394 LDKSignature val_ref;
29395 CHECK(val->arr_len == 64);
29396 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
29397 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
29400 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_1"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint32_t this_ptr) {
29401 LDKChannelAnnouncement this_ptr_conv;
29402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29403 this_ptr_conv.is_owned = false;
29404 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29405 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
29406 memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
29410 void __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_1"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint32_t this_ptr, int8_tArray val) {
29411 LDKChannelAnnouncement this_ptr_conv;
29412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29413 this_ptr_conv.is_owned = false;
29414 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29415 LDKSignature val_ref;
29416 CHECK(val->arr_len == 64);
29417 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
29418 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
29421 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_2"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint32_t this_ptr) {
29422 LDKChannelAnnouncement this_ptr_conv;
29423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29424 this_ptr_conv.is_owned = false;
29425 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29426 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
29427 memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
29431 void __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_2"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint32_t this_ptr, int8_tArray val) {
29432 LDKChannelAnnouncement this_ptr_conv;
29433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29434 this_ptr_conv.is_owned = false;
29435 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29436 LDKSignature val_ref;
29437 CHECK(val->arr_len == 64);
29438 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
29439 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
29442 uint32_t __attribute__((export_name("TS_ChannelAnnouncement_get_contents"))) TS_ChannelAnnouncement_get_contents(uint32_t this_ptr) {
29443 LDKChannelAnnouncement this_ptr_conv;
29444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29445 this_ptr_conv.is_owned = false;
29446 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29447 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
29448 uintptr_t ret_ref = 0;
29449 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29450 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29451 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29452 ret_ref = (uintptr_t)ret_var.inner;
29453 if (ret_var.is_owned) {
29459 void __attribute__((export_name("TS_ChannelAnnouncement_set_contents"))) TS_ChannelAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
29460 LDKChannelAnnouncement this_ptr_conv;
29461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29462 this_ptr_conv.is_owned = false;
29463 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29464 LDKUnsignedChannelAnnouncement val_conv;
29465 val_conv.inner = (void*)(val & (~1));
29466 val_conv.is_owned = (val & 1) || (val == 0);
29467 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29468 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
29469 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
29472 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) {
29473 LDKSignature node_signature_1_arg_ref;
29474 CHECK(node_signature_1_arg->arr_len == 64);
29475 memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
29476 LDKSignature node_signature_2_arg_ref;
29477 CHECK(node_signature_2_arg->arr_len == 64);
29478 memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
29479 LDKSignature bitcoin_signature_1_arg_ref;
29480 CHECK(bitcoin_signature_1_arg->arr_len == 64);
29481 memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
29482 LDKSignature bitcoin_signature_2_arg_ref;
29483 CHECK(bitcoin_signature_2_arg->arr_len == 64);
29484 memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
29485 LDKUnsignedChannelAnnouncement contents_arg_conv;
29486 contents_arg_conv.inner = (void*)(contents_arg & (~1));
29487 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
29488 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
29489 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
29490 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);
29491 uintptr_t ret_ref = 0;
29492 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29493 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29494 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29495 ret_ref = (uintptr_t)ret_var.inner;
29496 if (ret_var.is_owned) {
29502 static inline uintptr_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
29503 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
29504 uintptr_t ret_ref = 0;
29505 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29506 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29507 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29508 ret_ref = (uintptr_t)ret_var.inner;
29509 if (ret_var.is_owned) {
29514 intptr_t __attribute__((export_name("TS_ChannelAnnouncement_clone_ptr"))) TS_ChannelAnnouncement_clone_ptr(uint32_t arg) {
29515 LDKChannelAnnouncement arg_conv;
29516 arg_conv.inner = (void*)(arg & (~1));
29517 arg_conv.is_owned = false;
29518 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29519 intptr_t ret_val = ChannelAnnouncement_clone_ptr(&arg_conv);
29523 uint32_t __attribute__((export_name("TS_ChannelAnnouncement_clone"))) TS_ChannelAnnouncement_clone(uint32_t orig) {
29524 LDKChannelAnnouncement orig_conv;
29525 orig_conv.inner = (void*)(orig & (~1));
29526 orig_conv.is_owned = false;
29527 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29528 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
29529 uintptr_t ret_ref = 0;
29530 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29531 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29532 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29533 ret_ref = (uintptr_t)ret_var.inner;
29534 if (ret_var.is_owned) {
29540 void __attribute__((export_name("TS_UnsignedChannelUpdate_free"))) TS_UnsignedChannelUpdate_free(uint32_t this_obj) {
29541 LDKUnsignedChannelUpdate this_obj_conv;
29542 this_obj_conv.inner = (void*)(this_obj & (~1));
29543 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29544 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29545 UnsignedChannelUpdate_free(this_obj_conv);
29548 int8_tArray __attribute__((export_name("TS_UnsignedChannelUpdate_get_chain_hash"))) TS_UnsignedChannelUpdate_get_chain_hash(uint32_t this_ptr) {
29549 LDKUnsignedChannelUpdate this_ptr_conv;
29550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29551 this_ptr_conv.is_owned = false;
29552 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29553 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29554 memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
29558 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_chain_hash"))) TS_UnsignedChannelUpdate_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
29559 LDKUnsignedChannelUpdate this_ptr_conv;
29560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29561 this_ptr_conv.is_owned = false;
29562 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29563 LDKThirtyTwoBytes val_ref;
29564 CHECK(val->arr_len == 32);
29565 memcpy(val_ref.data, val->elems, 32); FREE(val);
29566 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
29569 int64_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_short_channel_id"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint32_t this_ptr) {
29570 LDKUnsignedChannelUpdate this_ptr_conv;
29571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29572 this_ptr_conv.is_owned = false;
29573 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29574 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
29578 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_short_channel_id"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint32_t this_ptr, int64_t val) {
29579 LDKUnsignedChannelUpdate this_ptr_conv;
29580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29581 this_ptr_conv.is_owned = false;
29582 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29583 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
29586 int32_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_timestamp"))) TS_UnsignedChannelUpdate_get_timestamp(uint32_t this_ptr) {
29587 LDKUnsignedChannelUpdate this_ptr_conv;
29588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29589 this_ptr_conv.is_owned = false;
29590 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29591 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
29595 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_timestamp"))) TS_UnsignedChannelUpdate_set_timestamp(uint32_t this_ptr, int32_t val) {
29596 LDKUnsignedChannelUpdate this_ptr_conv;
29597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29598 this_ptr_conv.is_owned = false;
29599 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29600 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
29603 int8_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_flags"))) TS_UnsignedChannelUpdate_get_flags(uint32_t this_ptr) {
29604 LDKUnsignedChannelUpdate this_ptr_conv;
29605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29606 this_ptr_conv.is_owned = false;
29607 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29608 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
29612 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_flags"))) TS_UnsignedChannelUpdate_set_flags(uint32_t this_ptr, int8_t val) {
29613 LDKUnsignedChannelUpdate this_ptr_conv;
29614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29615 this_ptr_conv.is_owned = false;
29616 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29617 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
29620 int16_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint32_t this_ptr) {
29621 LDKUnsignedChannelUpdate this_ptr_conv;
29622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29623 this_ptr_conv.is_owned = false;
29624 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29625 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
29629 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
29630 LDKUnsignedChannelUpdate this_ptr_conv;
29631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29632 this_ptr_conv.is_owned = false;
29633 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29634 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
29637 int64_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint32_t this_ptr) {
29638 LDKUnsignedChannelUpdate this_ptr_conv;
29639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29640 this_ptr_conv.is_owned = false;
29641 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29642 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
29646 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
29647 LDKUnsignedChannelUpdate this_ptr_conv;
29648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29649 this_ptr_conv.is_owned = false;
29650 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29651 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
29654 int32_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_base_msat"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint32_t this_ptr) {
29655 LDKUnsignedChannelUpdate this_ptr_conv;
29656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29657 this_ptr_conv.is_owned = false;
29658 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29659 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
29663 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_base_msat"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
29664 LDKUnsignedChannelUpdate this_ptr_conv;
29665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29666 this_ptr_conv.is_owned = false;
29667 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29668 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
29671 int32_t __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint32_t this_ptr) {
29672 LDKUnsignedChannelUpdate this_ptr_conv;
29673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29674 this_ptr_conv.is_owned = false;
29675 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29676 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
29680 void __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
29681 LDKUnsignedChannelUpdate this_ptr_conv;
29682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29683 this_ptr_conv.is_owned = false;
29684 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29685 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
29688 static inline uintptr_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
29689 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
29690 uintptr_t ret_ref = 0;
29691 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29692 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29693 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29694 ret_ref = (uintptr_t)ret_var.inner;
29695 if (ret_var.is_owned) {
29700 intptr_t __attribute__((export_name("TS_UnsignedChannelUpdate_clone_ptr"))) TS_UnsignedChannelUpdate_clone_ptr(uint32_t arg) {
29701 LDKUnsignedChannelUpdate arg_conv;
29702 arg_conv.inner = (void*)(arg & (~1));
29703 arg_conv.is_owned = false;
29704 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29705 intptr_t ret_val = UnsignedChannelUpdate_clone_ptr(&arg_conv);
29709 uint32_t __attribute__((export_name("TS_UnsignedChannelUpdate_clone"))) TS_UnsignedChannelUpdate_clone(uint32_t orig) {
29710 LDKUnsignedChannelUpdate orig_conv;
29711 orig_conv.inner = (void*)(orig & (~1));
29712 orig_conv.is_owned = false;
29713 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29714 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
29715 uintptr_t ret_ref = 0;
29716 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29717 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29718 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29719 ret_ref = (uintptr_t)ret_var.inner;
29720 if (ret_var.is_owned) {
29726 void __attribute__((export_name("TS_ChannelUpdate_free"))) TS_ChannelUpdate_free(uint32_t this_obj) {
29727 LDKChannelUpdate this_obj_conv;
29728 this_obj_conv.inner = (void*)(this_obj & (~1));
29729 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29730 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29731 ChannelUpdate_free(this_obj_conv);
29734 int8_tArray __attribute__((export_name("TS_ChannelUpdate_get_signature"))) TS_ChannelUpdate_get_signature(uint32_t this_ptr) {
29735 LDKChannelUpdate this_ptr_conv;
29736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29737 this_ptr_conv.is_owned = false;
29738 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29739 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
29740 memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
29744 void __attribute__((export_name("TS_ChannelUpdate_set_signature"))) TS_ChannelUpdate_set_signature(uint32_t this_ptr, int8_tArray val) {
29745 LDKChannelUpdate this_ptr_conv;
29746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29747 this_ptr_conv.is_owned = false;
29748 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29749 LDKSignature val_ref;
29750 CHECK(val->arr_len == 64);
29751 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
29752 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
29755 uint32_t __attribute__((export_name("TS_ChannelUpdate_get_contents"))) TS_ChannelUpdate_get_contents(uint32_t this_ptr) {
29756 LDKChannelUpdate this_ptr_conv;
29757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29758 this_ptr_conv.is_owned = false;
29759 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29760 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
29761 uintptr_t ret_ref = 0;
29762 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29763 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29764 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29765 ret_ref = (uintptr_t)ret_var.inner;
29766 if (ret_var.is_owned) {
29772 void __attribute__((export_name("TS_ChannelUpdate_set_contents"))) TS_ChannelUpdate_set_contents(uint32_t this_ptr, uint32_t val) {
29773 LDKChannelUpdate this_ptr_conv;
29774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29775 this_ptr_conv.is_owned = false;
29776 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29777 LDKUnsignedChannelUpdate val_conv;
29778 val_conv.inner = (void*)(val & (~1));
29779 val_conv.is_owned = (val & 1) || (val == 0);
29780 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29781 val_conv = UnsignedChannelUpdate_clone(&val_conv);
29782 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
29785 uint32_t __attribute__((export_name("TS_ChannelUpdate_new"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint32_t contents_arg) {
29786 LDKSignature signature_arg_ref;
29787 CHECK(signature_arg->arr_len == 64);
29788 memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
29789 LDKUnsignedChannelUpdate contents_arg_conv;
29790 contents_arg_conv.inner = (void*)(contents_arg & (~1));
29791 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
29792 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
29793 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
29794 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
29795 uintptr_t ret_ref = 0;
29796 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29797 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29798 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29799 ret_ref = (uintptr_t)ret_var.inner;
29800 if (ret_var.is_owned) {
29806 static inline uintptr_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
29807 LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
29808 uintptr_t ret_ref = 0;
29809 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29810 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29811 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29812 ret_ref = (uintptr_t)ret_var.inner;
29813 if (ret_var.is_owned) {
29818 intptr_t __attribute__((export_name("TS_ChannelUpdate_clone_ptr"))) TS_ChannelUpdate_clone_ptr(uint32_t arg) {
29819 LDKChannelUpdate arg_conv;
29820 arg_conv.inner = (void*)(arg & (~1));
29821 arg_conv.is_owned = false;
29822 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29823 intptr_t ret_val = ChannelUpdate_clone_ptr(&arg_conv);
29827 uint32_t __attribute__((export_name("TS_ChannelUpdate_clone"))) TS_ChannelUpdate_clone(uint32_t orig) {
29828 LDKChannelUpdate orig_conv;
29829 orig_conv.inner = (void*)(orig & (~1));
29830 orig_conv.is_owned = false;
29831 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29832 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
29833 uintptr_t ret_ref = 0;
29834 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29835 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29836 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29837 ret_ref = (uintptr_t)ret_var.inner;
29838 if (ret_var.is_owned) {
29844 void __attribute__((export_name("TS_QueryChannelRange_free"))) TS_QueryChannelRange_free(uint32_t this_obj) {
29845 LDKQueryChannelRange this_obj_conv;
29846 this_obj_conv.inner = (void*)(this_obj & (~1));
29847 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29848 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29849 QueryChannelRange_free(this_obj_conv);
29852 int8_tArray __attribute__((export_name("TS_QueryChannelRange_get_chain_hash"))) TS_QueryChannelRange_get_chain_hash(uint32_t this_ptr) {
29853 LDKQueryChannelRange this_ptr_conv;
29854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29855 this_ptr_conv.is_owned = false;
29856 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29857 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29858 memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
29862 void __attribute__((export_name("TS_QueryChannelRange_set_chain_hash"))) TS_QueryChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
29863 LDKQueryChannelRange this_ptr_conv;
29864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29865 this_ptr_conv.is_owned = false;
29866 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29867 LDKThirtyTwoBytes val_ref;
29868 CHECK(val->arr_len == 32);
29869 memcpy(val_ref.data, val->elems, 32); FREE(val);
29870 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
29873 int32_t __attribute__((export_name("TS_QueryChannelRange_get_first_blocknum"))) TS_QueryChannelRange_get_first_blocknum(uint32_t this_ptr) {
29874 LDKQueryChannelRange this_ptr_conv;
29875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29876 this_ptr_conv.is_owned = false;
29877 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29878 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
29882 void __attribute__((export_name("TS_QueryChannelRange_set_first_blocknum"))) TS_QueryChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
29883 LDKQueryChannelRange this_ptr_conv;
29884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29885 this_ptr_conv.is_owned = false;
29886 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29887 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
29890 int32_t __attribute__((export_name("TS_QueryChannelRange_get_number_of_blocks"))) TS_QueryChannelRange_get_number_of_blocks(uint32_t this_ptr) {
29891 LDKQueryChannelRange 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 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
29899 void __attribute__((export_name("TS_QueryChannelRange_set_number_of_blocks"))) TS_QueryChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
29900 LDKQueryChannelRange this_ptr_conv;
29901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29902 this_ptr_conv.is_owned = false;
29903 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29904 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
29907 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) {
29908 LDKThirtyTwoBytes chain_hash_arg_ref;
29909 CHECK(chain_hash_arg->arr_len == 32);
29910 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
29911 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
29912 uintptr_t ret_ref = 0;
29913 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29914 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29915 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29916 ret_ref = (uintptr_t)ret_var.inner;
29917 if (ret_var.is_owned) {
29923 static inline uintptr_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
29924 LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
29925 uintptr_t ret_ref = 0;
29926 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29927 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29928 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29929 ret_ref = (uintptr_t)ret_var.inner;
29930 if (ret_var.is_owned) {
29935 intptr_t __attribute__((export_name("TS_QueryChannelRange_clone_ptr"))) TS_QueryChannelRange_clone_ptr(uint32_t arg) {
29936 LDKQueryChannelRange arg_conv;
29937 arg_conv.inner = (void*)(arg & (~1));
29938 arg_conv.is_owned = false;
29939 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29940 intptr_t ret_val = QueryChannelRange_clone_ptr(&arg_conv);
29944 uint32_t __attribute__((export_name("TS_QueryChannelRange_clone"))) TS_QueryChannelRange_clone(uint32_t orig) {
29945 LDKQueryChannelRange orig_conv;
29946 orig_conv.inner = (void*)(orig & (~1));
29947 orig_conv.is_owned = false;
29948 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29949 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
29950 uintptr_t ret_ref = 0;
29951 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29952 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29953 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29954 ret_ref = (uintptr_t)ret_var.inner;
29955 if (ret_var.is_owned) {
29961 void __attribute__((export_name("TS_ReplyChannelRange_free"))) TS_ReplyChannelRange_free(uint32_t this_obj) {
29962 LDKReplyChannelRange this_obj_conv;
29963 this_obj_conv.inner = (void*)(this_obj & (~1));
29964 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29965 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29966 ReplyChannelRange_free(this_obj_conv);
29969 int8_tArray __attribute__((export_name("TS_ReplyChannelRange_get_chain_hash"))) TS_ReplyChannelRange_get_chain_hash(uint32_t this_ptr) {
29970 LDKReplyChannelRange this_ptr_conv;
29971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29972 this_ptr_conv.is_owned = false;
29973 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29974 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29975 memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
29979 void __attribute__((export_name("TS_ReplyChannelRange_set_chain_hash"))) TS_ReplyChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
29980 LDKReplyChannelRange this_ptr_conv;
29981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29982 this_ptr_conv.is_owned = false;
29983 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29984 LDKThirtyTwoBytes val_ref;
29985 CHECK(val->arr_len == 32);
29986 memcpy(val_ref.data, val->elems, 32); FREE(val);
29987 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
29990 int32_t __attribute__((export_name("TS_ReplyChannelRange_get_first_blocknum"))) TS_ReplyChannelRange_get_first_blocknum(uint32_t this_ptr) {
29991 LDKReplyChannelRange this_ptr_conv;
29992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29993 this_ptr_conv.is_owned = false;
29994 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29995 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
29999 void __attribute__((export_name("TS_ReplyChannelRange_set_first_blocknum"))) TS_ReplyChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
30000 LDKReplyChannelRange this_ptr_conv;
30001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30002 this_ptr_conv.is_owned = false;
30003 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30004 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
30007 int32_t __attribute__((export_name("TS_ReplyChannelRange_get_number_of_blocks"))) TS_ReplyChannelRange_get_number_of_blocks(uint32_t this_ptr) {
30008 LDKReplyChannelRange this_ptr_conv;
30009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30010 this_ptr_conv.is_owned = false;
30011 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30012 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
30016 void __attribute__((export_name("TS_ReplyChannelRange_set_number_of_blocks"))) TS_ReplyChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
30017 LDKReplyChannelRange this_ptr_conv;
30018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30019 this_ptr_conv.is_owned = false;
30020 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30021 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
30024 jboolean __attribute__((export_name("TS_ReplyChannelRange_get_sync_complete"))) TS_ReplyChannelRange_get_sync_complete(uint32_t this_ptr) {
30025 LDKReplyChannelRange this_ptr_conv;
30026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30027 this_ptr_conv.is_owned = false;
30028 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30029 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
30033 void __attribute__((export_name("TS_ReplyChannelRange_set_sync_complete"))) TS_ReplyChannelRange_set_sync_complete(uint32_t this_ptr, jboolean val) {
30034 LDKReplyChannelRange this_ptr_conv;
30035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30036 this_ptr_conv.is_owned = false;
30037 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30038 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
30041 void __attribute__((export_name("TS_ReplyChannelRange_set_short_channel_ids"))) TS_ReplyChannelRange_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
30042 LDKReplyChannelRange this_ptr_conv;
30043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30044 this_ptr_conv.is_owned = false;
30045 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30046 LDKCVec_u64Z val_constr;
30047 val_constr.datalen = val->arr_len;
30048 if (val_constr.datalen > 0)
30049 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
30051 val_constr.data = NULL;
30052 int64_t* val_vals = val->elems /* XXX val leaks */;
30053 for (size_t i = 0; i < val_constr.datalen; i++) {
30054 int64_t val_conv_8 = val_vals[i];
30055 val_constr.data[i] = val_conv_8;
30057 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
30060 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) {
30061 LDKThirtyTwoBytes chain_hash_arg_ref;
30062 CHECK(chain_hash_arg->arr_len == 32);
30063 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
30064 LDKCVec_u64Z short_channel_ids_arg_constr;
30065 short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
30066 if (short_channel_ids_arg_constr.datalen > 0)
30067 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
30069 short_channel_ids_arg_constr.data = NULL;
30070 int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems /* XXX short_channel_ids_arg leaks */;
30071 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
30072 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
30073 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
30075 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
30076 uintptr_t ret_ref = 0;
30077 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30078 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30079 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30080 ret_ref = (uintptr_t)ret_var.inner;
30081 if (ret_var.is_owned) {
30087 static inline uintptr_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
30088 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
30089 uintptr_t ret_ref = 0;
30090 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30091 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30092 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30093 ret_ref = (uintptr_t)ret_var.inner;
30094 if (ret_var.is_owned) {
30099 intptr_t __attribute__((export_name("TS_ReplyChannelRange_clone_ptr"))) TS_ReplyChannelRange_clone_ptr(uint32_t arg) {
30100 LDKReplyChannelRange arg_conv;
30101 arg_conv.inner = (void*)(arg & (~1));
30102 arg_conv.is_owned = false;
30103 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30104 intptr_t ret_val = ReplyChannelRange_clone_ptr(&arg_conv);
30108 uint32_t __attribute__((export_name("TS_ReplyChannelRange_clone"))) TS_ReplyChannelRange_clone(uint32_t orig) {
30109 LDKReplyChannelRange orig_conv;
30110 orig_conv.inner = (void*)(orig & (~1));
30111 orig_conv.is_owned = false;
30112 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30113 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
30114 uintptr_t ret_ref = 0;
30115 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30116 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30117 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30118 ret_ref = (uintptr_t)ret_var.inner;
30119 if (ret_var.is_owned) {
30125 void __attribute__((export_name("TS_QueryShortChannelIds_free"))) TS_QueryShortChannelIds_free(uint32_t this_obj) {
30126 LDKQueryShortChannelIds this_obj_conv;
30127 this_obj_conv.inner = (void*)(this_obj & (~1));
30128 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30129 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30130 QueryShortChannelIds_free(this_obj_conv);
30133 int8_tArray __attribute__((export_name("TS_QueryShortChannelIds_get_chain_hash"))) TS_QueryShortChannelIds_get_chain_hash(uint32_t this_ptr) {
30134 LDKQueryShortChannelIds this_ptr_conv;
30135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30136 this_ptr_conv.is_owned = false;
30137 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30138 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30139 memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
30143 void __attribute__((export_name("TS_QueryShortChannelIds_set_chain_hash"))) TS_QueryShortChannelIds_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
30144 LDKQueryShortChannelIds this_ptr_conv;
30145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30146 this_ptr_conv.is_owned = false;
30147 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30148 LDKThirtyTwoBytes val_ref;
30149 CHECK(val->arr_len == 32);
30150 memcpy(val_ref.data, val->elems, 32); FREE(val);
30151 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
30154 void __attribute__((export_name("TS_QueryShortChannelIds_set_short_channel_ids"))) TS_QueryShortChannelIds_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
30155 LDKQueryShortChannelIds this_ptr_conv;
30156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30157 this_ptr_conv.is_owned = false;
30158 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30159 LDKCVec_u64Z val_constr;
30160 val_constr.datalen = val->arr_len;
30161 if (val_constr.datalen > 0)
30162 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
30164 val_constr.data = NULL;
30165 int64_t* val_vals = val->elems /* XXX val leaks */;
30166 for (size_t i = 0; i < val_constr.datalen; i++) {
30167 int64_t val_conv_8 = val_vals[i];
30168 val_constr.data[i] = val_conv_8;
30170 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
30173 uint32_t __attribute__((export_name("TS_QueryShortChannelIds_new"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
30174 LDKThirtyTwoBytes chain_hash_arg_ref;
30175 CHECK(chain_hash_arg->arr_len == 32);
30176 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
30177 LDKCVec_u64Z short_channel_ids_arg_constr;
30178 short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
30179 if (short_channel_ids_arg_constr.datalen > 0)
30180 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
30182 short_channel_ids_arg_constr.data = NULL;
30183 int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems /* XXX short_channel_ids_arg leaks */;
30184 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
30185 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
30186 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
30188 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
30189 uintptr_t ret_ref = 0;
30190 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30191 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30192 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30193 ret_ref = (uintptr_t)ret_var.inner;
30194 if (ret_var.is_owned) {
30200 static inline uintptr_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
30201 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
30202 uintptr_t ret_ref = 0;
30203 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30204 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30205 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30206 ret_ref = (uintptr_t)ret_var.inner;
30207 if (ret_var.is_owned) {
30212 intptr_t __attribute__((export_name("TS_QueryShortChannelIds_clone_ptr"))) TS_QueryShortChannelIds_clone_ptr(uint32_t arg) {
30213 LDKQueryShortChannelIds arg_conv;
30214 arg_conv.inner = (void*)(arg & (~1));
30215 arg_conv.is_owned = false;
30216 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30217 intptr_t ret_val = QueryShortChannelIds_clone_ptr(&arg_conv);
30221 uint32_t __attribute__((export_name("TS_QueryShortChannelIds_clone"))) TS_QueryShortChannelIds_clone(uint32_t orig) {
30222 LDKQueryShortChannelIds orig_conv;
30223 orig_conv.inner = (void*)(orig & (~1));
30224 orig_conv.is_owned = false;
30225 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30226 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
30227 uintptr_t ret_ref = 0;
30228 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30229 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30230 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30231 ret_ref = (uintptr_t)ret_var.inner;
30232 if (ret_var.is_owned) {
30238 void __attribute__((export_name("TS_ReplyShortChannelIdsEnd_free"))) TS_ReplyShortChannelIdsEnd_free(uint32_t this_obj) {
30239 LDKReplyShortChannelIdsEnd this_obj_conv;
30240 this_obj_conv.inner = (void*)(this_obj & (~1));
30241 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30242 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30243 ReplyShortChannelIdsEnd_free(this_obj_conv);
30246 int8_tArray __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_chain_hash"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint32_t this_ptr) {
30247 LDKReplyShortChannelIdsEnd this_ptr_conv;
30248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30249 this_ptr_conv.is_owned = false;
30250 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30251 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30252 memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
30256 void __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_chain_hash"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
30257 LDKReplyShortChannelIdsEnd this_ptr_conv;
30258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30259 this_ptr_conv.is_owned = false;
30260 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30261 LDKThirtyTwoBytes val_ref;
30262 CHECK(val->arr_len == 32);
30263 memcpy(val_ref.data, val->elems, 32); FREE(val);
30264 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
30267 jboolean __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_full_information"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint32_t this_ptr) {
30268 LDKReplyShortChannelIdsEnd this_ptr_conv;
30269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30270 this_ptr_conv.is_owned = false;
30271 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30272 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
30276 void __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_full_information"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint32_t this_ptr, jboolean val) {
30277 LDKReplyShortChannelIdsEnd this_ptr_conv;
30278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30279 this_ptr_conv.is_owned = false;
30280 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30281 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
30284 uint32_t __attribute__((export_name("TS_ReplyShortChannelIdsEnd_new"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
30285 LDKThirtyTwoBytes chain_hash_arg_ref;
30286 CHECK(chain_hash_arg->arr_len == 32);
30287 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
30288 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
30289 uintptr_t ret_ref = 0;
30290 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30291 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30292 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30293 ret_ref = (uintptr_t)ret_var.inner;
30294 if (ret_var.is_owned) {
30300 static inline uintptr_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
30301 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
30302 uintptr_t ret_ref = 0;
30303 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30304 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30305 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30306 ret_ref = (uintptr_t)ret_var.inner;
30307 if (ret_var.is_owned) {
30312 intptr_t __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone_ptr"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint32_t arg) {
30313 LDKReplyShortChannelIdsEnd arg_conv;
30314 arg_conv.inner = (void*)(arg & (~1));
30315 arg_conv.is_owned = false;
30316 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30317 intptr_t ret_val = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
30321 uint32_t __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone"))) TS_ReplyShortChannelIdsEnd_clone(uint32_t orig) {
30322 LDKReplyShortChannelIdsEnd orig_conv;
30323 orig_conv.inner = (void*)(orig & (~1));
30324 orig_conv.is_owned = false;
30325 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30326 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
30327 uintptr_t ret_ref = 0;
30328 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30329 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30330 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30331 ret_ref = (uintptr_t)ret_var.inner;
30332 if (ret_var.is_owned) {
30338 void __attribute__((export_name("TS_GossipTimestampFilter_free"))) TS_GossipTimestampFilter_free(uint32_t this_obj) {
30339 LDKGossipTimestampFilter this_obj_conv;
30340 this_obj_conv.inner = (void*)(this_obj & (~1));
30341 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30342 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30343 GossipTimestampFilter_free(this_obj_conv);
30346 int8_tArray __attribute__((export_name("TS_GossipTimestampFilter_get_chain_hash"))) TS_GossipTimestampFilter_get_chain_hash(uint32_t this_ptr) {
30347 LDKGossipTimestampFilter this_ptr_conv;
30348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30349 this_ptr_conv.is_owned = false;
30350 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30351 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30352 memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
30356 void __attribute__((export_name("TS_GossipTimestampFilter_set_chain_hash"))) TS_GossipTimestampFilter_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
30357 LDKGossipTimestampFilter this_ptr_conv;
30358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30359 this_ptr_conv.is_owned = false;
30360 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30361 LDKThirtyTwoBytes val_ref;
30362 CHECK(val->arr_len == 32);
30363 memcpy(val_ref.data, val->elems, 32); FREE(val);
30364 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
30367 int32_t __attribute__((export_name("TS_GossipTimestampFilter_get_first_timestamp"))) TS_GossipTimestampFilter_get_first_timestamp(uint32_t this_ptr) {
30368 LDKGossipTimestampFilter this_ptr_conv;
30369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30370 this_ptr_conv.is_owned = false;
30371 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30372 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
30376 void __attribute__((export_name("TS_GossipTimestampFilter_set_first_timestamp"))) TS_GossipTimestampFilter_set_first_timestamp(uint32_t this_ptr, int32_t val) {
30377 LDKGossipTimestampFilter this_ptr_conv;
30378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30379 this_ptr_conv.is_owned = false;
30380 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30381 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
30384 int32_t __attribute__((export_name("TS_GossipTimestampFilter_get_timestamp_range"))) TS_GossipTimestampFilter_get_timestamp_range(uint32_t this_ptr) {
30385 LDKGossipTimestampFilter this_ptr_conv;
30386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30387 this_ptr_conv.is_owned = false;
30388 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30389 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
30393 void __attribute__((export_name("TS_GossipTimestampFilter_set_timestamp_range"))) TS_GossipTimestampFilter_set_timestamp_range(uint32_t this_ptr, int32_t val) {
30394 LDKGossipTimestampFilter this_ptr_conv;
30395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30396 this_ptr_conv.is_owned = false;
30397 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30398 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
30401 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) {
30402 LDKThirtyTwoBytes chain_hash_arg_ref;
30403 CHECK(chain_hash_arg->arr_len == 32);
30404 memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
30405 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
30406 uintptr_t ret_ref = 0;
30407 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30408 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30409 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30410 ret_ref = (uintptr_t)ret_var.inner;
30411 if (ret_var.is_owned) {
30417 static inline uintptr_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
30418 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
30419 uintptr_t ret_ref = 0;
30420 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30421 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30422 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30423 ret_ref = (uintptr_t)ret_var.inner;
30424 if (ret_var.is_owned) {
30429 intptr_t __attribute__((export_name("TS_GossipTimestampFilter_clone_ptr"))) TS_GossipTimestampFilter_clone_ptr(uint32_t arg) {
30430 LDKGossipTimestampFilter arg_conv;
30431 arg_conv.inner = (void*)(arg & (~1));
30432 arg_conv.is_owned = false;
30433 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30434 intptr_t ret_val = GossipTimestampFilter_clone_ptr(&arg_conv);
30438 uint32_t __attribute__((export_name("TS_GossipTimestampFilter_clone"))) TS_GossipTimestampFilter_clone(uint32_t orig) {
30439 LDKGossipTimestampFilter orig_conv;
30440 orig_conv.inner = (void*)(orig & (~1));
30441 orig_conv.is_owned = false;
30442 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30443 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
30444 uintptr_t ret_ref = 0;
30445 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30446 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30447 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30448 ret_ref = (uintptr_t)ret_var.inner;
30449 if (ret_var.is_owned) {
30455 void __attribute__((export_name("TS_ErrorAction_free"))) TS_ErrorAction_free(uint32_t this_ptr) {
30456 if ((this_ptr & 1) != 0) return;
30457 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
30458 CHECK_ACCESS(this_ptr_ptr);
30459 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
30460 FREE((void*)this_ptr);
30461 ErrorAction_free(this_ptr_conv);
30464 static inline uintptr_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
30465 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
30466 *ret_copy = ErrorAction_clone(arg);
30467 uintptr_t ret_ref = (uintptr_t)ret_copy;
30470 intptr_t __attribute__((export_name("TS_ErrorAction_clone_ptr"))) TS_ErrorAction_clone_ptr(uint32_t arg) {
30471 LDKErrorAction* arg_conv = (LDKErrorAction*)arg;
30472 intptr_t ret_val = ErrorAction_clone_ptr(arg_conv);
30476 uint32_t __attribute__((export_name("TS_ErrorAction_clone"))) TS_ErrorAction_clone(uint32_t orig) {
30477 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
30478 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
30479 *ret_copy = ErrorAction_clone(orig_conv);
30480 uintptr_t ret_ref = (uintptr_t)ret_copy;
30484 uint32_t __attribute__((export_name("TS_ErrorAction_disconnect_peer"))) TS_ErrorAction_disconnect_peer(uint32_t msg) {
30485 LDKErrorMessage msg_conv;
30486 msg_conv.inner = (void*)(msg & (~1));
30487 msg_conv.is_owned = (msg & 1) || (msg == 0);
30488 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
30489 msg_conv = ErrorMessage_clone(&msg_conv);
30490 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
30491 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
30492 uintptr_t ret_ref = (uintptr_t)ret_copy;
30496 uint32_t __attribute__((export_name("TS_ErrorAction_ignore_error"))) TS_ErrorAction_ignore_error() {
30497 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
30498 *ret_copy = ErrorAction_ignore_error();
30499 uintptr_t ret_ref = (uintptr_t)ret_copy;
30503 uint32_t __attribute__((export_name("TS_ErrorAction_ignore_and_log"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
30504 LDKLevel a_conv = LDKLevel_from_js(a);
30505 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
30506 *ret_copy = ErrorAction_ignore_and_log(a_conv);
30507 uintptr_t ret_ref = (uintptr_t)ret_copy;
30511 uint32_t __attribute__((export_name("TS_ErrorAction_ignore_duplicate_gossip"))) TS_ErrorAction_ignore_duplicate_gossip() {
30512 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
30513 *ret_copy = ErrorAction_ignore_duplicate_gossip();
30514 uintptr_t ret_ref = (uintptr_t)ret_copy;
30518 uint32_t __attribute__((export_name("TS_ErrorAction_send_error_message"))) TS_ErrorAction_send_error_message(uint32_t msg) {
30519 LDKErrorMessage msg_conv;
30520 msg_conv.inner = (void*)(msg & (~1));
30521 msg_conv.is_owned = (msg & 1) || (msg == 0);
30522 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
30523 msg_conv = ErrorMessage_clone(&msg_conv);
30524 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
30525 *ret_copy = ErrorAction_send_error_message(msg_conv);
30526 uintptr_t ret_ref = (uintptr_t)ret_copy;
30530 uint32_t __attribute__((export_name("TS_ErrorAction_send_warning_message"))) TS_ErrorAction_send_warning_message(uint32_t msg, uint32_t log_level) {
30531 LDKWarningMessage msg_conv;
30532 msg_conv.inner = (void*)(msg & (~1));
30533 msg_conv.is_owned = (msg & 1) || (msg == 0);
30534 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
30535 msg_conv = WarningMessage_clone(&msg_conv);
30536 LDKLevel log_level_conv = LDKLevel_from_js(log_level);
30537 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
30538 *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
30539 uintptr_t ret_ref = (uintptr_t)ret_copy;
30543 void __attribute__((export_name("TS_LightningError_free"))) TS_LightningError_free(uint32_t this_obj) {
30544 LDKLightningError this_obj_conv;
30545 this_obj_conv.inner = (void*)(this_obj & (~1));
30546 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30547 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30548 LightningError_free(this_obj_conv);
30551 jstring __attribute__((export_name("TS_LightningError_get_err"))) TS_LightningError_get_err(uint32_t this_ptr) {
30552 LDKLightningError this_ptr_conv;
30553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30554 this_ptr_conv.is_owned = false;
30555 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30556 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
30557 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
30562 void __attribute__((export_name("TS_LightningError_set_err"))) TS_LightningError_set_err(uint32_t this_ptr, jstring val) {
30563 LDKLightningError this_ptr_conv;
30564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30565 this_ptr_conv.is_owned = false;
30566 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30567 LDKStr val_conv = str_ref_to_owned_c(val);
30568 LightningError_set_err(&this_ptr_conv, val_conv);
30571 uint32_t __attribute__((export_name("TS_LightningError_get_action"))) TS_LightningError_get_action(uint32_t this_ptr) {
30572 LDKLightningError this_ptr_conv;
30573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30574 this_ptr_conv.is_owned = false;
30575 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30576 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
30577 *ret_copy = LightningError_get_action(&this_ptr_conv);
30578 uintptr_t ret_ref = (uintptr_t)ret_copy;
30582 void __attribute__((export_name("TS_LightningError_set_action"))) TS_LightningError_set_action(uint32_t this_ptr, uint32_t val) {
30583 LDKLightningError this_ptr_conv;
30584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30585 this_ptr_conv.is_owned = false;
30586 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30587 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
30588 CHECK_ACCESS(val_ptr);
30589 LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
30590 val_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)val) & ~1));
30591 LightningError_set_action(&this_ptr_conv, val_conv);
30594 uint32_t __attribute__((export_name("TS_LightningError_new"))) TS_LightningError_new(jstring err_arg, uint32_t action_arg) {
30595 LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
30596 void* action_arg_ptr = (void*)(((uintptr_t)action_arg) & ~1);
30597 CHECK_ACCESS(action_arg_ptr);
30598 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
30599 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)action_arg) & ~1));
30600 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
30601 uintptr_t ret_ref = 0;
30602 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30603 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30604 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30605 ret_ref = (uintptr_t)ret_var.inner;
30606 if (ret_var.is_owned) {
30612 static inline uintptr_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
30613 LDKLightningError ret_var = LightningError_clone(arg);
30614 uintptr_t ret_ref = 0;
30615 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30616 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30617 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30618 ret_ref = (uintptr_t)ret_var.inner;
30619 if (ret_var.is_owned) {
30624 intptr_t __attribute__((export_name("TS_LightningError_clone_ptr"))) TS_LightningError_clone_ptr(uint32_t arg) {
30625 LDKLightningError arg_conv;
30626 arg_conv.inner = (void*)(arg & (~1));
30627 arg_conv.is_owned = false;
30628 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30629 intptr_t ret_val = LightningError_clone_ptr(&arg_conv);
30633 uint32_t __attribute__((export_name("TS_LightningError_clone"))) TS_LightningError_clone(uint32_t orig) {
30634 LDKLightningError orig_conv;
30635 orig_conv.inner = (void*)(orig & (~1));
30636 orig_conv.is_owned = false;
30637 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30638 LDKLightningError ret_var = LightningError_clone(&orig_conv);
30639 uintptr_t ret_ref = 0;
30640 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30641 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30642 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30643 ret_ref = (uintptr_t)ret_var.inner;
30644 if (ret_var.is_owned) {
30650 void __attribute__((export_name("TS_CommitmentUpdate_free"))) TS_CommitmentUpdate_free(uint32_t this_obj) {
30651 LDKCommitmentUpdate this_obj_conv;
30652 this_obj_conv.inner = (void*)(this_obj & (~1));
30653 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30654 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30655 CommitmentUpdate_free(this_obj_conv);
30658 uint32_tArray __attribute__((export_name("TS_CommitmentUpdate_get_update_add_htlcs"))) TS_CommitmentUpdate_get_update_add_htlcs(uint32_t this_ptr) {
30659 LDKCommitmentUpdate this_ptr_conv;
30660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30661 this_ptr_conv.is_owned = false;
30662 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30663 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
30664 uint32_tArray ret_arr = NULL;
30665 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
30666 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
30667 for (size_t p = 0; p < ret_var.datalen; p++) {
30668 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
30669 uintptr_t ret_conv_15_ref = 0;
30670 CHECK((((uintptr_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30671 CHECK((((uintptr_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30672 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
30673 ret_conv_15_ref = (uintptr_t)ret_conv_15_var.inner;
30674 if (ret_conv_15_var.is_owned) {
30675 ret_conv_15_ref |= 1;
30677 ret_arr_ptr[p] = ret_conv_15_ref;
30680 FREE(ret_var.data);
30684 void __attribute__((export_name("TS_CommitmentUpdate_set_update_add_htlcs"))) TS_CommitmentUpdate_set_update_add_htlcs(uint32_t this_ptr, uint32_tArray val) {
30685 LDKCommitmentUpdate this_ptr_conv;
30686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30687 this_ptr_conv.is_owned = false;
30688 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30689 LDKCVec_UpdateAddHTLCZ val_constr;
30690 val_constr.datalen = val->arr_len;
30691 if (val_constr.datalen > 0)
30692 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
30694 val_constr.data = NULL;
30695 uint32_t* val_vals = val->elems /* XXX val leaks */;
30696 for (size_t p = 0; p < val_constr.datalen; p++) {
30697 uint32_t val_conv_15 = val_vals[p];
30698 LDKUpdateAddHTLC val_conv_15_conv;
30699 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
30700 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
30701 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
30702 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
30703 val_constr.data[p] = val_conv_15_conv;
30705 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
30708 uint32_tArray __attribute__((export_name("TS_CommitmentUpdate_get_update_fulfill_htlcs"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint32_t this_ptr) {
30709 LDKCommitmentUpdate 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 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
30714 uint32_tArray ret_arr = NULL;
30715 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
30716 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
30717 for (size_t t = 0; t < ret_var.datalen; t++) {
30718 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
30719 uintptr_t ret_conv_19_ref = 0;
30720 CHECK((((uintptr_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30721 CHECK((((uintptr_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30722 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
30723 ret_conv_19_ref = (uintptr_t)ret_conv_19_var.inner;
30724 if (ret_conv_19_var.is_owned) {
30725 ret_conv_19_ref |= 1;
30727 ret_arr_ptr[t] = ret_conv_19_ref;
30730 FREE(ret_var.data);
30734 void __attribute__((export_name("TS_CommitmentUpdate_set_update_fulfill_htlcs"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint32_t this_ptr, uint32_tArray val) {
30735 LDKCommitmentUpdate this_ptr_conv;
30736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30737 this_ptr_conv.is_owned = false;
30738 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30739 LDKCVec_UpdateFulfillHTLCZ val_constr;
30740 val_constr.datalen = val->arr_len;
30741 if (val_constr.datalen > 0)
30742 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
30744 val_constr.data = NULL;
30745 uint32_t* val_vals = val->elems /* XXX val leaks */;
30746 for (size_t t = 0; t < val_constr.datalen; t++) {
30747 uint32_t val_conv_19 = val_vals[t];
30748 LDKUpdateFulfillHTLC val_conv_19_conv;
30749 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
30750 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
30751 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
30752 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
30753 val_constr.data[t] = val_conv_19_conv;
30755 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
30758 uint32_tArray __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_htlcs"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint32_t this_ptr) {
30759 LDKCommitmentUpdate this_ptr_conv;
30760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30761 this_ptr_conv.is_owned = false;
30762 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30763 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
30764 uint32_tArray ret_arr = NULL;
30765 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
30766 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
30767 for (size_t q = 0; q < ret_var.datalen; q++) {
30768 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
30769 uintptr_t ret_conv_16_ref = 0;
30770 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30771 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30772 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
30773 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
30774 if (ret_conv_16_var.is_owned) {
30775 ret_conv_16_ref |= 1;
30777 ret_arr_ptr[q] = ret_conv_16_ref;
30780 FREE(ret_var.data);
30784 void __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_htlcs"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint32_t this_ptr, uint32_tArray val) {
30785 LDKCommitmentUpdate this_ptr_conv;
30786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30787 this_ptr_conv.is_owned = false;
30788 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30789 LDKCVec_UpdateFailHTLCZ val_constr;
30790 val_constr.datalen = val->arr_len;
30791 if (val_constr.datalen > 0)
30792 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
30794 val_constr.data = NULL;
30795 uint32_t* val_vals = val->elems /* XXX val leaks */;
30796 for (size_t q = 0; q < val_constr.datalen; q++) {
30797 uint32_t val_conv_16 = val_vals[q];
30798 LDKUpdateFailHTLC val_conv_16_conv;
30799 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
30800 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
30801 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
30802 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
30803 val_constr.data[q] = val_conv_16_conv;
30805 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
30808 uint32_tArray __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint32_t this_ptr) {
30809 LDKCommitmentUpdate this_ptr_conv;
30810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30811 this_ptr_conv.is_owned = false;
30812 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30813 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
30814 uint32_tArray ret_arr = NULL;
30815 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
30816 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
30817 for (size_t z = 0; z < ret_var.datalen; z++) {
30818 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
30819 uintptr_t ret_conv_25_ref = 0;
30820 CHECK((((uintptr_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30821 CHECK((((uintptr_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30822 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
30823 ret_conv_25_ref = (uintptr_t)ret_conv_25_var.inner;
30824 if (ret_conv_25_var.is_owned) {
30825 ret_conv_25_ref |= 1;
30827 ret_arr_ptr[z] = ret_conv_25_ref;
30830 FREE(ret_var.data);
30834 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) {
30835 LDKCommitmentUpdate this_ptr_conv;
30836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30837 this_ptr_conv.is_owned = false;
30838 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30839 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
30840 val_constr.datalen = val->arr_len;
30841 if (val_constr.datalen > 0)
30842 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
30844 val_constr.data = NULL;
30845 uint32_t* val_vals = val->elems /* XXX val leaks */;
30846 for (size_t z = 0; z < val_constr.datalen; z++) {
30847 uint32_t val_conv_25 = val_vals[z];
30848 LDKUpdateFailMalformedHTLC val_conv_25_conv;
30849 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
30850 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
30851 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
30852 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
30853 val_constr.data[z] = val_conv_25_conv;
30855 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
30858 uint32_t __attribute__((export_name("TS_CommitmentUpdate_get_update_fee"))) TS_CommitmentUpdate_get_update_fee(uint32_t this_ptr) {
30859 LDKCommitmentUpdate this_ptr_conv;
30860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30861 this_ptr_conv.is_owned = false;
30862 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30863 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
30864 uintptr_t ret_ref = 0;
30865 if ((uintptr_t)ret_var.inner > 4096) {
30866 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30867 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30868 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30869 ret_ref = (uintptr_t)ret_var.inner;
30870 if (ret_var.is_owned) {
30877 void __attribute__((export_name("TS_CommitmentUpdate_set_update_fee"))) TS_CommitmentUpdate_set_update_fee(uint32_t this_ptr, uint32_t val) {
30878 LDKCommitmentUpdate this_ptr_conv;
30879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30880 this_ptr_conv.is_owned = false;
30881 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30882 LDKUpdateFee val_conv;
30883 val_conv.inner = (void*)(val & (~1));
30884 val_conv.is_owned = (val & 1) || (val == 0);
30885 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30886 val_conv = UpdateFee_clone(&val_conv);
30887 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
30890 uint32_t __attribute__((export_name("TS_CommitmentUpdate_get_commitment_signed"))) TS_CommitmentUpdate_get_commitment_signed(uint32_t this_ptr) {
30891 LDKCommitmentUpdate this_ptr_conv;
30892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30893 this_ptr_conv.is_owned = false;
30894 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30895 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
30896 uintptr_t ret_ref = 0;
30897 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30898 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30899 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30900 ret_ref = (uintptr_t)ret_var.inner;
30901 if (ret_var.is_owned) {
30907 void __attribute__((export_name("TS_CommitmentUpdate_set_commitment_signed"))) TS_CommitmentUpdate_set_commitment_signed(uint32_t this_ptr, uint32_t val) {
30908 LDKCommitmentUpdate this_ptr_conv;
30909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30910 this_ptr_conv.is_owned = false;
30911 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30912 LDKCommitmentSigned val_conv;
30913 val_conv.inner = (void*)(val & (~1));
30914 val_conv.is_owned = (val & 1) || (val == 0);
30915 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30916 val_conv = CommitmentSigned_clone(&val_conv);
30917 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
30920 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) {
30921 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
30922 update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
30923 if (update_add_htlcs_arg_constr.datalen > 0)
30924 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
30926 update_add_htlcs_arg_constr.data = NULL;
30927 uint32_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems /* XXX update_add_htlcs_arg leaks */;
30928 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
30929 uint32_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
30930 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
30931 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
30932 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
30933 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
30934 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
30935 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
30937 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
30938 update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
30939 if (update_fulfill_htlcs_arg_constr.datalen > 0)
30940 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
30942 update_fulfill_htlcs_arg_constr.data = NULL;
30943 uint32_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems /* XXX update_fulfill_htlcs_arg leaks */;
30944 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
30945 uint32_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
30946 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
30947 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
30948 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
30949 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
30950 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
30951 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
30953 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
30954 update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
30955 if (update_fail_htlcs_arg_constr.datalen > 0)
30956 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
30958 update_fail_htlcs_arg_constr.data = NULL;
30959 uint32_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems /* XXX update_fail_htlcs_arg leaks */;
30960 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
30961 uint32_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
30962 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
30963 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
30964 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
30965 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
30966 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
30967 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
30969 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
30970 update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
30971 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
30972 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
30974 update_fail_malformed_htlcs_arg_constr.data = NULL;
30975 uint32_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems /* XXX update_fail_malformed_htlcs_arg leaks */;
30976 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
30977 uint32_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
30978 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
30979 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
30980 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);
30981 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
30982 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
30983 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
30985 LDKUpdateFee update_fee_arg_conv;
30986 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
30987 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
30988 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
30989 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
30990 LDKCommitmentSigned commitment_signed_arg_conv;
30991 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
30992 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
30993 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
30994 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
30995 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);
30996 uintptr_t ret_ref = 0;
30997 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30998 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30999 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31000 ret_ref = (uintptr_t)ret_var.inner;
31001 if (ret_var.is_owned) {
31007 static inline uintptr_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
31008 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
31009 uintptr_t ret_ref = 0;
31010 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31011 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31012 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31013 ret_ref = (uintptr_t)ret_var.inner;
31014 if (ret_var.is_owned) {
31019 intptr_t __attribute__((export_name("TS_CommitmentUpdate_clone_ptr"))) TS_CommitmentUpdate_clone_ptr(uint32_t arg) {
31020 LDKCommitmentUpdate arg_conv;
31021 arg_conv.inner = (void*)(arg & (~1));
31022 arg_conv.is_owned = false;
31023 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31024 intptr_t ret_val = CommitmentUpdate_clone_ptr(&arg_conv);
31028 uint32_t __attribute__((export_name("TS_CommitmentUpdate_clone"))) TS_CommitmentUpdate_clone(uint32_t orig) {
31029 LDKCommitmentUpdate orig_conv;
31030 orig_conv.inner = (void*)(orig & (~1));
31031 orig_conv.is_owned = false;
31032 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31033 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
31034 uintptr_t ret_ref = 0;
31035 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31036 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31037 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31038 ret_ref = (uintptr_t)ret_var.inner;
31039 if (ret_var.is_owned) {
31045 void __attribute__((export_name("TS_ChannelMessageHandler_free"))) TS_ChannelMessageHandler_free(uint32_t this_ptr) {
31046 if ((this_ptr & 1) != 0) return;
31047 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
31048 CHECK_ACCESS(this_ptr_ptr);
31049 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
31050 FREE((void*)this_ptr);
31051 ChannelMessageHandler_free(this_ptr_conv);
31054 void __attribute__((export_name("TS_RoutingMessageHandler_free"))) TS_RoutingMessageHandler_free(uint32_t this_ptr) {
31055 if ((this_ptr & 1) != 0) return;
31056 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
31057 CHECK_ACCESS(this_ptr_ptr);
31058 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
31059 FREE((void*)this_ptr);
31060 RoutingMessageHandler_free(this_ptr_conv);
31063 int8_tArray __attribute__((export_name("TS_AcceptChannel_write"))) TS_AcceptChannel_write(uint32_t obj) {
31064 LDKAcceptChannel obj_conv;
31065 obj_conv.inner = (void*)(obj & (~1));
31066 obj_conv.is_owned = false;
31067 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31068 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
31069 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31070 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31071 CVec_u8Z_free(ret_var);
31075 uint32_t __attribute__((export_name("TS_AcceptChannel_read"))) TS_AcceptChannel_read(int8_tArray ser) {
31076 LDKu8slice ser_ref;
31077 ser_ref.datalen = ser->arr_len;
31078 ser_ref.data = ser->elems /* XXX ser leaks */;
31079 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
31080 *ret_conv = AcceptChannel_read(ser_ref);
31081 return (uintptr_t)ret_conv;
31084 int8_tArray __attribute__((export_name("TS_AnnouncementSignatures_write"))) TS_AnnouncementSignatures_write(uint32_t obj) {
31085 LDKAnnouncementSignatures obj_conv;
31086 obj_conv.inner = (void*)(obj & (~1));
31087 obj_conv.is_owned = false;
31088 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31089 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
31090 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31091 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31092 CVec_u8Z_free(ret_var);
31096 uint32_t __attribute__((export_name("TS_AnnouncementSignatures_read"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
31097 LDKu8slice ser_ref;
31098 ser_ref.datalen = ser->arr_len;
31099 ser_ref.data = ser->elems /* XXX ser leaks */;
31100 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
31101 *ret_conv = AnnouncementSignatures_read(ser_ref);
31102 return (uintptr_t)ret_conv;
31105 int8_tArray __attribute__((export_name("TS_ChannelReestablish_write"))) TS_ChannelReestablish_write(uint32_t obj) {
31106 LDKChannelReestablish obj_conv;
31107 obj_conv.inner = (void*)(obj & (~1));
31108 obj_conv.is_owned = false;
31109 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31110 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
31111 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31112 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31113 CVec_u8Z_free(ret_var);
31117 uint32_t __attribute__((export_name("TS_ChannelReestablish_read"))) TS_ChannelReestablish_read(int8_tArray ser) {
31118 LDKu8slice ser_ref;
31119 ser_ref.datalen = ser->arr_len;
31120 ser_ref.data = ser->elems /* XXX ser leaks */;
31121 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
31122 *ret_conv = ChannelReestablish_read(ser_ref);
31123 return (uintptr_t)ret_conv;
31126 int8_tArray __attribute__((export_name("TS_ClosingSigned_write"))) TS_ClosingSigned_write(uint32_t obj) {
31127 LDKClosingSigned obj_conv;
31128 obj_conv.inner = (void*)(obj & (~1));
31129 obj_conv.is_owned = false;
31130 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31131 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
31132 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31133 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31134 CVec_u8Z_free(ret_var);
31138 uint32_t __attribute__((export_name("TS_ClosingSigned_read"))) TS_ClosingSigned_read(int8_tArray ser) {
31139 LDKu8slice ser_ref;
31140 ser_ref.datalen = ser->arr_len;
31141 ser_ref.data = ser->elems /* XXX ser leaks */;
31142 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
31143 *ret_conv = ClosingSigned_read(ser_ref);
31144 return (uintptr_t)ret_conv;
31147 int8_tArray __attribute__((export_name("TS_ClosingSignedFeeRange_write"))) TS_ClosingSignedFeeRange_write(uint32_t obj) {
31148 LDKClosingSignedFeeRange obj_conv;
31149 obj_conv.inner = (void*)(obj & (~1));
31150 obj_conv.is_owned = false;
31151 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31152 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
31153 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31154 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31155 CVec_u8Z_free(ret_var);
31159 uint32_t __attribute__((export_name("TS_ClosingSignedFeeRange_read"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
31160 LDKu8slice ser_ref;
31161 ser_ref.datalen = ser->arr_len;
31162 ser_ref.data = ser->elems /* XXX ser leaks */;
31163 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
31164 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
31165 return (uintptr_t)ret_conv;
31168 int8_tArray __attribute__((export_name("TS_CommitmentSigned_write"))) TS_CommitmentSigned_write(uint32_t obj) {
31169 LDKCommitmentSigned obj_conv;
31170 obj_conv.inner = (void*)(obj & (~1));
31171 obj_conv.is_owned = false;
31172 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31173 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
31174 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31175 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31176 CVec_u8Z_free(ret_var);
31180 uint32_t __attribute__((export_name("TS_CommitmentSigned_read"))) TS_CommitmentSigned_read(int8_tArray ser) {
31181 LDKu8slice ser_ref;
31182 ser_ref.datalen = ser->arr_len;
31183 ser_ref.data = ser->elems /* XXX ser leaks */;
31184 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
31185 *ret_conv = CommitmentSigned_read(ser_ref);
31186 return (uintptr_t)ret_conv;
31189 int8_tArray __attribute__((export_name("TS_FundingCreated_write"))) TS_FundingCreated_write(uint32_t obj) {
31190 LDKFundingCreated obj_conv;
31191 obj_conv.inner = (void*)(obj & (~1));
31192 obj_conv.is_owned = false;
31193 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31194 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
31195 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31196 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31197 CVec_u8Z_free(ret_var);
31201 uint32_t __attribute__((export_name("TS_FundingCreated_read"))) TS_FundingCreated_read(int8_tArray ser) {
31202 LDKu8slice ser_ref;
31203 ser_ref.datalen = ser->arr_len;
31204 ser_ref.data = ser->elems /* XXX ser leaks */;
31205 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
31206 *ret_conv = FundingCreated_read(ser_ref);
31207 return (uintptr_t)ret_conv;
31210 int8_tArray __attribute__((export_name("TS_FundingSigned_write"))) TS_FundingSigned_write(uint32_t obj) {
31211 LDKFundingSigned obj_conv;
31212 obj_conv.inner = (void*)(obj & (~1));
31213 obj_conv.is_owned = false;
31214 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31215 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
31216 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31217 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31218 CVec_u8Z_free(ret_var);
31222 uint32_t __attribute__((export_name("TS_FundingSigned_read"))) TS_FundingSigned_read(int8_tArray ser) {
31223 LDKu8slice ser_ref;
31224 ser_ref.datalen = ser->arr_len;
31225 ser_ref.data = ser->elems /* XXX ser leaks */;
31226 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
31227 *ret_conv = FundingSigned_read(ser_ref);
31228 return (uintptr_t)ret_conv;
31231 int8_tArray __attribute__((export_name("TS_FundingLocked_write"))) TS_FundingLocked_write(uint32_t obj) {
31232 LDKFundingLocked obj_conv;
31233 obj_conv.inner = (void*)(obj & (~1));
31234 obj_conv.is_owned = false;
31235 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31236 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
31237 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31238 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31239 CVec_u8Z_free(ret_var);
31243 uint32_t __attribute__((export_name("TS_FundingLocked_read"))) TS_FundingLocked_read(int8_tArray ser) {
31244 LDKu8slice ser_ref;
31245 ser_ref.datalen = ser->arr_len;
31246 ser_ref.data = ser->elems /* XXX ser leaks */;
31247 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
31248 *ret_conv = FundingLocked_read(ser_ref);
31249 return (uintptr_t)ret_conv;
31252 int8_tArray __attribute__((export_name("TS_Init_write"))) TS_Init_write(uint32_t obj) {
31254 obj_conv.inner = (void*)(obj & (~1));
31255 obj_conv.is_owned = false;
31256 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31257 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
31258 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31259 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31260 CVec_u8Z_free(ret_var);
31264 uint32_t __attribute__((export_name("TS_Init_read"))) TS_Init_read(int8_tArray ser) {
31265 LDKu8slice ser_ref;
31266 ser_ref.datalen = ser->arr_len;
31267 ser_ref.data = ser->elems /* XXX ser leaks */;
31268 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
31269 *ret_conv = Init_read(ser_ref);
31270 return (uintptr_t)ret_conv;
31273 int8_tArray __attribute__((export_name("TS_OpenChannel_write"))) TS_OpenChannel_write(uint32_t obj) {
31274 LDKOpenChannel obj_conv;
31275 obj_conv.inner = (void*)(obj & (~1));
31276 obj_conv.is_owned = false;
31277 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31278 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
31279 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31280 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31281 CVec_u8Z_free(ret_var);
31285 uint32_t __attribute__((export_name("TS_OpenChannel_read"))) TS_OpenChannel_read(int8_tArray ser) {
31286 LDKu8slice ser_ref;
31287 ser_ref.datalen = ser->arr_len;
31288 ser_ref.data = ser->elems /* XXX ser leaks */;
31289 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
31290 *ret_conv = OpenChannel_read(ser_ref);
31291 return (uintptr_t)ret_conv;
31294 int8_tArray __attribute__((export_name("TS_RevokeAndACK_write"))) TS_RevokeAndACK_write(uint32_t obj) {
31295 LDKRevokeAndACK obj_conv;
31296 obj_conv.inner = (void*)(obj & (~1));
31297 obj_conv.is_owned = false;
31298 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31299 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
31300 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31301 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31302 CVec_u8Z_free(ret_var);
31306 uint32_t __attribute__((export_name("TS_RevokeAndACK_read"))) TS_RevokeAndACK_read(int8_tArray ser) {
31307 LDKu8slice ser_ref;
31308 ser_ref.datalen = ser->arr_len;
31309 ser_ref.data = ser->elems /* XXX ser leaks */;
31310 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
31311 *ret_conv = RevokeAndACK_read(ser_ref);
31312 return (uintptr_t)ret_conv;
31315 int8_tArray __attribute__((export_name("TS_Shutdown_write"))) TS_Shutdown_write(uint32_t obj) {
31316 LDKShutdown obj_conv;
31317 obj_conv.inner = (void*)(obj & (~1));
31318 obj_conv.is_owned = false;
31319 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31320 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
31321 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31322 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31323 CVec_u8Z_free(ret_var);
31327 uint32_t __attribute__((export_name("TS_Shutdown_read"))) TS_Shutdown_read(int8_tArray ser) {
31328 LDKu8slice ser_ref;
31329 ser_ref.datalen = ser->arr_len;
31330 ser_ref.data = ser->elems /* XXX ser leaks */;
31331 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
31332 *ret_conv = Shutdown_read(ser_ref);
31333 return (uintptr_t)ret_conv;
31336 int8_tArray __attribute__((export_name("TS_UpdateFailHTLC_write"))) TS_UpdateFailHTLC_write(uint32_t obj) {
31337 LDKUpdateFailHTLC obj_conv;
31338 obj_conv.inner = (void*)(obj & (~1));
31339 obj_conv.is_owned = false;
31340 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31341 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
31342 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31343 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31344 CVec_u8Z_free(ret_var);
31348 uint32_t __attribute__((export_name("TS_UpdateFailHTLC_read"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
31349 LDKu8slice ser_ref;
31350 ser_ref.datalen = ser->arr_len;
31351 ser_ref.data = ser->elems /* XXX ser leaks */;
31352 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
31353 *ret_conv = UpdateFailHTLC_read(ser_ref);
31354 return (uintptr_t)ret_conv;
31357 int8_tArray __attribute__((export_name("TS_UpdateFailMalformedHTLC_write"))) TS_UpdateFailMalformedHTLC_write(uint32_t obj) {
31358 LDKUpdateFailMalformedHTLC obj_conv;
31359 obj_conv.inner = (void*)(obj & (~1));
31360 obj_conv.is_owned = false;
31361 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31362 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
31363 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31364 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31365 CVec_u8Z_free(ret_var);
31369 uint32_t __attribute__((export_name("TS_UpdateFailMalformedHTLC_read"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
31370 LDKu8slice ser_ref;
31371 ser_ref.datalen = ser->arr_len;
31372 ser_ref.data = ser->elems /* XXX ser leaks */;
31373 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
31374 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
31375 return (uintptr_t)ret_conv;
31378 int8_tArray __attribute__((export_name("TS_UpdateFee_write"))) TS_UpdateFee_write(uint32_t obj) {
31379 LDKUpdateFee obj_conv;
31380 obj_conv.inner = (void*)(obj & (~1));
31381 obj_conv.is_owned = false;
31382 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31383 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
31384 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31385 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31386 CVec_u8Z_free(ret_var);
31390 uint32_t __attribute__((export_name("TS_UpdateFee_read"))) TS_UpdateFee_read(int8_tArray ser) {
31391 LDKu8slice ser_ref;
31392 ser_ref.datalen = ser->arr_len;
31393 ser_ref.data = ser->elems /* XXX ser leaks */;
31394 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
31395 *ret_conv = UpdateFee_read(ser_ref);
31396 return (uintptr_t)ret_conv;
31399 int8_tArray __attribute__((export_name("TS_UpdateFulfillHTLC_write"))) TS_UpdateFulfillHTLC_write(uint32_t obj) {
31400 LDKUpdateFulfillHTLC obj_conv;
31401 obj_conv.inner = (void*)(obj & (~1));
31402 obj_conv.is_owned = false;
31403 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31404 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
31405 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31406 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31407 CVec_u8Z_free(ret_var);
31411 uint32_t __attribute__((export_name("TS_UpdateFulfillHTLC_read"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
31412 LDKu8slice ser_ref;
31413 ser_ref.datalen = ser->arr_len;
31414 ser_ref.data = ser->elems /* XXX ser leaks */;
31415 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
31416 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
31417 return (uintptr_t)ret_conv;
31420 int8_tArray __attribute__((export_name("TS_UpdateAddHTLC_write"))) TS_UpdateAddHTLC_write(uint32_t obj) {
31421 LDKUpdateAddHTLC obj_conv;
31422 obj_conv.inner = (void*)(obj & (~1));
31423 obj_conv.is_owned = false;
31424 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31425 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
31426 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31427 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31428 CVec_u8Z_free(ret_var);
31432 uint32_t __attribute__((export_name("TS_UpdateAddHTLC_read"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
31433 LDKu8slice ser_ref;
31434 ser_ref.datalen = ser->arr_len;
31435 ser_ref.data = ser->elems /* XXX ser leaks */;
31436 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
31437 *ret_conv = UpdateAddHTLC_read(ser_ref);
31438 return (uintptr_t)ret_conv;
31441 int8_tArray __attribute__((export_name("TS_Ping_write"))) TS_Ping_write(uint32_t obj) {
31443 obj_conv.inner = (void*)(obj & (~1));
31444 obj_conv.is_owned = false;
31445 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31446 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
31447 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31448 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31449 CVec_u8Z_free(ret_var);
31453 uint32_t __attribute__((export_name("TS_Ping_read"))) TS_Ping_read(int8_tArray ser) {
31454 LDKu8slice ser_ref;
31455 ser_ref.datalen = ser->arr_len;
31456 ser_ref.data = ser->elems /* XXX ser leaks */;
31457 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
31458 *ret_conv = Ping_read(ser_ref);
31459 return (uintptr_t)ret_conv;
31462 int8_tArray __attribute__((export_name("TS_Pong_write"))) TS_Pong_write(uint32_t obj) {
31464 obj_conv.inner = (void*)(obj & (~1));
31465 obj_conv.is_owned = false;
31466 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31467 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
31468 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31469 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31470 CVec_u8Z_free(ret_var);
31474 uint32_t __attribute__((export_name("TS_Pong_read"))) TS_Pong_read(int8_tArray ser) {
31475 LDKu8slice ser_ref;
31476 ser_ref.datalen = ser->arr_len;
31477 ser_ref.data = ser->elems /* XXX ser leaks */;
31478 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
31479 *ret_conv = Pong_read(ser_ref);
31480 return (uintptr_t)ret_conv;
31483 int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_write"))) TS_UnsignedChannelAnnouncement_write(uint32_t obj) {
31484 LDKUnsignedChannelAnnouncement obj_conv;
31485 obj_conv.inner = (void*)(obj & (~1));
31486 obj_conv.is_owned = false;
31487 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31488 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
31489 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31490 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31491 CVec_u8Z_free(ret_var);
31495 uint32_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_read"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
31496 LDKu8slice ser_ref;
31497 ser_ref.datalen = ser->arr_len;
31498 ser_ref.data = ser->elems /* XXX ser leaks */;
31499 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
31500 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
31501 return (uintptr_t)ret_conv;
31504 int8_tArray __attribute__((export_name("TS_ChannelAnnouncement_write"))) TS_ChannelAnnouncement_write(uint32_t obj) {
31505 LDKChannelAnnouncement obj_conv;
31506 obj_conv.inner = (void*)(obj & (~1));
31507 obj_conv.is_owned = false;
31508 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31509 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
31510 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31511 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31512 CVec_u8Z_free(ret_var);
31516 uint32_t __attribute__((export_name("TS_ChannelAnnouncement_read"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
31517 LDKu8slice ser_ref;
31518 ser_ref.datalen = ser->arr_len;
31519 ser_ref.data = ser->elems /* XXX ser leaks */;
31520 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
31521 *ret_conv = ChannelAnnouncement_read(ser_ref);
31522 return (uintptr_t)ret_conv;
31525 int8_tArray __attribute__((export_name("TS_UnsignedChannelUpdate_write"))) TS_UnsignedChannelUpdate_write(uint32_t obj) {
31526 LDKUnsignedChannelUpdate obj_conv;
31527 obj_conv.inner = (void*)(obj & (~1));
31528 obj_conv.is_owned = false;
31529 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31530 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
31531 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31532 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31533 CVec_u8Z_free(ret_var);
31537 uint32_t __attribute__((export_name("TS_UnsignedChannelUpdate_read"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
31538 LDKu8slice ser_ref;
31539 ser_ref.datalen = ser->arr_len;
31540 ser_ref.data = ser->elems /* XXX ser leaks */;
31541 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
31542 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
31543 return (uintptr_t)ret_conv;
31546 int8_tArray __attribute__((export_name("TS_ChannelUpdate_write"))) TS_ChannelUpdate_write(uint32_t obj) {
31547 LDKChannelUpdate obj_conv;
31548 obj_conv.inner = (void*)(obj & (~1));
31549 obj_conv.is_owned = false;
31550 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31551 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
31552 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31553 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31554 CVec_u8Z_free(ret_var);
31558 uint32_t __attribute__((export_name("TS_ChannelUpdate_read"))) TS_ChannelUpdate_read(int8_tArray ser) {
31559 LDKu8slice ser_ref;
31560 ser_ref.datalen = ser->arr_len;
31561 ser_ref.data = ser->elems /* XXX ser leaks */;
31562 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
31563 *ret_conv = ChannelUpdate_read(ser_ref);
31564 return (uintptr_t)ret_conv;
31567 int8_tArray __attribute__((export_name("TS_ErrorMessage_write"))) TS_ErrorMessage_write(uint32_t obj) {
31568 LDKErrorMessage obj_conv;
31569 obj_conv.inner = (void*)(obj & (~1));
31570 obj_conv.is_owned = false;
31571 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31572 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
31573 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31574 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31575 CVec_u8Z_free(ret_var);
31579 uint32_t __attribute__((export_name("TS_ErrorMessage_read"))) TS_ErrorMessage_read(int8_tArray ser) {
31580 LDKu8slice ser_ref;
31581 ser_ref.datalen = ser->arr_len;
31582 ser_ref.data = ser->elems /* XXX ser leaks */;
31583 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
31584 *ret_conv = ErrorMessage_read(ser_ref);
31585 return (uintptr_t)ret_conv;
31588 int8_tArray __attribute__((export_name("TS_WarningMessage_write"))) TS_WarningMessage_write(uint32_t obj) {
31589 LDKWarningMessage obj_conv;
31590 obj_conv.inner = (void*)(obj & (~1));
31591 obj_conv.is_owned = false;
31592 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31593 LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
31594 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31595 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31596 CVec_u8Z_free(ret_var);
31600 uint32_t __attribute__((export_name("TS_WarningMessage_read"))) TS_WarningMessage_read(int8_tArray ser) {
31601 LDKu8slice ser_ref;
31602 ser_ref.datalen = ser->arr_len;
31603 ser_ref.data = ser->elems /* XXX ser leaks */;
31604 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
31605 *ret_conv = WarningMessage_read(ser_ref);
31606 return (uintptr_t)ret_conv;
31609 int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_write"))) TS_UnsignedNodeAnnouncement_write(uint32_t obj) {
31610 LDKUnsignedNodeAnnouncement obj_conv;
31611 obj_conv.inner = (void*)(obj & (~1));
31612 obj_conv.is_owned = false;
31613 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31614 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
31615 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31616 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31617 CVec_u8Z_free(ret_var);
31621 uint32_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_read"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
31622 LDKu8slice ser_ref;
31623 ser_ref.datalen = ser->arr_len;
31624 ser_ref.data = ser->elems /* XXX ser leaks */;
31625 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
31626 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
31627 return (uintptr_t)ret_conv;
31630 int8_tArray __attribute__((export_name("TS_NodeAnnouncement_write"))) TS_NodeAnnouncement_write(uint32_t obj) {
31631 LDKNodeAnnouncement obj_conv;
31632 obj_conv.inner = (void*)(obj & (~1));
31633 obj_conv.is_owned = false;
31634 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31635 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
31636 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31637 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31638 CVec_u8Z_free(ret_var);
31642 uint32_t __attribute__((export_name("TS_NodeAnnouncement_read"))) TS_NodeAnnouncement_read(int8_tArray ser) {
31643 LDKu8slice ser_ref;
31644 ser_ref.datalen = ser->arr_len;
31645 ser_ref.data = ser->elems /* XXX ser leaks */;
31646 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
31647 *ret_conv = NodeAnnouncement_read(ser_ref);
31648 return (uintptr_t)ret_conv;
31651 uint32_t __attribute__((export_name("TS_QueryShortChannelIds_read"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
31652 LDKu8slice ser_ref;
31653 ser_ref.datalen = ser->arr_len;
31654 ser_ref.data = ser->elems /* XXX ser leaks */;
31655 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
31656 *ret_conv = QueryShortChannelIds_read(ser_ref);
31657 return (uintptr_t)ret_conv;
31660 int8_tArray __attribute__((export_name("TS_QueryShortChannelIds_write"))) TS_QueryShortChannelIds_write(uint32_t obj) {
31661 LDKQueryShortChannelIds obj_conv;
31662 obj_conv.inner = (void*)(obj & (~1));
31663 obj_conv.is_owned = false;
31664 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31665 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
31666 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31667 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31668 CVec_u8Z_free(ret_var);
31672 int8_tArray __attribute__((export_name("TS_ReplyShortChannelIdsEnd_write"))) TS_ReplyShortChannelIdsEnd_write(uint32_t obj) {
31673 LDKReplyShortChannelIdsEnd obj_conv;
31674 obj_conv.inner = (void*)(obj & (~1));
31675 obj_conv.is_owned = false;
31676 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31677 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
31678 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31679 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31680 CVec_u8Z_free(ret_var);
31684 uint32_t __attribute__((export_name("TS_ReplyShortChannelIdsEnd_read"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
31685 LDKu8slice ser_ref;
31686 ser_ref.datalen = ser->arr_len;
31687 ser_ref.data = ser->elems /* XXX ser leaks */;
31688 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
31689 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
31690 return (uintptr_t)ret_conv;
31693 int32_t __attribute__((export_name("TS_QueryChannelRange_end_blocknum"))) TS_QueryChannelRange_end_blocknum(uint32_t this_arg) {
31694 LDKQueryChannelRange this_arg_conv;
31695 this_arg_conv.inner = (void*)(this_arg & (~1));
31696 this_arg_conv.is_owned = false;
31697 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31698 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
31702 int8_tArray __attribute__((export_name("TS_QueryChannelRange_write"))) TS_QueryChannelRange_write(uint32_t obj) {
31703 LDKQueryChannelRange obj_conv;
31704 obj_conv.inner = (void*)(obj & (~1));
31705 obj_conv.is_owned = false;
31706 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31707 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
31708 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31709 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31710 CVec_u8Z_free(ret_var);
31714 uint32_t __attribute__((export_name("TS_QueryChannelRange_read"))) TS_QueryChannelRange_read(int8_tArray ser) {
31715 LDKu8slice ser_ref;
31716 ser_ref.datalen = ser->arr_len;
31717 ser_ref.data = ser->elems /* XXX ser leaks */;
31718 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
31719 *ret_conv = QueryChannelRange_read(ser_ref);
31720 return (uintptr_t)ret_conv;
31723 uint32_t __attribute__((export_name("TS_ReplyChannelRange_read"))) TS_ReplyChannelRange_read(int8_tArray ser) {
31724 LDKu8slice ser_ref;
31725 ser_ref.datalen = ser->arr_len;
31726 ser_ref.data = ser->elems /* XXX ser leaks */;
31727 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
31728 *ret_conv = ReplyChannelRange_read(ser_ref);
31729 return (uintptr_t)ret_conv;
31732 int8_tArray __attribute__((export_name("TS_ReplyChannelRange_write"))) TS_ReplyChannelRange_write(uint32_t obj) {
31733 LDKReplyChannelRange obj_conv;
31734 obj_conv.inner = (void*)(obj & (~1));
31735 obj_conv.is_owned = false;
31736 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31737 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
31738 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31739 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31740 CVec_u8Z_free(ret_var);
31744 int8_tArray __attribute__((export_name("TS_GossipTimestampFilter_write"))) TS_GossipTimestampFilter_write(uint32_t obj) {
31745 LDKGossipTimestampFilter obj_conv;
31746 obj_conv.inner = (void*)(obj & (~1));
31747 obj_conv.is_owned = false;
31748 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31749 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
31750 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31751 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31752 CVec_u8Z_free(ret_var);
31756 uint32_t __attribute__((export_name("TS_GossipTimestampFilter_read"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
31757 LDKu8slice ser_ref;
31758 ser_ref.datalen = ser->arr_len;
31759 ser_ref.data = ser->elems /* XXX ser leaks */;
31760 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
31761 *ret_conv = GossipTimestampFilter_read(ser_ref);
31762 return (uintptr_t)ret_conv;
31765 void __attribute__((export_name("TS_CustomMessageHandler_free"))) TS_CustomMessageHandler_free(uint32_t this_ptr) {
31766 if ((this_ptr & 1) != 0) return;
31767 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
31768 CHECK_ACCESS(this_ptr_ptr);
31769 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
31770 FREE((void*)this_ptr);
31771 CustomMessageHandler_free(this_ptr_conv);
31774 void __attribute__((export_name("TS_IgnoringMessageHandler_free"))) TS_IgnoringMessageHandler_free(uint32_t this_obj) {
31775 LDKIgnoringMessageHandler this_obj_conv;
31776 this_obj_conv.inner = (void*)(this_obj & (~1));
31777 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31778 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31779 IgnoringMessageHandler_free(this_obj_conv);
31782 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_new"))) TS_IgnoringMessageHandler_new() {
31783 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
31784 uintptr_t ret_ref = 0;
31785 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31786 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31787 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31788 ret_ref = (uintptr_t)ret_var.inner;
31789 if (ret_var.is_owned) {
31795 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_as_MessageSendEventsProvider"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
31796 LDKIgnoringMessageHandler this_arg_conv;
31797 this_arg_conv.inner = (void*)(this_arg & (~1));
31798 this_arg_conv.is_owned = false;
31799 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31800 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
31801 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
31802 return (uintptr_t)ret_ret;
31805 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_as_RoutingMessageHandler"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint32_t this_arg) {
31806 LDKIgnoringMessageHandler this_arg_conv;
31807 this_arg_conv.inner = (void*)(this_arg & (~1));
31808 this_arg_conv.is_owned = false;
31809 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31810 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
31811 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
31812 return (uintptr_t)ret_ret;
31815 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageReader"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint32_t this_arg) {
31816 LDKIgnoringMessageHandler this_arg_conv;
31817 this_arg_conv.inner = (void*)(this_arg & (~1));
31818 this_arg_conv.is_owned = false;
31819 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31820 LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
31821 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
31822 return (uintptr_t)ret_ret;
31825 uint32_t __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageHandler"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint32_t this_arg) {
31826 LDKIgnoringMessageHandler this_arg_conv;
31827 this_arg_conv.inner = (void*)(this_arg & (~1));
31828 this_arg_conv.is_owned = false;
31829 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31830 LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
31831 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
31832 return (uintptr_t)ret_ret;
31835 void __attribute__((export_name("TS_ErroringMessageHandler_free"))) TS_ErroringMessageHandler_free(uint32_t this_obj) {
31836 LDKErroringMessageHandler this_obj_conv;
31837 this_obj_conv.inner = (void*)(this_obj & (~1));
31838 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31839 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31840 ErroringMessageHandler_free(this_obj_conv);
31843 uint32_t __attribute__((export_name("TS_ErroringMessageHandler_new"))) TS_ErroringMessageHandler_new() {
31844 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
31845 uintptr_t ret_ref = 0;
31846 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31847 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31848 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31849 ret_ref = (uintptr_t)ret_var.inner;
31850 if (ret_var.is_owned) {
31856 uint32_t __attribute__((export_name("TS_ErroringMessageHandler_as_MessageSendEventsProvider"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
31857 LDKErroringMessageHandler this_arg_conv;
31858 this_arg_conv.inner = (void*)(this_arg & (~1));
31859 this_arg_conv.is_owned = false;
31860 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31861 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
31862 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
31863 return (uintptr_t)ret_ret;
31866 uint32_t __attribute__((export_name("TS_ErroringMessageHandler_as_ChannelMessageHandler"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint32_t this_arg) {
31867 LDKErroringMessageHandler this_arg_conv;
31868 this_arg_conv.inner = (void*)(this_arg & (~1));
31869 this_arg_conv.is_owned = false;
31870 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31871 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
31872 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
31873 return (uintptr_t)ret_ret;
31876 void __attribute__((export_name("TS_MessageHandler_free"))) TS_MessageHandler_free(uint32_t this_obj) {
31877 LDKMessageHandler this_obj_conv;
31878 this_obj_conv.inner = (void*)(this_obj & (~1));
31879 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31880 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31881 MessageHandler_free(this_obj_conv);
31884 uint32_t __attribute__((export_name("TS_MessageHandler_get_chan_handler"))) TS_MessageHandler_get_chan_handler(uint32_t this_ptr) {
31885 LDKMessageHandler this_ptr_conv;
31886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31887 this_ptr_conv.is_owned = false;
31888 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31889 // WARNING: This object doesn't live past this scope, needs clone!
31890 uintptr_t ret_ret = ((uintptr_t)MessageHandler_get_chan_handler(&this_ptr_conv)) | 1;
31894 void __attribute__((export_name("TS_MessageHandler_set_chan_handler"))) TS_MessageHandler_set_chan_handler(uint32_t this_ptr, uint32_t val) {
31895 LDKMessageHandler this_ptr_conv;
31896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31897 this_ptr_conv.is_owned = false;
31898 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31899 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
31900 CHECK_ACCESS(val_ptr);
31901 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
31902 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
31905 uint32_t __attribute__((export_name("TS_MessageHandler_get_route_handler"))) TS_MessageHandler_get_route_handler(uint32_t this_ptr) {
31906 LDKMessageHandler this_ptr_conv;
31907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31908 this_ptr_conv.is_owned = false;
31909 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31910 // WARNING: This object doesn't live past this scope, needs clone!
31911 uintptr_t ret_ret = ((uintptr_t)MessageHandler_get_route_handler(&this_ptr_conv)) | 1;
31915 void __attribute__((export_name("TS_MessageHandler_set_route_handler"))) TS_MessageHandler_set_route_handler(uint32_t this_ptr, uint32_t val) {
31916 LDKMessageHandler this_ptr_conv;
31917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31918 this_ptr_conv.is_owned = false;
31919 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31920 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
31921 CHECK_ACCESS(val_ptr);
31922 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
31923 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
31926 uint32_t __attribute__((export_name("TS_MessageHandler_new"))) TS_MessageHandler_new(uint32_t chan_handler_arg, uint32_t route_handler_arg) {
31927 void* chan_handler_arg_ptr = (void*)(((uintptr_t)chan_handler_arg) & ~1);
31928 CHECK_ACCESS(chan_handler_arg_ptr);
31929 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
31930 void* route_handler_arg_ptr = (void*)(((uintptr_t)route_handler_arg) & ~1);
31931 CHECK_ACCESS(route_handler_arg_ptr);
31932 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
31933 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
31934 uintptr_t ret_ref = 0;
31935 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31936 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31937 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31938 ret_ref = (uintptr_t)ret_var.inner;
31939 if (ret_var.is_owned) {
31945 static inline uintptr_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
31946 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
31947 *ret_ret = SocketDescriptor_clone(arg);
31948 return (uintptr_t)ret_ret;
31950 intptr_t __attribute__((export_name("TS_SocketDescriptor_clone_ptr"))) TS_SocketDescriptor_clone_ptr(uint32_t arg) {
31951 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
31952 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
31953 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
31954 intptr_t ret_val = SocketDescriptor_clone_ptr(arg_conv);
31958 uint32_t __attribute__((export_name("TS_SocketDescriptor_clone"))) TS_SocketDescriptor_clone(uint32_t orig) {
31959 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
31960 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
31961 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
31962 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
31963 *ret_ret = SocketDescriptor_clone(orig_conv);
31964 return (uintptr_t)ret_ret;
31967 void __attribute__((export_name("TS_SocketDescriptor_free"))) TS_SocketDescriptor_free(uint32_t this_ptr) {
31968 if ((this_ptr & 1) != 0) return;
31969 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
31970 CHECK_ACCESS(this_ptr_ptr);
31971 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
31972 FREE((void*)this_ptr);
31973 SocketDescriptor_free(this_ptr_conv);
31976 void __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError_free(uint32_t this_obj) {
31977 LDKPeerHandleError this_obj_conv;
31978 this_obj_conv.inner = (void*)(this_obj & (~1));
31979 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31980 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31981 PeerHandleError_free(this_obj_conv);
31984 jboolean __attribute__((export_name("TS_PeerHandleError_get_no_connection_possible"))) TS_PeerHandleError_get_no_connection_possible(uint32_t this_ptr) {
31985 LDKPeerHandleError this_ptr_conv;
31986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31987 this_ptr_conv.is_owned = false;
31988 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31989 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
31993 void __attribute__((export_name("TS_PeerHandleError_set_no_connection_possible"))) TS_PeerHandleError_set_no_connection_possible(uint32_t this_ptr, jboolean val) {
31994 LDKPeerHandleError this_ptr_conv;
31995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31996 this_ptr_conv.is_owned = false;
31997 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31998 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
32001 uint32_t __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
32002 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
32003 uintptr_t ret_ref = 0;
32004 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32005 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32006 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32007 ret_ref = (uintptr_t)ret_var.inner;
32008 if (ret_var.is_owned) {
32014 static inline uintptr_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
32015 LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
32016 uintptr_t ret_ref = 0;
32017 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32018 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32019 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32020 ret_ref = (uintptr_t)ret_var.inner;
32021 if (ret_var.is_owned) {
32026 intptr_t __attribute__((export_name("TS_PeerHandleError_clone_ptr"))) TS_PeerHandleError_clone_ptr(uint32_t arg) {
32027 LDKPeerHandleError arg_conv;
32028 arg_conv.inner = (void*)(arg & (~1));
32029 arg_conv.is_owned = false;
32030 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32031 intptr_t ret_val = PeerHandleError_clone_ptr(&arg_conv);
32035 uint32_t __attribute__((export_name("TS_PeerHandleError_clone"))) TS_PeerHandleError_clone(uint32_t orig) {
32036 LDKPeerHandleError orig_conv;
32037 orig_conv.inner = (void*)(orig & (~1));
32038 orig_conv.is_owned = false;
32039 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32040 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
32041 uintptr_t ret_ref = 0;
32042 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32043 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32044 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32045 ret_ref = (uintptr_t)ret_var.inner;
32046 if (ret_var.is_owned) {
32052 void __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(uint32_t this_obj) {
32053 LDKPeerManager this_obj_conv;
32054 this_obj_conv.inner = (void*)(this_obj & (~1));
32055 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32056 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32057 PeerManager_free(this_obj_conv);
32060 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) {
32061 LDKMessageHandler message_handler_conv;
32062 message_handler_conv.inner = (void*)(message_handler & (~1));
32063 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
32064 CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
32065 // WARNING: we need a move here but no clone is available for LDKMessageHandler
32066 LDKSecretKey our_node_secret_ref;
32067 CHECK(our_node_secret->arr_len == 32);
32068 memcpy(our_node_secret_ref.bytes, our_node_secret->elems, 32); FREE(our_node_secret);
32069 unsigned char ephemeral_random_data_arr[32];
32070 CHECK(ephemeral_random_data->arr_len == 32);
32071 memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
32072 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
32073 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
32074 CHECK_ACCESS(logger_ptr);
32075 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
32076 void* custom_message_handler_ptr = (void*)(((uintptr_t)custom_message_handler) & ~1);
32077 CHECK_ACCESS(custom_message_handler_ptr);
32078 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
32079 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
32080 uintptr_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 ptrArray __attribute__((export_name("TS_PeerManager_get_peer_node_ids"))) TS_PeerManager_get_peer_node_ids(uint32_t this_arg) {
32092 LDKPeerManager this_arg_conv;
32093 this_arg_conv.inner = (void*)(this_arg & (~1));
32094 this_arg_conv.is_owned = false;
32095 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32096 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
32097 ptrArray ret_arr = NULL;
32098 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
32099 int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 4);
32100 for (size_t m = 0; m < ret_var.datalen; m++) {
32101 int8_tArray ret_conv_12_arr = init_int8_tArray(33, __LINE__);
32102 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compressed_form, 33);
32103 ret_arr_ptr[m] = ret_conv_12_arr;
32106 FREE(ret_var.data);
32110 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) {
32111 LDKPeerManager this_arg_conv;
32112 this_arg_conv.inner = (void*)(this_arg & (~1));
32113 this_arg_conv.is_owned = false;
32114 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32115 LDKPublicKey their_node_id_ref;
32116 CHECK(their_node_id->arr_len == 33);
32117 memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
32118 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
32119 CHECK_ACCESS(descriptor_ptr);
32120 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
32121 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
32122 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
32123 return (uintptr_t)ret_conv;
32126 uint32_t __attribute__((export_name("TS_PeerManager_new_inbound_connection"))) TS_PeerManager_new_inbound_connection(uint32_t this_arg, uint32_t descriptor) {
32127 LDKPeerManager this_arg_conv;
32128 this_arg_conv.inner = (void*)(this_arg & (~1));
32129 this_arg_conv.is_owned = false;
32130 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32131 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
32132 CHECK_ACCESS(descriptor_ptr);
32133 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
32134 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
32135 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
32136 return (uintptr_t)ret_conv;
32139 uint32_t __attribute__((export_name("TS_PeerManager_write_buffer_space_avail"))) TS_PeerManager_write_buffer_space_avail(uint32_t this_arg, uint32_t descriptor) {
32140 LDKPeerManager this_arg_conv;
32141 this_arg_conv.inner = (void*)(this_arg & (~1));
32142 this_arg_conv.is_owned = false;
32143 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32144 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
32145 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
32146 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
32147 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
32148 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
32149 return (uintptr_t)ret_conv;
32152 uint32_t __attribute__((export_name("TS_PeerManager_read_event"))) TS_PeerManager_read_event(uint32_t this_arg, uint32_t peer_descriptor, int8_tArray data) {
32153 LDKPeerManager this_arg_conv;
32154 this_arg_conv.inner = (void*)(this_arg & (~1));
32155 this_arg_conv.is_owned = false;
32156 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32157 void* peer_descriptor_ptr = (void*)(((uintptr_t)peer_descriptor) & ~1);
32158 if (!(peer_descriptor & 1)) { CHECK_ACCESS(peer_descriptor_ptr); }
32159 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
32160 LDKu8slice data_ref;
32161 data_ref.datalen = data->arr_len;
32162 data_ref.data = data->elems /* XXX data leaks */;
32163 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
32164 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
32165 return (uintptr_t)ret_conv;
32168 void __attribute__((export_name("TS_PeerManager_process_events"))) TS_PeerManager_process_events(uint32_t this_arg) {
32169 LDKPeerManager this_arg_conv;
32170 this_arg_conv.inner = (void*)(this_arg & (~1));
32171 this_arg_conv.is_owned = false;
32172 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32173 PeerManager_process_events(&this_arg_conv);
32176 void __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_PeerManager_socket_disconnected(uint32_t this_arg, uint32_t descriptor) {
32177 LDKPeerManager this_arg_conv;
32178 this_arg_conv.inner = (void*)(this_arg & (~1));
32179 this_arg_conv.is_owned = false;
32180 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32181 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
32182 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
32183 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
32184 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
32187 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) {
32188 LDKPeerManager this_arg_conv;
32189 this_arg_conv.inner = (void*)(this_arg & (~1));
32190 this_arg_conv.is_owned = false;
32191 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32192 LDKPublicKey node_id_ref;
32193 CHECK(node_id->arr_len == 33);
32194 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
32195 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
32198 void __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint32_t this_arg) {
32199 LDKPeerManager this_arg_conv;
32200 this_arg_conv.inner = (void*)(this_arg & (~1));
32201 this_arg_conv.is_owned = false;
32202 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32203 PeerManager_disconnect_all_peers(&this_arg_conv);
32206 void __attribute__((export_name("TS_PeerManager_timer_tick_occurred"))) TS_PeerManager_timer_tick_occurred(uint32_t this_arg) {
32207 LDKPeerManager this_arg_conv;
32208 this_arg_conv.inner = (void*)(this_arg & (~1));
32209 this_arg_conv.is_owned = false;
32210 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32211 PeerManager_timer_tick_occurred(&this_arg_conv);
32214 int64_t __attribute__((export_name("TS_htlc_success_tx_weight"))) TS_htlc_success_tx_weight(jboolean opt_anchors) {
32215 int64_t ret_val = htlc_success_tx_weight(opt_anchors);
32219 int64_t __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeout_tx_weight(jboolean opt_anchors) {
32220 int64_t ret_val = htlc_timeout_tx_weight(opt_anchors);
32224 int8_tArray __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
32225 unsigned char commitment_seed_arr[32];
32226 CHECK(commitment_seed->arr_len == 32);
32227 memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
32228 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
32229 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32230 memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
32234 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) {
32235 LDKCVec_u8Z to_holder_script_ref;
32236 to_holder_script_ref.datalen = to_holder_script->arr_len;
32237 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
32238 memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
32239 LDKCVec_u8Z to_counterparty_script_ref;
32240 to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
32241 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
32242 memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
32243 LDKOutPoint funding_outpoint_conv;
32244 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
32245 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
32246 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
32247 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
32248 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);
32249 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32250 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32251 Transaction_free(ret_var);
32255 void __attribute__((export_name("TS_CounterpartyCommitmentSecrets_free"))) TS_CounterpartyCommitmentSecrets_free(uint32_t this_obj) {
32256 LDKCounterpartyCommitmentSecrets this_obj_conv;
32257 this_obj_conv.inner = (void*)(this_obj & (~1));
32258 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32259 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32260 CounterpartyCommitmentSecrets_free(this_obj_conv);
32263 static inline uintptr_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
32264 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
32265 uintptr_t ret_ref = 0;
32266 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32267 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32268 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32269 ret_ref = (uintptr_t)ret_var.inner;
32270 if (ret_var.is_owned) {
32275 intptr_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone_ptr"))) TS_CounterpartyCommitmentSecrets_clone_ptr(uint32_t arg) {
32276 LDKCounterpartyCommitmentSecrets arg_conv;
32277 arg_conv.inner = (void*)(arg & (~1));
32278 arg_conv.is_owned = false;
32279 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32280 intptr_t ret_val = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
32284 uint32_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone"))) TS_CounterpartyCommitmentSecrets_clone(uint32_t orig) {
32285 LDKCounterpartyCommitmentSecrets orig_conv;
32286 orig_conv.inner = (void*)(orig & (~1));
32287 orig_conv.is_owned = false;
32288 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32289 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
32290 uintptr_t ret_ref = 0;
32291 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32292 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32293 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32294 ret_ref = (uintptr_t)ret_var.inner;
32295 if (ret_var.is_owned) {
32301 uint32_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_new"))) TS_CounterpartyCommitmentSecrets_new() {
32302 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
32303 uintptr_t ret_ref = 0;
32304 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32305 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32306 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32307 ret_ref = (uintptr_t)ret_var.inner;
32308 if (ret_var.is_owned) {
32314 int64_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_min_seen_secret"))) TS_CounterpartyCommitmentSecrets_get_min_seen_secret(uint32_t this_arg) {
32315 LDKCounterpartyCommitmentSecrets 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 int64_t ret_val = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
32323 uint32_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_provide_secret"))) TS_CounterpartyCommitmentSecrets_provide_secret(uint32_t this_arg, int64_t idx, int8_tArray secret) {
32324 LDKCounterpartyCommitmentSecrets this_arg_conv;
32325 this_arg_conv.inner = (void*)(this_arg & (~1));
32326 this_arg_conv.is_owned = false;
32327 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32328 LDKThirtyTwoBytes secret_ref;
32329 CHECK(secret->arr_len == 32);
32330 memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
32331 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
32332 *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
32333 return (uintptr_t)ret_conv;
32336 int8_tArray __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_secret"))) TS_CounterpartyCommitmentSecrets_get_secret(uint32_t this_arg, int64_t idx) {
32337 LDKCounterpartyCommitmentSecrets this_arg_conv;
32338 this_arg_conv.inner = (void*)(this_arg & (~1));
32339 this_arg_conv.is_owned = false;
32340 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32341 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32342 memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
32346 int8_tArray __attribute__((export_name("TS_CounterpartyCommitmentSecrets_write"))) TS_CounterpartyCommitmentSecrets_write(uint32_t obj) {
32347 LDKCounterpartyCommitmentSecrets obj_conv;
32348 obj_conv.inner = (void*)(obj & (~1));
32349 obj_conv.is_owned = false;
32350 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32351 LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
32352 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32353 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32354 CVec_u8Z_free(ret_var);
32358 uint32_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_read"))) TS_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
32359 LDKu8slice ser_ref;
32360 ser_ref.datalen = ser->arr_len;
32361 ser_ref.data = ser->elems /* XXX ser leaks */;
32362 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
32363 *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
32364 return (uintptr_t)ret_conv;
32367 uint32_t __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
32368 LDKPublicKey per_commitment_point_ref;
32369 CHECK(per_commitment_point->arr_len == 33);
32370 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
32371 unsigned char base_secret_arr[32];
32372 CHECK(base_secret->arr_len == 32);
32373 memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
32374 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
32375 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
32376 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
32377 return (uintptr_t)ret_conv;
32380 uint32_t __attribute__((export_name("TS_derive_public_key"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
32381 LDKPublicKey per_commitment_point_ref;
32382 CHECK(per_commitment_point->arr_len == 33);
32383 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
32384 LDKPublicKey base_point_ref;
32385 CHECK(base_point->arr_len == 33);
32386 memcpy(base_point_ref.compressed_form, base_point->elems, 33); FREE(base_point);
32387 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
32388 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
32389 return (uintptr_t)ret_conv;
32392 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) {
32393 unsigned char per_commitment_secret_arr[32];
32394 CHECK(per_commitment_secret->arr_len == 32);
32395 memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
32396 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
32397 unsigned char countersignatory_revocation_base_secret_arr[32];
32398 CHECK(countersignatory_revocation_base_secret->arr_len == 32);
32399 memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
32400 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
32401 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
32402 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
32403 return (uintptr_t)ret_conv;
32406 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) {
32407 LDKPublicKey per_commitment_point_ref;
32408 CHECK(per_commitment_point->arr_len == 33);
32409 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
32410 LDKPublicKey countersignatory_revocation_base_point_ref;
32411 CHECK(countersignatory_revocation_base_point->arr_len == 33);
32412 memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point->elems, 33); FREE(countersignatory_revocation_base_point);
32413 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
32414 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
32415 return (uintptr_t)ret_conv;
32418 void __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint32_t this_obj) {
32419 LDKTxCreationKeys this_obj_conv;
32420 this_obj_conv.inner = (void*)(this_obj & (~1));
32421 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32422 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32423 TxCreationKeys_free(this_obj_conv);
32426 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_per_commitment_point"))) TS_TxCreationKeys_get_per_commitment_point(uint32_t this_ptr) {
32427 LDKTxCreationKeys this_ptr_conv;
32428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32429 this_ptr_conv.is_owned = false;
32430 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32431 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32432 memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
32436 void __attribute__((export_name("TS_TxCreationKeys_set_per_commitment_point"))) TS_TxCreationKeys_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
32437 LDKTxCreationKeys this_ptr_conv;
32438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32439 this_ptr_conv.is_owned = false;
32440 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32441 LDKPublicKey val_ref;
32442 CHECK(val->arr_len == 33);
32443 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32444 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
32447 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_revocation_key"))) TS_TxCreationKeys_get_revocation_key(uint32_t this_ptr) {
32448 LDKTxCreationKeys this_ptr_conv;
32449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32450 this_ptr_conv.is_owned = false;
32451 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32452 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32453 memcpy(ret_arr->elems, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
32457 void __attribute__((export_name("TS_TxCreationKeys_set_revocation_key"))) TS_TxCreationKeys_set_revocation_key(uint32_t this_ptr, int8_tArray val) {
32458 LDKTxCreationKeys this_ptr_conv;
32459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32460 this_ptr_conv.is_owned = false;
32461 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32462 LDKPublicKey val_ref;
32463 CHECK(val->arr_len == 33);
32464 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32465 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
32468 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_htlc_key"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint32_t this_ptr) {
32469 LDKTxCreationKeys this_ptr_conv;
32470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32471 this_ptr_conv.is_owned = false;
32472 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32473 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32474 memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
32478 void __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_htlc_key"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint32_t this_ptr, int8_tArray val) {
32479 LDKTxCreationKeys this_ptr_conv;
32480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32481 this_ptr_conv.is_owned = false;
32482 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32483 LDKPublicKey val_ref;
32484 CHECK(val->arr_len == 33);
32485 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32486 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
32489 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_countersignatory_htlc_key"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint32_t this_ptr) {
32490 LDKTxCreationKeys this_ptr_conv;
32491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32492 this_ptr_conv.is_owned = false;
32493 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32494 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32495 memcpy(ret_arr->elems, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
32499 void __attribute__((export_name("TS_TxCreationKeys_set_countersignatory_htlc_key"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint32_t this_ptr, int8_tArray val) {
32500 LDKTxCreationKeys this_ptr_conv;
32501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32502 this_ptr_conv.is_owned = false;
32503 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32504 LDKPublicKey val_ref;
32505 CHECK(val->arr_len == 33);
32506 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32507 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
32510 int8_tArray __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint32_t this_ptr) {
32511 LDKTxCreationKeys this_ptr_conv;
32512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32513 this_ptr_conv.is_owned = false;
32514 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32515 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32516 memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
32520 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) {
32521 LDKTxCreationKeys this_ptr_conv;
32522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32523 this_ptr_conv.is_owned = false;
32524 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32525 LDKPublicKey val_ref;
32526 CHECK(val->arr_len == 33);
32527 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32528 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
32531 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) {
32532 LDKPublicKey per_commitment_point_arg_ref;
32533 CHECK(per_commitment_point_arg->arr_len == 33);
32534 memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
32535 LDKPublicKey revocation_key_arg_ref;
32536 CHECK(revocation_key_arg->arr_len == 33);
32537 memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg->elems, 33); FREE(revocation_key_arg);
32538 LDKPublicKey broadcaster_htlc_key_arg_ref;
32539 CHECK(broadcaster_htlc_key_arg->arr_len == 33);
32540 memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg->elems, 33); FREE(broadcaster_htlc_key_arg);
32541 LDKPublicKey countersignatory_htlc_key_arg_ref;
32542 CHECK(countersignatory_htlc_key_arg->arr_len == 33);
32543 memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg->elems, 33); FREE(countersignatory_htlc_key_arg);
32544 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
32545 CHECK(broadcaster_delayed_payment_key_arg->arr_len == 33);
32546 memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg->elems, 33); FREE(broadcaster_delayed_payment_key_arg);
32547 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);
32548 uintptr_t ret_ref = 0;
32549 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32550 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32551 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32552 ret_ref = (uintptr_t)ret_var.inner;
32553 if (ret_var.is_owned) {
32559 static inline uintptr_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
32560 LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
32561 uintptr_t ret_ref = 0;
32562 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32563 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32564 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32565 ret_ref = (uintptr_t)ret_var.inner;
32566 if (ret_var.is_owned) {
32571 intptr_t __attribute__((export_name("TS_TxCreationKeys_clone_ptr"))) TS_TxCreationKeys_clone_ptr(uint32_t arg) {
32572 LDKTxCreationKeys arg_conv;
32573 arg_conv.inner = (void*)(arg & (~1));
32574 arg_conv.is_owned = false;
32575 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32576 intptr_t ret_val = TxCreationKeys_clone_ptr(&arg_conv);
32580 uint32_t __attribute__((export_name("TS_TxCreationKeys_clone"))) TS_TxCreationKeys_clone(uint32_t orig) {
32581 LDKTxCreationKeys orig_conv;
32582 orig_conv.inner = (void*)(orig & (~1));
32583 orig_conv.is_owned = false;
32584 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32585 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
32586 uintptr_t ret_ref = 0;
32587 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32588 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32589 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32590 ret_ref = (uintptr_t)ret_var.inner;
32591 if (ret_var.is_owned) {
32597 int8_tArray __attribute__((export_name("TS_TxCreationKeys_write"))) TS_TxCreationKeys_write(uint32_t obj) {
32598 LDKTxCreationKeys obj_conv;
32599 obj_conv.inner = (void*)(obj & (~1));
32600 obj_conv.is_owned = false;
32601 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32602 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
32603 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32604 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32605 CVec_u8Z_free(ret_var);
32609 uint32_t __attribute__((export_name("TS_TxCreationKeys_read"))) TS_TxCreationKeys_read(int8_tArray ser) {
32610 LDKu8slice ser_ref;
32611 ser_ref.datalen = ser->arr_len;
32612 ser_ref.data = ser->elems /* XXX ser leaks */;
32613 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
32614 *ret_conv = TxCreationKeys_read(ser_ref);
32615 return (uintptr_t)ret_conv;
32618 void __attribute__((export_name("TS_ChannelPublicKeys_free"))) TS_ChannelPublicKeys_free(uint32_t this_obj) {
32619 LDKChannelPublicKeys this_obj_conv;
32620 this_obj_conv.inner = (void*)(this_obj & (~1));
32621 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32622 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32623 ChannelPublicKeys_free(this_obj_conv);
32626 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_funding_pubkey"))) TS_ChannelPublicKeys_get_funding_pubkey(uint32_t this_ptr) {
32627 LDKChannelPublicKeys this_ptr_conv;
32628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32629 this_ptr_conv.is_owned = false;
32630 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32631 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32632 memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
32636 void __attribute__((export_name("TS_ChannelPublicKeys_set_funding_pubkey"))) TS_ChannelPublicKeys_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
32637 LDKChannelPublicKeys this_ptr_conv;
32638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32639 this_ptr_conv.is_owned = false;
32640 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32641 LDKPublicKey val_ref;
32642 CHECK(val->arr_len == 33);
32643 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32644 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
32647 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_revocation_basepoint"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint32_t this_ptr) {
32648 LDKChannelPublicKeys this_ptr_conv;
32649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32650 this_ptr_conv.is_owned = false;
32651 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32652 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32653 memcpy(ret_arr->elems, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
32657 void __attribute__((export_name("TS_ChannelPublicKeys_set_revocation_basepoint"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
32658 LDKChannelPublicKeys this_ptr_conv;
32659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32660 this_ptr_conv.is_owned = false;
32661 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32662 LDKPublicKey val_ref;
32663 CHECK(val->arr_len == 33);
32664 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32665 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
32668 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_payment_point"))) TS_ChannelPublicKeys_get_payment_point(uint32_t this_ptr) {
32669 LDKChannelPublicKeys this_ptr_conv;
32670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32671 this_ptr_conv.is_owned = false;
32672 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32673 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32674 memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
32678 void __attribute__((export_name("TS_ChannelPublicKeys_set_payment_point"))) TS_ChannelPublicKeys_set_payment_point(uint32_t this_ptr, int8_tArray val) {
32679 LDKChannelPublicKeys this_ptr_conv;
32680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32681 this_ptr_conv.is_owned = false;
32682 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32683 LDKPublicKey val_ref;
32684 CHECK(val->arr_len == 33);
32685 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32686 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
32689 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_delayed_payment_basepoint"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint32_t this_ptr) {
32690 LDKChannelPublicKeys this_ptr_conv;
32691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32692 this_ptr_conv.is_owned = false;
32693 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32694 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32695 memcpy(ret_arr->elems, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
32699 void __attribute__((export_name("TS_ChannelPublicKeys_set_delayed_payment_basepoint"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
32700 LDKChannelPublicKeys this_ptr_conv;
32701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32702 this_ptr_conv.is_owned = false;
32703 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32704 LDKPublicKey val_ref;
32705 CHECK(val->arr_len == 33);
32706 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32707 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
32710 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_get_htlc_basepoint"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint32_t this_ptr) {
32711 LDKChannelPublicKeys this_ptr_conv;
32712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32713 this_ptr_conv.is_owned = false;
32714 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32715 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32716 memcpy(ret_arr->elems, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
32720 void __attribute__((export_name("TS_ChannelPublicKeys_set_htlc_basepoint"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
32721 LDKChannelPublicKeys this_ptr_conv;
32722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32723 this_ptr_conv.is_owned = false;
32724 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32725 LDKPublicKey val_ref;
32726 CHECK(val->arr_len == 33);
32727 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32728 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
32731 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) {
32732 LDKPublicKey funding_pubkey_arg_ref;
32733 CHECK(funding_pubkey_arg->arr_len == 33);
32734 memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
32735 LDKPublicKey revocation_basepoint_arg_ref;
32736 CHECK(revocation_basepoint_arg->arr_len == 33);
32737 memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
32738 LDKPublicKey payment_point_arg_ref;
32739 CHECK(payment_point_arg->arr_len == 33);
32740 memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
32741 LDKPublicKey delayed_payment_basepoint_arg_ref;
32742 CHECK(delayed_payment_basepoint_arg->arr_len == 33);
32743 memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
32744 LDKPublicKey htlc_basepoint_arg_ref;
32745 CHECK(htlc_basepoint_arg->arr_len == 33);
32746 memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
32747 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);
32748 uintptr_t ret_ref = 0;
32749 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32750 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32751 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32752 ret_ref = (uintptr_t)ret_var.inner;
32753 if (ret_var.is_owned) {
32759 static inline uintptr_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
32760 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
32761 uintptr_t ret_ref = 0;
32762 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32763 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32764 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32765 ret_ref = (uintptr_t)ret_var.inner;
32766 if (ret_var.is_owned) {
32771 intptr_t __attribute__((export_name("TS_ChannelPublicKeys_clone_ptr"))) TS_ChannelPublicKeys_clone_ptr(uint32_t arg) {
32772 LDKChannelPublicKeys arg_conv;
32773 arg_conv.inner = (void*)(arg & (~1));
32774 arg_conv.is_owned = false;
32775 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32776 intptr_t ret_val = ChannelPublicKeys_clone_ptr(&arg_conv);
32780 uint32_t __attribute__((export_name("TS_ChannelPublicKeys_clone"))) TS_ChannelPublicKeys_clone(uint32_t orig) {
32781 LDKChannelPublicKeys orig_conv;
32782 orig_conv.inner = (void*)(orig & (~1));
32783 orig_conv.is_owned = false;
32784 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32785 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
32786 uintptr_t ret_ref = 0;
32787 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32788 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32789 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32790 ret_ref = (uintptr_t)ret_var.inner;
32791 if (ret_var.is_owned) {
32797 int8_tArray __attribute__((export_name("TS_ChannelPublicKeys_write"))) TS_ChannelPublicKeys_write(uint32_t obj) {
32798 LDKChannelPublicKeys obj_conv;
32799 obj_conv.inner = (void*)(obj & (~1));
32800 obj_conv.is_owned = false;
32801 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32802 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
32803 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32804 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32805 CVec_u8Z_free(ret_var);
32809 uint32_t __attribute__((export_name("TS_ChannelPublicKeys_read"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
32810 LDKu8slice ser_ref;
32811 ser_ref.datalen = ser->arr_len;
32812 ser_ref.data = ser->elems /* XXX ser leaks */;
32813 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
32814 *ret_conv = ChannelPublicKeys_read(ser_ref);
32815 return (uintptr_t)ret_conv;
32818 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) {
32819 LDKPublicKey per_commitment_point_ref;
32820 CHECK(per_commitment_point->arr_len == 33);
32821 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
32822 LDKPublicKey broadcaster_delayed_payment_base_ref;
32823 CHECK(broadcaster_delayed_payment_base->arr_len == 33);
32824 memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base->elems, 33); FREE(broadcaster_delayed_payment_base);
32825 LDKPublicKey broadcaster_htlc_base_ref;
32826 CHECK(broadcaster_htlc_base->arr_len == 33);
32827 memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base->elems, 33); FREE(broadcaster_htlc_base);
32828 LDKPublicKey countersignatory_revocation_base_ref;
32829 CHECK(countersignatory_revocation_base->arr_len == 33);
32830 memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base->elems, 33); FREE(countersignatory_revocation_base);
32831 LDKPublicKey countersignatory_htlc_base_ref;
32832 CHECK(countersignatory_htlc_base->arr_len == 33);
32833 memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base->elems, 33); FREE(countersignatory_htlc_base);
32834 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
32835 *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);
32836 return (uintptr_t)ret_conv;
32839 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) {
32840 LDKPublicKey per_commitment_point_ref;
32841 CHECK(per_commitment_point->arr_len == 33);
32842 memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
32843 LDKChannelPublicKeys broadcaster_keys_conv;
32844 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
32845 broadcaster_keys_conv.is_owned = false;
32846 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
32847 LDKChannelPublicKeys countersignatory_keys_conv;
32848 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
32849 countersignatory_keys_conv.is_owned = false;
32850 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
32851 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
32852 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
32853 return (uintptr_t)ret_conv;
32856 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) {
32857 LDKPublicKey revocation_key_ref;
32858 CHECK(revocation_key->arr_len == 33);
32859 memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
32860 LDKPublicKey broadcaster_delayed_payment_key_ref;
32861 CHECK(broadcaster_delayed_payment_key->arr_len == 33);
32862 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
32863 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
32864 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32865 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32866 CVec_u8Z_free(ret_var);
32870 void __attribute__((export_name("TS_HTLCOutputInCommitment_free"))) TS_HTLCOutputInCommitment_free(uint32_t this_obj) {
32871 LDKHTLCOutputInCommitment this_obj_conv;
32872 this_obj_conv.inner = (void*)(this_obj & (~1));
32873 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32874 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32875 HTLCOutputInCommitment_free(this_obj_conv);
32878 jboolean __attribute__((export_name("TS_HTLCOutputInCommitment_get_offered"))) TS_HTLCOutputInCommitment_get_offered(uint32_t this_ptr) {
32879 LDKHTLCOutputInCommitment this_ptr_conv;
32880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32881 this_ptr_conv.is_owned = false;
32882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32883 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
32887 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_offered"))) TS_HTLCOutputInCommitment_set_offered(uint32_t this_ptr, jboolean val) {
32888 LDKHTLCOutputInCommitment this_ptr_conv;
32889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32890 this_ptr_conv.is_owned = false;
32891 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32892 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
32895 int64_t __attribute__((export_name("TS_HTLCOutputInCommitment_get_amount_msat"))) TS_HTLCOutputInCommitment_get_amount_msat(uint32_t this_ptr) {
32896 LDKHTLCOutputInCommitment this_ptr_conv;
32897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32898 this_ptr_conv.is_owned = false;
32899 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32900 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
32904 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_amount_msat"))) TS_HTLCOutputInCommitment_set_amount_msat(uint32_t this_ptr, int64_t val) {
32905 LDKHTLCOutputInCommitment this_ptr_conv;
32906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32907 this_ptr_conv.is_owned = false;
32908 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32909 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
32912 int32_t __attribute__((export_name("TS_HTLCOutputInCommitment_get_cltv_expiry"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint32_t this_ptr) {
32913 LDKHTLCOutputInCommitment this_ptr_conv;
32914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32915 this_ptr_conv.is_owned = false;
32916 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32917 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
32921 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_cltv_expiry"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
32922 LDKHTLCOutputInCommitment this_ptr_conv;
32923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32924 this_ptr_conv.is_owned = false;
32925 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32926 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
32929 int8_tArray __attribute__((export_name("TS_HTLCOutputInCommitment_get_payment_hash"))) TS_HTLCOutputInCommitment_get_payment_hash(uint32_t this_ptr) {
32930 LDKHTLCOutputInCommitment this_ptr_conv;
32931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32932 this_ptr_conv.is_owned = false;
32933 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32934 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32935 memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
32939 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_payment_hash"))) TS_HTLCOutputInCommitment_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
32940 LDKHTLCOutputInCommitment this_ptr_conv;
32941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32942 this_ptr_conv.is_owned = false;
32943 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32944 LDKThirtyTwoBytes val_ref;
32945 CHECK(val->arr_len == 32);
32946 memcpy(val_ref.data, val->elems, 32); FREE(val);
32947 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
32950 uint32_t __attribute__((export_name("TS_HTLCOutputInCommitment_get_transaction_output_index"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint32_t this_ptr) {
32951 LDKHTLCOutputInCommitment this_ptr_conv;
32952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32953 this_ptr_conv.is_owned = false;
32954 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32955 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
32956 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
32957 uintptr_t ret_ref = (uintptr_t)ret_copy;
32961 void __attribute__((export_name("TS_HTLCOutputInCommitment_set_transaction_output_index"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint32_t this_ptr, uint32_t val) {
32962 LDKHTLCOutputInCommitment this_ptr_conv;
32963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32964 this_ptr_conv.is_owned = false;
32965 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32966 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
32967 CHECK_ACCESS(val_ptr);
32968 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
32969 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)val) & ~1));
32970 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
32973 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) {
32974 LDKThirtyTwoBytes payment_hash_arg_ref;
32975 CHECK(payment_hash_arg->arr_len == 32);
32976 memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
32977 void* transaction_output_index_arg_ptr = (void*)(((uintptr_t)transaction_output_index_arg) & ~1);
32978 CHECK_ACCESS(transaction_output_index_arg_ptr);
32979 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
32980 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)transaction_output_index_arg) & ~1));
32981 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
32982 uintptr_t ret_ref = 0;
32983 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32984 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32985 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32986 ret_ref = (uintptr_t)ret_var.inner;
32987 if (ret_var.is_owned) {
32993 static inline uintptr_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
32994 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
32995 uintptr_t ret_ref = 0;
32996 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32997 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32998 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32999 ret_ref = (uintptr_t)ret_var.inner;
33000 if (ret_var.is_owned) {
33005 intptr_t __attribute__((export_name("TS_HTLCOutputInCommitment_clone_ptr"))) TS_HTLCOutputInCommitment_clone_ptr(uint32_t arg) {
33006 LDKHTLCOutputInCommitment arg_conv;
33007 arg_conv.inner = (void*)(arg & (~1));
33008 arg_conv.is_owned = false;
33009 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33010 intptr_t ret_val = HTLCOutputInCommitment_clone_ptr(&arg_conv);
33014 uint32_t __attribute__((export_name("TS_HTLCOutputInCommitment_clone"))) TS_HTLCOutputInCommitment_clone(uint32_t orig) {
33015 LDKHTLCOutputInCommitment orig_conv;
33016 orig_conv.inner = (void*)(orig & (~1));
33017 orig_conv.is_owned = false;
33018 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33019 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
33020 uintptr_t ret_ref = 0;
33021 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33022 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33023 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33024 ret_ref = (uintptr_t)ret_var.inner;
33025 if (ret_var.is_owned) {
33031 int8_tArray __attribute__((export_name("TS_HTLCOutputInCommitment_write"))) TS_HTLCOutputInCommitment_write(uint32_t obj) {
33032 LDKHTLCOutputInCommitment obj_conv;
33033 obj_conv.inner = (void*)(obj & (~1));
33034 obj_conv.is_owned = false;
33035 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33036 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
33037 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33038 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33039 CVec_u8Z_free(ret_var);
33043 uint32_t __attribute__((export_name("TS_HTLCOutputInCommitment_read"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
33044 LDKu8slice ser_ref;
33045 ser_ref.datalen = ser->arr_len;
33046 ser_ref.data = ser->elems /* XXX ser leaks */;
33047 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
33048 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
33049 return (uintptr_t)ret_conv;
33052 int8_tArray __attribute__((export_name("TS_get_htlc_redeemscript"))) TS_get_htlc_redeemscript(uint32_t htlc, jboolean opt_anchors, uint32_t keys) {
33053 LDKHTLCOutputInCommitment htlc_conv;
33054 htlc_conv.inner = (void*)(htlc & (~1));
33055 htlc_conv.is_owned = false;
33056 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
33057 LDKTxCreationKeys keys_conv;
33058 keys_conv.inner = (void*)(keys & (~1));
33059 keys_conv.is_owned = false;
33060 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
33061 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
33062 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33063 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33064 CVec_u8Z_free(ret_var);
33068 int8_tArray __attribute__((export_name("TS_make_funding_redeemscript"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
33069 LDKPublicKey broadcaster_ref;
33070 CHECK(broadcaster->arr_len == 33);
33071 memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
33072 LDKPublicKey countersignatory_ref;
33073 CHECK(countersignatory->arr_len == 33);
33074 memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
33075 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
33076 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33077 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33078 CVec_u8Z_free(ret_var);
33082 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) {
33083 unsigned char commitment_txid_arr[32];
33084 CHECK(commitment_txid->arr_len == 32);
33085 memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
33086 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
33087 LDKHTLCOutputInCommitment htlc_conv;
33088 htlc_conv.inner = (void*)(htlc & (~1));
33089 htlc_conv.is_owned = false;
33090 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
33091 LDKPublicKey broadcaster_delayed_payment_key_ref;
33092 CHECK(broadcaster_delayed_payment_key->arr_len == 33);
33093 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
33094 LDKPublicKey revocation_key_ref;
33095 CHECK(revocation_key->arr_len == 33);
33096 memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
33097 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);
33098 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33099 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33100 Transaction_free(ret_var);
33104 int8_tArray __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
33105 LDKPublicKey funding_pubkey_ref;
33106 CHECK(funding_pubkey->arr_len == 33);
33107 memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
33108 LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
33109 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33110 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33111 CVec_u8Z_free(ret_var);
33115 void __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint32_t this_obj) {
33116 LDKChannelTransactionParameters this_obj_conv;
33117 this_obj_conv.inner = (void*)(this_obj & (~1));
33118 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33119 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33120 ChannelTransactionParameters_free(this_obj_conv);
33123 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_pubkeys"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint32_t this_ptr) {
33124 LDKChannelTransactionParameters this_ptr_conv;
33125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33126 this_ptr_conv.is_owned = false;
33127 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33128 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
33129 uintptr_t ret_ref = 0;
33130 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33131 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33132 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33133 ret_ref = (uintptr_t)ret_var.inner;
33134 if (ret_var.is_owned) {
33140 void __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_pubkeys"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint32_t this_ptr, uint32_t val) {
33141 LDKChannelTransactionParameters this_ptr_conv;
33142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33143 this_ptr_conv.is_owned = false;
33144 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33145 LDKChannelPublicKeys val_conv;
33146 val_conv.inner = (void*)(val & (~1));
33147 val_conv.is_owned = (val & 1) || (val == 0);
33148 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33149 val_conv = ChannelPublicKeys_clone(&val_conv);
33150 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
33153 int16_t __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint32_t this_ptr) {
33154 LDKChannelTransactionParameters this_ptr_conv;
33155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33156 this_ptr_conv.is_owned = false;
33157 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33158 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
33162 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) {
33163 LDKChannelTransactionParameters this_ptr_conv;
33164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33165 this_ptr_conv.is_owned = false;
33166 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33167 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
33170 jboolean __attribute__((export_name("TS_ChannelTransactionParameters_get_is_outbound_from_holder"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint32_t this_ptr) {
33171 LDKChannelTransactionParameters this_ptr_conv;
33172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33173 this_ptr_conv.is_owned = false;
33174 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33175 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
33179 void __attribute__((export_name("TS_ChannelTransactionParameters_set_is_outbound_from_holder"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint32_t this_ptr, jboolean val) {
33180 LDKChannelTransactionParameters this_ptr_conv;
33181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33182 this_ptr_conv.is_owned = false;
33183 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33184 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
33187 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_get_counterparty_parameters"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint32_t this_ptr) {
33188 LDKChannelTransactionParameters this_ptr_conv;
33189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33190 this_ptr_conv.is_owned = false;
33191 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33192 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
33193 uintptr_t ret_ref = 0;
33194 if ((uintptr_t)ret_var.inner > 4096) {
33195 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33196 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33197 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33198 ret_ref = (uintptr_t)ret_var.inner;
33199 if (ret_var.is_owned) {
33206 void __attribute__((export_name("TS_ChannelTransactionParameters_set_counterparty_parameters"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint32_t this_ptr, uint32_t val) {
33207 LDKChannelTransactionParameters this_ptr_conv;
33208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33209 this_ptr_conv.is_owned = false;
33210 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33211 LDKCounterpartyChannelTransactionParameters val_conv;
33212 val_conv.inner = (void*)(val & (~1));
33213 val_conv.is_owned = (val & 1) || (val == 0);
33214 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33215 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
33216 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
33219 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_get_funding_outpoint"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint32_t this_ptr) {
33220 LDKChannelTransactionParameters this_ptr_conv;
33221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33222 this_ptr_conv.is_owned = false;
33223 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33224 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
33225 uintptr_t ret_ref = 0;
33226 if ((uintptr_t)ret_var.inner > 4096) {
33227 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33228 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33229 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33230 ret_ref = (uintptr_t)ret_var.inner;
33231 if (ret_var.is_owned) {
33238 void __attribute__((export_name("TS_ChannelTransactionParameters_set_funding_outpoint"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint32_t this_ptr, uint32_t val) {
33239 LDKChannelTransactionParameters this_ptr_conv;
33240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33241 this_ptr_conv.is_owned = false;
33242 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33243 LDKOutPoint val_conv;
33244 val_conv.inner = (void*)(val & (~1));
33245 val_conv.is_owned = (val & 1) || (val == 0);
33246 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33247 val_conv = OutPoint_clone(&val_conv);
33248 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
33251 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_get_opt_anchors"))) TS_ChannelTransactionParameters_get_opt_anchors(uint32_t this_ptr) {
33252 LDKChannelTransactionParameters this_ptr_conv;
33253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33254 this_ptr_conv.is_owned = false;
33255 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33256 uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
33260 void __attribute__((export_name("TS_ChannelTransactionParameters_set_opt_anchors"))) TS_ChannelTransactionParameters_set_opt_anchors(uint32_t this_ptr, uint32_t val) {
33261 LDKChannelTransactionParameters this_ptr_conv;
33262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33263 this_ptr_conv.is_owned = false;
33264 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33265 LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
33266 ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
33269 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) {
33270 LDKChannelPublicKeys holder_pubkeys_arg_conv;
33271 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
33272 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
33273 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
33274 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
33275 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
33276 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
33277 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
33278 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
33279 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
33280 LDKOutPoint funding_outpoint_arg_conv;
33281 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
33282 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
33283 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
33284 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
33285 LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_anchors_arg);
33286 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);
33287 uintptr_t ret_ref = 0;
33288 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33289 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33290 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33291 ret_ref = (uintptr_t)ret_var.inner;
33292 if (ret_var.is_owned) {
33298 static inline uintptr_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
33299 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
33300 uintptr_t ret_ref = 0;
33301 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33302 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33303 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33304 ret_ref = (uintptr_t)ret_var.inner;
33305 if (ret_var.is_owned) {
33310 intptr_t __attribute__((export_name("TS_ChannelTransactionParameters_clone_ptr"))) TS_ChannelTransactionParameters_clone_ptr(uint32_t arg) {
33311 LDKChannelTransactionParameters arg_conv;
33312 arg_conv.inner = (void*)(arg & (~1));
33313 arg_conv.is_owned = false;
33314 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33315 intptr_t ret_val = ChannelTransactionParameters_clone_ptr(&arg_conv);
33319 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_clone"))) TS_ChannelTransactionParameters_clone(uint32_t orig) {
33320 LDKChannelTransactionParameters orig_conv;
33321 orig_conv.inner = (void*)(orig & (~1));
33322 orig_conv.is_owned = false;
33323 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33324 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
33325 uintptr_t ret_ref = 0;
33326 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33327 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33328 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33329 ret_ref = (uintptr_t)ret_var.inner;
33330 if (ret_var.is_owned) {
33336 void __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_free"))) TS_CounterpartyChannelTransactionParameters_free(uint32_t this_obj) {
33337 LDKCounterpartyChannelTransactionParameters this_obj_conv;
33338 this_obj_conv.inner = (void*)(this_obj & (~1));
33339 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33340 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33341 CounterpartyChannelTransactionParameters_free(this_obj_conv);
33344 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_pubkeys"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint32_t this_ptr) {
33345 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
33346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33347 this_ptr_conv.is_owned = false;
33348 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33349 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
33350 uintptr_t ret_ref = 0;
33351 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33352 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33353 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33354 ret_ref = (uintptr_t)ret_var.inner;
33355 if (ret_var.is_owned) {
33361 void __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_pubkeys"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint32_t this_ptr, uint32_t val) {
33362 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
33363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33364 this_ptr_conv.is_owned = false;
33365 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33366 LDKChannelPublicKeys val_conv;
33367 val_conv.inner = (void*)(val & (~1));
33368 val_conv.is_owned = (val & 1) || (val == 0);
33369 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33370 val_conv = ChannelPublicKeys_clone(&val_conv);
33371 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
33374 int16_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint32_t this_ptr) {
33375 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
33376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33377 this_ptr_conv.is_owned = false;
33378 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33379 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
33383 void __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint32_t this_ptr, int16_t val) {
33384 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
33385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33386 this_ptr_conv.is_owned = false;
33387 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33388 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
33391 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_new"))) TS_CounterpartyChannelTransactionParameters_new(uint32_t pubkeys_arg, int16_t selected_contest_delay_arg) {
33392 LDKChannelPublicKeys pubkeys_arg_conv;
33393 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
33394 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
33395 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
33396 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
33397 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
33398 uintptr_t ret_ref = 0;
33399 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33400 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33401 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33402 ret_ref = (uintptr_t)ret_var.inner;
33403 if (ret_var.is_owned) {
33409 static inline uintptr_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
33410 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
33411 uintptr_t ret_ref = 0;
33412 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33413 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33414 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33415 ret_ref = (uintptr_t)ret_var.inner;
33416 if (ret_var.is_owned) {
33421 intptr_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone_ptr"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint32_t arg) {
33422 LDKCounterpartyChannelTransactionParameters arg_conv;
33423 arg_conv.inner = (void*)(arg & (~1));
33424 arg_conv.is_owned = false;
33425 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33426 intptr_t ret_val = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
33430 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone"))) TS_CounterpartyChannelTransactionParameters_clone(uint32_t orig) {
33431 LDKCounterpartyChannelTransactionParameters orig_conv;
33432 orig_conv.inner = (void*)(orig & (~1));
33433 orig_conv.is_owned = false;
33434 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33435 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
33436 uintptr_t ret_ref = 0;
33437 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33438 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33439 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33440 ret_ref = (uintptr_t)ret_var.inner;
33441 if (ret_var.is_owned) {
33447 jboolean __attribute__((export_name("TS_ChannelTransactionParameters_is_populated"))) TS_ChannelTransactionParameters_is_populated(uint32_t this_arg) {
33448 LDKChannelTransactionParameters this_arg_conv;
33449 this_arg_conv.inner = (void*)(this_arg & (~1));
33450 this_arg_conv.is_owned = false;
33451 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33452 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
33456 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_as_holder_broadcastable"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint32_t this_arg) {
33457 LDKChannelTransactionParameters this_arg_conv;
33458 this_arg_conv.inner = (void*)(this_arg & (~1));
33459 this_arg_conv.is_owned = false;
33460 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33461 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
33462 uintptr_t ret_ref = 0;
33463 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33464 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33465 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33466 ret_ref = (uintptr_t)ret_var.inner;
33467 if (ret_var.is_owned) {
33473 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_as_counterparty_broadcastable"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint32_t this_arg) {
33474 LDKChannelTransactionParameters this_arg_conv;
33475 this_arg_conv.inner = (void*)(this_arg & (~1));
33476 this_arg_conv.is_owned = false;
33477 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33478 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
33479 uintptr_t ret_ref = 0;
33480 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33481 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33482 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33483 ret_ref = (uintptr_t)ret_var.inner;
33484 if (ret_var.is_owned) {
33490 int8_tArray __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_write"))) TS_CounterpartyChannelTransactionParameters_write(uint32_t obj) {
33491 LDKCounterpartyChannelTransactionParameters obj_conv;
33492 obj_conv.inner = (void*)(obj & (~1));
33493 obj_conv.is_owned = false;
33494 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33495 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
33496 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33497 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33498 CVec_u8Z_free(ret_var);
33502 uint32_t __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_read"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
33503 LDKu8slice ser_ref;
33504 ser_ref.datalen = ser->arr_len;
33505 ser_ref.data = ser->elems /* XXX ser leaks */;
33506 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
33507 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
33508 return (uintptr_t)ret_conv;
33511 int8_tArray __attribute__((export_name("TS_ChannelTransactionParameters_write"))) TS_ChannelTransactionParameters_write(uint32_t obj) {
33512 LDKChannelTransactionParameters obj_conv;
33513 obj_conv.inner = (void*)(obj & (~1));
33514 obj_conv.is_owned = false;
33515 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33516 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
33517 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33518 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33519 CVec_u8Z_free(ret_var);
33523 uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_read"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
33524 LDKu8slice ser_ref;
33525 ser_ref.datalen = ser->arr_len;
33526 ser_ref.data = ser->elems /* XXX ser leaks */;
33527 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
33528 *ret_conv = ChannelTransactionParameters_read(ser_ref);
33529 return (uintptr_t)ret_conv;
33532 void __attribute__((export_name("TS_DirectedChannelTransactionParameters_free"))) TS_DirectedChannelTransactionParameters_free(uint32_t this_obj) {
33533 LDKDirectedChannelTransactionParameters this_obj_conv;
33534 this_obj_conv.inner = (void*)(this_obj & (~1));
33535 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33536 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33537 DirectedChannelTransactionParameters_free(this_obj_conv);
33540 uint32_t __attribute__((export_name("TS_DirectedChannelTransactionParameters_broadcaster_pubkeys"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint32_t this_arg) {
33541 LDKDirectedChannelTransactionParameters this_arg_conv;
33542 this_arg_conv.inner = (void*)(this_arg & (~1));
33543 this_arg_conv.is_owned = false;
33544 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33545 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
33546 uintptr_t ret_ref = 0;
33547 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33548 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33549 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33550 ret_ref = (uintptr_t)ret_var.inner;
33551 if (ret_var.is_owned) {
33557 uint32_t __attribute__((export_name("TS_DirectedChannelTransactionParameters_countersignatory_pubkeys"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint32_t this_arg) {
33558 LDKDirectedChannelTransactionParameters this_arg_conv;
33559 this_arg_conv.inner = (void*)(this_arg & (~1));
33560 this_arg_conv.is_owned = false;
33561 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33562 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
33563 uintptr_t ret_ref = 0;
33564 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33565 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33566 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33567 ret_ref = (uintptr_t)ret_var.inner;
33568 if (ret_var.is_owned) {
33574 int16_t __attribute__((export_name("TS_DirectedChannelTransactionParameters_contest_delay"))) TS_DirectedChannelTransactionParameters_contest_delay(uint32_t this_arg) {
33575 LDKDirectedChannelTransactionParameters this_arg_conv;
33576 this_arg_conv.inner = (void*)(this_arg & (~1));
33577 this_arg_conv.is_owned = false;
33578 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33579 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
33583 jboolean __attribute__((export_name("TS_DirectedChannelTransactionParameters_is_outbound"))) TS_DirectedChannelTransactionParameters_is_outbound(uint32_t this_arg) {
33584 LDKDirectedChannelTransactionParameters this_arg_conv;
33585 this_arg_conv.inner = (void*)(this_arg & (~1));
33586 this_arg_conv.is_owned = false;
33587 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33588 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
33592 uint32_t __attribute__((export_name("TS_DirectedChannelTransactionParameters_funding_outpoint"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint32_t this_arg) {
33593 LDKDirectedChannelTransactionParameters this_arg_conv;
33594 this_arg_conv.inner = (void*)(this_arg & (~1));
33595 this_arg_conv.is_owned = false;
33596 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33597 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
33598 uintptr_t ret_ref = 0;
33599 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33600 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33601 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33602 ret_ref = (uintptr_t)ret_var.inner;
33603 if (ret_var.is_owned) {
33609 jboolean __attribute__((export_name("TS_DirectedChannelTransactionParameters_opt_anchors"))) TS_DirectedChannelTransactionParameters_opt_anchors(uint32_t this_arg) {
33610 LDKDirectedChannelTransactionParameters this_arg_conv;
33611 this_arg_conv.inner = (void*)(this_arg & (~1));
33612 this_arg_conv.is_owned = false;
33613 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33614 jboolean ret_val = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
33618 void __attribute__((export_name("TS_HolderCommitmentTransaction_free"))) TS_HolderCommitmentTransaction_free(uint32_t this_obj) {
33619 LDKHolderCommitmentTransaction this_obj_conv;
33620 this_obj_conv.inner = (void*)(this_obj & (~1));
33621 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33622 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33623 HolderCommitmentTransaction_free(this_obj_conv);
33626 int8_tArray __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_sig"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint32_t this_ptr) {
33627 LDKHolderCommitmentTransaction this_ptr_conv;
33628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33629 this_ptr_conv.is_owned = false;
33630 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33631 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
33632 memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
33636 void __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_sig"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint32_t this_ptr, int8_tArray val) {
33637 LDKHolderCommitmentTransaction this_ptr_conv;
33638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33639 this_ptr_conv.is_owned = false;
33640 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33641 LDKSignature val_ref;
33642 CHECK(val->arr_len == 64);
33643 memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
33644 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
33647 void __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint32_t this_ptr, ptrArray val) {
33648 LDKHolderCommitmentTransaction this_ptr_conv;
33649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33650 this_ptr_conv.is_owned = false;
33651 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33652 LDKCVec_SignatureZ val_constr;
33653 val_constr.datalen = val->arr_len;
33654 if (val_constr.datalen > 0)
33655 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
33657 val_constr.data = NULL;
33658 int8_tArray* val_vals = (void*) val->elems /* XXX val leaks */;
33659 for (size_t m = 0; m < val_constr.datalen; m++) {
33660 int8_tArray val_conv_12 = val_vals[m];
33661 LDKSignature val_conv_12_ref;
33662 CHECK(val_conv_12->arr_len == 64);
33663 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
33664 val_constr.data[m] = val_conv_12_ref;
33666 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
33669 static inline uintptr_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
33670 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
33671 uintptr_t ret_ref = 0;
33672 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33673 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33674 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33675 ret_ref = (uintptr_t)ret_var.inner;
33676 if (ret_var.is_owned) {
33681 intptr_t __attribute__((export_name("TS_HolderCommitmentTransaction_clone_ptr"))) TS_HolderCommitmentTransaction_clone_ptr(uint32_t arg) {
33682 LDKHolderCommitmentTransaction arg_conv;
33683 arg_conv.inner = (void*)(arg & (~1));
33684 arg_conv.is_owned = false;
33685 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33686 intptr_t ret_val = HolderCommitmentTransaction_clone_ptr(&arg_conv);
33690 uint32_t __attribute__((export_name("TS_HolderCommitmentTransaction_clone"))) TS_HolderCommitmentTransaction_clone(uint32_t orig) {
33691 LDKHolderCommitmentTransaction orig_conv;
33692 orig_conv.inner = (void*)(orig & (~1));
33693 orig_conv.is_owned = false;
33694 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33695 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
33696 uintptr_t ret_ref = 0;
33697 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33698 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33699 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33700 ret_ref = (uintptr_t)ret_var.inner;
33701 if (ret_var.is_owned) {
33707 int8_tArray __attribute__((export_name("TS_HolderCommitmentTransaction_write"))) TS_HolderCommitmentTransaction_write(uint32_t obj) {
33708 LDKHolderCommitmentTransaction obj_conv;
33709 obj_conv.inner = (void*)(obj & (~1));
33710 obj_conv.is_owned = false;
33711 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33712 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
33713 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33714 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33715 CVec_u8Z_free(ret_var);
33719 uint32_t __attribute__((export_name("TS_HolderCommitmentTransaction_read"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
33720 LDKu8slice ser_ref;
33721 ser_ref.datalen = ser->arr_len;
33722 ser_ref.data = ser->elems /* XXX ser leaks */;
33723 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
33724 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
33725 return (uintptr_t)ret_conv;
33728 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) {
33729 LDKCommitmentTransaction commitment_tx_conv;
33730 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
33731 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
33732 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
33733 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
33734 LDKSignature counterparty_sig_ref;
33735 CHECK(counterparty_sig->arr_len == 64);
33736 memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
33737 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
33738 counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
33739 if (counterparty_htlc_sigs_constr.datalen > 0)
33740 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
33742 counterparty_htlc_sigs_constr.data = NULL;
33743 int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems /* XXX counterparty_htlc_sigs leaks */;
33744 for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
33745 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
33746 LDKSignature counterparty_htlc_sigs_conv_12_ref;
33747 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
33748 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64); FREE(counterparty_htlc_sigs_conv_12);
33749 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
33751 LDKPublicKey holder_funding_key_ref;
33752 CHECK(holder_funding_key->arr_len == 33);
33753 memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
33754 LDKPublicKey counterparty_funding_key_ref;
33755 CHECK(counterparty_funding_key->arr_len == 33);
33756 memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
33757 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
33758 uintptr_t ret_ref = 0;
33759 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33760 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33761 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33762 ret_ref = (uintptr_t)ret_var.inner;
33763 if (ret_var.is_owned) {
33769 void __attribute__((export_name("TS_BuiltCommitmentTransaction_free"))) TS_BuiltCommitmentTransaction_free(uint32_t this_obj) {
33770 LDKBuiltCommitmentTransaction this_obj_conv;
33771 this_obj_conv.inner = (void*)(this_obj & (~1));
33772 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33773 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33774 BuiltCommitmentTransaction_free(this_obj_conv);
33777 int8_tArray __attribute__((export_name("TS_BuiltCommitmentTransaction_get_transaction"))) TS_BuiltCommitmentTransaction_get_transaction(uint32_t this_ptr) {
33778 LDKBuiltCommitmentTransaction this_ptr_conv;
33779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33780 this_ptr_conv.is_owned = false;
33781 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33782 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
33783 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33784 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33785 Transaction_free(ret_var);
33789 void __attribute__((export_name("TS_BuiltCommitmentTransaction_set_transaction"))) TS_BuiltCommitmentTransaction_set_transaction(uint32_t this_ptr, int8_tArray val) {
33790 LDKBuiltCommitmentTransaction this_ptr_conv;
33791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33792 this_ptr_conv.is_owned = false;
33793 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33794 LDKTransaction val_ref;
33795 val_ref.datalen = val->arr_len;
33796 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
33797 memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
33798 val_ref.data_is_owned = true;
33799 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
33802 int8_tArray __attribute__((export_name("TS_BuiltCommitmentTransaction_get_txid"))) TS_BuiltCommitmentTransaction_get_txid(uint32_t this_ptr) {
33803 LDKBuiltCommitmentTransaction this_ptr_conv;
33804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33805 this_ptr_conv.is_owned = false;
33806 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33807 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33808 memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
33812 void __attribute__((export_name("TS_BuiltCommitmentTransaction_set_txid"))) TS_BuiltCommitmentTransaction_set_txid(uint32_t this_ptr, int8_tArray val) {
33813 LDKBuiltCommitmentTransaction this_ptr_conv;
33814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33815 this_ptr_conv.is_owned = false;
33816 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33817 LDKThirtyTwoBytes val_ref;
33818 CHECK(val->arr_len == 32);
33819 memcpy(val_ref.data, val->elems, 32); FREE(val);
33820 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
33823 uint32_t __attribute__((export_name("TS_BuiltCommitmentTransaction_new"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
33824 LDKTransaction transaction_arg_ref;
33825 transaction_arg_ref.datalen = transaction_arg->arr_len;
33826 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
33827 memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
33828 transaction_arg_ref.data_is_owned = true;
33829 LDKThirtyTwoBytes txid_arg_ref;
33830 CHECK(txid_arg->arr_len == 32);
33831 memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
33832 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
33833 uintptr_t ret_ref = 0;
33834 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33835 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33836 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33837 ret_ref = (uintptr_t)ret_var.inner;
33838 if (ret_var.is_owned) {
33844 static inline uintptr_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
33845 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
33846 uintptr_t ret_ref = 0;
33847 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33848 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33849 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33850 ret_ref = (uintptr_t)ret_var.inner;
33851 if (ret_var.is_owned) {
33856 intptr_t __attribute__((export_name("TS_BuiltCommitmentTransaction_clone_ptr"))) TS_BuiltCommitmentTransaction_clone_ptr(uint32_t arg) {
33857 LDKBuiltCommitmentTransaction arg_conv;
33858 arg_conv.inner = (void*)(arg & (~1));
33859 arg_conv.is_owned = false;
33860 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33861 intptr_t ret_val = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
33865 uint32_t __attribute__((export_name("TS_BuiltCommitmentTransaction_clone"))) TS_BuiltCommitmentTransaction_clone(uint32_t orig) {
33866 LDKBuiltCommitmentTransaction orig_conv;
33867 orig_conv.inner = (void*)(orig & (~1));
33868 orig_conv.is_owned = false;
33869 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33870 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
33871 uintptr_t ret_ref = 0;
33872 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33873 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33874 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33875 ret_ref = (uintptr_t)ret_var.inner;
33876 if (ret_var.is_owned) {
33882 int8_tArray __attribute__((export_name("TS_BuiltCommitmentTransaction_write"))) TS_BuiltCommitmentTransaction_write(uint32_t obj) {
33883 LDKBuiltCommitmentTransaction obj_conv;
33884 obj_conv.inner = (void*)(obj & (~1));
33885 obj_conv.is_owned = false;
33886 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33887 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
33888 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33889 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33890 CVec_u8Z_free(ret_var);
33894 uint32_t __attribute__((export_name("TS_BuiltCommitmentTransaction_read"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
33895 LDKu8slice ser_ref;
33896 ser_ref.datalen = ser->arr_len;
33897 ser_ref.data = ser->elems /* XXX ser leaks */;
33898 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
33899 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
33900 return (uintptr_t)ret_conv;
33903 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) {
33904 LDKBuiltCommitmentTransaction this_arg_conv;
33905 this_arg_conv.inner = (void*)(this_arg & (~1));
33906 this_arg_conv.is_owned = false;
33907 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33908 LDKu8slice funding_redeemscript_ref;
33909 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
33910 funding_redeemscript_ref.data = funding_redeemscript->elems /* XXX funding_redeemscript leaks */;
33911 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33912 memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
33916 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) {
33917 LDKBuiltCommitmentTransaction this_arg_conv;
33918 this_arg_conv.inner = (void*)(this_arg & (~1));
33919 this_arg_conv.is_owned = false;
33920 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33921 unsigned char funding_key_arr[32];
33922 CHECK(funding_key->arr_len == 32);
33923 memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
33924 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
33925 LDKu8slice funding_redeemscript_ref;
33926 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
33927 funding_redeemscript_ref.data = funding_redeemscript->elems /* XXX funding_redeemscript leaks */;
33928 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
33929 memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
33933 void __attribute__((export_name("TS_ClosingTransaction_free"))) TS_ClosingTransaction_free(uint32_t this_obj) {
33934 LDKClosingTransaction this_obj_conv;
33935 this_obj_conv.inner = (void*)(this_obj & (~1));
33936 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33938 ClosingTransaction_free(this_obj_conv);
33941 static inline uintptr_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
33942 LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
33943 uintptr_t ret_ref = 0;
33944 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33945 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33946 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33947 ret_ref = (uintptr_t)ret_var.inner;
33948 if (ret_var.is_owned) {
33953 intptr_t __attribute__((export_name("TS_ClosingTransaction_clone_ptr"))) TS_ClosingTransaction_clone_ptr(uint32_t arg) {
33954 LDKClosingTransaction arg_conv;
33955 arg_conv.inner = (void*)(arg & (~1));
33956 arg_conv.is_owned = false;
33957 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33958 intptr_t ret_val = ClosingTransaction_clone_ptr(&arg_conv);
33962 uint32_t __attribute__((export_name("TS_ClosingTransaction_clone"))) TS_ClosingTransaction_clone(uint32_t orig) {
33963 LDKClosingTransaction orig_conv;
33964 orig_conv.inner = (void*)(orig & (~1));
33965 orig_conv.is_owned = false;
33966 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33967 LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
33968 uintptr_t ret_ref = 0;
33969 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33970 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33971 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33972 ret_ref = (uintptr_t)ret_var.inner;
33973 if (ret_var.is_owned) {
33979 int64_t __attribute__((export_name("TS_ClosingTransaction_hash"))) TS_ClosingTransaction_hash(uint32_t o) {
33980 LDKClosingTransaction o_conv;
33981 o_conv.inner = (void*)(o & (~1));
33982 o_conv.is_owned = false;
33983 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33984 int64_t ret_val = ClosingTransaction_hash(&o_conv);
33988 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) {
33989 LDKCVec_u8Z to_holder_script_ref;
33990 to_holder_script_ref.datalen = to_holder_script->arr_len;
33991 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
33992 memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
33993 LDKCVec_u8Z to_counterparty_script_ref;
33994 to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
33995 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
33996 memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
33997 LDKOutPoint funding_outpoint_conv;
33998 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
33999 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
34000 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
34001 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
34002 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
34003 uintptr_t ret_ref = 0;
34004 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34005 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34006 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34007 ret_ref = (uintptr_t)ret_var.inner;
34008 if (ret_var.is_owned) {
34014 uint32_t __attribute__((export_name("TS_ClosingTransaction_trust"))) TS_ClosingTransaction_trust(uint32_t this_arg) {
34015 LDKClosingTransaction this_arg_conv;
34016 this_arg_conv.inner = (void*)(this_arg & (~1));
34017 this_arg_conv.is_owned = false;
34018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34019 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
34020 uintptr_t ret_ref = 0;
34021 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34022 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34023 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34024 ret_ref = (uintptr_t)ret_var.inner;
34025 if (ret_var.is_owned) {
34031 uint32_t __attribute__((export_name("TS_ClosingTransaction_verify"))) TS_ClosingTransaction_verify(uint32_t this_arg, uint32_t funding_outpoint) {
34032 LDKClosingTransaction this_arg_conv;
34033 this_arg_conv.inner = (void*)(this_arg & (~1));
34034 this_arg_conv.is_owned = false;
34035 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34036 LDKOutPoint funding_outpoint_conv;
34037 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
34038 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
34039 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
34040 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
34041 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
34042 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
34043 return (uintptr_t)ret_conv;
34046 int64_t __attribute__((export_name("TS_ClosingTransaction_to_holder_value_sat"))) TS_ClosingTransaction_to_holder_value_sat(uint32_t this_arg) {
34047 LDKClosingTransaction this_arg_conv;
34048 this_arg_conv.inner = (void*)(this_arg & (~1));
34049 this_arg_conv.is_owned = false;
34050 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34051 int64_t ret_val = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
34055 int64_t __attribute__((export_name("TS_ClosingTransaction_to_counterparty_value_sat"))) TS_ClosingTransaction_to_counterparty_value_sat(uint32_t this_arg) {
34056 LDKClosingTransaction this_arg_conv;
34057 this_arg_conv.inner = (void*)(this_arg & (~1));
34058 this_arg_conv.is_owned = false;
34059 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34060 int64_t ret_val = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
34064 int8_tArray __attribute__((export_name("TS_ClosingTransaction_to_holder_script"))) TS_ClosingTransaction_to_holder_script(uint32_t this_arg) {
34065 LDKClosingTransaction this_arg_conv;
34066 this_arg_conv.inner = (void*)(this_arg & (~1));
34067 this_arg_conv.is_owned = false;
34068 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34069 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
34070 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34071 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34075 int8_tArray __attribute__((export_name("TS_ClosingTransaction_to_counterparty_script"))) TS_ClosingTransaction_to_counterparty_script(uint32_t this_arg) {
34076 LDKClosingTransaction this_arg_conv;
34077 this_arg_conv.inner = (void*)(this_arg & (~1));
34078 this_arg_conv.is_owned = false;
34079 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34080 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
34081 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34082 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34086 void __attribute__((export_name("TS_TrustedClosingTransaction_free"))) TS_TrustedClosingTransaction_free(uint32_t this_obj) {
34087 LDKTrustedClosingTransaction this_obj_conv;
34088 this_obj_conv.inner = (void*)(this_obj & (~1));
34089 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34090 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34091 TrustedClosingTransaction_free(this_obj_conv);
34094 int8_tArray __attribute__((export_name("TS_TrustedClosingTransaction_built_transaction"))) TS_TrustedClosingTransaction_built_transaction(uint32_t this_arg) {
34095 LDKTrustedClosingTransaction this_arg_conv;
34096 this_arg_conv.inner = (void*)(this_arg & (~1));
34097 this_arg_conv.is_owned = false;
34098 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34099 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
34100 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34101 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34102 Transaction_free(ret_var);
34106 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) {
34107 LDKTrustedClosingTransaction this_arg_conv;
34108 this_arg_conv.inner = (void*)(this_arg & (~1));
34109 this_arg_conv.is_owned = false;
34110 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34111 LDKu8slice funding_redeemscript_ref;
34112 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
34113 funding_redeemscript_ref.data = funding_redeemscript->elems /* XXX funding_redeemscript leaks */;
34114 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34115 memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
34119 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) {
34120 LDKTrustedClosingTransaction this_arg_conv;
34121 this_arg_conv.inner = (void*)(this_arg & (~1));
34122 this_arg_conv.is_owned = false;
34123 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34124 unsigned char funding_key_arr[32];
34125 CHECK(funding_key->arr_len == 32);
34126 memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
34127 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
34128 LDKu8slice funding_redeemscript_ref;
34129 funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
34130 funding_redeemscript_ref.data = funding_redeemscript->elems /* XXX funding_redeemscript leaks */;
34131 int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34132 memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
34136 void __attribute__((export_name("TS_CommitmentTransaction_free"))) TS_CommitmentTransaction_free(uint32_t this_obj) {
34137 LDKCommitmentTransaction this_obj_conv;
34138 this_obj_conv.inner = (void*)(this_obj & (~1));
34139 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34140 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34141 CommitmentTransaction_free(this_obj_conv);
34144 static inline uintptr_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
34145 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
34146 uintptr_t ret_ref = 0;
34147 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34148 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34149 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34150 ret_ref = (uintptr_t)ret_var.inner;
34151 if (ret_var.is_owned) {
34156 intptr_t __attribute__((export_name("TS_CommitmentTransaction_clone_ptr"))) TS_CommitmentTransaction_clone_ptr(uint32_t arg) {
34157 LDKCommitmentTransaction arg_conv;
34158 arg_conv.inner = (void*)(arg & (~1));
34159 arg_conv.is_owned = false;
34160 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34161 intptr_t ret_val = CommitmentTransaction_clone_ptr(&arg_conv);
34165 uint32_t __attribute__((export_name("TS_CommitmentTransaction_clone"))) TS_CommitmentTransaction_clone(uint32_t orig) {
34166 LDKCommitmentTransaction orig_conv;
34167 orig_conv.inner = (void*)(orig & (~1));
34168 orig_conv.is_owned = false;
34169 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34170 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
34171 uintptr_t ret_ref = 0;
34172 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34173 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34174 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34175 ret_ref = (uintptr_t)ret_var.inner;
34176 if (ret_var.is_owned) {
34182 int8_tArray __attribute__((export_name("TS_CommitmentTransaction_write"))) TS_CommitmentTransaction_write(uint32_t obj) {
34183 LDKCommitmentTransaction obj_conv;
34184 obj_conv.inner = (void*)(obj & (~1));
34185 obj_conv.is_owned = false;
34186 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34187 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
34188 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34189 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34190 CVec_u8Z_free(ret_var);
34194 uint32_t __attribute__((export_name("TS_CommitmentTransaction_read"))) TS_CommitmentTransaction_read(int8_tArray ser) {
34195 LDKu8slice ser_ref;
34196 ser_ref.datalen = ser->arr_len;
34197 ser_ref.data = ser->elems /* XXX ser leaks */;
34198 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
34199 *ret_conv = CommitmentTransaction_read(ser_ref);
34200 return (uintptr_t)ret_conv;
34203 int64_t __attribute__((export_name("TS_CommitmentTransaction_commitment_number"))) TS_CommitmentTransaction_commitment_number(uint32_t this_arg) {
34204 LDKCommitmentTransaction this_arg_conv;
34205 this_arg_conv.inner = (void*)(this_arg & (~1));
34206 this_arg_conv.is_owned = false;
34207 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34208 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
34212 int64_t __attribute__((export_name("TS_CommitmentTransaction_to_broadcaster_value_sat"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint32_t this_arg) {
34213 LDKCommitmentTransaction this_arg_conv;
34214 this_arg_conv.inner = (void*)(this_arg & (~1));
34215 this_arg_conv.is_owned = false;
34216 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34217 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
34221 int64_t __attribute__((export_name("TS_CommitmentTransaction_to_countersignatory_value_sat"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint32_t this_arg) {
34222 LDKCommitmentTransaction 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 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
34230 int32_t __attribute__((export_name("TS_CommitmentTransaction_feerate_per_kw"))) TS_CommitmentTransaction_feerate_per_kw(uint32_t this_arg) {
34231 LDKCommitmentTransaction this_arg_conv;
34232 this_arg_conv.inner = (void*)(this_arg & (~1));
34233 this_arg_conv.is_owned = false;
34234 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34235 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
34239 uint32_t __attribute__((export_name("TS_CommitmentTransaction_trust"))) TS_CommitmentTransaction_trust(uint32_t this_arg) {
34240 LDKCommitmentTransaction this_arg_conv;
34241 this_arg_conv.inner = (void*)(this_arg & (~1));
34242 this_arg_conv.is_owned = false;
34243 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34244 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
34245 uintptr_t ret_ref = 0;
34246 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34247 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34248 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34249 ret_ref = (uintptr_t)ret_var.inner;
34250 if (ret_var.is_owned) {
34256 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) {
34257 LDKCommitmentTransaction this_arg_conv;
34258 this_arg_conv.inner = (void*)(this_arg & (~1));
34259 this_arg_conv.is_owned = false;
34260 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34261 LDKDirectedChannelTransactionParameters channel_parameters_conv;
34262 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
34263 channel_parameters_conv.is_owned = false;
34264 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
34265 LDKChannelPublicKeys broadcaster_keys_conv;
34266 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
34267 broadcaster_keys_conv.is_owned = false;
34268 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
34269 LDKChannelPublicKeys countersignatory_keys_conv;
34270 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
34271 countersignatory_keys_conv.is_owned = false;
34272 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
34273 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
34274 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
34275 return (uintptr_t)ret_conv;
34278 void __attribute__((export_name("TS_TrustedCommitmentTransaction_free"))) TS_TrustedCommitmentTransaction_free(uint32_t this_obj) {
34279 LDKTrustedCommitmentTransaction this_obj_conv;
34280 this_obj_conv.inner = (void*)(this_obj & (~1));
34281 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34282 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34283 TrustedCommitmentTransaction_free(this_obj_conv);
34286 int8_tArray __attribute__((export_name("TS_TrustedCommitmentTransaction_txid"))) TS_TrustedCommitmentTransaction_txid(uint32_t this_arg) {
34287 LDKTrustedCommitmentTransaction this_arg_conv;
34288 this_arg_conv.inner = (void*)(this_arg & (~1));
34289 this_arg_conv.is_owned = false;
34290 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34291 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34292 memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
34296 uint32_t __attribute__((export_name("TS_TrustedCommitmentTransaction_built_transaction"))) TS_TrustedCommitmentTransaction_built_transaction(uint32_t this_arg) {
34297 LDKTrustedCommitmentTransaction this_arg_conv;
34298 this_arg_conv.inner = (void*)(this_arg & (~1));
34299 this_arg_conv.is_owned = false;
34300 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34301 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
34302 uintptr_t ret_ref = 0;
34303 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34304 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34305 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34306 ret_ref = (uintptr_t)ret_var.inner;
34307 if (ret_var.is_owned) {
34313 uint32_t __attribute__((export_name("TS_TrustedCommitmentTransaction_keys"))) TS_TrustedCommitmentTransaction_keys(uint32_t this_arg) {
34314 LDKTrustedCommitmentTransaction this_arg_conv;
34315 this_arg_conv.inner = (void*)(this_arg & (~1));
34316 this_arg_conv.is_owned = false;
34317 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34318 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
34319 uintptr_t ret_ref = 0;
34320 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34321 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34322 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34323 ret_ref = (uintptr_t)ret_var.inner;
34324 if (ret_var.is_owned) {
34330 jboolean __attribute__((export_name("TS_TrustedCommitmentTransaction_opt_anchors"))) TS_TrustedCommitmentTransaction_opt_anchors(uint32_t this_arg) {
34331 LDKTrustedCommitmentTransaction this_arg_conv;
34332 this_arg_conv.inner = (void*)(this_arg & (~1));
34333 this_arg_conv.is_owned = false;
34334 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34335 jboolean ret_val = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
34339 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) {
34340 LDKTrustedCommitmentTransaction this_arg_conv;
34341 this_arg_conv.inner = (void*)(this_arg & (~1));
34342 this_arg_conv.is_owned = false;
34343 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34344 unsigned char htlc_base_key_arr[32];
34345 CHECK(htlc_base_key->arr_len == 32);
34346 memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
34347 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
34348 LDKDirectedChannelTransactionParameters channel_parameters_conv;
34349 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
34350 channel_parameters_conv.is_owned = false;
34351 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
34352 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
34353 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
34354 return (uintptr_t)ret_conv;
34357 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) {
34358 LDKPublicKey broadcaster_payment_basepoint_ref;
34359 CHECK(broadcaster_payment_basepoint->arr_len == 33);
34360 memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
34361 LDKPublicKey countersignatory_payment_basepoint_ref;
34362 CHECK(countersignatory_payment_basepoint->arr_len == 33);
34363 memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
34364 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
34368 jboolean __attribute__((export_name("TS_InitFeatures_eq"))) TS_InitFeatures_eq(uint32_t a, uint32_t b) {
34369 LDKInitFeatures a_conv;
34370 a_conv.inner = (void*)(a & (~1));
34371 a_conv.is_owned = false;
34372 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34373 LDKInitFeatures b_conv;
34374 b_conv.inner = (void*)(b & (~1));
34375 b_conv.is_owned = false;
34376 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34377 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
34381 jboolean __attribute__((export_name("TS_NodeFeatures_eq"))) TS_NodeFeatures_eq(uint32_t a, uint32_t b) {
34382 LDKNodeFeatures a_conv;
34383 a_conv.inner = (void*)(a & (~1));
34384 a_conv.is_owned = false;
34385 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34386 LDKNodeFeatures b_conv;
34387 b_conv.inner = (void*)(b & (~1));
34388 b_conv.is_owned = false;
34389 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34390 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
34394 jboolean __attribute__((export_name("TS_ChannelFeatures_eq"))) TS_ChannelFeatures_eq(uint32_t a, uint32_t b) {
34395 LDKChannelFeatures a_conv;
34396 a_conv.inner = (void*)(a & (~1));
34397 a_conv.is_owned = false;
34398 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34399 LDKChannelFeatures b_conv;
34400 b_conv.inner = (void*)(b & (~1));
34401 b_conv.is_owned = false;
34402 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34403 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
34407 jboolean __attribute__((export_name("TS_InvoiceFeatures_eq"))) TS_InvoiceFeatures_eq(uint32_t a, uint32_t b) {
34408 LDKInvoiceFeatures a_conv;
34409 a_conv.inner = (void*)(a & (~1));
34410 a_conv.is_owned = false;
34411 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34412 LDKInvoiceFeatures b_conv;
34413 b_conv.inner = (void*)(b & (~1));
34414 b_conv.is_owned = false;
34415 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34416 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
34420 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint32_t a, uint32_t b) {
34421 LDKChannelTypeFeatures a_conv;
34422 a_conv.inner = (void*)(a & (~1));
34423 a_conv.is_owned = false;
34424 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34425 LDKChannelTypeFeatures b_conv;
34426 b_conv.inner = (void*)(b & (~1));
34427 b_conv.is_owned = false;
34428 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34429 jboolean ret_val = ChannelTypeFeatures_eq(&a_conv, &b_conv);
34433 static inline uintptr_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
34434 LDKInitFeatures ret_var = InitFeatures_clone(arg);
34435 uintptr_t ret_ref = 0;
34436 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34437 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34438 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34439 ret_ref = (uintptr_t)ret_var.inner;
34440 if (ret_var.is_owned) {
34445 intptr_t __attribute__((export_name("TS_InitFeatures_clone_ptr"))) TS_InitFeatures_clone_ptr(uint32_t arg) {
34446 LDKInitFeatures arg_conv;
34447 arg_conv.inner = (void*)(arg & (~1));
34448 arg_conv.is_owned = false;
34449 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34450 intptr_t ret_val = InitFeatures_clone_ptr(&arg_conv);
34454 uint32_t __attribute__((export_name("TS_InitFeatures_clone"))) TS_InitFeatures_clone(uint32_t orig) {
34455 LDKInitFeatures orig_conv;
34456 orig_conv.inner = (void*)(orig & (~1));
34457 orig_conv.is_owned = false;
34458 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34459 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
34460 uintptr_t ret_ref = 0;
34461 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34462 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34463 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34464 ret_ref = (uintptr_t)ret_var.inner;
34465 if (ret_var.is_owned) {
34471 static inline uintptr_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
34472 LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
34473 uintptr_t ret_ref = 0;
34474 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34475 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34476 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34477 ret_ref = (uintptr_t)ret_var.inner;
34478 if (ret_var.is_owned) {
34483 intptr_t __attribute__((export_name("TS_NodeFeatures_clone_ptr"))) TS_NodeFeatures_clone_ptr(uint32_t arg) {
34484 LDKNodeFeatures arg_conv;
34485 arg_conv.inner = (void*)(arg & (~1));
34486 arg_conv.is_owned = false;
34487 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34488 intptr_t ret_val = NodeFeatures_clone_ptr(&arg_conv);
34492 uint32_t __attribute__((export_name("TS_NodeFeatures_clone"))) TS_NodeFeatures_clone(uint32_t orig) {
34493 LDKNodeFeatures orig_conv;
34494 orig_conv.inner = (void*)(orig & (~1));
34495 orig_conv.is_owned = false;
34496 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34497 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
34498 uintptr_t ret_ref = 0;
34499 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34500 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34501 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34502 ret_ref = (uintptr_t)ret_var.inner;
34503 if (ret_var.is_owned) {
34509 static inline uintptr_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
34510 LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
34511 uintptr_t ret_ref = 0;
34512 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34513 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34514 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34515 ret_ref = (uintptr_t)ret_var.inner;
34516 if (ret_var.is_owned) {
34521 intptr_t __attribute__((export_name("TS_ChannelFeatures_clone_ptr"))) TS_ChannelFeatures_clone_ptr(uint32_t arg) {
34522 LDKChannelFeatures arg_conv;
34523 arg_conv.inner = (void*)(arg & (~1));
34524 arg_conv.is_owned = false;
34525 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34526 intptr_t ret_val = ChannelFeatures_clone_ptr(&arg_conv);
34530 uint32_t __attribute__((export_name("TS_ChannelFeatures_clone"))) TS_ChannelFeatures_clone(uint32_t orig) {
34531 LDKChannelFeatures orig_conv;
34532 orig_conv.inner = (void*)(orig & (~1));
34533 orig_conv.is_owned = false;
34534 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34535 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
34536 uintptr_t ret_ref = 0;
34537 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34538 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34539 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34540 ret_ref = (uintptr_t)ret_var.inner;
34541 if (ret_var.is_owned) {
34547 static inline uintptr_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
34548 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
34549 uintptr_t ret_ref = 0;
34550 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34551 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34552 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34553 ret_ref = (uintptr_t)ret_var.inner;
34554 if (ret_var.is_owned) {
34559 intptr_t __attribute__((export_name("TS_InvoiceFeatures_clone_ptr"))) TS_InvoiceFeatures_clone_ptr(uint32_t arg) {
34560 LDKInvoiceFeatures arg_conv;
34561 arg_conv.inner = (void*)(arg & (~1));
34562 arg_conv.is_owned = false;
34563 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34564 intptr_t ret_val = InvoiceFeatures_clone_ptr(&arg_conv);
34568 uint32_t __attribute__((export_name("TS_InvoiceFeatures_clone"))) TS_InvoiceFeatures_clone(uint32_t orig) {
34569 LDKInvoiceFeatures orig_conv;
34570 orig_conv.inner = (void*)(orig & (~1));
34571 orig_conv.is_owned = false;
34572 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34573 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
34574 uintptr_t ret_ref = 0;
34575 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34576 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34577 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34578 ret_ref = (uintptr_t)ret_var.inner;
34579 if (ret_var.is_owned) {
34585 static inline uintptr_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
34586 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
34587 uintptr_t ret_ref = 0;
34588 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34589 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34590 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34591 ret_ref = (uintptr_t)ret_var.inner;
34592 if (ret_var.is_owned) {
34597 intptr_t __attribute__((export_name("TS_ChannelTypeFeatures_clone_ptr"))) TS_ChannelTypeFeatures_clone_ptr(uint32_t arg) {
34598 LDKChannelTypeFeatures arg_conv;
34599 arg_conv.inner = (void*)(arg & (~1));
34600 arg_conv.is_owned = false;
34601 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34602 intptr_t ret_val = ChannelTypeFeatures_clone_ptr(&arg_conv);
34606 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_clone"))) TS_ChannelTypeFeatures_clone(uint32_t orig) {
34607 LDKChannelTypeFeatures orig_conv;
34608 orig_conv.inner = (void*)(orig & (~1));
34609 orig_conv.is_owned = false;
34610 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34611 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
34612 uintptr_t ret_ref = 0;
34613 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34614 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34615 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34616 ret_ref = (uintptr_t)ret_var.inner;
34617 if (ret_var.is_owned) {
34623 void __attribute__((export_name("TS_InitFeatures_free"))) TS_InitFeatures_free(uint32_t this_obj) {
34624 LDKInitFeatures this_obj_conv;
34625 this_obj_conv.inner = (void*)(this_obj & (~1));
34626 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34627 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34628 InitFeatures_free(this_obj_conv);
34631 void __attribute__((export_name("TS_NodeFeatures_free"))) TS_NodeFeatures_free(uint32_t this_obj) {
34632 LDKNodeFeatures this_obj_conv;
34633 this_obj_conv.inner = (void*)(this_obj & (~1));
34634 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34635 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34636 NodeFeatures_free(this_obj_conv);
34639 void __attribute__((export_name("TS_ChannelFeatures_free"))) TS_ChannelFeatures_free(uint32_t this_obj) {
34640 LDKChannelFeatures this_obj_conv;
34641 this_obj_conv.inner = (void*)(this_obj & (~1));
34642 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34643 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34644 ChannelFeatures_free(this_obj_conv);
34647 void __attribute__((export_name("TS_InvoiceFeatures_free"))) TS_InvoiceFeatures_free(uint32_t this_obj) {
34648 LDKInvoiceFeatures this_obj_conv;
34649 this_obj_conv.inner = (void*)(this_obj & (~1));
34650 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34651 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34652 InvoiceFeatures_free(this_obj_conv);
34655 void __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint32_t this_obj) {
34656 LDKChannelTypeFeatures this_obj_conv;
34657 this_obj_conv.inner = (void*)(this_obj & (~1));
34658 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34659 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34660 ChannelTypeFeatures_free(this_obj_conv);
34663 uint32_t __attribute__((export_name("TS_InitFeatures_empty"))) TS_InitFeatures_empty() {
34664 LDKInitFeatures ret_var = InitFeatures_empty();
34665 uintptr_t ret_ref = 0;
34666 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34667 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34668 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34669 ret_ref = (uintptr_t)ret_var.inner;
34670 if (ret_var.is_owned) {
34676 uint32_t __attribute__((export_name("TS_InitFeatures_known"))) TS_InitFeatures_known() {
34677 LDKInitFeatures ret_var = InitFeatures_known();
34678 uintptr_t ret_ref = 0;
34679 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34680 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34681 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34682 ret_ref = (uintptr_t)ret_var.inner;
34683 if (ret_var.is_owned) {
34689 jboolean __attribute__((export_name("TS_InitFeatures_requires_unknown_bits"))) TS_InitFeatures_requires_unknown_bits(uint32_t this_arg) {
34690 LDKInitFeatures this_arg_conv;
34691 this_arg_conv.inner = (void*)(this_arg & (~1));
34692 this_arg_conv.is_owned = false;
34693 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34694 jboolean ret_val = InitFeatures_requires_unknown_bits(&this_arg_conv);
34698 uint32_t __attribute__((export_name("TS_NodeFeatures_empty"))) TS_NodeFeatures_empty() {
34699 LDKNodeFeatures ret_var = NodeFeatures_empty();
34700 uintptr_t ret_ref = 0;
34701 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34702 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34703 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34704 ret_ref = (uintptr_t)ret_var.inner;
34705 if (ret_var.is_owned) {
34711 uint32_t __attribute__((export_name("TS_NodeFeatures_known"))) TS_NodeFeatures_known() {
34712 LDKNodeFeatures ret_var = NodeFeatures_known();
34713 uintptr_t ret_ref = 0;
34714 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34715 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34716 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34717 ret_ref = (uintptr_t)ret_var.inner;
34718 if (ret_var.is_owned) {
34724 jboolean __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits"))) TS_NodeFeatures_requires_unknown_bits(uint32_t this_arg) {
34725 LDKNodeFeatures this_arg_conv;
34726 this_arg_conv.inner = (void*)(this_arg & (~1));
34727 this_arg_conv.is_owned = false;
34728 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34729 jboolean ret_val = NodeFeatures_requires_unknown_bits(&this_arg_conv);
34733 uint32_t __attribute__((export_name("TS_ChannelFeatures_empty"))) TS_ChannelFeatures_empty() {
34734 LDKChannelFeatures ret_var = ChannelFeatures_empty();
34735 uintptr_t ret_ref = 0;
34736 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34737 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34738 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34739 ret_ref = (uintptr_t)ret_var.inner;
34740 if (ret_var.is_owned) {
34746 uint32_t __attribute__((export_name("TS_ChannelFeatures_known"))) TS_ChannelFeatures_known() {
34747 LDKChannelFeatures ret_var = ChannelFeatures_known();
34748 uintptr_t ret_ref = 0;
34749 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34750 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34751 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34752 ret_ref = (uintptr_t)ret_var.inner;
34753 if (ret_var.is_owned) {
34759 jboolean __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits"))) TS_ChannelFeatures_requires_unknown_bits(uint32_t this_arg) {
34760 LDKChannelFeatures this_arg_conv;
34761 this_arg_conv.inner = (void*)(this_arg & (~1));
34762 this_arg_conv.is_owned = false;
34763 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34764 jboolean ret_val = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
34768 uint32_t __attribute__((export_name("TS_InvoiceFeatures_empty"))) TS_InvoiceFeatures_empty() {
34769 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
34770 uintptr_t ret_ref = 0;
34771 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34772 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34773 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34774 ret_ref = (uintptr_t)ret_var.inner;
34775 if (ret_var.is_owned) {
34781 uint32_t __attribute__((export_name("TS_InvoiceFeatures_known"))) TS_InvoiceFeatures_known() {
34782 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
34783 uintptr_t ret_ref = 0;
34784 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34785 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34786 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34787 ret_ref = (uintptr_t)ret_var.inner;
34788 if (ret_var.is_owned) {
34794 jboolean __attribute__((export_name("TS_InvoiceFeatures_requires_unknown_bits"))) TS_InvoiceFeatures_requires_unknown_bits(uint32_t this_arg) {
34795 LDKInvoiceFeatures this_arg_conv;
34796 this_arg_conv.inner = (void*)(this_arg & (~1));
34797 this_arg_conv.is_owned = false;
34798 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34799 jboolean ret_val = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
34803 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() {
34804 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
34805 uintptr_t ret_ref = 0;
34806 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34807 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34808 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34809 ret_ref = (uintptr_t)ret_var.inner;
34810 if (ret_var.is_owned) {
34816 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_known"))) TS_ChannelTypeFeatures_known() {
34817 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_known();
34818 uintptr_t ret_ref = 0;
34819 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34820 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34821 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34822 ret_ref = (uintptr_t)ret_var.inner;
34823 if (ret_var.is_owned) {
34829 jboolean __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint32_t this_arg) {
34830 LDKChannelTypeFeatures this_arg_conv;
34831 this_arg_conv.inner = (void*)(this_arg & (~1));
34832 this_arg_conv.is_owned = false;
34833 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34834 jboolean ret_val = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
34838 int8_tArray __attribute__((export_name("TS_InitFeatures_write"))) TS_InitFeatures_write(uint32_t obj) {
34839 LDKInitFeatures obj_conv;
34840 obj_conv.inner = (void*)(obj & (~1));
34841 obj_conv.is_owned = false;
34842 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34843 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
34844 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34845 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34846 CVec_u8Z_free(ret_var);
34850 uint32_t __attribute__((export_name("TS_InitFeatures_read"))) TS_InitFeatures_read(int8_tArray ser) {
34851 LDKu8slice ser_ref;
34852 ser_ref.datalen = ser->arr_len;
34853 ser_ref.data = ser->elems /* XXX ser leaks */;
34854 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
34855 *ret_conv = InitFeatures_read(ser_ref);
34856 return (uintptr_t)ret_conv;
34859 int8_tArray __attribute__((export_name("TS_ChannelFeatures_write"))) TS_ChannelFeatures_write(uint32_t obj) {
34860 LDKChannelFeatures obj_conv;
34861 obj_conv.inner = (void*)(obj & (~1));
34862 obj_conv.is_owned = false;
34863 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34864 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
34865 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34866 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34867 CVec_u8Z_free(ret_var);
34871 uint32_t __attribute__((export_name("TS_ChannelFeatures_read"))) TS_ChannelFeatures_read(int8_tArray ser) {
34872 LDKu8slice ser_ref;
34873 ser_ref.datalen = ser->arr_len;
34874 ser_ref.data = ser->elems /* XXX ser leaks */;
34875 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
34876 *ret_conv = ChannelFeatures_read(ser_ref);
34877 return (uintptr_t)ret_conv;
34880 int8_tArray __attribute__((export_name("TS_NodeFeatures_write"))) TS_NodeFeatures_write(uint32_t obj) {
34881 LDKNodeFeatures obj_conv;
34882 obj_conv.inner = (void*)(obj & (~1));
34883 obj_conv.is_owned = false;
34884 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34885 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
34886 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34887 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34888 CVec_u8Z_free(ret_var);
34892 uint32_t __attribute__((export_name("TS_NodeFeatures_read"))) TS_NodeFeatures_read(int8_tArray ser) {
34893 LDKu8slice ser_ref;
34894 ser_ref.datalen = ser->arr_len;
34895 ser_ref.data = ser->elems /* XXX ser leaks */;
34896 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
34897 *ret_conv = NodeFeatures_read(ser_ref);
34898 return (uintptr_t)ret_conv;
34901 int8_tArray __attribute__((export_name("TS_InvoiceFeatures_write"))) TS_InvoiceFeatures_write(uint32_t obj) {
34902 LDKInvoiceFeatures obj_conv;
34903 obj_conv.inner = (void*)(obj & (~1));
34904 obj_conv.is_owned = false;
34905 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34906 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
34907 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34908 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34909 CVec_u8Z_free(ret_var);
34913 uint32_t __attribute__((export_name("TS_InvoiceFeatures_read"))) TS_InvoiceFeatures_read(int8_tArray ser) {
34914 LDKu8slice ser_ref;
34915 ser_ref.datalen = ser->arr_len;
34916 ser_ref.data = ser->elems /* XXX ser leaks */;
34917 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
34918 *ret_conv = InvoiceFeatures_read(ser_ref);
34919 return (uintptr_t)ret_conv;
34922 int8_tArray __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint32_t obj) {
34923 LDKChannelTypeFeatures obj_conv;
34924 obj_conv.inner = (void*)(obj & (~1));
34925 obj_conv.is_owned = false;
34926 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34927 LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
34928 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34929 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34930 CVec_u8Z_free(ret_var);
34934 uint32_t __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
34935 LDKu8slice ser_ref;
34936 ser_ref.datalen = ser->arr_len;
34937 ser_ref.data = ser->elems /* XXX ser leaks */;
34938 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
34939 *ret_conv = ChannelTypeFeatures_read(ser_ref);
34940 return (uintptr_t)ret_conv;
34943 void __attribute__((export_name("TS_ShutdownScript_free"))) TS_ShutdownScript_free(uint32_t this_obj) {
34944 LDKShutdownScript this_obj_conv;
34945 this_obj_conv.inner = (void*)(this_obj & (~1));
34946 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34947 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34948 ShutdownScript_free(this_obj_conv);
34951 static inline uintptr_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
34952 LDKShutdownScript ret_var = ShutdownScript_clone(arg);
34953 uintptr_t ret_ref = 0;
34954 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34955 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34956 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34957 ret_ref = (uintptr_t)ret_var.inner;
34958 if (ret_var.is_owned) {
34963 intptr_t __attribute__((export_name("TS_ShutdownScript_clone_ptr"))) TS_ShutdownScript_clone_ptr(uint32_t arg) {
34964 LDKShutdownScript arg_conv;
34965 arg_conv.inner = (void*)(arg & (~1));
34966 arg_conv.is_owned = false;
34967 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34968 intptr_t ret_val = ShutdownScript_clone_ptr(&arg_conv);
34972 uint32_t __attribute__((export_name("TS_ShutdownScript_clone"))) TS_ShutdownScript_clone(uint32_t orig) {
34973 LDKShutdownScript orig_conv;
34974 orig_conv.inner = (void*)(orig & (~1));
34975 orig_conv.is_owned = false;
34976 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34977 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
34978 uintptr_t ret_ref = 0;
34979 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34980 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34981 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34982 ret_ref = (uintptr_t)ret_var.inner;
34983 if (ret_var.is_owned) {
34989 void __attribute__((export_name("TS_InvalidShutdownScript_free"))) TS_InvalidShutdownScript_free(uint32_t this_obj) {
34990 LDKInvalidShutdownScript this_obj_conv;
34991 this_obj_conv.inner = (void*)(this_obj & (~1));
34992 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34993 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34994 InvalidShutdownScript_free(this_obj_conv);
34997 int8_tArray __attribute__((export_name("TS_InvalidShutdownScript_get_script"))) TS_InvalidShutdownScript_get_script(uint32_t this_ptr) {
34998 LDKInvalidShutdownScript this_ptr_conv;
34999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35000 this_ptr_conv.is_owned = false;
35001 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35002 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
35003 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35004 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35008 void __attribute__((export_name("TS_InvalidShutdownScript_set_script"))) TS_InvalidShutdownScript_set_script(uint32_t this_ptr, int8_tArray val) {
35009 LDKInvalidShutdownScript this_ptr_conv;
35010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35011 this_ptr_conv.is_owned = false;
35012 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35013 LDKCVec_u8Z val_ref;
35014 val_ref.datalen = val->arr_len;
35015 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
35016 memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
35017 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
35020 uint32_t __attribute__((export_name("TS_InvalidShutdownScript_new"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
35021 LDKCVec_u8Z script_arg_ref;
35022 script_arg_ref.datalen = script_arg->arr_len;
35023 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
35024 memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
35025 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
35026 uintptr_t ret_ref = 0;
35027 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35028 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35029 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35030 ret_ref = (uintptr_t)ret_var.inner;
35031 if (ret_var.is_owned) {
35037 static inline uintptr_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
35038 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
35039 uintptr_t ret_ref = 0;
35040 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35041 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35042 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35043 ret_ref = (uintptr_t)ret_var.inner;
35044 if (ret_var.is_owned) {
35049 intptr_t __attribute__((export_name("TS_InvalidShutdownScript_clone_ptr"))) TS_InvalidShutdownScript_clone_ptr(uint32_t arg) {
35050 LDKInvalidShutdownScript arg_conv;
35051 arg_conv.inner = (void*)(arg & (~1));
35052 arg_conv.is_owned = false;
35053 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35054 intptr_t ret_val = InvalidShutdownScript_clone_ptr(&arg_conv);
35058 uint32_t __attribute__((export_name("TS_InvalidShutdownScript_clone"))) TS_InvalidShutdownScript_clone(uint32_t orig) {
35059 LDKInvalidShutdownScript orig_conv;
35060 orig_conv.inner = (void*)(orig & (~1));
35061 orig_conv.is_owned = false;
35062 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35063 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
35064 uintptr_t ret_ref = 0;
35065 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35066 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35067 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35068 ret_ref = (uintptr_t)ret_var.inner;
35069 if (ret_var.is_owned) {
35075 int8_tArray __attribute__((export_name("TS_ShutdownScript_write"))) TS_ShutdownScript_write(uint32_t obj) {
35076 LDKShutdownScript obj_conv;
35077 obj_conv.inner = (void*)(obj & (~1));
35078 obj_conv.is_owned = false;
35079 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35080 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
35081 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35082 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35083 CVec_u8Z_free(ret_var);
35087 uint32_t __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScript_read(int8_tArray ser) {
35088 LDKu8slice ser_ref;
35089 ser_ref.datalen = ser->arr_len;
35090 ser_ref.data = ser->elems /* XXX ser leaks */;
35091 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
35092 *ret_conv = ShutdownScript_read(ser_ref);
35093 return (uintptr_t)ret_conv;
35096 uint32_t __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
35097 unsigned char pubkey_hash_arr[20];
35098 CHECK(pubkey_hash->arr_len == 20);
35099 memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
35100 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
35101 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
35102 uintptr_t ret_ref = 0;
35103 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35104 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35105 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35106 ret_ref = (uintptr_t)ret_var.inner;
35107 if (ret_var.is_owned) {
35113 uint32_t __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
35114 unsigned char script_hash_arr[32];
35115 CHECK(script_hash->arr_len == 32);
35116 memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
35117 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
35118 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
35119 uintptr_t ret_ref = 0;
35120 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35121 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35122 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35123 ret_ref = (uintptr_t)ret_var.inner;
35124 if (ret_var.is_owned) {
35130 uint32_t __attribute__((export_name("TS_ShutdownScript_new_witness_program"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
35131 LDKu8slice program_ref;
35132 program_ref.datalen = program->arr_len;
35133 program_ref.data = program->elems /* XXX program leaks */;
35134 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
35135 *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
35136 return (uintptr_t)ret_conv;
35139 int8_tArray __attribute__((export_name("TS_ShutdownScript_into_inner"))) TS_ShutdownScript_into_inner(uint32_t this_arg) {
35140 LDKShutdownScript this_arg_conv;
35141 this_arg_conv.inner = (void*)(this_arg & (~1));
35142 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
35143 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35144 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
35145 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
35146 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35147 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35148 CVec_u8Z_free(ret_var);
35152 int8_tArray __attribute__((export_name("TS_ShutdownScript_as_legacy_pubkey"))) TS_ShutdownScript_as_legacy_pubkey(uint32_t this_arg) {
35153 LDKShutdownScript this_arg_conv;
35154 this_arg_conv.inner = (void*)(this_arg & (~1));
35155 this_arg_conv.is_owned = false;
35156 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35157 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35158 memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
35162 jboolean __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_ShutdownScript_is_compatible(uint32_t this_arg, uint32_t features) {
35163 LDKShutdownScript this_arg_conv;
35164 this_arg_conv.inner = (void*)(this_arg & (~1));
35165 this_arg_conv.is_owned = false;
35166 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35167 LDKInitFeatures features_conv;
35168 features_conv.inner = (void*)(features & (~1));
35169 features_conv.is_owned = false;
35170 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
35171 jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
35175 void __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint32_t this_ptr) {
35176 if ((this_ptr & 1) != 0) return;
35177 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
35178 CHECK_ACCESS(this_ptr_ptr);
35179 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
35180 FREE((void*)this_ptr);
35181 CustomMessageReader_free(this_ptr_conv);
35184 static inline uintptr_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
35185 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
35186 *ret_ret = Type_clone(arg);
35187 return (uintptr_t)ret_ret;
35189 intptr_t __attribute__((export_name("TS_Type_clone_ptr"))) TS_Type_clone_ptr(uint32_t arg) {
35190 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
35191 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
35192 LDKType* arg_conv = (LDKType*)arg_ptr;
35193 intptr_t ret_val = Type_clone_ptr(arg_conv);
35197 uint32_t __attribute__((export_name("TS_Type_clone"))) TS_Type_clone(uint32_t orig) {
35198 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
35199 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
35200 LDKType* orig_conv = (LDKType*)orig_ptr;
35201 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
35202 *ret_ret = Type_clone(orig_conv);
35203 return (uintptr_t)ret_ret;
35206 void __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint32_t this_ptr) {
35207 if ((this_ptr & 1) != 0) return;
35208 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
35209 CHECK_ACCESS(this_ptr_ptr);
35210 LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
35211 FREE((void*)this_ptr);
35212 Type_free(this_ptr_conv);
35215 void __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint32_t this_obj) {
35216 LDKNodeId this_obj_conv;
35217 this_obj_conv.inner = (void*)(this_obj & (~1));
35218 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35219 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35220 NodeId_free(this_obj_conv);
35223 static inline uintptr_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
35224 LDKNodeId ret_var = NodeId_clone(arg);
35225 uintptr_t ret_ref = 0;
35226 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35227 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35228 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35229 ret_ref = (uintptr_t)ret_var.inner;
35230 if (ret_var.is_owned) {
35235 intptr_t __attribute__((export_name("TS_NodeId_clone_ptr"))) TS_NodeId_clone_ptr(uint32_t arg) {
35236 LDKNodeId arg_conv;
35237 arg_conv.inner = (void*)(arg & (~1));
35238 arg_conv.is_owned = false;
35239 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35240 intptr_t ret_val = NodeId_clone_ptr(&arg_conv);
35244 uint32_t __attribute__((export_name("TS_NodeId_clone"))) TS_NodeId_clone(uint32_t orig) {
35245 LDKNodeId orig_conv;
35246 orig_conv.inner = (void*)(orig & (~1));
35247 orig_conv.is_owned = false;
35248 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35249 LDKNodeId ret_var = NodeId_clone(&orig_conv);
35250 uintptr_t ret_ref = 0;
35251 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35252 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35253 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35254 ret_ref = (uintptr_t)ret_var.inner;
35255 if (ret_var.is_owned) {
35261 uint32_t __attribute__((export_name("TS_NodeId_from_pubkey"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
35262 LDKPublicKey pubkey_ref;
35263 CHECK(pubkey->arr_len == 33);
35264 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
35265 LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
35266 uintptr_t ret_ref = 0;
35267 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35268 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35269 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35270 ret_ref = (uintptr_t)ret_var.inner;
35271 if (ret_var.is_owned) {
35277 int8_tArray __attribute__((export_name("TS_NodeId_as_slice"))) TS_NodeId_as_slice(uint32_t this_arg) {
35278 LDKNodeId this_arg_conv;
35279 this_arg_conv.inner = (void*)(this_arg & (~1));
35280 this_arg_conv.is_owned = false;
35281 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35282 LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
35283 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35284 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35288 int64_t __attribute__((export_name("TS_NodeId_hash"))) TS_NodeId_hash(uint32_t o) {
35290 o_conv.inner = (void*)(o & (~1));
35291 o_conv.is_owned = false;
35292 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35293 int64_t ret_val = NodeId_hash(&o_conv);
35297 int8_tArray __attribute__((export_name("TS_NodeId_write"))) TS_NodeId_write(uint32_t obj) {
35298 LDKNodeId obj_conv;
35299 obj_conv.inner = (void*)(obj & (~1));
35300 obj_conv.is_owned = false;
35301 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35302 LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
35303 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35304 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35305 CVec_u8Z_free(ret_var);
35309 uint32_t __attribute__((export_name("TS_NodeId_read"))) TS_NodeId_read(int8_tArray ser) {
35310 LDKu8slice ser_ref;
35311 ser_ref.datalen = ser->arr_len;
35312 ser_ref.data = ser->elems /* XXX ser leaks */;
35313 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
35314 *ret_conv = NodeId_read(ser_ref);
35315 return (uintptr_t)ret_conv;
35318 void __attribute__((export_name("TS_NetworkGraph_free"))) TS_NetworkGraph_free(uint32_t this_obj) {
35319 LDKNetworkGraph this_obj_conv;
35320 this_obj_conv.inner = (void*)(this_obj & (~1));
35321 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35322 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35323 NetworkGraph_free(this_obj_conv);
35326 static inline uintptr_t NetworkGraph_clone_ptr(LDKNetworkGraph *NONNULL_PTR arg) {
35327 LDKNetworkGraph ret_var = NetworkGraph_clone(arg);
35328 uintptr_t ret_ref = 0;
35329 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35330 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35331 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35332 ret_ref = (uintptr_t)ret_var.inner;
35333 if (ret_var.is_owned) {
35338 intptr_t __attribute__((export_name("TS_NetworkGraph_clone_ptr"))) TS_NetworkGraph_clone_ptr(uint32_t arg) {
35339 LDKNetworkGraph arg_conv;
35340 arg_conv.inner = (void*)(arg & (~1));
35341 arg_conv.is_owned = false;
35342 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35343 intptr_t ret_val = NetworkGraph_clone_ptr(&arg_conv);
35347 uint32_t __attribute__((export_name("TS_NetworkGraph_clone"))) TS_NetworkGraph_clone(uint32_t orig) {
35348 LDKNetworkGraph orig_conv;
35349 orig_conv.inner = (void*)(orig & (~1));
35350 orig_conv.is_owned = false;
35351 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35352 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
35353 uintptr_t ret_ref = 0;
35354 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35355 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35356 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35357 ret_ref = (uintptr_t)ret_var.inner;
35358 if (ret_var.is_owned) {
35364 void __attribute__((export_name("TS_ReadOnlyNetworkGraph_free"))) TS_ReadOnlyNetworkGraph_free(uint32_t this_obj) {
35365 LDKReadOnlyNetworkGraph this_obj_conv;
35366 this_obj_conv.inner = (void*)(this_obj & (~1));
35367 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35368 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35369 ReadOnlyNetworkGraph_free(this_obj_conv);
35372 void __attribute__((export_name("TS_NetworkUpdate_free"))) TS_NetworkUpdate_free(uint32_t this_ptr) {
35373 if ((this_ptr & 1) != 0) return;
35374 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
35375 CHECK_ACCESS(this_ptr_ptr);
35376 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
35377 FREE((void*)this_ptr);
35378 NetworkUpdate_free(this_ptr_conv);
35381 static inline uintptr_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
35382 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
35383 *ret_copy = NetworkUpdate_clone(arg);
35384 uintptr_t ret_ref = (uintptr_t)ret_copy;
35387 intptr_t __attribute__((export_name("TS_NetworkUpdate_clone_ptr"))) TS_NetworkUpdate_clone_ptr(uint32_t arg) {
35388 LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)arg;
35389 intptr_t ret_val = NetworkUpdate_clone_ptr(arg_conv);
35393 uint32_t __attribute__((export_name("TS_NetworkUpdate_clone"))) TS_NetworkUpdate_clone(uint32_t orig) {
35394 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
35395 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
35396 *ret_copy = NetworkUpdate_clone(orig_conv);
35397 uintptr_t ret_ref = (uintptr_t)ret_copy;
35401 uint32_t __attribute__((export_name("TS_NetworkUpdate_channel_update_message"))) TS_NetworkUpdate_channel_update_message(uint32_t msg) {
35402 LDKChannelUpdate msg_conv;
35403 msg_conv.inner = (void*)(msg & (~1));
35404 msg_conv.is_owned = (msg & 1) || (msg == 0);
35405 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35406 msg_conv = ChannelUpdate_clone(&msg_conv);
35407 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
35408 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
35409 uintptr_t ret_ref = (uintptr_t)ret_copy;
35413 uint32_t __attribute__((export_name("TS_NetworkUpdate_channel_closed"))) TS_NetworkUpdate_channel_closed(int64_t short_channel_id, jboolean is_permanent) {
35414 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
35415 *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent);
35416 uintptr_t ret_ref = (uintptr_t)ret_copy;
35420 uint32_t __attribute__((export_name("TS_NetworkUpdate_node_failure"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
35421 LDKPublicKey node_id_ref;
35422 CHECK(node_id->arr_len == 33);
35423 memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
35424 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
35425 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
35426 uintptr_t ret_ref = (uintptr_t)ret_copy;
35430 int8_tArray __attribute__((export_name("TS_NetworkUpdate_write"))) TS_NetworkUpdate_write(uint32_t obj) {
35431 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
35432 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
35433 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35434 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35435 CVec_u8Z_free(ret_var);
35439 uint32_t __attribute__((export_name("TS_NetworkUpdate_read"))) TS_NetworkUpdate_read(int8_tArray ser) {
35440 LDKu8slice ser_ref;
35441 ser_ref.datalen = ser->arr_len;
35442 ser_ref.data = ser->elems /* XXX ser leaks */;
35443 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
35444 *ret_conv = NetworkUpdate_read(ser_ref);
35445 return (uintptr_t)ret_conv;
35448 uint32_t __attribute__((export_name("TS_NetGraphMsgHandler_as_EventHandler"))) TS_NetGraphMsgHandler_as_EventHandler(uint32_t this_arg) {
35449 LDKNetGraphMsgHandler this_arg_conv;
35450 this_arg_conv.inner = (void*)(this_arg & (~1));
35451 this_arg_conv.is_owned = false;
35452 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35453 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
35454 *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv);
35455 return (uintptr_t)ret_ret;
35458 void __attribute__((export_name("TS_NetGraphMsgHandler_free"))) TS_NetGraphMsgHandler_free(uint32_t this_obj) {
35459 LDKNetGraphMsgHandler this_obj_conv;
35460 this_obj_conv.inner = (void*)(this_obj & (~1));
35461 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35462 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35463 NetGraphMsgHandler_free(this_obj_conv);
35466 uint32_t __attribute__((export_name("TS_NetGraphMsgHandler_new"))) TS_NetGraphMsgHandler_new(uint32_t network_graph, uint32_t chain_access, uint32_t logger) {
35467 LDKNetworkGraph network_graph_conv;
35468 network_graph_conv.inner = (void*)(network_graph & (~1));
35469 network_graph_conv.is_owned = false;
35470 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
35471 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
35472 CHECK_ACCESS(chain_access_ptr);
35473 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
35474 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
35475 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
35476 // Manually implement clone for Java trait instances
35478 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
35479 CHECK_ACCESS(logger_ptr);
35480 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
35481 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(&network_graph_conv, chain_access_conv, logger_conv);
35482 uintptr_t ret_ref = 0;
35483 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35484 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35485 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35486 ret_ref = (uintptr_t)ret_var.inner;
35487 if (ret_var.is_owned) {
35493 void __attribute__((export_name("TS_NetGraphMsgHandler_add_chain_access"))) TS_NetGraphMsgHandler_add_chain_access(uint32_t this_arg, uint32_t chain_access) {
35494 LDKNetGraphMsgHandler this_arg_conv;
35495 this_arg_conv.inner = (void*)(this_arg & (~1));
35496 this_arg_conv.is_owned = false;
35497 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35498 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
35499 CHECK_ACCESS(chain_access_ptr);
35500 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
35501 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
35502 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
35503 // Manually implement clone for Java trait instances
35505 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
35508 uint32_t __attribute__((export_name("TS_NetGraphMsgHandler_as_RoutingMessageHandler"))) TS_NetGraphMsgHandler_as_RoutingMessageHandler(uint32_t this_arg) {
35509 LDKNetGraphMsgHandler this_arg_conv;
35510 this_arg_conv.inner = (void*)(this_arg & (~1));
35511 this_arg_conv.is_owned = false;
35512 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35513 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
35514 *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
35515 return (uintptr_t)ret_ret;
35518 uint32_t __attribute__((export_name("TS_NetGraphMsgHandler_as_MessageSendEventsProvider"))) TS_NetGraphMsgHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
35519 LDKNetGraphMsgHandler this_arg_conv;
35520 this_arg_conv.inner = (void*)(this_arg & (~1));
35521 this_arg_conv.is_owned = false;
35522 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35523 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
35524 *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
35525 return (uintptr_t)ret_ret;
35528 void __attribute__((export_name("TS_ChannelUpdateInfo_free"))) TS_ChannelUpdateInfo_free(uint32_t this_obj) {
35529 LDKChannelUpdateInfo this_obj_conv;
35530 this_obj_conv.inner = (void*)(this_obj & (~1));
35531 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35532 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35533 ChannelUpdateInfo_free(this_obj_conv);
35536 int32_t __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update"))) TS_ChannelUpdateInfo_get_last_update(uint32_t this_ptr) {
35537 LDKChannelUpdateInfo this_ptr_conv;
35538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35539 this_ptr_conv.is_owned = false;
35540 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35541 int32_t ret_val = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
35545 void __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update"))) TS_ChannelUpdateInfo_set_last_update(uint32_t this_ptr, int32_t val) {
35546 LDKChannelUpdateInfo this_ptr_conv;
35547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35548 this_ptr_conv.is_owned = false;
35549 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35550 ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
35553 jboolean __attribute__((export_name("TS_ChannelUpdateInfo_get_enabled"))) TS_ChannelUpdateInfo_get_enabled(uint32_t this_ptr) {
35554 LDKChannelUpdateInfo this_ptr_conv;
35555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35556 this_ptr_conv.is_owned = false;
35557 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35558 jboolean ret_val = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
35562 void __attribute__((export_name("TS_ChannelUpdateInfo_set_enabled"))) TS_ChannelUpdateInfo_set_enabled(uint32_t this_ptr, jboolean val) {
35563 LDKChannelUpdateInfo this_ptr_conv;
35564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35565 this_ptr_conv.is_owned = false;
35566 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35567 ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
35570 int16_t __attribute__((export_name("TS_ChannelUpdateInfo_get_cltv_expiry_delta"))) TS_ChannelUpdateInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
35571 LDKChannelUpdateInfo this_ptr_conv;
35572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35573 this_ptr_conv.is_owned = false;
35574 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35575 int16_t ret_val = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
35579 void __attribute__((export_name("TS_ChannelUpdateInfo_set_cltv_expiry_delta"))) TS_ChannelUpdateInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
35580 LDKChannelUpdateInfo this_ptr_conv;
35581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35582 this_ptr_conv.is_owned = false;
35583 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35584 ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
35587 int64_t __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_minimum_msat"))) TS_ChannelUpdateInfo_get_htlc_minimum_msat(uint32_t this_ptr) {
35588 LDKChannelUpdateInfo this_ptr_conv;
35589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35590 this_ptr_conv.is_owned = false;
35591 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35592 int64_t ret_val = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
35596 void __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_minimum_msat"))) TS_ChannelUpdateInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
35597 LDKChannelUpdateInfo this_ptr_conv;
35598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35599 this_ptr_conv.is_owned = false;
35600 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35601 ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
35604 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_maximum_msat"))) TS_ChannelUpdateInfo_get_htlc_maximum_msat(uint32_t this_ptr) {
35605 LDKChannelUpdateInfo this_ptr_conv;
35606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35607 this_ptr_conv.is_owned = false;
35608 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35609 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
35610 *ret_copy = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
35611 uintptr_t ret_ref = (uintptr_t)ret_copy;
35615 void __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_maximum_msat"))) TS_ChannelUpdateInfo_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
35616 LDKChannelUpdateInfo this_ptr_conv;
35617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35618 this_ptr_conv.is_owned = false;
35619 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35620 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
35621 CHECK_ACCESS(val_ptr);
35622 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
35623 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
35624 ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
35627 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_get_fees"))) TS_ChannelUpdateInfo_get_fees(uint32_t this_ptr) {
35628 LDKChannelUpdateInfo this_ptr_conv;
35629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35630 this_ptr_conv.is_owned = false;
35631 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35632 LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
35633 uintptr_t ret_ref = 0;
35634 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35635 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35636 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35637 ret_ref = (uintptr_t)ret_var.inner;
35638 if (ret_var.is_owned) {
35644 void __attribute__((export_name("TS_ChannelUpdateInfo_set_fees"))) TS_ChannelUpdateInfo_set_fees(uint32_t this_ptr, uint32_t val) {
35645 LDKChannelUpdateInfo this_ptr_conv;
35646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35647 this_ptr_conv.is_owned = false;
35648 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35649 LDKRoutingFees val_conv;
35650 val_conv.inner = (void*)(val & (~1));
35651 val_conv.is_owned = (val & 1) || (val == 0);
35652 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35653 val_conv = RoutingFees_clone(&val_conv);
35654 ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
35657 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update_message"))) TS_ChannelUpdateInfo_get_last_update_message(uint32_t this_ptr) {
35658 LDKChannelUpdateInfo this_ptr_conv;
35659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35660 this_ptr_conv.is_owned = false;
35661 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35662 LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
35663 uintptr_t ret_ref = 0;
35664 if ((uintptr_t)ret_var.inner > 4096) {
35665 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35666 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35667 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35668 ret_ref = (uintptr_t)ret_var.inner;
35669 if (ret_var.is_owned) {
35676 void __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update_message"))) TS_ChannelUpdateInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) {
35677 LDKChannelUpdateInfo this_ptr_conv;
35678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35679 this_ptr_conv.is_owned = false;
35680 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35681 LDKChannelUpdate val_conv;
35682 val_conv.inner = (void*)(val & (~1));
35683 val_conv.is_owned = (val & 1) || (val == 0);
35684 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35685 val_conv = ChannelUpdate_clone(&val_conv);
35686 ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
35689 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) {
35690 void* htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)htlc_maximum_msat_arg) & ~1);
35691 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
35692 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
35693 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_maximum_msat_arg) & ~1));
35694 LDKRoutingFees fees_arg_conv;
35695 fees_arg_conv.inner = (void*)(fees_arg & (~1));
35696 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
35697 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
35698 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
35699 LDKChannelUpdate last_update_message_arg_conv;
35700 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
35701 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
35702 CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
35703 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
35704 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);
35705 uintptr_t ret_ref = 0;
35706 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35707 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35708 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35709 ret_ref = (uintptr_t)ret_var.inner;
35710 if (ret_var.is_owned) {
35716 static inline uintptr_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
35717 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
35718 uintptr_t ret_ref = 0;
35719 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35720 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35721 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35722 ret_ref = (uintptr_t)ret_var.inner;
35723 if (ret_var.is_owned) {
35728 intptr_t __attribute__((export_name("TS_ChannelUpdateInfo_clone_ptr"))) TS_ChannelUpdateInfo_clone_ptr(uint32_t arg) {
35729 LDKChannelUpdateInfo arg_conv;
35730 arg_conv.inner = (void*)(arg & (~1));
35731 arg_conv.is_owned = false;
35732 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35733 intptr_t ret_val = ChannelUpdateInfo_clone_ptr(&arg_conv);
35737 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_clone"))) TS_ChannelUpdateInfo_clone(uint32_t orig) {
35738 LDKChannelUpdateInfo orig_conv;
35739 orig_conv.inner = (void*)(orig & (~1));
35740 orig_conv.is_owned = false;
35741 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35742 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
35743 uintptr_t ret_ref = 0;
35744 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35745 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35746 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35747 ret_ref = (uintptr_t)ret_var.inner;
35748 if (ret_var.is_owned) {
35754 int8_tArray __attribute__((export_name("TS_ChannelUpdateInfo_write"))) TS_ChannelUpdateInfo_write(uint32_t obj) {
35755 LDKChannelUpdateInfo obj_conv;
35756 obj_conv.inner = (void*)(obj & (~1));
35757 obj_conv.is_owned = false;
35758 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35759 LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
35760 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35761 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35762 CVec_u8Z_free(ret_var);
35766 uint32_t __attribute__((export_name("TS_ChannelUpdateInfo_read"))) TS_ChannelUpdateInfo_read(int8_tArray ser) {
35767 LDKu8slice ser_ref;
35768 ser_ref.datalen = ser->arr_len;
35769 ser_ref.data = ser->elems /* XXX ser leaks */;
35770 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
35771 *ret_conv = ChannelUpdateInfo_read(ser_ref);
35772 return (uintptr_t)ret_conv;
35775 void __attribute__((export_name("TS_ChannelInfo_free"))) TS_ChannelInfo_free(uint32_t this_obj) {
35776 LDKChannelInfo this_obj_conv;
35777 this_obj_conv.inner = (void*)(this_obj & (~1));
35778 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35779 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35780 ChannelInfo_free(this_obj_conv);
35783 uint32_t __attribute__((export_name("TS_ChannelInfo_get_features"))) TS_ChannelInfo_get_features(uint32_t this_ptr) {
35784 LDKChannelInfo this_ptr_conv;
35785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35786 this_ptr_conv.is_owned = false;
35787 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35788 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
35789 uintptr_t ret_ref = 0;
35790 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35791 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35792 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35793 ret_ref = (uintptr_t)ret_var.inner;
35794 if (ret_var.is_owned) {
35800 void __attribute__((export_name("TS_ChannelInfo_set_features"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) {
35801 LDKChannelInfo this_ptr_conv;
35802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35803 this_ptr_conv.is_owned = false;
35804 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35805 LDKChannelFeatures val_conv;
35806 val_conv.inner = (void*)(val & (~1));
35807 val_conv.is_owned = (val & 1) || (val == 0);
35808 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35809 val_conv = ChannelFeatures_clone(&val_conv);
35810 ChannelInfo_set_features(&this_ptr_conv, val_conv);
35813 uint32_t __attribute__((export_name("TS_ChannelInfo_get_node_one"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) {
35814 LDKChannelInfo this_ptr_conv;
35815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35816 this_ptr_conv.is_owned = false;
35817 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35818 LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
35819 uintptr_t ret_ref = 0;
35820 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35821 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35822 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35823 ret_ref = (uintptr_t)ret_var.inner;
35824 if (ret_var.is_owned) {
35830 void __attribute__((export_name("TS_ChannelInfo_set_node_one"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, uint32_t val) {
35831 LDKChannelInfo this_ptr_conv;
35832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35833 this_ptr_conv.is_owned = false;
35834 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35835 LDKNodeId val_conv;
35836 val_conv.inner = (void*)(val & (~1));
35837 val_conv.is_owned = (val & 1) || (val == 0);
35838 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35839 val_conv = NodeId_clone(&val_conv);
35840 ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
35843 uint32_t __attribute__((export_name("TS_ChannelInfo_get_one_to_two"))) TS_ChannelInfo_get_one_to_two(uint32_t this_ptr) {
35844 LDKChannelInfo this_ptr_conv;
35845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35846 this_ptr_conv.is_owned = false;
35847 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35848 LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
35849 uintptr_t ret_ref = 0;
35850 if ((uintptr_t)ret_var.inner > 4096) {
35851 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35852 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35853 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35854 ret_ref = (uintptr_t)ret_var.inner;
35855 if (ret_var.is_owned) {
35862 void __attribute__((export_name("TS_ChannelInfo_set_one_to_two"))) TS_ChannelInfo_set_one_to_two(uint32_t this_ptr, uint32_t val) {
35863 LDKChannelInfo this_ptr_conv;
35864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35865 this_ptr_conv.is_owned = false;
35866 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35867 LDKChannelUpdateInfo val_conv;
35868 val_conv.inner = (void*)(val & (~1));
35869 val_conv.is_owned = (val & 1) || (val == 0);
35870 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35871 val_conv = ChannelUpdateInfo_clone(&val_conv);
35872 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
35875 uint32_t __attribute__((export_name("TS_ChannelInfo_get_node_two"))) TS_ChannelInfo_get_node_two(uint32_t this_ptr) {
35876 LDKChannelInfo this_ptr_conv;
35877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35878 this_ptr_conv.is_owned = false;
35879 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35880 LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
35881 uintptr_t ret_ref = 0;
35882 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35883 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35884 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35885 ret_ref = (uintptr_t)ret_var.inner;
35886 if (ret_var.is_owned) {
35892 void __attribute__((export_name("TS_ChannelInfo_set_node_two"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, uint32_t val) {
35893 LDKChannelInfo this_ptr_conv;
35894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35895 this_ptr_conv.is_owned = false;
35896 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35897 LDKNodeId val_conv;
35898 val_conv.inner = (void*)(val & (~1));
35899 val_conv.is_owned = (val & 1) || (val == 0);
35900 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35901 val_conv = NodeId_clone(&val_conv);
35902 ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
35905 uint32_t __attribute__((export_name("TS_ChannelInfo_get_two_to_one"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) {
35906 LDKChannelInfo this_ptr_conv;
35907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35908 this_ptr_conv.is_owned = false;
35909 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35910 LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
35911 uintptr_t ret_ref = 0;
35912 if ((uintptr_t)ret_var.inner > 4096) {
35913 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35914 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35915 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35916 ret_ref = (uintptr_t)ret_var.inner;
35917 if (ret_var.is_owned) {
35924 void __attribute__((export_name("TS_ChannelInfo_set_two_to_one"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) {
35925 LDKChannelInfo this_ptr_conv;
35926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35927 this_ptr_conv.is_owned = false;
35928 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35929 LDKChannelUpdateInfo val_conv;
35930 val_conv.inner = (void*)(val & (~1));
35931 val_conv.is_owned = (val & 1) || (val == 0);
35932 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35933 val_conv = ChannelUpdateInfo_clone(&val_conv);
35934 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
35937 uint32_t __attribute__((export_name("TS_ChannelInfo_get_capacity_sats"))) TS_ChannelInfo_get_capacity_sats(uint32_t this_ptr) {
35938 LDKChannelInfo this_ptr_conv;
35939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35940 this_ptr_conv.is_owned = false;
35941 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35942 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
35943 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
35944 uintptr_t ret_ref = (uintptr_t)ret_copy;
35948 void __attribute__((export_name("TS_ChannelInfo_set_capacity_sats"))) TS_ChannelInfo_set_capacity_sats(uint32_t this_ptr, uint32_t val) {
35949 LDKChannelInfo this_ptr_conv;
35950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35951 this_ptr_conv.is_owned = false;
35952 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35953 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
35954 CHECK_ACCESS(val_ptr);
35955 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
35956 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
35957 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
35960 uint32_t __attribute__((export_name("TS_ChannelInfo_get_announcement_message"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) {
35961 LDKChannelInfo this_ptr_conv;
35962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35963 this_ptr_conv.is_owned = false;
35964 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35965 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
35966 uintptr_t ret_ref = 0;
35967 if ((uintptr_t)ret_var.inner > 4096) {
35968 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35969 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35970 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35971 ret_ref = (uintptr_t)ret_var.inner;
35972 if (ret_var.is_owned) {
35979 void __attribute__((export_name("TS_ChannelInfo_set_announcement_message"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
35980 LDKChannelInfo this_ptr_conv;
35981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35982 this_ptr_conv.is_owned = false;
35983 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35984 LDKChannelAnnouncement val_conv;
35985 val_conv.inner = (void*)(val & (~1));
35986 val_conv.is_owned = (val & 1) || (val == 0);
35987 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35988 val_conv = ChannelAnnouncement_clone(&val_conv);
35989 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
35992 static inline uintptr_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
35993 LDKChannelInfo ret_var = ChannelInfo_clone(arg);
35994 uintptr_t ret_ref = 0;
35995 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35996 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35997 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35998 ret_ref = (uintptr_t)ret_var.inner;
35999 if (ret_var.is_owned) {
36004 intptr_t __attribute__((export_name("TS_ChannelInfo_clone_ptr"))) TS_ChannelInfo_clone_ptr(uint32_t arg) {
36005 LDKChannelInfo arg_conv;
36006 arg_conv.inner = (void*)(arg & (~1));
36007 arg_conv.is_owned = false;
36008 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36009 intptr_t ret_val = ChannelInfo_clone_ptr(&arg_conv);
36013 uint32_t __attribute__((export_name("TS_ChannelInfo_clone"))) TS_ChannelInfo_clone(uint32_t orig) {
36014 LDKChannelInfo orig_conv;
36015 orig_conv.inner = (void*)(orig & (~1));
36016 orig_conv.is_owned = false;
36017 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36018 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
36019 uintptr_t ret_ref = 0;
36020 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36021 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36022 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36023 ret_ref = (uintptr_t)ret_var.inner;
36024 if (ret_var.is_owned) {
36030 int8_tArray __attribute__((export_name("TS_ChannelInfo_write"))) TS_ChannelInfo_write(uint32_t obj) {
36031 LDKChannelInfo obj_conv;
36032 obj_conv.inner = (void*)(obj & (~1));
36033 obj_conv.is_owned = false;
36034 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36035 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
36036 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36037 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36038 CVec_u8Z_free(ret_var);
36042 uint32_t __attribute__((export_name("TS_ChannelInfo_read"))) TS_ChannelInfo_read(int8_tArray ser) {
36043 LDKu8slice ser_ref;
36044 ser_ref.datalen = ser->arr_len;
36045 ser_ref.data = ser->elems /* XXX ser leaks */;
36046 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
36047 *ret_conv = ChannelInfo_read(ser_ref);
36048 return (uintptr_t)ret_conv;
36051 void __attribute__((export_name("TS_DirectedChannelInfo_free"))) TS_DirectedChannelInfo_free(uint32_t this_obj) {
36052 LDKDirectedChannelInfo this_obj_conv;
36053 this_obj_conv.inner = (void*)(this_obj & (~1));
36054 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36055 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36056 DirectedChannelInfo_free(this_obj_conv);
36059 static inline uintptr_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
36060 LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
36061 uintptr_t ret_ref = 0;
36062 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36063 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36064 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36065 ret_ref = (uintptr_t)ret_var.inner;
36066 if (ret_var.is_owned) {
36071 intptr_t __attribute__((export_name("TS_DirectedChannelInfo_clone_ptr"))) TS_DirectedChannelInfo_clone_ptr(uint32_t arg) {
36072 LDKDirectedChannelInfo arg_conv;
36073 arg_conv.inner = (void*)(arg & (~1));
36074 arg_conv.is_owned = false;
36075 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36076 intptr_t ret_val = DirectedChannelInfo_clone_ptr(&arg_conv);
36080 uint32_t __attribute__((export_name("TS_DirectedChannelInfo_clone"))) TS_DirectedChannelInfo_clone(uint32_t orig) {
36081 LDKDirectedChannelInfo orig_conv;
36082 orig_conv.inner = (void*)(orig & (~1));
36083 orig_conv.is_owned = false;
36084 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36085 LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
36086 uintptr_t ret_ref = 0;
36087 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36088 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36089 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36090 ret_ref = (uintptr_t)ret_var.inner;
36091 if (ret_var.is_owned) {
36097 uint32_t __attribute__((export_name("TS_DirectedChannelInfo_channel"))) TS_DirectedChannelInfo_channel(uint32_t this_arg) {
36098 LDKDirectedChannelInfo this_arg_conv;
36099 this_arg_conv.inner = (void*)(this_arg & (~1));
36100 this_arg_conv.is_owned = false;
36101 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36102 LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
36103 uintptr_t ret_ref = 0;
36104 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36105 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36106 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36107 ret_ref = (uintptr_t)ret_var.inner;
36108 if (ret_var.is_owned) {
36114 uint32_t __attribute__((export_name("TS_DirectedChannelInfo_direction"))) TS_DirectedChannelInfo_direction(uint32_t this_arg) {
36115 LDKDirectedChannelInfo this_arg_conv;
36116 this_arg_conv.inner = (void*)(this_arg & (~1));
36117 this_arg_conv.is_owned = false;
36118 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36119 LDKChannelUpdateInfo ret_var = DirectedChannelInfo_direction(&this_arg_conv);
36120 uintptr_t ret_ref = 0;
36121 if ((uintptr_t)ret_var.inner > 4096) {
36122 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36123 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36124 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36125 ret_ref = (uintptr_t)ret_var.inner;
36126 if (ret_var.is_owned) {
36133 uint32_t __attribute__((export_name("TS_DirectedChannelInfo_effective_capacity"))) TS_DirectedChannelInfo_effective_capacity(uint32_t this_arg) {
36134 LDKDirectedChannelInfo this_arg_conv;
36135 this_arg_conv.inner = (void*)(this_arg & (~1));
36136 this_arg_conv.is_owned = false;
36137 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36138 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
36139 *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
36140 uintptr_t ret_ref = (uintptr_t)ret_copy;
36144 void __attribute__((export_name("TS_EffectiveCapacity_free"))) TS_EffectiveCapacity_free(uint32_t this_ptr) {
36145 if ((this_ptr & 1) != 0) return;
36146 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
36147 CHECK_ACCESS(this_ptr_ptr);
36148 LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
36149 FREE((void*)this_ptr);
36150 EffectiveCapacity_free(this_ptr_conv);
36153 static inline uintptr_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
36154 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
36155 *ret_copy = EffectiveCapacity_clone(arg);
36156 uintptr_t ret_ref = (uintptr_t)ret_copy;
36159 intptr_t __attribute__((export_name("TS_EffectiveCapacity_clone_ptr"))) TS_EffectiveCapacity_clone_ptr(uint32_t arg) {
36160 LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)arg;
36161 intptr_t ret_val = EffectiveCapacity_clone_ptr(arg_conv);
36165 uint32_t __attribute__((export_name("TS_EffectiveCapacity_clone"))) TS_EffectiveCapacity_clone(uint32_t orig) {
36166 LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)orig;
36167 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
36168 *ret_copy = EffectiveCapacity_clone(orig_conv);
36169 uintptr_t ret_ref = (uintptr_t)ret_copy;
36173 uint32_t __attribute__((export_name("TS_EffectiveCapacity_exact_liquidity"))) TS_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
36174 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
36175 *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
36176 uintptr_t ret_ref = (uintptr_t)ret_copy;
36180 uint32_t __attribute__((export_name("TS_EffectiveCapacity_maximum_htlc"))) TS_EffectiveCapacity_maximum_htlc(int64_t amount_msat) {
36181 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
36182 *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat);
36183 uintptr_t ret_ref = (uintptr_t)ret_copy;
36187 uint32_t __attribute__((export_name("TS_EffectiveCapacity_total"))) TS_EffectiveCapacity_total(int64_t capacity_msat) {
36188 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
36189 *ret_copy = EffectiveCapacity_total(capacity_msat);
36190 uintptr_t ret_ref = (uintptr_t)ret_copy;
36194 uint32_t __attribute__((export_name("TS_EffectiveCapacity_infinite"))) TS_EffectiveCapacity_infinite() {
36195 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
36196 *ret_copy = EffectiveCapacity_infinite();
36197 uintptr_t ret_ref = (uintptr_t)ret_copy;
36201 uint32_t __attribute__((export_name("TS_EffectiveCapacity_unknown"))) TS_EffectiveCapacity_unknown() {
36202 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
36203 *ret_copy = EffectiveCapacity_unknown();
36204 uintptr_t ret_ref = (uintptr_t)ret_copy;
36208 int64_t __attribute__((export_name("TS_EffectiveCapacity_as_msat"))) TS_EffectiveCapacity_as_msat(uint32_t this_arg) {
36209 LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)this_arg;
36210 int64_t ret_val = EffectiveCapacity_as_msat(this_arg_conv);
36214 void __attribute__((export_name("TS_RoutingFees_free"))) TS_RoutingFees_free(uint32_t this_obj) {
36215 LDKRoutingFees this_obj_conv;
36216 this_obj_conv.inner = (void*)(this_obj & (~1));
36217 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36218 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36219 RoutingFees_free(this_obj_conv);
36222 int32_t __attribute__((export_name("TS_RoutingFees_get_base_msat"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) {
36223 LDKRoutingFees this_ptr_conv;
36224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36225 this_ptr_conv.is_owned = false;
36226 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36227 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
36231 void __attribute__((export_name("TS_RoutingFees_set_base_msat"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) {
36232 LDKRoutingFees this_ptr_conv;
36233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36234 this_ptr_conv.is_owned = false;
36235 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36236 RoutingFees_set_base_msat(&this_ptr_conv, val);
36239 int32_t __attribute__((export_name("TS_RoutingFees_get_proportional_millionths"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) {
36240 LDKRoutingFees this_ptr_conv;
36241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36242 this_ptr_conv.is_owned = false;
36243 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36244 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
36248 void __attribute__((export_name("TS_RoutingFees_set_proportional_millionths"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) {
36249 LDKRoutingFees this_ptr_conv;
36250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36251 this_ptr_conv.is_owned = false;
36252 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36253 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
36256 uint32_t __attribute__((export_name("TS_RoutingFees_new"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
36257 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
36258 uintptr_t ret_ref = 0;
36259 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36260 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36261 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36262 ret_ref = (uintptr_t)ret_var.inner;
36263 if (ret_var.is_owned) {
36269 jboolean __attribute__((export_name("TS_RoutingFees_eq"))) TS_RoutingFees_eq(uint32_t a, uint32_t b) {
36270 LDKRoutingFees a_conv;
36271 a_conv.inner = (void*)(a & (~1));
36272 a_conv.is_owned = false;
36273 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36274 LDKRoutingFees b_conv;
36275 b_conv.inner = (void*)(b & (~1));
36276 b_conv.is_owned = false;
36277 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36278 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
36282 static inline uintptr_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
36283 LDKRoutingFees ret_var = RoutingFees_clone(arg);
36284 uintptr_t ret_ref = 0;
36285 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36286 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36287 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36288 ret_ref = (uintptr_t)ret_var.inner;
36289 if (ret_var.is_owned) {
36294 intptr_t __attribute__((export_name("TS_RoutingFees_clone_ptr"))) TS_RoutingFees_clone_ptr(uint32_t arg) {
36295 LDKRoutingFees arg_conv;
36296 arg_conv.inner = (void*)(arg & (~1));
36297 arg_conv.is_owned = false;
36298 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36299 intptr_t ret_val = RoutingFees_clone_ptr(&arg_conv);
36303 uint32_t __attribute__((export_name("TS_RoutingFees_clone"))) TS_RoutingFees_clone(uint32_t orig) {
36304 LDKRoutingFees orig_conv;
36305 orig_conv.inner = (void*)(orig & (~1));
36306 orig_conv.is_owned = false;
36307 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36308 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
36309 uintptr_t ret_ref = 0;
36310 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36311 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36312 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36313 ret_ref = (uintptr_t)ret_var.inner;
36314 if (ret_var.is_owned) {
36320 int64_t __attribute__((export_name("TS_RoutingFees_hash"))) TS_RoutingFees_hash(uint32_t o) {
36321 LDKRoutingFees o_conv;
36322 o_conv.inner = (void*)(o & (~1));
36323 o_conv.is_owned = false;
36324 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36325 int64_t ret_val = RoutingFees_hash(&o_conv);
36329 int8_tArray __attribute__((export_name("TS_RoutingFees_write"))) TS_RoutingFees_write(uint32_t obj) {
36330 LDKRoutingFees obj_conv;
36331 obj_conv.inner = (void*)(obj & (~1));
36332 obj_conv.is_owned = false;
36333 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36334 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
36335 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36336 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36337 CVec_u8Z_free(ret_var);
36341 uint32_t __attribute__((export_name("TS_RoutingFees_read"))) TS_RoutingFees_read(int8_tArray ser) {
36342 LDKu8slice ser_ref;
36343 ser_ref.datalen = ser->arr_len;
36344 ser_ref.data = ser->elems /* XXX ser leaks */;
36345 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
36346 *ret_conv = RoutingFees_read(ser_ref);
36347 return (uintptr_t)ret_conv;
36350 void __attribute__((export_name("TS_NodeAnnouncementInfo_free"))) TS_NodeAnnouncementInfo_free(uint32_t this_obj) {
36351 LDKNodeAnnouncementInfo this_obj_conv;
36352 this_obj_conv.inner = (void*)(this_obj & (~1));
36353 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36354 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36355 NodeAnnouncementInfo_free(this_obj_conv);
36358 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_get_features"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) {
36359 LDKNodeAnnouncementInfo this_ptr_conv;
36360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36361 this_ptr_conv.is_owned = false;
36362 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36363 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
36364 uintptr_t ret_ref = 0;
36365 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36366 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36367 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36368 ret_ref = (uintptr_t)ret_var.inner;
36369 if (ret_var.is_owned) {
36375 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_features"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) {
36376 LDKNodeAnnouncementInfo this_ptr_conv;
36377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36378 this_ptr_conv.is_owned = false;
36379 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36380 LDKNodeFeatures val_conv;
36381 val_conv.inner = (void*)(val & (~1));
36382 val_conv.is_owned = (val & 1) || (val == 0);
36383 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36384 val_conv = NodeFeatures_clone(&val_conv);
36385 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
36388 int32_t __attribute__((export_name("TS_NodeAnnouncementInfo_get_last_update"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) {
36389 LDKNodeAnnouncementInfo this_ptr_conv;
36390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36391 this_ptr_conv.is_owned = false;
36392 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36393 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
36397 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_last_update"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) {
36398 LDKNodeAnnouncementInfo this_ptr_conv;
36399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36400 this_ptr_conv.is_owned = false;
36401 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36402 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
36405 int8_tArray __attribute__((export_name("TS_NodeAnnouncementInfo_get_rgb"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) {
36406 LDKNodeAnnouncementInfo this_ptr_conv;
36407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36408 this_ptr_conv.is_owned = false;
36409 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36410 int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
36411 memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
36415 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_rgb"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) {
36416 LDKNodeAnnouncementInfo this_ptr_conv;
36417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36418 this_ptr_conv.is_owned = false;
36419 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36420 LDKThreeBytes val_ref;
36421 CHECK(val->arr_len == 3);
36422 memcpy(val_ref.data, val->elems, 3); FREE(val);
36423 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
36426 int8_tArray __attribute__((export_name("TS_NodeAnnouncementInfo_get_alias"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) {
36427 LDKNodeAnnouncementInfo this_ptr_conv;
36428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36429 this_ptr_conv.is_owned = false;
36430 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36431 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36432 memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
36436 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_alias"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, int8_tArray val) {
36437 LDKNodeAnnouncementInfo this_ptr_conv;
36438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36439 this_ptr_conv.is_owned = false;
36440 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36441 LDKThirtyTwoBytes val_ref;
36442 CHECK(val->arr_len == 32);
36443 memcpy(val_ref.data, val->elems, 32); FREE(val);
36444 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
36447 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_addresses"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) {
36448 LDKNodeAnnouncementInfo this_ptr_conv;
36449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36450 this_ptr_conv.is_owned = false;
36451 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36452 LDKCVec_NetAddressZ val_constr;
36453 val_constr.datalen = val->arr_len;
36454 if (val_constr.datalen > 0)
36455 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
36457 val_constr.data = NULL;
36458 uint32_t* val_vals = val->elems /* XXX val leaks */;
36459 for (size_t m = 0; m < val_constr.datalen; m++) {
36460 uint32_t val_conv_12 = val_vals[m];
36461 void* val_conv_12_ptr = (void*)(((uintptr_t)val_conv_12) & ~1);
36462 CHECK_ACCESS(val_conv_12_ptr);
36463 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
36464 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)val_conv_12) & ~1));
36465 val_constr.data[m] = val_conv_12_conv;
36467 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
36470 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_get_announcement_message"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) {
36471 LDKNodeAnnouncementInfo this_ptr_conv;
36472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36473 this_ptr_conv.is_owned = false;
36474 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36475 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
36476 uintptr_t ret_ref = 0;
36477 if ((uintptr_t)ret_var.inner > 4096) {
36478 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36479 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36480 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36481 ret_ref = (uintptr_t)ret_var.inner;
36482 if (ret_var.is_owned) {
36489 void __attribute__((export_name("TS_NodeAnnouncementInfo_set_announcement_message"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
36490 LDKNodeAnnouncementInfo this_ptr_conv;
36491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36492 this_ptr_conv.is_owned = false;
36493 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36494 LDKNodeAnnouncement val_conv;
36495 val_conv.inner = (void*)(val & (~1));
36496 val_conv.is_owned = (val & 1) || (val == 0);
36497 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36498 val_conv = NodeAnnouncement_clone(&val_conv);
36499 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
36502 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) {
36503 LDKNodeFeatures features_arg_conv;
36504 features_arg_conv.inner = (void*)(features_arg & (~1));
36505 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
36506 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
36507 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
36508 LDKThreeBytes rgb_arg_ref;
36509 CHECK(rgb_arg->arr_len == 3);
36510 memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
36511 LDKThirtyTwoBytes alias_arg_ref;
36512 CHECK(alias_arg->arr_len == 32);
36513 memcpy(alias_arg_ref.data, alias_arg->elems, 32); FREE(alias_arg);
36514 LDKCVec_NetAddressZ addresses_arg_constr;
36515 addresses_arg_constr.datalen = addresses_arg->arr_len;
36516 if (addresses_arg_constr.datalen > 0)
36517 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
36519 addresses_arg_constr.data = NULL;
36520 uint32_t* addresses_arg_vals = addresses_arg->elems /* XXX addresses_arg leaks */;
36521 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
36522 uint32_t addresses_arg_conv_12 = addresses_arg_vals[m];
36523 void* addresses_arg_conv_12_ptr = (void*)(((uintptr_t)addresses_arg_conv_12) & ~1);
36524 CHECK_ACCESS(addresses_arg_conv_12_ptr);
36525 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
36526 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
36528 LDKNodeAnnouncement announcement_message_arg_conv;
36529 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
36530 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
36531 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
36532 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
36533 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
36534 uintptr_t ret_ref = 0;
36535 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36536 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36537 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36538 ret_ref = (uintptr_t)ret_var.inner;
36539 if (ret_var.is_owned) {
36545 static inline uintptr_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
36546 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
36547 uintptr_t ret_ref = 0;
36548 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36549 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36550 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36551 ret_ref = (uintptr_t)ret_var.inner;
36552 if (ret_var.is_owned) {
36557 intptr_t __attribute__((export_name("TS_NodeAnnouncementInfo_clone_ptr"))) TS_NodeAnnouncementInfo_clone_ptr(uint32_t arg) {
36558 LDKNodeAnnouncementInfo arg_conv;
36559 arg_conv.inner = (void*)(arg & (~1));
36560 arg_conv.is_owned = false;
36561 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36562 intptr_t ret_val = NodeAnnouncementInfo_clone_ptr(&arg_conv);
36566 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_clone"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) {
36567 LDKNodeAnnouncementInfo orig_conv;
36568 orig_conv.inner = (void*)(orig & (~1));
36569 orig_conv.is_owned = false;
36570 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36571 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
36572 uintptr_t ret_ref = 0;
36573 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36574 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36575 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36576 ret_ref = (uintptr_t)ret_var.inner;
36577 if (ret_var.is_owned) {
36583 int8_tArray __attribute__((export_name("TS_NodeAnnouncementInfo_write"))) TS_NodeAnnouncementInfo_write(uint32_t obj) {
36584 LDKNodeAnnouncementInfo obj_conv;
36585 obj_conv.inner = (void*)(obj & (~1));
36586 obj_conv.is_owned = false;
36587 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36588 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
36589 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36590 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36591 CVec_u8Z_free(ret_var);
36595 uint32_t __attribute__((export_name("TS_NodeAnnouncementInfo_read"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
36596 LDKu8slice ser_ref;
36597 ser_ref.datalen = ser->arr_len;
36598 ser_ref.data = ser->elems /* XXX ser leaks */;
36599 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
36600 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
36601 return (uintptr_t)ret_conv;
36604 void __attribute__((export_name("TS_NodeInfo_free"))) TS_NodeInfo_free(uint32_t this_obj) {
36605 LDKNodeInfo this_obj_conv;
36606 this_obj_conv.inner = (void*)(this_obj & (~1));
36607 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36608 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36609 NodeInfo_free(this_obj_conv);
36612 void __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) {
36613 LDKNodeInfo this_ptr_conv;
36614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36615 this_ptr_conv.is_owned = false;
36616 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36617 LDKCVec_u64Z val_constr;
36618 val_constr.datalen = val->arr_len;
36619 if (val_constr.datalen > 0)
36620 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
36622 val_constr.data = NULL;
36623 int64_t* val_vals = val->elems /* XXX val leaks */;
36624 for (size_t i = 0; i < val_constr.datalen; i++) {
36625 int64_t val_conv_8 = val_vals[i];
36626 val_constr.data[i] = val_conv_8;
36628 NodeInfo_set_channels(&this_ptr_conv, val_constr);
36631 uint32_t __attribute__((export_name("TS_NodeInfo_get_lowest_inbound_channel_fees"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) {
36632 LDKNodeInfo this_ptr_conv;
36633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36634 this_ptr_conv.is_owned = false;
36635 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36636 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
36637 uintptr_t ret_ref = 0;
36638 if ((uintptr_t)ret_var.inner > 4096) {
36639 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36640 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36641 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36642 ret_ref = (uintptr_t)ret_var.inner;
36643 if (ret_var.is_owned) {
36650 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) {
36651 LDKNodeInfo this_ptr_conv;
36652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36653 this_ptr_conv.is_owned = false;
36654 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36655 LDKRoutingFees val_conv;
36656 val_conv.inner = (void*)(val & (~1));
36657 val_conv.is_owned = (val & 1) || (val == 0);
36658 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36659 val_conv = RoutingFees_clone(&val_conv);
36660 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
36663 uint32_t __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) {
36664 LDKNodeInfo this_ptr_conv;
36665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36666 this_ptr_conv.is_owned = false;
36667 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36668 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
36669 uintptr_t ret_ref = 0;
36670 if ((uintptr_t)ret_var.inner > 4096) {
36671 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36672 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36673 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36674 ret_ref = (uintptr_t)ret_var.inner;
36675 if (ret_var.is_owned) {
36682 void __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) {
36683 LDKNodeInfo this_ptr_conv;
36684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36685 this_ptr_conv.is_owned = false;
36686 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36687 LDKNodeAnnouncementInfo val_conv;
36688 val_conv.inner = (void*)(val & (~1));
36689 val_conv.is_owned = (val & 1) || (val == 0);
36690 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36691 val_conv = NodeAnnouncementInfo_clone(&val_conv);
36692 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
36695 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) {
36696 LDKCVec_u64Z channels_arg_constr;
36697 channels_arg_constr.datalen = channels_arg->arr_len;
36698 if (channels_arg_constr.datalen > 0)
36699 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
36701 channels_arg_constr.data = NULL;
36702 int64_t* channels_arg_vals = channels_arg->elems /* XXX channels_arg leaks */;
36703 for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
36704 int64_t channels_arg_conv_8 = channels_arg_vals[i];
36705 channels_arg_constr.data[i] = channels_arg_conv_8;
36707 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
36708 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
36709 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
36710 CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
36711 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
36712 LDKNodeAnnouncementInfo announcement_info_arg_conv;
36713 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
36714 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
36715 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
36716 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
36717 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
36718 uintptr_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 static inline uintptr_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
36730 LDKNodeInfo ret_var = NodeInfo_clone(arg);
36731 uintptr_t ret_ref = 0;
36732 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36733 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36734 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36735 ret_ref = (uintptr_t)ret_var.inner;
36736 if (ret_var.is_owned) {
36741 intptr_t __attribute__((export_name("TS_NodeInfo_clone_ptr"))) TS_NodeInfo_clone_ptr(uint32_t arg) {
36742 LDKNodeInfo arg_conv;
36743 arg_conv.inner = (void*)(arg & (~1));
36744 arg_conv.is_owned = false;
36745 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36746 intptr_t ret_val = NodeInfo_clone_ptr(&arg_conv);
36750 uint32_t __attribute__((export_name("TS_NodeInfo_clone"))) TS_NodeInfo_clone(uint32_t orig) {
36751 LDKNodeInfo orig_conv;
36752 orig_conv.inner = (void*)(orig & (~1));
36753 orig_conv.is_owned = false;
36754 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36755 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
36756 uintptr_t ret_ref = 0;
36757 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36758 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36759 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36760 ret_ref = (uintptr_t)ret_var.inner;
36761 if (ret_var.is_owned) {
36767 int8_tArray __attribute__((export_name("TS_NodeInfo_write"))) TS_NodeInfo_write(uint32_t obj) {
36768 LDKNodeInfo obj_conv;
36769 obj_conv.inner = (void*)(obj & (~1));
36770 obj_conv.is_owned = false;
36771 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36772 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
36773 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36774 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36775 CVec_u8Z_free(ret_var);
36779 uint32_t __attribute__((export_name("TS_NodeInfo_read"))) TS_NodeInfo_read(int8_tArray ser) {
36780 LDKu8slice ser_ref;
36781 ser_ref.datalen = ser->arr_len;
36782 ser_ref.data = ser->elems /* XXX ser leaks */;
36783 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
36784 *ret_conv = NodeInfo_read(ser_ref);
36785 return (uintptr_t)ret_conv;
36788 int8_tArray __attribute__((export_name("TS_NetworkGraph_write"))) TS_NetworkGraph_write(uint32_t obj) {
36789 LDKNetworkGraph obj_conv;
36790 obj_conv.inner = (void*)(obj & (~1));
36791 obj_conv.is_owned = false;
36792 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36793 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
36794 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36795 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36796 CVec_u8Z_free(ret_var);
36800 uint32_t __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_read(int8_tArray ser) {
36801 LDKu8slice ser_ref;
36802 ser_ref.datalen = ser->arr_len;
36803 ser_ref.data = ser->elems /* XXX ser leaks */;
36804 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
36805 *ret_conv = NetworkGraph_read(ser_ref);
36806 return (uintptr_t)ret_conv;
36809 uint32_t __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(int8_tArray genesis_hash) {
36810 LDKThirtyTwoBytes genesis_hash_ref;
36811 CHECK(genesis_hash->arr_len == 32);
36812 memcpy(genesis_hash_ref.data, genesis_hash->elems, 32); FREE(genesis_hash);
36813 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
36814 uintptr_t ret_ref = 0;
36815 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36816 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36817 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36818 ret_ref = (uintptr_t)ret_var.inner;
36819 if (ret_var.is_owned) {
36825 uint32_t __attribute__((export_name("TS_NetworkGraph_read_only"))) TS_NetworkGraph_read_only(uint32_t this_arg) {
36826 LDKNetworkGraph this_arg_conv;
36827 this_arg_conv.inner = (void*)(this_arg & (~1));
36828 this_arg_conv.is_owned = false;
36829 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36830 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
36831 uintptr_t ret_ref = 0;
36832 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36833 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36834 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36835 ret_ref = (uintptr_t)ret_var.inner;
36836 if (ret_var.is_owned) {
36842 uint32_t __attribute__((export_name("TS_NetworkGraph_update_node_from_announcement"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) {
36843 LDKNetworkGraph this_arg_conv;
36844 this_arg_conv.inner = (void*)(this_arg & (~1));
36845 this_arg_conv.is_owned = false;
36846 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36847 LDKNodeAnnouncement msg_conv;
36848 msg_conv.inner = (void*)(msg & (~1));
36849 msg_conv.is_owned = false;
36850 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
36851 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
36852 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
36853 return (uintptr_t)ret_conv;
36856 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) {
36857 LDKNetworkGraph this_arg_conv;
36858 this_arg_conv.inner = (void*)(this_arg & (~1));
36859 this_arg_conv.is_owned = false;
36860 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36861 LDKUnsignedNodeAnnouncement msg_conv;
36862 msg_conv.inner = (void*)(msg & (~1));
36863 msg_conv.is_owned = false;
36864 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
36865 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
36866 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
36867 return (uintptr_t)ret_conv;
36870 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) {
36871 LDKNetworkGraph this_arg_conv;
36872 this_arg_conv.inner = (void*)(this_arg & (~1));
36873 this_arg_conv.is_owned = false;
36874 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36875 LDKChannelAnnouncement msg_conv;
36876 msg_conv.inner = (void*)(msg & (~1));
36877 msg_conv.is_owned = false;
36878 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
36879 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
36880 CHECK_ACCESS(chain_access_ptr);
36881 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
36882 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
36883 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
36884 // Manually implement clone for Java trait instances
36886 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
36887 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
36888 return (uintptr_t)ret_conv;
36891 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) {
36892 LDKNetworkGraph this_arg_conv;
36893 this_arg_conv.inner = (void*)(this_arg & (~1));
36894 this_arg_conv.is_owned = false;
36895 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36896 LDKUnsignedChannelAnnouncement msg_conv;
36897 msg_conv.inner = (void*)(msg & (~1));
36898 msg_conv.is_owned = false;
36899 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
36900 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
36901 CHECK_ACCESS(chain_access_ptr);
36902 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
36903 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
36904 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
36905 // Manually implement clone for Java trait instances
36907 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
36908 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
36909 return (uintptr_t)ret_conv;
36912 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) {
36913 LDKNetworkGraph this_arg_conv;
36914 this_arg_conv.inner = (void*)(this_arg & (~1));
36915 this_arg_conv.is_owned = false;
36916 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36917 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
36920 void __attribute__((export_name("TS_NetworkGraph_fail_node"))) TS_NetworkGraph_fail_node(uint32_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
36921 LDKNetworkGraph this_arg_conv;
36922 this_arg_conv.inner = (void*)(this_arg & (~1));
36923 this_arg_conv.is_owned = false;
36924 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36925 LDKPublicKey _node_id_ref;
36926 CHECK(_node_id->arr_len == 33);
36927 memcpy(_node_id_ref.compressed_form, _node_id->elems, 33); FREE(_node_id);
36928 NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent);
36931 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) {
36932 LDKNetworkGraph this_arg_conv;
36933 this_arg_conv.inner = (void*)(this_arg & (~1));
36934 this_arg_conv.is_owned = false;
36935 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36936 NetworkGraph_remove_stale_channels_with_time(&this_arg_conv, current_time_unix);
36939 uint32_t __attribute__((export_name("TS_NetworkGraph_update_channel"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) {
36940 LDKNetworkGraph this_arg_conv;
36941 this_arg_conv.inner = (void*)(this_arg & (~1));
36942 this_arg_conv.is_owned = false;
36943 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36944 LDKChannelUpdate msg_conv;
36945 msg_conv.inner = (void*)(msg & (~1));
36946 msg_conv.is_owned = false;
36947 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
36948 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
36949 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
36950 return (uintptr_t)ret_conv;
36953 uint32_t __attribute__((export_name("TS_NetworkGraph_update_channel_unsigned"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) {
36954 LDKNetworkGraph this_arg_conv;
36955 this_arg_conv.inner = (void*)(this_arg & (~1));
36956 this_arg_conv.is_owned = false;
36957 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36958 LDKUnsignedChannelUpdate msg_conv;
36959 msg_conv.inner = (void*)(msg & (~1));
36960 msg_conv.is_owned = false;
36961 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
36962 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
36963 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
36964 return (uintptr_t)ret_conv;
36967 uint32_t __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) TS_ReadOnlyNetworkGraph_get_addresses(uint32_t this_arg, int8_tArray pubkey) {
36968 LDKReadOnlyNetworkGraph this_arg_conv;
36969 this_arg_conv.inner = (void*)(this_arg & (~1));
36970 this_arg_conv.is_owned = false;
36971 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36972 LDKPublicKey pubkey_ref;
36973 CHECK(pubkey->arr_len == 33);
36974 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
36975 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
36976 *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
36977 uintptr_t ret_ref = (uintptr_t)ret_copy;
36981 void __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint32_t this_obj) {
36982 LDKRouteHop this_obj_conv;
36983 this_obj_conv.inner = (void*)(this_obj & (~1));
36984 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36985 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36986 RouteHop_free(this_obj_conv);
36989 int8_tArray __attribute__((export_name("TS_RouteHop_get_pubkey"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) {
36990 LDKRouteHop this_ptr_conv;
36991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36992 this_ptr_conv.is_owned = false;
36993 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36994 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36995 memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
36999 void __attribute__((export_name("TS_RouteHop_set_pubkey"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) {
37000 LDKRouteHop this_ptr_conv;
37001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37002 this_ptr_conv.is_owned = false;
37003 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37004 LDKPublicKey val_ref;
37005 CHECK(val->arr_len == 33);
37006 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37007 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
37010 uint32_t __attribute__((export_name("TS_RouteHop_get_node_features"))) TS_RouteHop_get_node_features(uint32_t this_ptr) {
37011 LDKRouteHop this_ptr_conv;
37012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37013 this_ptr_conv.is_owned = false;
37014 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37015 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
37016 uintptr_t ret_ref = 0;
37017 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37018 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37019 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37020 ret_ref = (uintptr_t)ret_var.inner;
37021 if (ret_var.is_owned) {
37027 void __attribute__((export_name("TS_RouteHop_set_node_features"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) {
37028 LDKRouteHop this_ptr_conv;
37029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37030 this_ptr_conv.is_owned = false;
37031 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37032 LDKNodeFeatures val_conv;
37033 val_conv.inner = (void*)(val & (~1));
37034 val_conv.is_owned = (val & 1) || (val == 0);
37035 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37036 val_conv = NodeFeatures_clone(&val_conv);
37037 RouteHop_set_node_features(&this_ptr_conv, val_conv);
37040 int64_t __attribute__((export_name("TS_RouteHop_get_short_channel_id"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) {
37041 LDKRouteHop this_ptr_conv;
37042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37043 this_ptr_conv.is_owned = false;
37044 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37045 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
37049 void __attribute__((export_name("TS_RouteHop_set_short_channel_id"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
37050 LDKRouteHop this_ptr_conv;
37051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37052 this_ptr_conv.is_owned = false;
37053 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37054 RouteHop_set_short_channel_id(&this_ptr_conv, val);
37057 uint32_t __attribute__((export_name("TS_RouteHop_get_channel_features"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) {
37058 LDKRouteHop this_ptr_conv;
37059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37060 this_ptr_conv.is_owned = false;
37061 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37062 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
37063 uintptr_t ret_ref = 0;
37064 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37065 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37066 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37067 ret_ref = (uintptr_t)ret_var.inner;
37068 if (ret_var.is_owned) {
37074 void __attribute__((export_name("TS_RouteHop_set_channel_features"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) {
37075 LDKRouteHop this_ptr_conv;
37076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37077 this_ptr_conv.is_owned = false;
37078 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37079 LDKChannelFeatures val_conv;
37080 val_conv.inner = (void*)(val & (~1));
37081 val_conv.is_owned = (val & 1) || (val == 0);
37082 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37083 val_conv = ChannelFeatures_clone(&val_conv);
37084 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
37087 int64_t __attribute__((export_name("TS_RouteHop_get_fee_msat"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) {
37088 LDKRouteHop this_ptr_conv;
37089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37090 this_ptr_conv.is_owned = false;
37091 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37092 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
37096 void __attribute__((export_name("TS_RouteHop_set_fee_msat"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) {
37097 LDKRouteHop this_ptr_conv;
37098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37099 this_ptr_conv.is_owned = false;
37100 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37101 RouteHop_set_fee_msat(&this_ptr_conv, val);
37104 int32_t __attribute__((export_name("TS_RouteHop_get_cltv_expiry_delta"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) {
37105 LDKRouteHop this_ptr_conv;
37106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37107 this_ptr_conv.is_owned = false;
37108 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37109 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
37113 void __attribute__((export_name("TS_RouteHop_set_cltv_expiry_delta"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
37114 LDKRouteHop this_ptr_conv;
37115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37116 this_ptr_conv.is_owned = false;
37117 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37118 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
37121 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) {
37122 LDKPublicKey pubkey_arg_ref;
37123 CHECK(pubkey_arg->arr_len == 33);
37124 memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
37125 LDKNodeFeatures node_features_arg_conv;
37126 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
37127 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
37128 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
37129 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
37130 LDKChannelFeatures channel_features_arg_conv;
37131 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
37132 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
37133 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
37134 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
37135 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);
37136 uintptr_t ret_ref = 0;
37137 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37138 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37139 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37140 ret_ref = (uintptr_t)ret_var.inner;
37141 if (ret_var.is_owned) {
37147 static inline uintptr_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
37148 LDKRouteHop ret_var = RouteHop_clone(arg);
37149 uintptr_t ret_ref = 0;
37150 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37151 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37152 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37153 ret_ref = (uintptr_t)ret_var.inner;
37154 if (ret_var.is_owned) {
37159 intptr_t __attribute__((export_name("TS_RouteHop_clone_ptr"))) TS_RouteHop_clone_ptr(uint32_t arg) {
37160 LDKRouteHop arg_conv;
37161 arg_conv.inner = (void*)(arg & (~1));
37162 arg_conv.is_owned = false;
37163 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37164 intptr_t ret_val = RouteHop_clone_ptr(&arg_conv);
37168 uint32_t __attribute__((export_name("TS_RouteHop_clone"))) TS_RouteHop_clone(uint32_t orig) {
37169 LDKRouteHop orig_conv;
37170 orig_conv.inner = (void*)(orig & (~1));
37171 orig_conv.is_owned = false;
37172 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37173 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
37174 uintptr_t ret_ref = 0;
37175 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37176 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37177 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37178 ret_ref = (uintptr_t)ret_var.inner;
37179 if (ret_var.is_owned) {
37185 int64_t __attribute__((export_name("TS_RouteHop_hash"))) TS_RouteHop_hash(uint32_t o) {
37186 LDKRouteHop o_conv;
37187 o_conv.inner = (void*)(o & (~1));
37188 o_conv.is_owned = false;
37189 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37190 int64_t ret_val = RouteHop_hash(&o_conv);
37194 jboolean __attribute__((export_name("TS_RouteHop_eq"))) TS_RouteHop_eq(uint32_t a, uint32_t b) {
37195 LDKRouteHop a_conv;
37196 a_conv.inner = (void*)(a & (~1));
37197 a_conv.is_owned = false;
37198 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37199 LDKRouteHop b_conv;
37200 b_conv.inner = (void*)(b & (~1));
37201 b_conv.is_owned = false;
37202 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37203 jboolean ret_val = RouteHop_eq(&a_conv, &b_conv);
37207 int8_tArray __attribute__((export_name("TS_RouteHop_write"))) TS_RouteHop_write(uint32_t obj) {
37208 LDKRouteHop obj_conv;
37209 obj_conv.inner = (void*)(obj & (~1));
37210 obj_conv.is_owned = false;
37211 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37212 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
37213 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37214 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37215 CVec_u8Z_free(ret_var);
37219 uint32_t __attribute__((export_name("TS_RouteHop_read"))) TS_RouteHop_read(int8_tArray ser) {
37220 LDKu8slice ser_ref;
37221 ser_ref.datalen = ser->arr_len;
37222 ser_ref.data = ser->elems /* XXX ser leaks */;
37223 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
37224 *ret_conv = RouteHop_read(ser_ref);
37225 return (uintptr_t)ret_conv;
37228 void __attribute__((export_name("TS_Route_free"))) TS_Route_free(uint32_t this_obj) {
37229 LDKRoute this_obj_conv;
37230 this_obj_conv.inner = (void*)(this_obj & (~1));
37231 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37232 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37233 Route_free(this_obj_conv);
37236 ptrArray __attribute__((export_name("TS_Route_get_paths"))) TS_Route_get_paths(uint32_t this_ptr) {
37237 LDKRoute this_ptr_conv;
37238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37239 this_ptr_conv.is_owned = false;
37240 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37241 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
37242 ptrArray ret_arr = NULL;
37243 ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
37244 uint32_tArray *ret_arr_ptr = (uint32_tArray*)(((uint8_t*)ret_arr) + 4);
37245 for (size_t m = 0; m < ret_var.datalen; m++) {
37246 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
37247 uint32_tArray ret_conv_12_arr = NULL;
37248 ret_conv_12_arr = init_uint32_tArray(ret_conv_12_var.datalen, __LINE__);
37249 uint32_t *ret_conv_12_arr_ptr = (uint32_t*)(((uint8_t*)ret_conv_12_arr) + 4);
37250 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
37251 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
37252 uintptr_t ret_conv_12_conv_10_ref = 0;
37253 CHECK((((uintptr_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37254 CHECK((((uintptr_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37255 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
37256 ret_conv_12_conv_10_ref = (uintptr_t)ret_conv_12_conv_10_var.inner;
37257 if (ret_conv_12_conv_10_var.is_owned) {
37258 ret_conv_12_conv_10_ref |= 1;
37260 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
37263 FREE(ret_conv_12_var.data);
37264 ret_arr_ptr[m] = ret_conv_12_arr;
37267 FREE(ret_var.data);
37271 void __attribute__((export_name("TS_Route_set_paths"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) {
37272 LDKRoute this_ptr_conv;
37273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37274 this_ptr_conv.is_owned = false;
37275 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37276 LDKCVec_CVec_RouteHopZZ val_constr;
37277 val_constr.datalen = val->arr_len;
37278 if (val_constr.datalen > 0)
37279 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
37281 val_constr.data = NULL;
37282 uint32_tArray* val_vals = (void*) val->elems /* XXX val leaks */;
37283 for (size_t m = 0; m < val_constr.datalen; m++) {
37284 uint32_tArray val_conv_12 = val_vals[m];
37285 LDKCVec_RouteHopZ val_conv_12_constr;
37286 val_conv_12_constr.datalen = val_conv_12->arr_len;
37287 if (val_conv_12_constr.datalen > 0)
37288 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
37290 val_conv_12_constr.data = NULL;
37291 uint32_t* val_conv_12_vals = val_conv_12->elems /* XXX val_conv_12 leaks */;
37292 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
37293 uint32_t val_conv_12_conv_10 = val_conv_12_vals[k];
37294 LDKRouteHop val_conv_12_conv_10_conv;
37295 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
37296 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
37297 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
37298 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
37299 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
37301 val_constr.data[m] = val_conv_12_constr;
37303 Route_set_paths(&this_ptr_conv, val_constr);
37306 uint32_t __attribute__((export_name("TS_Route_get_payment_params"))) TS_Route_get_payment_params(uint32_t this_ptr) {
37307 LDKRoute this_ptr_conv;
37308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37309 this_ptr_conv.is_owned = false;
37310 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37311 LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
37312 uintptr_t ret_ref = 0;
37313 if ((uintptr_t)ret_var.inner > 4096) {
37314 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37315 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37316 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37317 ret_ref = (uintptr_t)ret_var.inner;
37318 if (ret_var.is_owned) {
37325 void __attribute__((export_name("TS_Route_set_payment_params"))) TS_Route_set_payment_params(uint32_t this_ptr, uint32_t val) {
37326 LDKRoute this_ptr_conv;
37327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37328 this_ptr_conv.is_owned = false;
37329 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37330 LDKPaymentParameters val_conv;
37331 val_conv.inner = (void*)(val & (~1));
37332 val_conv.is_owned = (val & 1) || (val == 0);
37333 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37334 val_conv = PaymentParameters_clone(&val_conv);
37335 Route_set_payment_params(&this_ptr_conv, val_conv);
37338 uint32_t __attribute__((export_name("TS_Route_new"))) TS_Route_new(ptrArray paths_arg, uint32_t payment_params_arg) {
37339 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
37340 paths_arg_constr.datalen = paths_arg->arr_len;
37341 if (paths_arg_constr.datalen > 0)
37342 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
37344 paths_arg_constr.data = NULL;
37345 uint32_tArray* paths_arg_vals = (void*) paths_arg->elems /* XXX paths_arg leaks */;
37346 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
37347 uint32_tArray paths_arg_conv_12 = paths_arg_vals[m];
37348 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
37349 paths_arg_conv_12_constr.datalen = paths_arg_conv_12->arr_len;
37350 if (paths_arg_conv_12_constr.datalen > 0)
37351 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
37353 paths_arg_conv_12_constr.data = NULL;
37354 uint32_t* paths_arg_conv_12_vals = paths_arg_conv_12->elems /* XXX paths_arg_conv_12 leaks */;
37355 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
37356 uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
37357 LDKRouteHop paths_arg_conv_12_conv_10_conv;
37358 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
37359 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
37360 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
37361 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
37362 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
37364 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
37366 LDKPaymentParameters payment_params_arg_conv;
37367 payment_params_arg_conv.inner = (void*)(payment_params_arg & (~1));
37368 payment_params_arg_conv.is_owned = (payment_params_arg & 1) || (payment_params_arg == 0);
37369 CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
37370 payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
37371 LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
37372 uintptr_t ret_ref = 0;
37373 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37374 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37375 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37376 ret_ref = (uintptr_t)ret_var.inner;
37377 if (ret_var.is_owned) {
37383 static inline uintptr_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
37384 LDKRoute ret_var = Route_clone(arg);
37385 uintptr_t ret_ref = 0;
37386 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37387 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37388 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37389 ret_ref = (uintptr_t)ret_var.inner;
37390 if (ret_var.is_owned) {
37395 intptr_t __attribute__((export_name("TS_Route_clone_ptr"))) TS_Route_clone_ptr(uint32_t arg) {
37397 arg_conv.inner = (void*)(arg & (~1));
37398 arg_conv.is_owned = false;
37399 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37400 intptr_t ret_val = Route_clone_ptr(&arg_conv);
37404 uint32_t __attribute__((export_name("TS_Route_clone"))) TS_Route_clone(uint32_t orig) {
37405 LDKRoute orig_conv;
37406 orig_conv.inner = (void*)(orig & (~1));
37407 orig_conv.is_owned = false;
37408 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37409 LDKRoute ret_var = Route_clone(&orig_conv);
37410 uintptr_t ret_ref = 0;
37411 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37412 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37413 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37414 ret_ref = (uintptr_t)ret_var.inner;
37415 if (ret_var.is_owned) {
37421 int64_t __attribute__((export_name("TS_Route_hash"))) TS_Route_hash(uint32_t o) {
37423 o_conv.inner = (void*)(o & (~1));
37424 o_conv.is_owned = false;
37425 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37426 int64_t ret_val = Route_hash(&o_conv);
37430 jboolean __attribute__((export_name("TS_Route_eq"))) TS_Route_eq(uint32_t a, uint32_t b) {
37432 a_conv.inner = (void*)(a & (~1));
37433 a_conv.is_owned = false;
37434 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37436 b_conv.inner = (void*)(b & (~1));
37437 b_conv.is_owned = false;
37438 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37439 jboolean ret_val = Route_eq(&a_conv, &b_conv);
37443 int64_t __attribute__((export_name("TS_Route_get_total_fees"))) TS_Route_get_total_fees(uint32_t this_arg) {
37444 LDKRoute this_arg_conv;
37445 this_arg_conv.inner = (void*)(this_arg & (~1));
37446 this_arg_conv.is_owned = false;
37447 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37448 int64_t ret_val = Route_get_total_fees(&this_arg_conv);
37452 int64_t __attribute__((export_name("TS_Route_get_total_amount"))) TS_Route_get_total_amount(uint32_t this_arg) {
37453 LDKRoute this_arg_conv;
37454 this_arg_conv.inner = (void*)(this_arg & (~1));
37455 this_arg_conv.is_owned = false;
37456 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37457 int64_t ret_val = Route_get_total_amount(&this_arg_conv);
37461 int8_tArray __attribute__((export_name("TS_Route_write"))) TS_Route_write(uint32_t obj) {
37463 obj_conv.inner = (void*)(obj & (~1));
37464 obj_conv.is_owned = false;
37465 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37466 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
37467 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37468 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37469 CVec_u8Z_free(ret_var);
37473 uint32_t __attribute__((export_name("TS_Route_read"))) TS_Route_read(int8_tArray ser) {
37474 LDKu8slice ser_ref;
37475 ser_ref.datalen = ser->arr_len;
37476 ser_ref.data = ser->elems /* XXX ser leaks */;
37477 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
37478 *ret_conv = Route_read(ser_ref);
37479 return (uintptr_t)ret_conv;
37482 void __attribute__((export_name("TS_RouteParameters_free"))) TS_RouteParameters_free(uint32_t this_obj) {
37483 LDKRouteParameters this_obj_conv;
37484 this_obj_conv.inner = (void*)(this_obj & (~1));
37485 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37486 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37487 RouteParameters_free(this_obj_conv);
37490 uint32_t __attribute__((export_name("TS_RouteParameters_get_payment_params"))) TS_RouteParameters_get_payment_params(uint32_t this_ptr) {
37491 LDKRouteParameters this_ptr_conv;
37492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37493 this_ptr_conv.is_owned = false;
37494 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37495 LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
37496 uintptr_t ret_ref = 0;
37497 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37498 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37499 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37500 ret_ref = (uintptr_t)ret_var.inner;
37501 if (ret_var.is_owned) {
37507 void __attribute__((export_name("TS_RouteParameters_set_payment_params"))) TS_RouteParameters_set_payment_params(uint32_t this_ptr, uint32_t val) {
37508 LDKRouteParameters this_ptr_conv;
37509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37510 this_ptr_conv.is_owned = false;
37511 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37512 LDKPaymentParameters val_conv;
37513 val_conv.inner = (void*)(val & (~1));
37514 val_conv.is_owned = (val & 1) || (val == 0);
37515 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37516 val_conv = PaymentParameters_clone(&val_conv);
37517 RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
37520 int64_t __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint32_t this_ptr) {
37521 LDKRouteParameters this_ptr_conv;
37522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37523 this_ptr_conv.is_owned = false;
37524 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37525 int64_t ret_val = RouteParameters_get_final_value_msat(&this_ptr_conv);
37529 void __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint32_t this_ptr, int64_t val) {
37530 LDKRouteParameters this_ptr_conv;
37531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37532 this_ptr_conv.is_owned = false;
37533 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37534 RouteParameters_set_final_value_msat(&this_ptr_conv, val);
37537 int32_t __attribute__((export_name("TS_RouteParameters_get_final_cltv_expiry_delta"))) TS_RouteParameters_get_final_cltv_expiry_delta(uint32_t this_ptr) {
37538 LDKRouteParameters this_ptr_conv;
37539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37540 this_ptr_conv.is_owned = false;
37541 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37542 int32_t ret_val = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
37546 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) {
37547 LDKRouteParameters this_ptr_conv;
37548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37549 this_ptr_conv.is_owned = false;
37550 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37551 RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
37554 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) {
37555 LDKPaymentParameters payment_params_arg_conv;
37556 payment_params_arg_conv.inner = (void*)(payment_params_arg & (~1));
37557 payment_params_arg_conv.is_owned = (payment_params_arg & 1) || (payment_params_arg == 0);
37558 CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
37559 payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
37560 LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
37561 uintptr_t ret_ref = 0;
37562 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37563 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37564 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37565 ret_ref = (uintptr_t)ret_var.inner;
37566 if (ret_var.is_owned) {
37572 static inline uintptr_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
37573 LDKRouteParameters ret_var = RouteParameters_clone(arg);
37574 uintptr_t ret_ref = 0;
37575 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37576 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37577 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37578 ret_ref = (uintptr_t)ret_var.inner;
37579 if (ret_var.is_owned) {
37584 intptr_t __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint32_t arg) {
37585 LDKRouteParameters arg_conv;
37586 arg_conv.inner = (void*)(arg & (~1));
37587 arg_conv.is_owned = false;
37588 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37589 intptr_t ret_val = RouteParameters_clone_ptr(&arg_conv);
37593 uint32_t __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint32_t orig) {
37594 LDKRouteParameters orig_conv;
37595 orig_conv.inner = (void*)(orig & (~1));
37596 orig_conv.is_owned = false;
37597 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37598 LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
37599 uintptr_t ret_ref = 0;
37600 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37601 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37602 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37603 ret_ref = (uintptr_t)ret_var.inner;
37604 if (ret_var.is_owned) {
37610 int8_tArray __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint32_t obj) {
37611 LDKRouteParameters obj_conv;
37612 obj_conv.inner = (void*)(obj & (~1));
37613 obj_conv.is_owned = false;
37614 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37615 LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
37616 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37617 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37618 CVec_u8Z_free(ret_var);
37622 uint32_t __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
37623 LDKu8slice ser_ref;
37624 ser_ref.datalen = ser->arr_len;
37625 ser_ref.data = ser->elems /* XXX ser leaks */;
37626 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
37627 *ret_conv = RouteParameters_read(ser_ref);
37628 return (uintptr_t)ret_conv;
37631 void __attribute__((export_name("TS_PaymentParameters_free"))) TS_PaymentParameters_free(uint32_t this_obj) {
37632 LDKPaymentParameters this_obj_conv;
37633 this_obj_conv.inner = (void*)(this_obj & (~1));
37634 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37635 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37636 PaymentParameters_free(this_obj_conv);
37639 int8_tArray __attribute__((export_name("TS_PaymentParameters_get_payee_pubkey"))) TS_PaymentParameters_get_payee_pubkey(uint32_t this_ptr) {
37640 LDKPaymentParameters this_ptr_conv;
37641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37642 this_ptr_conv.is_owned = false;
37643 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37644 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37645 memcpy(ret_arr->elems, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form, 33);
37649 void __attribute__((export_name("TS_PaymentParameters_set_payee_pubkey"))) TS_PaymentParameters_set_payee_pubkey(uint32_t this_ptr, int8_tArray val) {
37650 LDKPaymentParameters this_ptr_conv;
37651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37652 this_ptr_conv.is_owned = false;
37653 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37654 LDKPublicKey val_ref;
37655 CHECK(val->arr_len == 33);
37656 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37657 PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
37660 uint32_t __attribute__((export_name("TS_PaymentParameters_get_features"))) TS_PaymentParameters_get_features(uint32_t this_ptr) {
37661 LDKPaymentParameters this_ptr_conv;
37662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37663 this_ptr_conv.is_owned = false;
37664 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37665 LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv);
37666 uintptr_t ret_ref = 0;
37667 if ((uintptr_t)ret_var.inner > 4096) {
37668 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37669 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37670 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37671 ret_ref = (uintptr_t)ret_var.inner;
37672 if (ret_var.is_owned) {
37679 void __attribute__((export_name("TS_PaymentParameters_set_features"))) TS_PaymentParameters_set_features(uint32_t this_ptr, uint32_t val) {
37680 LDKPaymentParameters this_ptr_conv;
37681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37682 this_ptr_conv.is_owned = false;
37683 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37684 LDKInvoiceFeatures val_conv;
37685 val_conv.inner = (void*)(val & (~1));
37686 val_conv.is_owned = (val & 1) || (val == 0);
37687 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37688 val_conv = InvoiceFeatures_clone(&val_conv);
37689 PaymentParameters_set_features(&this_ptr_conv, val_conv);
37692 uint32_tArray __attribute__((export_name("TS_PaymentParameters_get_route_hints"))) TS_PaymentParameters_get_route_hints(uint32_t this_ptr) {
37693 LDKPaymentParameters 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 LDKCVec_RouteHintZ ret_var = PaymentParameters_get_route_hints(&this_ptr_conv);
37698 uint32_tArray ret_arr = NULL;
37699 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
37700 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
37701 for (size_t l = 0; l < ret_var.datalen; l++) {
37702 LDKRouteHint ret_conv_11_var = ret_var.data[l];
37703 uintptr_t ret_conv_11_ref = 0;
37704 CHECK((((uintptr_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37705 CHECK((((uintptr_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37706 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
37707 ret_conv_11_ref = (uintptr_t)ret_conv_11_var.inner;
37708 if (ret_conv_11_var.is_owned) {
37709 ret_conv_11_ref |= 1;
37711 ret_arr_ptr[l] = ret_conv_11_ref;
37714 FREE(ret_var.data);
37718 void __attribute__((export_name("TS_PaymentParameters_set_route_hints"))) TS_PaymentParameters_set_route_hints(uint32_t this_ptr, uint32_tArray val) {
37719 LDKPaymentParameters this_ptr_conv;
37720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37721 this_ptr_conv.is_owned = false;
37722 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37723 LDKCVec_RouteHintZ val_constr;
37724 val_constr.datalen = val->arr_len;
37725 if (val_constr.datalen > 0)
37726 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
37728 val_constr.data = NULL;
37729 uint32_t* val_vals = val->elems /* XXX val leaks */;
37730 for (size_t l = 0; l < val_constr.datalen; l++) {
37731 uint32_t val_conv_11 = val_vals[l];
37732 LDKRouteHint val_conv_11_conv;
37733 val_conv_11_conv.inner = (void*)(val_conv_11 & (~1));
37734 val_conv_11_conv.is_owned = (val_conv_11 & 1) || (val_conv_11 == 0);
37735 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
37736 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
37737 val_constr.data[l] = val_conv_11_conv;
37739 PaymentParameters_set_route_hints(&this_ptr_conv, val_constr);
37742 uint32_t __attribute__((export_name("TS_PaymentParameters_get_expiry_time"))) TS_PaymentParameters_get_expiry_time(uint32_t this_ptr) {
37743 LDKPaymentParameters this_ptr_conv;
37744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37745 this_ptr_conv.is_owned = false;
37746 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37747 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37748 *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
37749 uintptr_t ret_ref = (uintptr_t)ret_copy;
37753 void __attribute__((export_name("TS_PaymentParameters_set_expiry_time"))) TS_PaymentParameters_set_expiry_time(uint32_t this_ptr, uint32_t val) {
37754 LDKPaymentParameters this_ptr_conv;
37755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37756 this_ptr_conv.is_owned = false;
37757 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37758 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
37759 CHECK_ACCESS(val_ptr);
37760 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37761 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
37762 PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
37765 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) {
37766 LDKPaymentParameters this_ptr_conv;
37767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37768 this_ptr_conv.is_owned = false;
37769 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37770 int32_t ret_val = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
37774 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) {
37775 LDKPaymentParameters this_ptr_conv;
37776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37777 this_ptr_conv.is_owned = false;
37778 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37779 PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
37782 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) {
37783 LDKPublicKey payee_pubkey_arg_ref;
37784 CHECK(payee_pubkey_arg->arr_len == 33);
37785 memcpy(payee_pubkey_arg_ref.compressed_form, payee_pubkey_arg->elems, 33); FREE(payee_pubkey_arg);
37786 LDKInvoiceFeatures features_arg_conv;
37787 features_arg_conv.inner = (void*)(features_arg & (~1));
37788 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
37789 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
37790 features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
37791 LDKCVec_RouteHintZ route_hints_arg_constr;
37792 route_hints_arg_constr.datalen = route_hints_arg->arr_len;
37793 if (route_hints_arg_constr.datalen > 0)
37794 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
37796 route_hints_arg_constr.data = NULL;
37797 uint32_t* route_hints_arg_vals = route_hints_arg->elems /* XXX route_hints_arg leaks */;
37798 for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
37799 uint32_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
37800 LDKRouteHint route_hints_arg_conv_11_conv;
37801 route_hints_arg_conv_11_conv.inner = (void*)(route_hints_arg_conv_11 & (~1));
37802 route_hints_arg_conv_11_conv.is_owned = (route_hints_arg_conv_11 & 1) || (route_hints_arg_conv_11 == 0);
37803 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
37804 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
37805 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
37807 void* expiry_time_arg_ptr = (void*)(((uintptr_t)expiry_time_arg) & ~1);
37808 CHECK_ACCESS(expiry_time_arg_ptr);
37809 LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
37810 expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)expiry_time_arg) & ~1));
37811 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);
37812 uintptr_t ret_ref = 0;
37813 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37814 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37815 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37816 ret_ref = (uintptr_t)ret_var.inner;
37817 if (ret_var.is_owned) {
37823 static inline uintptr_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
37824 LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
37825 uintptr_t ret_ref = 0;
37826 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37827 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37828 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37829 ret_ref = (uintptr_t)ret_var.inner;
37830 if (ret_var.is_owned) {
37835 intptr_t __attribute__((export_name("TS_PaymentParameters_clone_ptr"))) TS_PaymentParameters_clone_ptr(uint32_t arg) {
37836 LDKPaymentParameters arg_conv;
37837 arg_conv.inner = (void*)(arg & (~1));
37838 arg_conv.is_owned = false;
37839 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37840 intptr_t ret_val = PaymentParameters_clone_ptr(&arg_conv);
37844 uint32_t __attribute__((export_name("TS_PaymentParameters_clone"))) TS_PaymentParameters_clone(uint32_t orig) {
37845 LDKPaymentParameters orig_conv;
37846 orig_conv.inner = (void*)(orig & (~1));
37847 orig_conv.is_owned = false;
37848 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37849 LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
37850 uintptr_t ret_ref = 0;
37851 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37852 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37853 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37854 ret_ref = (uintptr_t)ret_var.inner;
37855 if (ret_var.is_owned) {
37861 int64_t __attribute__((export_name("TS_PaymentParameters_hash"))) TS_PaymentParameters_hash(uint32_t o) {
37862 LDKPaymentParameters o_conv;
37863 o_conv.inner = (void*)(o & (~1));
37864 o_conv.is_owned = false;
37865 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37866 int64_t ret_val = PaymentParameters_hash(&o_conv);
37870 jboolean __attribute__((export_name("TS_PaymentParameters_eq"))) TS_PaymentParameters_eq(uint32_t a, uint32_t b) {
37871 LDKPaymentParameters a_conv;
37872 a_conv.inner = (void*)(a & (~1));
37873 a_conv.is_owned = false;
37874 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37875 LDKPaymentParameters b_conv;
37876 b_conv.inner = (void*)(b & (~1));
37877 b_conv.is_owned = false;
37878 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37879 jboolean ret_val = PaymentParameters_eq(&a_conv, &b_conv);
37883 int8_tArray __attribute__((export_name("TS_PaymentParameters_write"))) TS_PaymentParameters_write(uint32_t obj) {
37884 LDKPaymentParameters obj_conv;
37885 obj_conv.inner = (void*)(obj & (~1));
37886 obj_conv.is_owned = false;
37887 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37888 LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
37889 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37890 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37891 CVec_u8Z_free(ret_var);
37895 uint32_t __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser) {
37896 LDKu8slice ser_ref;
37897 ser_ref.datalen = ser->arr_len;
37898 ser_ref.data = ser->elems /* XXX ser leaks */;
37899 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
37900 *ret_conv = PaymentParameters_read(ser_ref);
37901 return (uintptr_t)ret_conv;
37904 uint32_t __attribute__((export_name("TS_PaymentParameters_from_node_id"))) TS_PaymentParameters_from_node_id(int8_tArray payee_pubkey) {
37905 LDKPublicKey payee_pubkey_ref;
37906 CHECK(payee_pubkey->arr_len == 33);
37907 memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
37908 LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref);
37909 uintptr_t ret_ref = 0;
37910 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37911 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37912 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37913 ret_ref = (uintptr_t)ret_var.inner;
37914 if (ret_var.is_owned) {
37920 uint32_t __attribute__((export_name("TS_PaymentParameters_for_keysend"))) TS_PaymentParameters_for_keysend(int8_tArray payee_pubkey) {
37921 LDKPublicKey payee_pubkey_ref;
37922 CHECK(payee_pubkey->arr_len == 33);
37923 memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
37924 LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref);
37925 uintptr_t ret_ref = 0;
37926 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37927 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37928 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37929 ret_ref = (uintptr_t)ret_var.inner;
37930 if (ret_var.is_owned) {
37936 void __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint32_t this_obj) {
37937 LDKRouteHint this_obj_conv;
37938 this_obj_conv.inner = (void*)(this_obj & (~1));
37939 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37940 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37941 RouteHint_free(this_obj_conv);
37944 uint32_tArray __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint32_t this_ptr) {
37945 LDKRouteHint this_ptr_conv;
37946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37947 this_ptr_conv.is_owned = false;
37948 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37949 LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
37950 uint32_tArray ret_arr = NULL;
37951 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
37952 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
37953 for (size_t o = 0; o < ret_var.datalen; o++) {
37954 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
37955 uintptr_t ret_conv_14_ref = 0;
37956 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37957 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37958 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
37959 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
37960 if (ret_conv_14_var.is_owned) {
37961 ret_conv_14_ref |= 1;
37963 ret_arr_ptr[o] = ret_conv_14_ref;
37966 FREE(ret_var.data);
37970 void __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint32_t this_ptr, uint32_tArray val) {
37971 LDKRouteHint this_ptr_conv;
37972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37973 this_ptr_conv.is_owned = false;
37974 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37975 LDKCVec_RouteHintHopZ val_constr;
37976 val_constr.datalen = val->arr_len;
37977 if (val_constr.datalen > 0)
37978 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
37980 val_constr.data = NULL;
37981 uint32_t* val_vals = val->elems /* XXX val leaks */;
37982 for (size_t o = 0; o < val_constr.datalen; o++) {
37983 uint32_t val_conv_14 = val_vals[o];
37984 LDKRouteHintHop val_conv_14_conv;
37985 val_conv_14_conv.inner = (void*)(val_conv_14 & (~1));
37986 val_conv_14_conv.is_owned = (val_conv_14 & 1) || (val_conv_14 == 0);
37987 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
37988 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
37989 val_constr.data[o] = val_conv_14_conv;
37991 RouteHint_set_a(&this_ptr_conv, val_constr);
37994 uint32_t __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint32_tArray a_arg) {
37995 LDKCVec_RouteHintHopZ a_arg_constr;
37996 a_arg_constr.datalen = a_arg->arr_len;
37997 if (a_arg_constr.datalen > 0)
37998 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
38000 a_arg_constr.data = NULL;
38001 uint32_t* a_arg_vals = a_arg->elems /* XXX a_arg leaks */;
38002 for (size_t o = 0; o < a_arg_constr.datalen; o++) {
38003 uint32_t a_arg_conv_14 = a_arg_vals[o];
38004 LDKRouteHintHop a_arg_conv_14_conv;
38005 a_arg_conv_14_conv.inner = (void*)(a_arg_conv_14 & (~1));
38006 a_arg_conv_14_conv.is_owned = (a_arg_conv_14 & 1) || (a_arg_conv_14 == 0);
38007 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
38008 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
38009 a_arg_constr.data[o] = a_arg_conv_14_conv;
38011 LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
38012 uintptr_t ret_ref = 0;
38013 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38014 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38015 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38016 ret_ref = (uintptr_t)ret_var.inner;
38017 if (ret_var.is_owned) {
38023 static inline uintptr_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
38024 LDKRouteHint ret_var = RouteHint_clone(arg);
38025 uintptr_t ret_ref = 0;
38026 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38027 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38028 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38029 ret_ref = (uintptr_t)ret_var.inner;
38030 if (ret_var.is_owned) {
38035 intptr_t __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint32_t arg) {
38036 LDKRouteHint arg_conv;
38037 arg_conv.inner = (void*)(arg & (~1));
38038 arg_conv.is_owned = false;
38039 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38040 intptr_t ret_val = RouteHint_clone_ptr(&arg_conv);
38044 uint32_t __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint32_t orig) {
38045 LDKRouteHint orig_conv;
38046 orig_conv.inner = (void*)(orig & (~1));
38047 orig_conv.is_owned = false;
38048 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38049 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
38050 uintptr_t ret_ref = 0;
38051 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38052 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38053 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38054 ret_ref = (uintptr_t)ret_var.inner;
38055 if (ret_var.is_owned) {
38061 int64_t __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint32_t o) {
38062 LDKRouteHint o_conv;
38063 o_conv.inner = (void*)(o & (~1));
38064 o_conv.is_owned = false;
38065 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38066 int64_t ret_val = RouteHint_hash(&o_conv);
38070 jboolean __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint32_t a, uint32_t b) {
38071 LDKRouteHint a_conv;
38072 a_conv.inner = (void*)(a & (~1));
38073 a_conv.is_owned = false;
38074 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38075 LDKRouteHint b_conv;
38076 b_conv.inner = (void*)(b & (~1));
38077 b_conv.is_owned = false;
38078 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38079 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
38083 int8_tArray __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint32_t obj) {
38084 LDKRouteHint obj_conv;
38085 obj_conv.inner = (void*)(obj & (~1));
38086 obj_conv.is_owned = false;
38087 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38088 LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
38089 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38090 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38091 CVec_u8Z_free(ret_var);
38095 uint32_t __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
38096 LDKu8slice ser_ref;
38097 ser_ref.datalen = ser->arr_len;
38098 ser_ref.data = ser->elems /* XXX ser leaks */;
38099 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
38100 *ret_conv = RouteHint_read(ser_ref);
38101 return (uintptr_t)ret_conv;
38104 void __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint32_t this_obj) {
38105 LDKRouteHintHop this_obj_conv;
38106 this_obj_conv.inner = (void*)(this_obj & (~1));
38107 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38108 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38109 RouteHintHop_free(this_obj_conv);
38112 int8_tArray __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint32_t this_ptr) {
38113 LDKRouteHintHop this_ptr_conv;
38114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38115 this_ptr_conv.is_owned = false;
38116 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38117 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38118 memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
38122 void __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint32_t this_ptr, int8_tArray val) {
38123 LDKRouteHintHop this_ptr_conv;
38124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38125 this_ptr_conv.is_owned = false;
38126 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38127 LDKPublicKey val_ref;
38128 CHECK(val->arr_len == 33);
38129 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38130 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
38133 int64_t __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint32_t this_ptr) {
38134 LDKRouteHintHop this_ptr_conv;
38135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38136 this_ptr_conv.is_owned = false;
38137 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38138 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
38142 void __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
38143 LDKRouteHintHop this_ptr_conv;
38144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38145 this_ptr_conv.is_owned = false;
38146 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38147 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
38150 uint32_t __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint32_t this_ptr) {
38151 LDKRouteHintHop this_ptr_conv;
38152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38153 this_ptr_conv.is_owned = false;
38154 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38155 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
38156 uintptr_t ret_ref = 0;
38157 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38158 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38159 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38160 ret_ref = (uintptr_t)ret_var.inner;
38161 if (ret_var.is_owned) {
38167 void __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint32_t this_ptr, uint32_t val) {
38168 LDKRouteHintHop this_ptr_conv;
38169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38170 this_ptr_conv.is_owned = false;
38171 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38172 LDKRoutingFees val_conv;
38173 val_conv.inner = (void*)(val & (~1));
38174 val_conv.is_owned = (val & 1) || (val == 0);
38175 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38176 val_conv = RoutingFees_clone(&val_conv);
38177 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
38180 int16_t __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint32_t this_ptr) {
38181 LDKRouteHintHop this_ptr_conv;
38182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38183 this_ptr_conv.is_owned = false;
38184 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38185 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
38189 void __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
38190 LDKRouteHintHop this_ptr_conv;
38191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38192 this_ptr_conv.is_owned = false;
38193 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38194 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
38197 uint32_t __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint32_t this_ptr) {
38198 LDKRouteHintHop this_ptr_conv;
38199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38200 this_ptr_conv.is_owned = false;
38201 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38202 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
38203 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
38204 uintptr_t ret_ref = (uintptr_t)ret_copy;
38208 void __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint32_t this_ptr, uint32_t val) {
38209 LDKRouteHintHop this_ptr_conv;
38210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38211 this_ptr_conv.is_owned = false;
38212 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38213 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
38214 CHECK_ACCESS(val_ptr);
38215 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
38216 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
38217 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
38220 uint32_t __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint32_t this_ptr) {
38221 LDKRouteHintHop this_ptr_conv;
38222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38223 this_ptr_conv.is_owned = false;
38224 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38225 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
38226 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
38227 uintptr_t ret_ref = (uintptr_t)ret_copy;
38231 void __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
38232 LDKRouteHintHop this_ptr_conv;
38233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38234 this_ptr_conv.is_owned = false;
38235 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38236 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
38237 CHECK_ACCESS(val_ptr);
38238 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
38239 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
38240 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
38243 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) {
38244 LDKPublicKey src_node_id_arg_ref;
38245 CHECK(src_node_id_arg->arr_len == 33);
38246 memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
38247 LDKRoutingFees fees_arg_conv;
38248 fees_arg_conv.inner = (void*)(fees_arg & (~1));
38249 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
38250 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
38251 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
38252 void* htlc_minimum_msat_arg_ptr = (void*)(((uintptr_t)htlc_minimum_msat_arg) & ~1);
38253 CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
38254 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
38255 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_minimum_msat_arg) & ~1));
38256 void* htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)htlc_maximum_msat_arg) & ~1);
38257 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
38258 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
38259 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_maximum_msat_arg) & ~1));
38260 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);
38261 uintptr_t ret_ref = 0;
38262 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38263 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38264 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38265 ret_ref = (uintptr_t)ret_var.inner;
38266 if (ret_var.is_owned) {
38272 static inline uintptr_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
38273 LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
38274 uintptr_t ret_ref = 0;
38275 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38276 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38277 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38278 ret_ref = (uintptr_t)ret_var.inner;
38279 if (ret_var.is_owned) {
38284 intptr_t __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint32_t arg) {
38285 LDKRouteHintHop arg_conv;
38286 arg_conv.inner = (void*)(arg & (~1));
38287 arg_conv.is_owned = false;
38288 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38289 intptr_t ret_val = RouteHintHop_clone_ptr(&arg_conv);
38293 uint32_t __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint32_t orig) {
38294 LDKRouteHintHop orig_conv;
38295 orig_conv.inner = (void*)(orig & (~1));
38296 orig_conv.is_owned = false;
38297 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38298 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
38299 uintptr_t ret_ref = 0;
38300 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38301 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38302 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38303 ret_ref = (uintptr_t)ret_var.inner;
38304 if (ret_var.is_owned) {
38310 int64_t __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint32_t o) {
38311 LDKRouteHintHop o_conv;
38312 o_conv.inner = (void*)(o & (~1));
38313 o_conv.is_owned = false;
38314 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38315 int64_t ret_val = RouteHintHop_hash(&o_conv);
38319 jboolean __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint32_t a, uint32_t b) {
38320 LDKRouteHintHop a_conv;
38321 a_conv.inner = (void*)(a & (~1));
38322 a_conv.is_owned = false;
38323 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38324 LDKRouteHintHop b_conv;
38325 b_conv.inner = (void*)(b & (~1));
38326 b_conv.is_owned = false;
38327 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38328 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
38332 int8_tArray __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint32_t obj) {
38333 LDKRouteHintHop obj_conv;
38334 obj_conv.inner = (void*)(obj & (~1));
38335 obj_conv.is_owned = false;
38336 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38337 LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
38338 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38339 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38340 CVec_u8Z_free(ret_var);
38344 uint32_t __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
38345 LDKu8slice ser_ref;
38346 ser_ref.datalen = ser->arr_len;
38347 ser_ref.data = ser->elems /* XXX ser leaks */;
38348 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
38349 *ret_conv = RouteHintHop_read(ser_ref);
38350 return (uintptr_t)ret_conv;
38353 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) {
38354 LDKPublicKey our_node_pubkey_ref;
38355 CHECK(our_node_pubkey->arr_len == 33);
38356 memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
38357 LDKRouteParameters route_params_conv;
38358 route_params_conv.inner = (void*)(route_params & (~1));
38359 route_params_conv.is_owned = false;
38360 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
38361 LDKNetworkGraph network_conv;
38362 network_conv.inner = (void*)(network & (~1));
38363 network_conv.is_owned = false;
38364 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_conv);
38365 LDKCVec_ChannelDetailsZ first_hops_constr;
38366 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
38367 if (first_hops != 0) {
38368 first_hops_constr.datalen = first_hops->arr_len;
38369 if (first_hops_constr.datalen > 0)
38370 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
38372 first_hops_constr.data = NULL;
38373 uint32_t* first_hops_vals = first_hops->elems /* XXX first_hops leaks */;
38374 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
38375 uint32_t first_hops_conv_16 = first_hops_vals[q];
38376 LDKChannelDetails first_hops_conv_16_conv;
38377 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
38378 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
38379 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
38380 first_hops_constr.data[q] = first_hops_conv_16_conv;
38382 first_hops_ptr = &first_hops_constr;
38384 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
38385 CHECK_ACCESS(logger_ptr);
38386 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38387 void* scorer_ptr = (void*)(((uintptr_t)scorer) & ~1);
38388 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
38389 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
38390 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
38391 *ret_conv = find_route(our_node_pubkey_ref, &route_params_conv, &network_conv, first_hops_ptr, logger_conv, scorer_conv);
38392 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
38393 return (uintptr_t)ret_conv;
38396 void __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint32_t this_ptr) {
38397 if ((this_ptr & 1) != 0) return;
38398 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
38399 CHECK_ACCESS(this_ptr_ptr);
38400 LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
38401 FREE((void*)this_ptr);
38402 Score_free(this_ptr_conv);
38405 void __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint32_t this_ptr) {
38406 if ((this_ptr & 1) != 0) return;
38407 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
38408 CHECK_ACCESS(this_ptr_ptr);
38409 LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
38410 FREE((void*)this_ptr);
38411 LockableScore_free(this_ptr_conv);
38414 void __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint32_t this_obj) {
38415 LDKMultiThreadedLockableScore this_obj_conv;
38416 this_obj_conv.inner = (void*)(this_obj & (~1));
38417 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38418 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38419 MultiThreadedLockableScore_free(this_obj_conv);
38422 uint32_t __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint32_t score) {
38423 void* score_ptr = (void*)(((uintptr_t)score) & ~1);
38424 CHECK_ACCESS(score_ptr);
38425 LDKScore score_conv = *(LDKScore*)(score_ptr);
38426 LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
38427 uintptr_t ret_ref = 0;
38428 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38429 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38430 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38431 ret_ref = (uintptr_t)ret_var.inner;
38432 if (ret_var.is_owned) {
38438 void __attribute__((export_name("TS_FixedPenaltyScorer_free"))) TS_FixedPenaltyScorer_free(uint32_t this_obj) {
38439 LDKFixedPenaltyScorer this_obj_conv;
38440 this_obj_conv.inner = (void*)(this_obj & (~1));
38441 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38442 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38443 FixedPenaltyScorer_free(this_obj_conv);
38446 static inline uintptr_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
38447 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
38448 uintptr_t ret_ref = 0;
38449 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38450 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38451 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38452 ret_ref = (uintptr_t)ret_var.inner;
38453 if (ret_var.is_owned) {
38458 intptr_t __attribute__((export_name("TS_FixedPenaltyScorer_clone_ptr"))) TS_FixedPenaltyScorer_clone_ptr(uint32_t arg) {
38459 LDKFixedPenaltyScorer arg_conv;
38460 arg_conv.inner = (void*)(arg & (~1));
38461 arg_conv.is_owned = false;
38462 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38463 intptr_t ret_val = FixedPenaltyScorer_clone_ptr(&arg_conv);
38467 uint32_t __attribute__((export_name("TS_FixedPenaltyScorer_clone"))) TS_FixedPenaltyScorer_clone(uint32_t orig) {
38468 LDKFixedPenaltyScorer orig_conv;
38469 orig_conv.inner = (void*)(orig & (~1));
38470 orig_conv.is_owned = false;
38471 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38472 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
38473 uintptr_t ret_ref = 0;
38474 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38475 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38476 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38477 ret_ref = (uintptr_t)ret_var.inner;
38478 if (ret_var.is_owned) {
38484 int8_tArray __attribute__((export_name("TS_FixedPenaltyScorer_write"))) TS_FixedPenaltyScorer_write(uint32_t obj) {
38485 LDKFixedPenaltyScorer obj_conv;
38486 obj_conv.inner = (void*)(obj & (~1));
38487 obj_conv.is_owned = false;
38488 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38489 LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
38490 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38491 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38492 CVec_u8Z_free(ret_var);
38496 uint32_t __attribute__((export_name("TS_FixedPenaltyScorer_read"))) TS_FixedPenaltyScorer_read(int8_tArray ser) {
38497 LDKu8slice ser_ref;
38498 ser_ref.datalen = ser->arr_len;
38499 ser_ref.data = ser->elems /* XXX ser leaks */;
38500 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
38501 *ret_conv = FixedPenaltyScorer_read(ser_ref);
38502 return (uintptr_t)ret_conv;
38505 uint32_t __attribute__((export_name("TS_FixedPenaltyScorer_with_penalty"))) TS_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
38506 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
38507 uintptr_t ret_ref = 0;
38508 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38509 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38510 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38511 ret_ref = (uintptr_t)ret_var.inner;
38512 if (ret_var.is_owned) {
38518 uint32_t __attribute__((export_name("TS_FixedPenaltyScorer_as_Score"))) TS_FixedPenaltyScorer_as_Score(uint32_t this_arg) {
38519 LDKFixedPenaltyScorer this_arg_conv;
38520 this_arg_conv.inner = (void*)(this_arg & (~1));
38521 this_arg_conv.is_owned = false;
38522 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38523 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
38524 *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
38525 return (uintptr_t)ret_ret;
38528 void __attribute__((export_name("TS_Scorer_free"))) TS_Scorer_free(uint32_t this_obj) {
38529 LDKScorer this_obj_conv;
38530 this_obj_conv.inner = (void*)(this_obj & (~1));
38531 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38532 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38533 Scorer_free(this_obj_conv);
38536 void __attribute__((export_name("TS_ScoringParameters_free"))) TS_ScoringParameters_free(uint32_t this_obj) {
38537 LDKScoringParameters this_obj_conv;
38538 this_obj_conv.inner = (void*)(this_obj & (~1));
38539 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38540 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38541 ScoringParameters_free(this_obj_conv);
38544 int64_t __attribute__((export_name("TS_ScoringParameters_get_base_penalty_msat"))) TS_ScoringParameters_get_base_penalty_msat(uint32_t this_ptr) {
38545 LDKScoringParameters this_ptr_conv;
38546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38547 this_ptr_conv.is_owned = false;
38548 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38549 int64_t ret_val = ScoringParameters_get_base_penalty_msat(&this_ptr_conv);
38553 void __attribute__((export_name("TS_ScoringParameters_set_base_penalty_msat"))) TS_ScoringParameters_set_base_penalty_msat(uint32_t this_ptr, int64_t val) {
38554 LDKScoringParameters this_ptr_conv;
38555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38556 this_ptr_conv.is_owned = false;
38557 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38558 ScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
38561 int64_t __attribute__((export_name("TS_ScoringParameters_get_failure_penalty_msat"))) TS_ScoringParameters_get_failure_penalty_msat(uint32_t this_ptr) {
38562 LDKScoringParameters this_ptr_conv;
38563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38564 this_ptr_conv.is_owned = false;
38565 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38566 int64_t ret_val = ScoringParameters_get_failure_penalty_msat(&this_ptr_conv);
38570 void __attribute__((export_name("TS_ScoringParameters_set_failure_penalty_msat"))) TS_ScoringParameters_set_failure_penalty_msat(uint32_t this_ptr, int64_t val) {
38571 LDKScoringParameters this_ptr_conv;
38572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38573 this_ptr_conv.is_owned = false;
38574 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38575 ScoringParameters_set_failure_penalty_msat(&this_ptr_conv, val);
38578 int16_t __attribute__((export_name("TS_ScoringParameters_get_overuse_penalty_start_1024th"))) TS_ScoringParameters_get_overuse_penalty_start_1024th(uint32_t this_ptr) {
38579 LDKScoringParameters this_ptr_conv;
38580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38581 this_ptr_conv.is_owned = false;
38582 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38583 int16_t ret_val = ScoringParameters_get_overuse_penalty_start_1024th(&this_ptr_conv);
38587 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) {
38588 LDKScoringParameters this_ptr_conv;
38589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38590 this_ptr_conv.is_owned = false;
38591 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38592 ScoringParameters_set_overuse_penalty_start_1024th(&this_ptr_conv, val);
38595 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) {
38596 LDKScoringParameters this_ptr_conv;
38597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38598 this_ptr_conv.is_owned = false;
38599 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38600 int64_t ret_val = ScoringParameters_get_overuse_penalty_msat_per_1024th(&this_ptr_conv);
38604 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) {
38605 LDKScoringParameters this_ptr_conv;
38606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38607 this_ptr_conv.is_owned = false;
38608 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38609 ScoringParameters_set_overuse_penalty_msat_per_1024th(&this_ptr_conv, val);
38612 int64_t __attribute__((export_name("TS_ScoringParameters_get_failure_penalty_half_life"))) TS_ScoringParameters_get_failure_penalty_half_life(uint32_t this_ptr) {
38613 LDKScoringParameters this_ptr_conv;
38614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38615 this_ptr_conv.is_owned = false;
38616 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38617 int64_t ret_val = ScoringParameters_get_failure_penalty_half_life(&this_ptr_conv);
38621 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) {
38622 LDKScoringParameters this_ptr_conv;
38623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38624 this_ptr_conv.is_owned = false;
38625 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38626 ScoringParameters_set_failure_penalty_half_life(&this_ptr_conv, val);
38629 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) {
38630 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);
38631 uintptr_t ret_ref = 0;
38632 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38633 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38634 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38635 ret_ref = (uintptr_t)ret_var.inner;
38636 if (ret_var.is_owned) {
38642 static inline uintptr_t ScoringParameters_clone_ptr(LDKScoringParameters *NONNULL_PTR arg) {
38643 LDKScoringParameters ret_var = ScoringParameters_clone(arg);
38644 uintptr_t ret_ref = 0;
38645 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38646 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38647 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38648 ret_ref = (uintptr_t)ret_var.inner;
38649 if (ret_var.is_owned) {
38654 intptr_t __attribute__((export_name("TS_ScoringParameters_clone_ptr"))) TS_ScoringParameters_clone_ptr(uint32_t arg) {
38655 LDKScoringParameters arg_conv;
38656 arg_conv.inner = (void*)(arg & (~1));
38657 arg_conv.is_owned = false;
38658 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38659 intptr_t ret_val = ScoringParameters_clone_ptr(&arg_conv);
38663 uint32_t __attribute__((export_name("TS_ScoringParameters_clone"))) TS_ScoringParameters_clone(uint32_t orig) {
38664 LDKScoringParameters orig_conv;
38665 orig_conv.inner = (void*)(orig & (~1));
38666 orig_conv.is_owned = false;
38667 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38668 LDKScoringParameters ret_var = ScoringParameters_clone(&orig_conv);
38669 uintptr_t ret_ref = 0;
38670 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38671 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38672 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38673 ret_ref = (uintptr_t)ret_var.inner;
38674 if (ret_var.is_owned) {
38680 int8_tArray __attribute__((export_name("TS_ScoringParameters_write"))) TS_ScoringParameters_write(uint32_t obj) {
38681 LDKScoringParameters obj_conv;
38682 obj_conv.inner = (void*)(obj & (~1));
38683 obj_conv.is_owned = false;
38684 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38685 LDKCVec_u8Z ret_var = ScoringParameters_write(&obj_conv);
38686 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38687 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38688 CVec_u8Z_free(ret_var);
38692 uint32_t __attribute__((export_name("TS_ScoringParameters_read"))) TS_ScoringParameters_read(int8_tArray ser) {
38693 LDKu8slice ser_ref;
38694 ser_ref.datalen = ser->arr_len;
38695 ser_ref.data = ser->elems /* XXX ser leaks */;
38696 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
38697 *ret_conv = ScoringParameters_read(ser_ref);
38698 return (uintptr_t)ret_conv;
38701 uint32_t __attribute__((export_name("TS_Scorer_new"))) TS_Scorer_new(uint32_t params) {
38702 LDKScoringParameters params_conv;
38703 params_conv.inner = (void*)(params & (~1));
38704 params_conv.is_owned = (params & 1) || (params == 0);
38705 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
38706 params_conv = ScoringParameters_clone(¶ms_conv);
38707 LDKScorer ret_var = Scorer_new(params_conv);
38708 uintptr_t ret_ref = 0;
38709 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38710 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38711 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38712 ret_ref = (uintptr_t)ret_var.inner;
38713 if (ret_var.is_owned) {
38719 uint32_t __attribute__((export_name("TS_Scorer_default"))) TS_Scorer_default() {
38720 LDKScorer ret_var = Scorer_default();
38721 uintptr_t ret_ref = 0;
38722 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38723 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38724 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38725 ret_ref = (uintptr_t)ret_var.inner;
38726 if (ret_var.is_owned) {
38732 uint32_t __attribute__((export_name("TS_ScoringParameters_default"))) TS_ScoringParameters_default() {
38733 LDKScoringParameters ret_var = ScoringParameters_default();
38734 uintptr_t ret_ref = 0;
38735 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38736 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38737 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38738 ret_ref = (uintptr_t)ret_var.inner;
38739 if (ret_var.is_owned) {
38745 uint32_t __attribute__((export_name("TS_Scorer_as_Score"))) TS_Scorer_as_Score(uint32_t this_arg) {
38746 LDKScorer this_arg_conv;
38747 this_arg_conv.inner = (void*)(this_arg & (~1));
38748 this_arg_conv.is_owned = false;
38749 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38750 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
38751 *ret_ret = Scorer_as_Score(&this_arg_conv);
38752 return (uintptr_t)ret_ret;
38755 int8_tArray __attribute__((export_name("TS_Scorer_write"))) TS_Scorer_write(uint32_t obj) {
38756 LDKScorer obj_conv;
38757 obj_conv.inner = (void*)(obj & (~1));
38758 obj_conv.is_owned = false;
38759 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38760 LDKCVec_u8Z ret_var = Scorer_write(&obj_conv);
38761 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38762 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38763 CVec_u8Z_free(ret_var);
38767 uint32_t __attribute__((export_name("TS_Scorer_read"))) TS_Scorer_read(int8_tArray ser) {
38768 LDKu8slice ser_ref;
38769 ser_ref.datalen = ser->arr_len;
38770 ser_ref.data = ser->elems /* XXX ser leaks */;
38771 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
38772 *ret_conv = Scorer_read(ser_ref);
38773 return (uintptr_t)ret_conv;
38776 void __attribute__((export_name("TS_ProbabilisticScoringParameters_free"))) TS_ProbabilisticScoringParameters_free(uint32_t this_obj) {
38777 LDKProbabilisticScoringParameters this_obj_conv;
38778 this_obj_conv.inner = (void*)(this_obj & (~1));
38779 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38780 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38781 ProbabilisticScoringParameters_free(this_obj_conv);
38784 int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(uint32_t this_ptr) {
38785 LDKProbabilisticScoringParameters this_ptr_conv;
38786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38787 this_ptr_conv.is_owned = false;
38788 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38789 int64_t ret_val = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
38793 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) {
38794 LDKProbabilisticScoringParameters this_ptr_conv;
38795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38796 this_ptr_conv.is_owned = false;
38797 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38798 ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
38801 int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life"))) TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life(uint32_t this_ptr) {
38802 LDKProbabilisticScoringParameters this_ptr_conv;
38803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38804 this_ptr_conv.is_owned = false;
38805 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38806 int64_t ret_val = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
38810 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) {
38811 LDKProbabilisticScoringParameters this_ptr_conv;
38812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38813 this_ptr_conv.is_owned = false;
38814 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38815 ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
38818 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) {
38819 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_new(liquidity_penalty_multiplier_msat_arg, liquidity_offset_half_life_arg);
38820 uintptr_t ret_ref = 0;
38821 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38822 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38823 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38824 ret_ref = (uintptr_t)ret_var.inner;
38825 if (ret_var.is_owned) {
38831 static inline uintptr_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
38832 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
38833 uintptr_t ret_ref = 0;
38834 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38835 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38836 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38837 ret_ref = (uintptr_t)ret_var.inner;
38838 if (ret_var.is_owned) {
38843 intptr_t __attribute__((export_name("TS_ProbabilisticScoringParameters_clone_ptr"))) TS_ProbabilisticScoringParameters_clone_ptr(uint32_t arg) {
38844 LDKProbabilisticScoringParameters arg_conv;
38845 arg_conv.inner = (void*)(arg & (~1));
38846 arg_conv.is_owned = false;
38847 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38848 intptr_t ret_val = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
38852 uint32_t __attribute__((export_name("TS_ProbabilisticScoringParameters_clone"))) TS_ProbabilisticScoringParameters_clone(uint32_t orig) {
38853 LDKProbabilisticScoringParameters orig_conv;
38854 orig_conv.inner = (void*)(orig & (~1));
38855 orig_conv.is_owned = false;
38856 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38857 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
38858 uintptr_t ret_ref = 0;
38859 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38860 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38861 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38862 ret_ref = (uintptr_t)ret_var.inner;
38863 if (ret_var.is_owned) {
38869 int8_tArray __attribute__((export_name("TS_ProbabilisticScoringParameters_write"))) TS_ProbabilisticScoringParameters_write(uint32_t obj) {
38870 LDKProbabilisticScoringParameters obj_conv;
38871 obj_conv.inner = (void*)(obj & (~1));
38872 obj_conv.is_owned = false;
38873 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38874 LDKCVec_u8Z ret_var = ProbabilisticScoringParameters_write(&obj_conv);
38875 int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38876 memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38877 CVec_u8Z_free(ret_var);
38881 uint32_t __attribute__((export_name("TS_ProbabilisticScoringParameters_read"))) TS_ProbabilisticScoringParameters_read(int8_tArray ser) {
38882 LDKu8slice ser_ref;
38883 ser_ref.datalen = ser->arr_len;
38884 ser_ref.data = ser->elems /* XXX ser leaks */;
38885 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ");
38886 *ret_conv = ProbabilisticScoringParameters_read(ser_ref);
38887 return (uintptr_t)ret_conv;
38890 uint32_t __attribute__((export_name("TS_ProbabilisticScoringParameters_default"))) TS_ProbabilisticScoringParameters_default() {
38891 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
38892 uintptr_t ret_ref = 0;
38893 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38894 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38895 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38896 ret_ref = (uintptr_t)ret_var.inner;
38897 if (ret_var.is_owned) {
38903 void __attribute__((export_name("TS_Invoice_free"))) TS_Invoice_free(uint32_t this_obj) {
38904 LDKInvoice this_obj_conv;
38905 this_obj_conv.inner = (void*)(this_obj & (~1));
38906 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38907 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38908 Invoice_free(this_obj_conv);
38911 jboolean __attribute__((export_name("TS_Invoice_eq"))) TS_Invoice_eq(uint32_t a, uint32_t b) {
38913 a_conv.inner = (void*)(a & (~1));
38914 a_conv.is_owned = false;
38915 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38917 b_conv.inner = (void*)(b & (~1));
38918 b_conv.is_owned = false;
38919 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38920 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
38924 static inline uintptr_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
38925 LDKInvoice ret_var = Invoice_clone(arg);
38926 uintptr_t ret_ref = 0;
38927 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38928 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38929 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38930 ret_ref = (uintptr_t)ret_var.inner;
38931 if (ret_var.is_owned) {
38936 intptr_t __attribute__((export_name("TS_Invoice_clone_ptr"))) TS_Invoice_clone_ptr(uint32_t arg) {
38937 LDKInvoice arg_conv;
38938 arg_conv.inner = (void*)(arg & (~1));
38939 arg_conv.is_owned = false;
38940 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38941 intptr_t ret_val = Invoice_clone_ptr(&arg_conv);
38945 uint32_t __attribute__((export_name("TS_Invoice_clone"))) TS_Invoice_clone(uint32_t orig) {
38946 LDKInvoice orig_conv;
38947 orig_conv.inner = (void*)(orig & (~1));
38948 orig_conv.is_owned = false;
38949 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38950 LDKInvoice ret_var = Invoice_clone(&orig_conv);
38951 uintptr_t ret_ref = 0;
38952 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38953 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38954 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38955 ret_ref = (uintptr_t)ret_var.inner;
38956 if (ret_var.is_owned) {
38962 void __attribute__((export_name("TS_SignedRawInvoice_free"))) TS_SignedRawInvoice_free(uint32_t this_obj) {
38963 LDKSignedRawInvoice this_obj_conv;
38964 this_obj_conv.inner = (void*)(this_obj & (~1));
38965 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38966 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38967 SignedRawInvoice_free(this_obj_conv);
38970 jboolean __attribute__((export_name("TS_SignedRawInvoice_eq"))) TS_SignedRawInvoice_eq(uint32_t a, uint32_t b) {
38971 LDKSignedRawInvoice a_conv;
38972 a_conv.inner = (void*)(a & (~1));
38973 a_conv.is_owned = false;
38974 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38975 LDKSignedRawInvoice b_conv;
38976 b_conv.inner = (void*)(b & (~1));
38977 b_conv.is_owned = false;
38978 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38979 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
38983 static inline uintptr_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
38984 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
38985 uintptr_t ret_ref = 0;
38986 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38987 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38988 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38989 ret_ref = (uintptr_t)ret_var.inner;
38990 if (ret_var.is_owned) {
38995 intptr_t __attribute__((export_name("TS_SignedRawInvoice_clone_ptr"))) TS_SignedRawInvoice_clone_ptr(uint32_t arg) {
38996 LDKSignedRawInvoice arg_conv;
38997 arg_conv.inner = (void*)(arg & (~1));
38998 arg_conv.is_owned = false;
38999 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39000 intptr_t ret_val = SignedRawInvoice_clone_ptr(&arg_conv);
39004 uint32_t __attribute__((export_name("TS_SignedRawInvoice_clone"))) TS_SignedRawInvoice_clone(uint32_t orig) {
39005 LDKSignedRawInvoice orig_conv;
39006 orig_conv.inner = (void*)(orig & (~1));
39007 orig_conv.is_owned = false;
39008 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39009 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
39010 uintptr_t ret_ref = 0;
39011 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39012 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39013 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39014 ret_ref = (uintptr_t)ret_var.inner;
39015 if (ret_var.is_owned) {
39021 void __attribute__((export_name("TS_RawInvoice_free"))) TS_RawInvoice_free(uint32_t this_obj) {
39022 LDKRawInvoice this_obj_conv;
39023 this_obj_conv.inner = (void*)(this_obj & (~1));
39024 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39025 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39026 RawInvoice_free(this_obj_conv);
39029 uint32_t __attribute__((export_name("TS_RawInvoice_get_data"))) TS_RawInvoice_get_data(uint32_t this_ptr) {
39030 LDKRawInvoice this_ptr_conv;
39031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39032 this_ptr_conv.is_owned = false;
39033 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39034 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
39035 uintptr_t ret_ref = 0;
39036 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39037 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39038 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39039 ret_ref = (uintptr_t)ret_var.inner;
39040 if (ret_var.is_owned) {
39046 void __attribute__((export_name("TS_RawInvoice_set_data"))) TS_RawInvoice_set_data(uint32_t this_ptr, uint32_t val) {
39047 LDKRawInvoice this_ptr_conv;
39048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39049 this_ptr_conv.is_owned = false;
39050 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39051 LDKRawDataPart val_conv;
39052 val_conv.inner = (void*)(val & (~1));
39053 val_conv.is_owned = (val & 1) || (val == 0);
39054 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39055 val_conv = RawDataPart_clone(&val_conv);
39056 RawInvoice_set_data(&this_ptr_conv, val_conv);
39059 jboolean __attribute__((export_name("TS_RawInvoice_eq"))) TS_RawInvoice_eq(uint32_t a, uint32_t b) {
39060 LDKRawInvoice a_conv;
39061 a_conv.inner = (void*)(a & (~1));
39062 a_conv.is_owned = false;
39063 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39064 LDKRawInvoice b_conv;
39065 b_conv.inner = (void*)(b & (~1));
39066 b_conv.is_owned = false;
39067 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39068 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
39072 static inline uintptr_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
39073 LDKRawInvoice ret_var = RawInvoice_clone(arg);
39074 uintptr_t ret_ref = 0;
39075 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39076 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39077 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39078 ret_ref = (uintptr_t)ret_var.inner;
39079 if (ret_var.is_owned) {
39084 intptr_t __attribute__((export_name("TS_RawInvoice_clone_ptr"))) TS_RawInvoice_clone_ptr(uint32_t arg) {
39085 LDKRawInvoice arg_conv;
39086 arg_conv.inner = (void*)(arg & (~1));
39087 arg_conv.is_owned = false;
39088 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39089 intptr_t ret_val = RawInvoice_clone_ptr(&arg_conv);
39093 uint32_t __attribute__((export_name("TS_RawInvoice_clone"))) TS_RawInvoice_clone(uint32_t orig) {
39094 LDKRawInvoice orig_conv;
39095 orig_conv.inner = (void*)(orig & (~1));
39096 orig_conv.is_owned = false;
39097 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39098 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
39099 uintptr_t ret_ref = 0;
39100 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39101 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39102 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39103 ret_ref = (uintptr_t)ret_var.inner;
39104 if (ret_var.is_owned) {
39110 void __attribute__((export_name("TS_RawDataPart_free"))) TS_RawDataPart_free(uint32_t this_obj) {
39111 LDKRawDataPart this_obj_conv;
39112 this_obj_conv.inner = (void*)(this_obj & (~1));
39113 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39114 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39115 RawDataPart_free(this_obj_conv);
39118 uint32_t __attribute__((export_name("TS_RawDataPart_get_timestamp"))) TS_RawDataPart_get_timestamp(uint32_t this_ptr) {
39119 LDKRawDataPart this_ptr_conv;
39120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39121 this_ptr_conv.is_owned = false;
39122 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39123 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
39124 uintptr_t ret_ref = 0;
39125 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39126 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39127 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39128 ret_ref = (uintptr_t)ret_var.inner;
39129 if (ret_var.is_owned) {
39135 void __attribute__((export_name("TS_RawDataPart_set_timestamp"))) TS_RawDataPart_set_timestamp(uint32_t this_ptr, uint32_t val) {
39136 LDKRawDataPart this_ptr_conv;
39137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39138 this_ptr_conv.is_owned = false;
39139 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39140 LDKPositiveTimestamp val_conv;
39141 val_conv.inner = (void*)(val & (~1));
39142 val_conv.is_owned = (val & 1) || (val == 0);
39143 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39144 val_conv = PositiveTimestamp_clone(&val_conv);
39145 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
39148 jboolean __attribute__((export_name("TS_RawDataPart_eq"))) TS_RawDataPart_eq(uint32_t a, uint32_t b) {
39149 LDKRawDataPart a_conv;
39150 a_conv.inner = (void*)(a & (~1));
39151 a_conv.is_owned = false;
39152 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39153 LDKRawDataPart b_conv;
39154 b_conv.inner = (void*)(b & (~1));
39155 b_conv.is_owned = false;
39156 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39157 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
39161 static inline uintptr_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
39162 LDKRawDataPart ret_var = RawDataPart_clone(arg);
39163 uintptr_t ret_ref = 0;
39164 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39165 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39166 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39167 ret_ref = (uintptr_t)ret_var.inner;
39168 if (ret_var.is_owned) {
39173 intptr_t __attribute__((export_name("TS_RawDataPart_clone_ptr"))) TS_RawDataPart_clone_ptr(uint32_t arg) {
39174 LDKRawDataPart arg_conv;
39175 arg_conv.inner = (void*)(arg & (~1));
39176 arg_conv.is_owned = false;
39177 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39178 intptr_t ret_val = RawDataPart_clone_ptr(&arg_conv);
39182 uint32_t __attribute__((export_name("TS_RawDataPart_clone"))) TS_RawDataPart_clone(uint32_t orig) {
39183 LDKRawDataPart orig_conv;
39184 orig_conv.inner = (void*)(orig & (~1));
39185 orig_conv.is_owned = false;
39186 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39187 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
39188 uintptr_t ret_ref = 0;
39189 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39190 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39191 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39192 ret_ref = (uintptr_t)ret_var.inner;
39193 if (ret_var.is_owned) {
39199 void __attribute__((export_name("TS_PositiveTimestamp_free"))) TS_PositiveTimestamp_free(uint32_t this_obj) {
39200 LDKPositiveTimestamp this_obj_conv;
39201 this_obj_conv.inner = (void*)(this_obj & (~1));
39202 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39203 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39204 PositiveTimestamp_free(this_obj_conv);
39207 jboolean __attribute__((export_name("TS_PositiveTimestamp_eq"))) TS_PositiveTimestamp_eq(uint32_t a, uint32_t b) {
39208 LDKPositiveTimestamp a_conv;
39209 a_conv.inner = (void*)(a & (~1));
39210 a_conv.is_owned = false;
39211 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39212 LDKPositiveTimestamp b_conv;
39213 b_conv.inner = (void*)(b & (~1));
39214 b_conv.is_owned = false;
39215 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39216 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
39220 static inline uintptr_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
39221 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
39222 uintptr_t ret_ref = 0;
39223 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39224 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39225 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39226 ret_ref = (uintptr_t)ret_var.inner;
39227 if (ret_var.is_owned) {
39232 intptr_t __attribute__((export_name("TS_PositiveTimestamp_clone_ptr"))) TS_PositiveTimestamp_clone_ptr(uint32_t arg) {
39233 LDKPositiveTimestamp arg_conv;
39234 arg_conv.inner = (void*)(arg & (~1));
39235 arg_conv.is_owned = false;
39236 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39237 intptr_t ret_val = PositiveTimestamp_clone_ptr(&arg_conv);
39241 uint32_t __attribute__((export_name("TS_PositiveTimestamp_clone"))) TS_PositiveTimestamp_clone(uint32_t orig) {
39242 LDKPositiveTimestamp orig_conv;
39243 orig_conv.inner = (void*)(orig & (~1));
39244 orig_conv.is_owned = false;
39245 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39246 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
39247 uintptr_t ret_ref = 0;
39248 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39249 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39250 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39251 ret_ref = (uintptr_t)ret_var.inner;
39252 if (ret_var.is_owned) {
39258 uint32_t __attribute__((export_name("TS_SiPrefix_clone"))) TS_SiPrefix_clone(uint32_t orig) {
39259 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
39260 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
39264 uint32_t __attribute__((export_name("TS_SiPrefix_milli"))) TS_SiPrefix_milli() {
39265 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
39269 uint32_t __attribute__((export_name("TS_SiPrefix_micro"))) TS_SiPrefix_micro() {
39270 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
39274 uint32_t __attribute__((export_name("TS_SiPrefix_nano"))) TS_SiPrefix_nano() {
39275 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
39279 uint32_t __attribute__((export_name("TS_SiPrefix_pico"))) TS_SiPrefix_pico() {
39280 uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
39284 jboolean __attribute__((export_name("TS_SiPrefix_eq"))) TS_SiPrefix_eq(uint32_t a, uint32_t b) {
39285 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
39286 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
39287 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
39291 int64_t __attribute__((export_name("TS_SiPrefix_multiplier"))) TS_SiPrefix_multiplier(uint32_t this_arg) {
39292 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
39293 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
39297 uint32_t __attribute__((export_name("TS_Currency_clone"))) TS_Currency_clone(uint32_t orig) {
39298 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
39299 uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
39303 uint32_t __attribute__((export_name("TS_Currency_bitcoin"))) TS_Currency_bitcoin() {
39304 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
39308 uint32_t __attribute__((export_name("TS_Currency_bitcoin_testnet"))) TS_Currency_bitcoin_testnet() {
39309 uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
39313 uint32_t __attribute__((export_name("TS_Currency_regtest"))) TS_Currency_regtest() {
39314 uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
39318 uint32_t __attribute__((export_name("TS_Currency_simnet"))) TS_Currency_simnet() {
39319 uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
39323 uint32_t __attribute__((export_name("TS_Currency_signet"))) TS_Currency_signet() {
39324 uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
39328 int64_t __attribute__((export_name("TS_Currency_hash"))) TS_Currency_hash(uint32_t o) {
39329 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
39330 int64_t ret_val = Currency_hash(o_conv);
39334 jboolean __attribute__((export_name("TS_Currency_eq"))) TS_Currency_eq(uint32_t a, uint32_t b) {
39335 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
39336 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
39337 jboolean ret_val = Currency_eq(a_conv, b_conv);
39341 void __attribute__((export_name("TS_Sha256_free"))) TS_Sha256_free(uint32_t this_obj) {
39342 LDKSha256 this_obj_conv;
39343 this_obj_conv.inner = (void*)(this_obj & (~1));
39344 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39345 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39346 Sha256_free(this_obj_conv);
39349 static inline uintptr_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
39350 LDKSha256 ret_var = Sha256_clone(arg);
39351 uintptr_t ret_ref = 0;
39352 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39353 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39354 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39355 ret_ref = (uintptr_t)ret_var.inner;
39356 if (ret_var.is_owned) {
39361 intptr_t __attribute__((export_name("TS_Sha256_clone_ptr"))) TS_Sha256_clone_ptr(uint32_t arg) {
39362 LDKSha256 arg_conv;
39363 arg_conv.inner = (void*)(arg & (~1));
39364 arg_conv.is_owned = false;
39365 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39366 intptr_t ret_val = Sha256_clone_ptr(&arg_conv);
39370 uint32_t __attribute__((export_name("TS_Sha256_clone"))) TS_Sha256_clone(uint32_t orig) {
39371 LDKSha256 orig_conv;
39372 orig_conv.inner = (void*)(orig & (~1));
39373 orig_conv.is_owned = false;
39374 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39375 LDKSha256 ret_var = Sha256_clone(&orig_conv);
39376 uintptr_t ret_ref = 0;
39377 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39378 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39379 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39380 ret_ref = (uintptr_t)ret_var.inner;
39381 if (ret_var.is_owned) {
39387 int64_t __attribute__((export_name("TS_Sha256_hash"))) TS_Sha256_hash(uint32_t o) {
39389 o_conv.inner = (void*)(o & (~1));
39390 o_conv.is_owned = false;
39391 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39392 int64_t ret_val = Sha256_hash(&o_conv);
39396 jboolean __attribute__((export_name("TS_Sha256_eq"))) TS_Sha256_eq(uint32_t a, uint32_t b) {
39398 a_conv.inner = (void*)(a & (~1));
39399 a_conv.is_owned = false;
39400 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39402 b_conv.inner = (void*)(b & (~1));
39403 b_conv.is_owned = false;
39404 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39405 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
39409 void __attribute__((export_name("TS_Description_free"))) TS_Description_free(uint32_t this_obj) {
39410 LDKDescription this_obj_conv;
39411 this_obj_conv.inner = (void*)(this_obj & (~1));
39412 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39413 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39414 Description_free(this_obj_conv);
39417 static inline uintptr_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
39418 LDKDescription ret_var = Description_clone(arg);
39419 uintptr_t ret_ref = 0;
39420 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39421 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39422 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39423 ret_ref = (uintptr_t)ret_var.inner;
39424 if (ret_var.is_owned) {
39429 intptr_t __attribute__((export_name("TS_Description_clone_ptr"))) TS_Description_clone_ptr(uint32_t arg) {
39430 LDKDescription arg_conv;
39431 arg_conv.inner = (void*)(arg & (~1));
39432 arg_conv.is_owned = false;
39433 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39434 intptr_t ret_val = Description_clone_ptr(&arg_conv);
39438 uint32_t __attribute__((export_name("TS_Description_clone"))) TS_Description_clone(uint32_t orig) {
39439 LDKDescription orig_conv;
39440 orig_conv.inner = (void*)(orig & (~1));
39441 orig_conv.is_owned = false;
39442 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39443 LDKDescription ret_var = Description_clone(&orig_conv);
39444 uintptr_t ret_ref = 0;
39445 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39446 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39447 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39448 ret_ref = (uintptr_t)ret_var.inner;
39449 if (ret_var.is_owned) {
39455 int64_t __attribute__((export_name("TS_Description_hash"))) TS_Description_hash(uint32_t o) {
39456 LDKDescription o_conv;
39457 o_conv.inner = (void*)(o & (~1));
39458 o_conv.is_owned = false;
39459 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39460 int64_t ret_val = Description_hash(&o_conv);
39464 jboolean __attribute__((export_name("TS_Description_eq"))) TS_Description_eq(uint32_t a, uint32_t b) {
39465 LDKDescription a_conv;
39466 a_conv.inner = (void*)(a & (~1));
39467 a_conv.is_owned = false;
39468 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39469 LDKDescription b_conv;
39470 b_conv.inner = (void*)(b & (~1));
39471 b_conv.is_owned = false;
39472 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39473 jboolean ret_val = Description_eq(&a_conv, &b_conv);
39477 void __attribute__((export_name("TS_PayeePubKey_free"))) TS_PayeePubKey_free(uint32_t this_obj) {
39478 LDKPayeePubKey this_obj_conv;
39479 this_obj_conv.inner = (void*)(this_obj & (~1));
39480 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39481 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39482 PayeePubKey_free(this_obj_conv);
39485 int8_tArray __attribute__((export_name("TS_PayeePubKey_get_a"))) TS_PayeePubKey_get_a(uint32_t this_ptr) {
39486 LDKPayeePubKey this_ptr_conv;
39487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39488 this_ptr_conv.is_owned = false;
39489 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39490 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39491 memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
39495 void __attribute__((export_name("TS_PayeePubKey_set_a"))) TS_PayeePubKey_set_a(uint32_t this_ptr, int8_tArray val) {
39496 LDKPayeePubKey this_ptr_conv;
39497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39498 this_ptr_conv.is_owned = false;
39499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39500 LDKPublicKey val_ref;
39501 CHECK(val->arr_len == 33);
39502 memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39503 PayeePubKey_set_a(&this_ptr_conv, val_ref);
39506 uint32_t __attribute__((export_name("TS_PayeePubKey_new"))) TS_PayeePubKey_new(int8_tArray a_arg) {
39507 LDKPublicKey a_arg_ref;
39508 CHECK(a_arg->arr_len == 33);
39509 memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
39510 LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
39511 uintptr_t ret_ref = 0;
39512 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39513 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39514 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39515 ret_ref = (uintptr_t)ret_var.inner;
39516 if (ret_var.is_owned) {
39522 static inline uintptr_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
39523 LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
39524 uintptr_t ret_ref = 0;
39525 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39526 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39527 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39528 ret_ref = (uintptr_t)ret_var.inner;
39529 if (ret_var.is_owned) {
39534 intptr_t __attribute__((export_name("TS_PayeePubKey_clone_ptr"))) TS_PayeePubKey_clone_ptr(uint32_t arg) {
39535 LDKPayeePubKey arg_conv;
39536 arg_conv.inner = (void*)(arg & (~1));
39537 arg_conv.is_owned = false;
39538 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39539 intptr_t ret_val = PayeePubKey_clone_ptr(&arg_conv);
39543 uint32_t __attribute__((export_name("TS_PayeePubKey_clone"))) TS_PayeePubKey_clone(uint32_t orig) {
39544 LDKPayeePubKey orig_conv;
39545 orig_conv.inner = (void*)(orig & (~1));
39546 orig_conv.is_owned = false;
39547 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39548 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
39549 uintptr_t ret_ref = 0;
39550 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39551 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39552 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39553 ret_ref = (uintptr_t)ret_var.inner;
39554 if (ret_var.is_owned) {
39560 int64_t __attribute__((export_name("TS_PayeePubKey_hash"))) TS_PayeePubKey_hash(uint32_t o) {
39561 LDKPayeePubKey o_conv;
39562 o_conv.inner = (void*)(o & (~1));
39563 o_conv.is_owned = false;
39564 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39565 int64_t ret_val = PayeePubKey_hash(&o_conv);
39569 jboolean __attribute__((export_name("TS_PayeePubKey_eq"))) TS_PayeePubKey_eq(uint32_t a, uint32_t b) {
39570 LDKPayeePubKey a_conv;
39571 a_conv.inner = (void*)(a & (~1));
39572 a_conv.is_owned = false;
39573 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39574 LDKPayeePubKey b_conv;
39575 b_conv.inner = (void*)(b & (~1));
39576 b_conv.is_owned = false;
39577 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39578 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
39582 void __attribute__((export_name("TS_ExpiryTime_free"))) TS_ExpiryTime_free(uint32_t this_obj) {
39583 LDKExpiryTime this_obj_conv;
39584 this_obj_conv.inner = (void*)(this_obj & (~1));
39585 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39586 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39587 ExpiryTime_free(this_obj_conv);
39590 static inline uintptr_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
39591 LDKExpiryTime ret_var = ExpiryTime_clone(arg);
39592 uintptr_t ret_ref = 0;
39593 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39594 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39595 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39596 ret_ref = (uintptr_t)ret_var.inner;
39597 if (ret_var.is_owned) {
39602 intptr_t __attribute__((export_name("TS_ExpiryTime_clone_ptr"))) TS_ExpiryTime_clone_ptr(uint32_t arg) {
39603 LDKExpiryTime arg_conv;
39604 arg_conv.inner = (void*)(arg & (~1));
39605 arg_conv.is_owned = false;
39606 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39607 intptr_t ret_val = ExpiryTime_clone_ptr(&arg_conv);
39611 uint32_t __attribute__((export_name("TS_ExpiryTime_clone"))) TS_ExpiryTime_clone(uint32_t orig) {
39612 LDKExpiryTime orig_conv;
39613 orig_conv.inner = (void*)(orig & (~1));
39614 orig_conv.is_owned = false;
39615 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39616 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
39617 uintptr_t ret_ref = 0;
39618 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39619 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39620 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39621 ret_ref = (uintptr_t)ret_var.inner;
39622 if (ret_var.is_owned) {
39628 int64_t __attribute__((export_name("TS_ExpiryTime_hash"))) TS_ExpiryTime_hash(uint32_t o) {
39629 LDKExpiryTime o_conv;
39630 o_conv.inner = (void*)(o & (~1));
39631 o_conv.is_owned = false;
39632 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39633 int64_t ret_val = ExpiryTime_hash(&o_conv);
39637 jboolean __attribute__((export_name("TS_ExpiryTime_eq"))) TS_ExpiryTime_eq(uint32_t a, uint32_t b) {
39638 LDKExpiryTime a_conv;
39639 a_conv.inner = (void*)(a & (~1));
39640 a_conv.is_owned = false;
39641 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39642 LDKExpiryTime b_conv;
39643 b_conv.inner = (void*)(b & (~1));
39644 b_conv.is_owned = false;
39645 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39646 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
39650 void __attribute__((export_name("TS_MinFinalCltvExpiry_free"))) TS_MinFinalCltvExpiry_free(uint32_t this_obj) {
39651 LDKMinFinalCltvExpiry this_obj_conv;
39652 this_obj_conv.inner = (void*)(this_obj & (~1));
39653 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39654 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39655 MinFinalCltvExpiry_free(this_obj_conv);
39658 int64_t __attribute__((export_name("TS_MinFinalCltvExpiry_get_a"))) TS_MinFinalCltvExpiry_get_a(uint32_t this_ptr) {
39659 LDKMinFinalCltvExpiry this_ptr_conv;
39660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39661 this_ptr_conv.is_owned = false;
39662 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39663 int64_t ret_val = MinFinalCltvExpiry_get_a(&this_ptr_conv);
39667 void __attribute__((export_name("TS_MinFinalCltvExpiry_set_a"))) TS_MinFinalCltvExpiry_set_a(uint32_t this_ptr, int64_t val) {
39668 LDKMinFinalCltvExpiry this_ptr_conv;
39669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39670 this_ptr_conv.is_owned = false;
39671 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39672 MinFinalCltvExpiry_set_a(&this_ptr_conv, val);
39675 uint32_t __attribute__((export_name("TS_MinFinalCltvExpiry_new"))) TS_MinFinalCltvExpiry_new(int64_t a_arg) {
39676 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg);
39677 uintptr_t ret_ref = 0;
39678 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39679 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39680 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39681 ret_ref = (uintptr_t)ret_var.inner;
39682 if (ret_var.is_owned) {
39688 static inline uintptr_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) {
39689 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(arg);
39690 uintptr_t ret_ref = 0;
39691 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39692 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39693 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39694 ret_ref = (uintptr_t)ret_var.inner;
39695 if (ret_var.is_owned) {
39700 intptr_t __attribute__((export_name("TS_MinFinalCltvExpiry_clone_ptr"))) TS_MinFinalCltvExpiry_clone_ptr(uint32_t arg) {
39701 LDKMinFinalCltvExpiry arg_conv;
39702 arg_conv.inner = (void*)(arg & (~1));
39703 arg_conv.is_owned = false;
39704 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39705 intptr_t ret_val = MinFinalCltvExpiry_clone_ptr(&arg_conv);
39709 uint32_t __attribute__((export_name("TS_MinFinalCltvExpiry_clone"))) TS_MinFinalCltvExpiry_clone(uint32_t orig) {
39710 LDKMinFinalCltvExpiry orig_conv;
39711 orig_conv.inner = (void*)(orig & (~1));
39712 orig_conv.is_owned = false;
39713 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39714 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
39715 uintptr_t ret_ref = 0;
39716 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39717 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39718 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39719 ret_ref = (uintptr_t)ret_var.inner;
39720 if (ret_var.is_owned) {
39726 int64_t __attribute__((export_name("TS_MinFinalCltvExpiry_hash"))) TS_MinFinalCltvExpiry_hash(uint32_t o) {
39727 LDKMinFinalCltvExpiry o_conv;
39728 o_conv.inner = (void*)(o & (~1));
39729 o_conv.is_owned = false;
39730 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39731 int64_t ret_val = MinFinalCltvExpiry_hash(&o_conv);
39735 jboolean __attribute__((export_name("TS_MinFinalCltvExpiry_eq"))) TS_MinFinalCltvExpiry_eq(uint32_t a, uint32_t b) {
39736 LDKMinFinalCltvExpiry a_conv;
39737 a_conv.inner = (void*)(a & (~1));
39738 a_conv.is_owned = false;
39739 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39740 LDKMinFinalCltvExpiry b_conv;
39741 b_conv.inner = (void*)(b & (~1));
39742 b_conv.is_owned = false;
39743 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39744 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
39748 void __attribute__((export_name("TS_Fallback_free"))) TS_Fallback_free(uint32_t this_ptr) {
39749 if ((this_ptr & 1) != 0) return;
39750 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
39751 CHECK_ACCESS(this_ptr_ptr);
39752 LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
39753 FREE((void*)this_ptr);
39754 Fallback_free(this_ptr_conv);
39757 static inline uintptr_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
39758 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
39759 *ret_copy = Fallback_clone(arg);
39760 uintptr_t ret_ref = (uintptr_t)ret_copy;
39763 intptr_t __attribute__((export_name("TS_Fallback_clone_ptr"))) TS_Fallback_clone_ptr(uint32_t arg) {
39764 LDKFallback* arg_conv = (LDKFallback*)arg;
39765 intptr_t ret_val = Fallback_clone_ptr(arg_conv);
39769 uint32_t __attribute__((export_name("TS_Fallback_clone"))) TS_Fallback_clone(uint32_t orig) {
39770 LDKFallback* orig_conv = (LDKFallback*)orig;
39771 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
39772 *ret_copy = Fallback_clone(orig_conv);
39773 uintptr_t ret_ref = (uintptr_t)ret_copy;
39777 uint32_t __attribute__((export_name("TS_Fallback_seg_wit_program"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
39779 LDKCVec_u8Z program_ref;
39780 program_ref.datalen = program->arr_len;
39781 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
39782 memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
39783 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
39784 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
39785 uintptr_t ret_ref = (uintptr_t)ret_copy;
39789 uint32_t __attribute__((export_name("TS_Fallback_pub_key_hash"))) TS_Fallback_pub_key_hash(int8_tArray a) {
39790 LDKTwentyBytes a_ref;
39791 CHECK(a->arr_len == 20);
39792 memcpy(a_ref.data, a->elems, 20); FREE(a);
39793 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
39794 *ret_copy = Fallback_pub_key_hash(a_ref);
39795 uintptr_t ret_ref = (uintptr_t)ret_copy;
39799 uint32_t __attribute__((export_name("TS_Fallback_script_hash"))) TS_Fallback_script_hash(int8_tArray a) {
39800 LDKTwentyBytes a_ref;
39801 CHECK(a->arr_len == 20);
39802 memcpy(a_ref.data, a->elems, 20); FREE(a);
39803 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
39804 *ret_copy = Fallback_script_hash(a_ref);
39805 uintptr_t ret_ref = (uintptr_t)ret_copy;
39809 int64_t __attribute__((export_name("TS_Fallback_hash"))) TS_Fallback_hash(uint32_t o) {
39810 LDKFallback* o_conv = (LDKFallback*)o;
39811 int64_t ret_val = Fallback_hash(o_conv);
39815 jboolean __attribute__((export_name("TS_Fallback_eq"))) TS_Fallback_eq(uint32_t a, uint32_t b) {
39816 LDKFallback* a_conv = (LDKFallback*)a;
39817 LDKFallback* b_conv = (LDKFallback*)b;
39818 jboolean ret_val = Fallback_eq(a_conv, b_conv);
39822 void __attribute__((export_name("TS_InvoiceSignature_free"))) TS_InvoiceSignature_free(uint32_t this_obj) {
39823 LDKInvoiceSignature this_obj_conv;
39824 this_obj_conv.inner = (void*)(this_obj & (~1));
39825 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39826 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39827 InvoiceSignature_free(this_obj_conv);
39830 static inline uintptr_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
39831 LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
39832 uintptr_t ret_ref = 0;
39833 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39834 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39835 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39836 ret_ref = (uintptr_t)ret_var.inner;
39837 if (ret_var.is_owned) {
39842 intptr_t __attribute__((export_name("TS_InvoiceSignature_clone_ptr"))) TS_InvoiceSignature_clone_ptr(uint32_t arg) {
39843 LDKInvoiceSignature arg_conv;
39844 arg_conv.inner = (void*)(arg & (~1));
39845 arg_conv.is_owned = false;
39846 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39847 intptr_t ret_val = InvoiceSignature_clone_ptr(&arg_conv);
39851 uint32_t __attribute__((export_name("TS_InvoiceSignature_clone"))) TS_InvoiceSignature_clone(uint32_t orig) {
39852 LDKInvoiceSignature orig_conv;
39853 orig_conv.inner = (void*)(orig & (~1));
39854 orig_conv.is_owned = false;
39855 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39856 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
39857 uintptr_t ret_ref = 0;
39858 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39859 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39860 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39861 ret_ref = (uintptr_t)ret_var.inner;
39862 if (ret_var.is_owned) {
39868 jboolean __attribute__((export_name("TS_InvoiceSignature_eq"))) TS_InvoiceSignature_eq(uint32_t a, uint32_t b) {
39869 LDKInvoiceSignature a_conv;
39870 a_conv.inner = (void*)(a & (~1));
39871 a_conv.is_owned = false;
39872 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39873 LDKInvoiceSignature b_conv;
39874 b_conv.inner = (void*)(b & (~1));
39875 b_conv.is_owned = false;
39876 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39877 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
39881 void __attribute__((export_name("TS_PrivateRoute_free"))) TS_PrivateRoute_free(uint32_t this_obj) {
39882 LDKPrivateRoute this_obj_conv;
39883 this_obj_conv.inner = (void*)(this_obj & (~1));
39884 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39885 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39886 PrivateRoute_free(this_obj_conv);
39889 static inline uintptr_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
39890 LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
39891 uintptr_t ret_ref = 0;
39892 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39893 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39894 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39895 ret_ref = (uintptr_t)ret_var.inner;
39896 if (ret_var.is_owned) {
39901 intptr_t __attribute__((export_name("TS_PrivateRoute_clone_ptr"))) TS_PrivateRoute_clone_ptr(uint32_t arg) {
39902 LDKPrivateRoute arg_conv;
39903 arg_conv.inner = (void*)(arg & (~1));
39904 arg_conv.is_owned = false;
39905 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39906 intptr_t ret_val = PrivateRoute_clone_ptr(&arg_conv);
39910 uint32_t __attribute__((export_name("TS_PrivateRoute_clone"))) TS_PrivateRoute_clone(uint32_t orig) {
39911 LDKPrivateRoute orig_conv;
39912 orig_conv.inner = (void*)(orig & (~1));
39913 orig_conv.is_owned = false;
39914 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39915 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
39916 uintptr_t ret_ref = 0;
39917 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39918 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39919 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39920 ret_ref = (uintptr_t)ret_var.inner;
39921 if (ret_var.is_owned) {
39927 int64_t __attribute__((export_name("TS_PrivateRoute_hash"))) TS_PrivateRoute_hash(uint32_t o) {
39928 LDKPrivateRoute o_conv;
39929 o_conv.inner = (void*)(o & (~1));
39930 o_conv.is_owned = false;
39931 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39932 int64_t ret_val = PrivateRoute_hash(&o_conv);
39936 jboolean __attribute__((export_name("TS_PrivateRoute_eq"))) TS_PrivateRoute_eq(uint32_t a, uint32_t b) {
39937 LDKPrivateRoute a_conv;
39938 a_conv.inner = (void*)(a & (~1));
39939 a_conv.is_owned = false;
39940 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39941 LDKPrivateRoute b_conv;
39942 b_conv.inner = (void*)(b & (~1));
39943 b_conv.is_owned = false;
39944 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39945 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
39949 uint32_t __attribute__((export_name("TS_SignedRawInvoice_into_parts"))) TS_SignedRawInvoice_into_parts(uint32_t this_arg) {
39950 LDKSignedRawInvoice this_arg_conv;
39951 this_arg_conv.inner = (void*)(this_arg & (~1));
39952 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
39953 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39954 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
39955 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
39956 *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
39957 return ((uintptr_t)ret_conv);
39960 uint32_t __attribute__((export_name("TS_SignedRawInvoice_raw_invoice"))) TS_SignedRawInvoice_raw_invoice(uint32_t this_arg) {
39961 LDKSignedRawInvoice this_arg_conv;
39962 this_arg_conv.inner = (void*)(this_arg & (~1));
39963 this_arg_conv.is_owned = false;
39964 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39965 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
39966 uintptr_t ret_ref = 0;
39967 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39968 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39969 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39970 ret_ref = (uintptr_t)ret_var.inner;
39971 if (ret_var.is_owned) {
39977 int8_tArray __attribute__((export_name("TS_SignedRawInvoice_hash"))) TS_SignedRawInvoice_hash(uint32_t this_arg) {
39978 LDKSignedRawInvoice this_arg_conv;
39979 this_arg_conv.inner = (void*)(this_arg & (~1));
39980 this_arg_conv.is_owned = false;
39981 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39982 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39983 memcpy(ret_arr->elems, *SignedRawInvoice_hash(&this_arg_conv), 32);
39987 uint32_t __attribute__((export_name("TS_SignedRawInvoice_signature"))) TS_SignedRawInvoice_signature(uint32_t this_arg) {
39988 LDKSignedRawInvoice this_arg_conv;
39989 this_arg_conv.inner = (void*)(this_arg & (~1));
39990 this_arg_conv.is_owned = false;
39991 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39992 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
39993 uintptr_t ret_ref = 0;
39994 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39995 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39996 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39997 ret_ref = (uintptr_t)ret_var.inner;
39998 if (ret_var.is_owned) {
40004 uint32_t __attribute__((export_name("TS_SignedRawInvoice_recover_payee_pub_key"))) TS_SignedRawInvoice_recover_payee_pub_key(uint32_t this_arg) {
40005 LDKSignedRawInvoice this_arg_conv;
40006 this_arg_conv.inner = (void*)(this_arg & (~1));
40007 this_arg_conv.is_owned = false;
40008 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40009 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
40010 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
40011 return (uintptr_t)ret_conv;
40014 jboolean __attribute__((export_name("TS_SignedRawInvoice_check_signature"))) TS_SignedRawInvoice_check_signature(uint32_t this_arg) {
40015 LDKSignedRawInvoice this_arg_conv;
40016 this_arg_conv.inner = (void*)(this_arg & (~1));
40017 this_arg_conv.is_owned = false;
40018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40019 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
40023 int8_tArray __attribute__((export_name("TS_RawInvoice_hash"))) TS_RawInvoice_hash(uint32_t this_arg) {
40024 LDKRawInvoice this_arg_conv;
40025 this_arg_conv.inner = (void*)(this_arg & (~1));
40026 this_arg_conv.is_owned = false;
40027 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40028 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40029 memcpy(ret_arr->elems, RawInvoice_hash(&this_arg_conv).data, 32);
40033 uint32_t __attribute__((export_name("TS_RawInvoice_payment_hash"))) TS_RawInvoice_payment_hash(uint32_t this_arg) {
40034 LDKRawInvoice this_arg_conv;
40035 this_arg_conv.inner = (void*)(this_arg & (~1));
40036 this_arg_conv.is_owned = false;
40037 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40038 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
40039 uintptr_t ret_ref = 0;
40040 if ((uintptr_t)ret_var.inner > 4096) {
40041 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40042 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40043 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40044 ret_ref = (uintptr_t)ret_var.inner;
40045 if (ret_var.is_owned) {
40052 uint32_t __attribute__((export_name("TS_RawInvoice_description"))) TS_RawInvoice_description(uint32_t this_arg) {
40053 LDKRawInvoice this_arg_conv;
40054 this_arg_conv.inner = (void*)(this_arg & (~1));
40055 this_arg_conv.is_owned = false;
40056 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40057 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
40058 uintptr_t ret_ref = 0;
40059 if ((uintptr_t)ret_var.inner > 4096) {
40060 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40061 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40062 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40063 ret_ref = (uintptr_t)ret_var.inner;
40064 if (ret_var.is_owned) {
40071 uint32_t __attribute__((export_name("TS_RawInvoice_payee_pub_key"))) TS_RawInvoice_payee_pub_key(uint32_t this_arg) {
40072 LDKRawInvoice this_arg_conv;
40073 this_arg_conv.inner = (void*)(this_arg & (~1));
40074 this_arg_conv.is_owned = false;
40075 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40076 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
40077 uintptr_t ret_ref = 0;
40078 if ((uintptr_t)ret_var.inner > 4096) {
40079 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40080 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40081 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40082 ret_ref = (uintptr_t)ret_var.inner;
40083 if (ret_var.is_owned) {
40090 uint32_t __attribute__((export_name("TS_RawInvoice_description_hash"))) TS_RawInvoice_description_hash(uint32_t this_arg) {
40091 LDKRawInvoice this_arg_conv;
40092 this_arg_conv.inner = (void*)(this_arg & (~1));
40093 this_arg_conv.is_owned = false;
40094 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40095 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
40096 uintptr_t ret_ref = 0;
40097 if ((uintptr_t)ret_var.inner > 4096) {
40098 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40099 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40100 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40101 ret_ref = (uintptr_t)ret_var.inner;
40102 if (ret_var.is_owned) {
40109 uint32_t __attribute__((export_name("TS_RawInvoice_expiry_time"))) TS_RawInvoice_expiry_time(uint32_t this_arg) {
40110 LDKRawInvoice this_arg_conv;
40111 this_arg_conv.inner = (void*)(this_arg & (~1));
40112 this_arg_conv.is_owned = false;
40113 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40114 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
40115 uintptr_t ret_ref = 0;
40116 if ((uintptr_t)ret_var.inner > 4096) {
40117 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40118 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40119 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40120 ret_ref = (uintptr_t)ret_var.inner;
40121 if (ret_var.is_owned) {
40128 uint32_t __attribute__((export_name("TS_RawInvoice_min_final_cltv_expiry"))) TS_RawInvoice_min_final_cltv_expiry(uint32_t this_arg) {
40129 LDKRawInvoice this_arg_conv;
40130 this_arg_conv.inner = (void*)(this_arg & (~1));
40131 this_arg_conv.is_owned = false;
40132 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40133 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
40134 uintptr_t ret_ref = 0;
40135 if ((uintptr_t)ret_var.inner > 4096) {
40136 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40137 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40138 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40139 ret_ref = (uintptr_t)ret_var.inner;
40140 if (ret_var.is_owned) {
40147 int8_tArray __attribute__((export_name("TS_RawInvoice_payment_secret"))) TS_RawInvoice_payment_secret(uint32_t this_arg) {
40148 LDKRawInvoice this_arg_conv;
40149 this_arg_conv.inner = (void*)(this_arg & (~1));
40150 this_arg_conv.is_owned = false;
40151 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40152 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40153 memcpy(ret_arr->elems, RawInvoice_payment_secret(&this_arg_conv).data, 32);
40157 uint32_t __attribute__((export_name("TS_RawInvoice_features"))) TS_RawInvoice_features(uint32_t this_arg) {
40158 LDKRawInvoice this_arg_conv;
40159 this_arg_conv.inner = (void*)(this_arg & (~1));
40160 this_arg_conv.is_owned = false;
40161 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40162 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
40163 uintptr_t ret_ref = 0;
40164 if ((uintptr_t)ret_var.inner > 4096) {
40165 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40166 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40167 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40168 ret_ref = (uintptr_t)ret_var.inner;
40169 if (ret_var.is_owned) {
40176 uint32_tArray __attribute__((export_name("TS_RawInvoice_private_routes"))) TS_RawInvoice_private_routes(uint32_t this_arg) {
40177 LDKRawInvoice this_arg_conv;
40178 this_arg_conv.inner = (void*)(this_arg & (~1));
40179 this_arg_conv.is_owned = false;
40180 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40181 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
40182 uint32_tArray ret_arr = NULL;
40183 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
40184 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
40185 for (size_t o = 0; o < ret_var.datalen; o++) {
40186 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
40187 uintptr_t ret_conv_14_ref = 0;
40188 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40189 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40190 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
40191 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
40192 if (ret_conv_14_var.is_owned) {
40193 ret_conv_14_ref |= 1;
40195 ret_arr_ptr[o] = ret_conv_14_ref;
40198 FREE(ret_var.data);
40202 uint32_t __attribute__((export_name("TS_RawInvoice_amount_pico_btc"))) TS_RawInvoice_amount_pico_btc(uint32_t this_arg) {
40203 LDKRawInvoice this_arg_conv;
40204 this_arg_conv.inner = (void*)(this_arg & (~1));
40205 this_arg_conv.is_owned = false;
40206 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40207 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40208 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
40209 uintptr_t ret_ref = (uintptr_t)ret_copy;
40213 uint32_t __attribute__((export_name("TS_RawInvoice_currency"))) TS_RawInvoice_currency(uint32_t this_arg) {
40214 LDKRawInvoice this_arg_conv;
40215 this_arg_conv.inner = (void*)(this_arg & (~1));
40216 this_arg_conv.is_owned = false;
40217 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40218 uint32_t ret_conv = LDKCurrency_to_js(RawInvoice_currency(&this_arg_conv));
40222 uint32_t __attribute__((export_name("TS_PositiveTimestamp_from_unix_timestamp"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
40223 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
40224 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
40225 return (uintptr_t)ret_conv;
40228 uint32_t __attribute__((export_name("TS_PositiveTimestamp_from_duration_since_epoch"))) TS_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
40229 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
40230 *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
40231 return (uintptr_t)ret_conv;
40234 int64_t __attribute__((export_name("TS_PositiveTimestamp_as_unix_timestamp"))) TS_PositiveTimestamp_as_unix_timestamp(uint32_t this_arg) {
40235 LDKPositiveTimestamp 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 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
40243 int64_t __attribute__((export_name("TS_PositiveTimestamp_as_duration_since_epoch"))) TS_PositiveTimestamp_as_duration_since_epoch(uint32_t this_arg) {
40244 LDKPositiveTimestamp this_arg_conv;
40245 this_arg_conv.inner = (void*)(this_arg & (~1));
40246 this_arg_conv.is_owned = false;
40247 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40248 int64_t ret_val = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
40252 uint32_t __attribute__((export_name("TS_Invoice_into_signed_raw"))) TS_Invoice_into_signed_raw(uint32_t this_arg) {
40253 LDKInvoice this_arg_conv;
40254 this_arg_conv.inner = (void*)(this_arg & (~1));
40255 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
40256 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40257 this_arg_conv = Invoice_clone(&this_arg_conv);
40258 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
40259 uintptr_t ret_ref = 0;
40260 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40261 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40262 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40263 ret_ref = (uintptr_t)ret_var.inner;
40264 if (ret_var.is_owned) {
40270 uint32_t __attribute__((export_name("TS_Invoice_check_signature"))) TS_Invoice_check_signature(uint32_t this_arg) {
40271 LDKInvoice this_arg_conv;
40272 this_arg_conv.inner = (void*)(this_arg & (~1));
40273 this_arg_conv.is_owned = false;
40274 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40275 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
40276 *ret_conv = Invoice_check_signature(&this_arg_conv);
40277 return (uintptr_t)ret_conv;
40280 uint32_t __attribute__((export_name("TS_Invoice_from_signed"))) TS_Invoice_from_signed(uint32_t signed_invoice) {
40281 LDKSignedRawInvoice signed_invoice_conv;
40282 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
40283 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
40284 CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
40285 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
40286 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
40287 *ret_conv = Invoice_from_signed(signed_invoice_conv);
40288 return (uintptr_t)ret_conv;
40291 int64_t __attribute__((export_name("TS_Invoice_duration_since_epoch"))) TS_Invoice_duration_since_epoch(uint32_t this_arg) {
40292 LDKInvoice this_arg_conv;
40293 this_arg_conv.inner = (void*)(this_arg & (~1));
40294 this_arg_conv.is_owned = false;
40295 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40296 int64_t ret_val = Invoice_duration_since_epoch(&this_arg_conv);
40300 int8_tArray __attribute__((export_name("TS_Invoice_payment_hash"))) TS_Invoice_payment_hash(uint32_t this_arg) {
40301 LDKInvoice this_arg_conv;
40302 this_arg_conv.inner = (void*)(this_arg & (~1));
40303 this_arg_conv.is_owned = false;
40304 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40305 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40306 memcpy(ret_arr->elems, *Invoice_payment_hash(&this_arg_conv), 32);
40310 int8_tArray __attribute__((export_name("TS_Invoice_payee_pub_key"))) TS_Invoice_payee_pub_key(uint32_t this_arg) {
40311 LDKInvoice this_arg_conv;
40312 this_arg_conv.inner = (void*)(this_arg & (~1));
40313 this_arg_conv.is_owned = false;
40314 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40315 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40316 memcpy(ret_arr->elems, Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
40320 int8_tArray __attribute__((export_name("TS_Invoice_payment_secret"))) TS_Invoice_payment_secret(uint32_t this_arg) {
40321 LDKInvoice 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 int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40326 memcpy(ret_arr->elems, *Invoice_payment_secret(&this_arg_conv), 32);
40330 uint32_t __attribute__((export_name("TS_Invoice_features"))) TS_Invoice_features(uint32_t this_arg) {
40331 LDKInvoice this_arg_conv;
40332 this_arg_conv.inner = (void*)(this_arg & (~1));
40333 this_arg_conv.is_owned = false;
40334 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40335 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
40336 uintptr_t ret_ref = 0;
40337 if ((uintptr_t)ret_var.inner > 4096) {
40338 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40339 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40340 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40341 ret_ref = (uintptr_t)ret_var.inner;
40342 if (ret_var.is_owned) {
40349 int8_tArray __attribute__((export_name("TS_Invoice_recover_payee_pub_key"))) TS_Invoice_recover_payee_pub_key(uint32_t this_arg) {
40350 LDKInvoice this_arg_conv;
40351 this_arg_conv.inner = (void*)(this_arg & (~1));
40352 this_arg_conv.is_owned = false;
40353 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40354 int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40355 memcpy(ret_arr->elems, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
40359 int64_t __attribute__((export_name("TS_Invoice_expiry_time"))) TS_Invoice_expiry_time(uint32_t this_arg) {
40360 LDKInvoice this_arg_conv;
40361 this_arg_conv.inner = (void*)(this_arg & (~1));
40362 this_arg_conv.is_owned = false;
40363 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40364 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
40368 jboolean __attribute__((export_name("TS_Invoice_would_expire"))) TS_Invoice_would_expire(uint32_t this_arg, int64_t at_time) {
40369 LDKInvoice 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 jboolean ret_val = Invoice_would_expire(&this_arg_conv, at_time);
40377 int64_t __attribute__((export_name("TS_Invoice_min_final_cltv_expiry"))) TS_Invoice_min_final_cltv_expiry(uint32_t this_arg) {
40378 LDKInvoice this_arg_conv;
40379 this_arg_conv.inner = (void*)(this_arg & (~1));
40380 this_arg_conv.is_owned = false;
40381 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40382 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
40386 uint32_tArray __attribute__((export_name("TS_Invoice_private_routes"))) TS_Invoice_private_routes(uint32_t this_arg) {
40387 LDKInvoice this_arg_conv;
40388 this_arg_conv.inner = (void*)(this_arg & (~1));
40389 this_arg_conv.is_owned = false;
40390 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40391 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
40392 uint32_tArray ret_arr = NULL;
40393 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
40394 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
40395 for (size_t o = 0; o < ret_var.datalen; o++) {
40396 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
40397 uintptr_t ret_conv_14_ref = 0;
40398 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40399 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40400 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
40401 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
40402 if (ret_conv_14_var.is_owned) {
40403 ret_conv_14_ref |= 1;
40405 ret_arr_ptr[o] = ret_conv_14_ref;
40408 FREE(ret_var.data);
40412 uint32_tArray __attribute__((export_name("TS_Invoice_route_hints"))) TS_Invoice_route_hints(uint32_t this_arg) {
40413 LDKInvoice this_arg_conv;
40414 this_arg_conv.inner = (void*)(this_arg & (~1));
40415 this_arg_conv.is_owned = false;
40416 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40417 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
40418 uint32_tArray ret_arr = NULL;
40419 ret_arr = init_uint32_tArray(ret_var.datalen, __LINE__);
40420 uint32_t *ret_arr_ptr = (uint32_t*)(((uint8_t*)ret_arr) + 4);
40421 for (size_t l = 0; l < ret_var.datalen; l++) {
40422 LDKRouteHint ret_conv_11_var = ret_var.data[l];
40423 uintptr_t ret_conv_11_ref = 0;
40424 CHECK((((uintptr_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40425 CHECK((((uintptr_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40426 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
40427 ret_conv_11_ref = (uintptr_t)ret_conv_11_var.inner;
40428 if (ret_conv_11_var.is_owned) {
40429 ret_conv_11_ref |= 1;
40431 ret_arr_ptr[l] = ret_conv_11_ref;
40434 FREE(ret_var.data);
40438 uint32_t __attribute__((export_name("TS_Invoice_currency"))) TS_Invoice_currency(uint32_t this_arg) {
40439 LDKInvoice this_arg_conv;
40440 this_arg_conv.inner = (void*)(this_arg & (~1));
40441 this_arg_conv.is_owned = false;
40442 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40443 uint32_t ret_conv = LDKCurrency_to_js(Invoice_currency(&this_arg_conv));
40447 uint32_t __attribute__((export_name("TS_Invoice_amount_milli_satoshis"))) TS_Invoice_amount_milli_satoshis(uint32_t this_arg) {
40448 LDKInvoice this_arg_conv;
40449 this_arg_conv.inner = (void*)(this_arg & (~1));
40450 this_arg_conv.is_owned = false;
40451 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40452 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40453 *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
40454 uintptr_t ret_ref = (uintptr_t)ret_copy;
40458 uint32_t __attribute__((export_name("TS_Description_new"))) TS_Description_new(jstring description) {
40459 LDKStr description_conv = str_ref_to_owned_c(description);
40460 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
40461 *ret_conv = Description_new(description_conv);
40462 return (uintptr_t)ret_conv;
40465 jstring __attribute__((export_name("TS_Description_into_inner"))) TS_Description_into_inner(uint32_t this_arg) {
40466 LDKDescription this_arg_conv;
40467 this_arg_conv.inner = (void*)(this_arg & (~1));
40468 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
40469 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40470 this_arg_conv = Description_clone(&this_arg_conv);
40471 LDKStr ret_str = Description_into_inner(this_arg_conv);
40472 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
40477 uint32_t __attribute__((export_name("TS_ExpiryTime_from_seconds"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
40478 LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
40479 uintptr_t ret_ref = 0;
40480 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40481 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40482 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40483 ret_ref = (uintptr_t)ret_var.inner;
40484 if (ret_var.is_owned) {
40490 uint32_t __attribute__((export_name("TS_ExpiryTime_from_duration"))) TS_ExpiryTime_from_duration(int64_t duration) {
40491 LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
40492 uintptr_t ret_ref = 0;
40493 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40494 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40495 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40496 ret_ref = (uintptr_t)ret_var.inner;
40497 if (ret_var.is_owned) {
40503 int64_t __attribute__((export_name("TS_ExpiryTime_as_seconds"))) TS_ExpiryTime_as_seconds(uint32_t this_arg) {
40504 LDKExpiryTime this_arg_conv;
40505 this_arg_conv.inner = (void*)(this_arg & (~1));
40506 this_arg_conv.is_owned = false;
40507 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40508 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
40512 int64_t __attribute__((export_name("TS_ExpiryTime_as_duration"))) TS_ExpiryTime_as_duration(uint32_t this_arg) {
40513 LDKExpiryTime this_arg_conv;
40514 this_arg_conv.inner = (void*)(this_arg & (~1));
40515 this_arg_conv.is_owned = false;
40516 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40517 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
40521 uint32_t __attribute__((export_name("TS_PrivateRoute_new"))) TS_PrivateRoute_new(uint32_t hops) {
40522 LDKRouteHint hops_conv;
40523 hops_conv.inner = (void*)(hops & (~1));
40524 hops_conv.is_owned = (hops & 1) || (hops == 0);
40525 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
40526 hops_conv = RouteHint_clone(&hops_conv);
40527 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
40528 *ret_conv = PrivateRoute_new(hops_conv);
40529 return (uintptr_t)ret_conv;
40532 uint32_t __attribute__((export_name("TS_PrivateRoute_into_inner"))) TS_PrivateRoute_into_inner(uint32_t this_arg) {
40533 LDKPrivateRoute this_arg_conv;
40534 this_arg_conv.inner = (void*)(this_arg & (~1));
40535 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
40536 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40537 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
40538 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
40539 uintptr_t ret_ref = 0;
40540 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40541 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40542 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40543 ret_ref = (uintptr_t)ret_var.inner;
40544 if (ret_var.is_owned) {
40550 uint32_t __attribute__((export_name("TS_CreationError_clone"))) TS_CreationError_clone(uint32_t orig) {
40551 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
40552 uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
40556 uint32_t __attribute__((export_name("TS_CreationError_description_too_long"))) TS_CreationError_description_too_long() {
40557 uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
40561 uint32_t __attribute__((export_name("TS_CreationError_route_too_long"))) TS_CreationError_route_too_long() {
40562 uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
40566 uint32_t __attribute__((export_name("TS_CreationError_timestamp_out_of_bounds"))) TS_CreationError_timestamp_out_of_bounds() {
40567 uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
40571 uint32_t __attribute__((export_name("TS_CreationError_invalid_amount"))) TS_CreationError_invalid_amount() {
40572 uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount());
40576 uint32_t __attribute__((export_name("TS_CreationError_missing_route_hints"))) TS_CreationError_missing_route_hints() {
40577 uint32_t ret_conv = LDKCreationError_to_js(CreationError_missing_route_hints());
40581 jboolean __attribute__((export_name("TS_CreationError_eq"))) TS_CreationError_eq(uint32_t a, uint32_t b) {
40582 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
40583 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
40584 jboolean ret_val = CreationError_eq(a_conv, b_conv);
40588 jstring __attribute__((export_name("TS_CreationError_to_str"))) TS_CreationError_to_str(uint32_t o) {
40589 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
40590 LDKStr ret_str = CreationError_to_str(o_conv);
40591 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
40596 uint32_t __attribute__((export_name("TS_SemanticError_clone"))) TS_SemanticError_clone(uint32_t orig) {
40597 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
40598 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_clone(orig_conv));
40602 uint32_t __attribute__((export_name("TS_SemanticError_no_payment_hash"))) TS_SemanticError_no_payment_hash() {
40603 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_hash());
40607 uint32_t __attribute__((export_name("TS_SemanticError_multiple_payment_hashes"))) TS_SemanticError_multiple_payment_hashes() {
40608 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_hashes());
40612 uint32_t __attribute__((export_name("TS_SemanticError_no_description"))) TS_SemanticError_no_description() {
40613 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_description());
40617 uint32_t __attribute__((export_name("TS_SemanticError_multiple_descriptions"))) TS_SemanticError_multiple_descriptions() {
40618 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_descriptions());
40622 uint32_t __attribute__((export_name("TS_SemanticError_no_payment_secret"))) TS_SemanticError_no_payment_secret() {
40623 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_secret());
40627 uint32_t __attribute__((export_name("TS_SemanticError_multiple_payment_secrets"))) TS_SemanticError_multiple_payment_secrets() {
40628 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
40632 uint32_t __attribute__((export_name("TS_SemanticError_invalid_features"))) TS_SemanticError_invalid_features() {
40633 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_features());
40637 uint32_t __attribute__((export_name("TS_SemanticError_invalid_recovery_id"))) TS_SemanticError_invalid_recovery_id() {
40638 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_recovery_id());
40642 uint32_t __attribute__((export_name("TS_SemanticError_invalid_signature"))) TS_SemanticError_invalid_signature() {
40643 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_signature());
40647 uint32_t __attribute__((export_name("TS_SemanticError_imprecise_amount"))) TS_SemanticError_imprecise_amount() {
40648 uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_imprecise_amount());
40652 jboolean __attribute__((export_name("TS_SemanticError_eq"))) TS_SemanticError_eq(uint32_t a, uint32_t b) {
40653 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
40654 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
40655 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
40659 jstring __attribute__((export_name("TS_SemanticError_to_str"))) TS_SemanticError_to_str(uint32_t o) {
40660 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
40661 LDKStr ret_str = SemanticError_to_str(o_conv);
40662 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
40667 void __attribute__((export_name("TS_SignOrCreationError_free"))) TS_SignOrCreationError_free(uint32_t this_ptr) {
40668 if ((this_ptr & 1) != 0) return;
40669 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
40670 CHECK_ACCESS(this_ptr_ptr);
40671 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
40672 FREE((void*)this_ptr);
40673 SignOrCreationError_free(this_ptr_conv);
40676 static inline uintptr_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
40677 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
40678 *ret_copy = SignOrCreationError_clone(arg);
40679 uintptr_t ret_ref = (uintptr_t)ret_copy;
40682 intptr_t __attribute__((export_name("TS_SignOrCreationError_clone_ptr"))) TS_SignOrCreationError_clone_ptr(uint32_t arg) {
40683 LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)arg;
40684 intptr_t ret_val = SignOrCreationError_clone_ptr(arg_conv);
40688 uint32_t __attribute__((export_name("TS_SignOrCreationError_clone"))) TS_SignOrCreationError_clone(uint32_t orig) {
40689 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
40690 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
40691 *ret_copy = SignOrCreationError_clone(orig_conv);
40692 uintptr_t ret_ref = (uintptr_t)ret_copy;
40696 uint32_t __attribute__((export_name("TS_SignOrCreationError_sign_error"))) TS_SignOrCreationError_sign_error() {
40697 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
40698 *ret_copy = SignOrCreationError_sign_error();
40699 uintptr_t ret_ref = (uintptr_t)ret_copy;
40703 uint32_t __attribute__((export_name("TS_SignOrCreationError_creation_error"))) TS_SignOrCreationError_creation_error(uint32_t a) {
40704 LDKCreationError a_conv = LDKCreationError_from_js(a);
40705 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
40706 *ret_copy = SignOrCreationError_creation_error(a_conv);
40707 uintptr_t ret_ref = (uintptr_t)ret_copy;
40711 jboolean __attribute__((export_name("TS_SignOrCreationError_eq"))) TS_SignOrCreationError_eq(uint32_t a, uint32_t b) {
40712 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
40713 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
40714 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
40718 jstring __attribute__((export_name("TS_SignOrCreationError_to_str"))) TS_SignOrCreationError_to_str(uint32_t o) {
40719 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
40720 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
40721 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
40726 void __attribute__((export_name("TS_InvoicePayer_free"))) TS_InvoicePayer_free(uint32_t this_obj) {
40727 LDKInvoicePayer this_obj_conv;
40728 this_obj_conv.inner = (void*)(this_obj & (~1));
40729 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40730 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40731 InvoicePayer_free(this_obj_conv);
40734 void __attribute__((export_name("TS_Payer_free"))) TS_Payer_free(uint32_t this_ptr) {
40735 if ((this_ptr & 1) != 0) return;
40736 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
40737 CHECK_ACCESS(this_ptr_ptr);
40738 LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr);
40739 FREE((void*)this_ptr);
40740 Payer_free(this_ptr_conv);
40743 void __attribute__((export_name("TS_Router_free"))) TS_Router_free(uint32_t this_ptr) {
40744 if ((this_ptr & 1) != 0) return;
40745 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
40746 CHECK_ACCESS(this_ptr_ptr);
40747 LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
40748 FREE((void*)this_ptr);
40749 Router_free(this_ptr_conv);
40752 void __attribute__((export_name("TS_RetryAttempts_free"))) TS_RetryAttempts_free(uint32_t this_obj) {
40753 LDKRetryAttempts this_obj_conv;
40754 this_obj_conv.inner = (void*)(this_obj & (~1));
40755 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40756 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40757 RetryAttempts_free(this_obj_conv);
40760 intptr_t __attribute__((export_name("TS_RetryAttempts_get_a"))) TS_RetryAttempts_get_a(uint32_t this_ptr) {
40761 LDKRetryAttempts this_ptr_conv;
40762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40763 this_ptr_conv.is_owned = false;
40764 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40765 intptr_t ret_val = RetryAttempts_get_a(&this_ptr_conv);
40769 void __attribute__((export_name("TS_RetryAttempts_set_a"))) TS_RetryAttempts_set_a(uint32_t this_ptr, intptr_t val) {
40770 LDKRetryAttempts this_ptr_conv;
40771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40772 this_ptr_conv.is_owned = false;
40773 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40774 RetryAttempts_set_a(&this_ptr_conv, val);
40777 uint32_t __attribute__((export_name("TS_RetryAttempts_new"))) TS_RetryAttempts_new(intptr_t a_arg) {
40778 LDKRetryAttempts ret_var = RetryAttempts_new(a_arg);
40779 uintptr_t ret_ref = 0;
40780 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40781 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40782 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40783 ret_ref = (uintptr_t)ret_var.inner;
40784 if (ret_var.is_owned) {
40790 static inline uintptr_t RetryAttempts_clone_ptr(LDKRetryAttempts *NONNULL_PTR arg) {
40791 LDKRetryAttempts ret_var = RetryAttempts_clone(arg);
40792 uintptr_t ret_ref = 0;
40793 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40794 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40795 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40796 ret_ref = (uintptr_t)ret_var.inner;
40797 if (ret_var.is_owned) {
40802 intptr_t __attribute__((export_name("TS_RetryAttempts_clone_ptr"))) TS_RetryAttempts_clone_ptr(uint32_t arg) {
40803 LDKRetryAttempts arg_conv;
40804 arg_conv.inner = (void*)(arg & (~1));
40805 arg_conv.is_owned = false;
40806 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40807 intptr_t ret_val = RetryAttempts_clone_ptr(&arg_conv);
40811 uint32_t __attribute__((export_name("TS_RetryAttempts_clone"))) TS_RetryAttempts_clone(uint32_t orig) {
40812 LDKRetryAttempts orig_conv;
40813 orig_conv.inner = (void*)(orig & (~1));
40814 orig_conv.is_owned = false;
40815 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40816 LDKRetryAttempts ret_var = RetryAttempts_clone(&orig_conv);
40817 uintptr_t ret_ref = 0;
40818 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40819 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40820 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40821 ret_ref = (uintptr_t)ret_var.inner;
40822 if (ret_var.is_owned) {
40828 jboolean __attribute__((export_name("TS_RetryAttempts_eq"))) TS_RetryAttempts_eq(uint32_t a, uint32_t b) {
40829 LDKRetryAttempts a_conv;
40830 a_conv.inner = (void*)(a & (~1));
40831 a_conv.is_owned = false;
40832 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40833 LDKRetryAttempts b_conv;
40834 b_conv.inner = (void*)(b & (~1));
40835 b_conv.is_owned = false;
40836 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40837 jboolean ret_val = RetryAttempts_eq(&a_conv, &b_conv);
40841 int64_t __attribute__((export_name("TS_RetryAttempts_hash"))) TS_RetryAttempts_hash(uint32_t o) {
40842 LDKRetryAttempts o_conv;
40843 o_conv.inner = (void*)(o & (~1));
40844 o_conv.is_owned = false;
40845 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40846 int64_t ret_val = RetryAttempts_hash(&o_conv);
40850 void __attribute__((export_name("TS_PaymentError_free"))) TS_PaymentError_free(uint32_t this_ptr) {
40851 if ((this_ptr & 1) != 0) return;
40852 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
40853 CHECK_ACCESS(this_ptr_ptr);
40854 LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
40855 FREE((void*)this_ptr);
40856 PaymentError_free(this_ptr_conv);
40859 static inline uintptr_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
40860 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
40861 *ret_copy = PaymentError_clone(arg);
40862 uintptr_t ret_ref = (uintptr_t)ret_copy;
40865 intptr_t __attribute__((export_name("TS_PaymentError_clone_ptr"))) TS_PaymentError_clone_ptr(uint32_t arg) {
40866 LDKPaymentError* arg_conv = (LDKPaymentError*)arg;
40867 intptr_t ret_val = PaymentError_clone_ptr(arg_conv);
40871 uint32_t __attribute__((export_name("TS_PaymentError_clone"))) TS_PaymentError_clone(uint32_t orig) {
40872 LDKPaymentError* orig_conv = (LDKPaymentError*)orig;
40873 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
40874 *ret_copy = PaymentError_clone(orig_conv);
40875 uintptr_t ret_ref = (uintptr_t)ret_copy;
40879 uint32_t __attribute__((export_name("TS_PaymentError_invoice"))) TS_PaymentError_invoice(jstring a) {
40880 LDKStr a_conv = str_ref_to_owned_c(a);
40881 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
40882 *ret_copy = PaymentError_invoice(a_conv);
40883 uintptr_t ret_ref = (uintptr_t)ret_copy;
40887 uint32_t __attribute__((export_name("TS_PaymentError_routing"))) TS_PaymentError_routing(uint32_t a) {
40888 LDKLightningError a_conv;
40889 a_conv.inner = (void*)(a & (~1));
40890 a_conv.is_owned = (a & 1) || (a == 0);
40891 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40892 a_conv = LightningError_clone(&a_conv);
40893 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
40894 *ret_copy = PaymentError_routing(a_conv);
40895 uintptr_t ret_ref = (uintptr_t)ret_copy;
40899 uint32_t __attribute__((export_name("TS_PaymentError_sending"))) TS_PaymentError_sending(uint32_t a) {
40900 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
40901 CHECK_ACCESS(a_ptr);
40902 LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
40903 a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)a) & ~1));
40904 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
40905 *ret_copy = PaymentError_sending(a_conv);
40906 uintptr_t ret_ref = (uintptr_t)ret_copy;
40910 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) {
40911 void* payer_ptr = (void*)(((uintptr_t)payer) & ~1);
40912 CHECK_ACCESS(payer_ptr);
40913 LDKPayer payer_conv = *(LDKPayer*)(payer_ptr);
40914 void* router_ptr = (void*)(((uintptr_t)router) & ~1);
40915 CHECK_ACCESS(router_ptr);
40916 LDKRouter router_conv = *(LDKRouter*)(router_ptr);
40917 LDKMultiThreadedLockableScore scorer_conv;
40918 scorer_conv.inner = (void*)(scorer & (~1));
40919 scorer_conv.is_owned = false;
40920 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
40921 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
40922 CHECK_ACCESS(logger_ptr);
40923 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
40924 void* event_handler_ptr = (void*)(((uintptr_t)event_handler) & ~1);
40925 CHECK_ACCESS(event_handler_ptr);
40926 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
40927 LDKRetryAttempts retry_attempts_conv;
40928 retry_attempts_conv.inner = (void*)(retry_attempts & (~1));
40929 retry_attempts_conv.is_owned = (retry_attempts & 1) || (retry_attempts == 0);
40930 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_attempts_conv);
40931 retry_attempts_conv = RetryAttempts_clone(&retry_attempts_conv);
40932 LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, &scorer_conv, logger_conv, event_handler_conv, retry_attempts_conv);
40933 uintptr_t ret_ref = 0;
40934 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40935 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40936 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40937 ret_ref = (uintptr_t)ret_var.inner;
40938 if (ret_var.is_owned) {
40944 uint32_t __attribute__((export_name("TS_InvoicePayer_pay_invoice"))) TS_InvoicePayer_pay_invoice(uint32_t this_arg, uint32_t invoice) {
40945 LDKInvoicePayer this_arg_conv;
40946 this_arg_conv.inner = (void*)(this_arg & (~1));
40947 this_arg_conv.is_owned = false;
40948 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40949 LDKInvoice invoice_conv;
40950 invoice_conv.inner = (void*)(invoice & (~1));
40951 invoice_conv.is_owned = false;
40952 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
40953 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
40954 *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv);
40955 return (uintptr_t)ret_conv;
40958 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) {
40959 LDKInvoicePayer this_arg_conv;
40960 this_arg_conv.inner = (void*)(this_arg & (~1));
40961 this_arg_conv.is_owned = false;
40962 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40963 LDKInvoice invoice_conv;
40964 invoice_conv.inner = (void*)(invoice & (~1));
40965 invoice_conv.is_owned = false;
40966 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
40967 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
40968 *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats);
40969 return (uintptr_t)ret_conv;
40972 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) {
40973 LDKInvoicePayer this_arg_conv;
40974 this_arg_conv.inner = (void*)(this_arg & (~1));
40975 this_arg_conv.is_owned = false;
40976 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40977 LDKPublicKey pubkey_ref;
40978 CHECK(pubkey->arr_len == 33);
40979 memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
40980 LDKThirtyTwoBytes payment_preimage_ref;
40981 CHECK(payment_preimage->arr_len == 32);
40982 memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
40983 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
40984 *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta);
40985 return (uintptr_t)ret_conv;
40988 void __attribute__((export_name("TS_InvoicePayer_remove_cached_payment"))) TS_InvoicePayer_remove_cached_payment(uint32_t this_arg, int8_tArray payment_hash) {
40989 LDKInvoicePayer this_arg_conv;
40990 this_arg_conv.inner = (void*)(this_arg & (~1));
40991 this_arg_conv.is_owned = false;
40992 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40993 unsigned char payment_hash_arr[32];
40994 CHECK(payment_hash->arr_len == 32);
40995 memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
40996 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
40997 InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref);
41000 uint32_t __attribute__((export_name("TS_InvoicePayer_as_EventHandler"))) TS_InvoicePayer_as_EventHandler(uint32_t this_arg) {
41001 LDKInvoicePayer this_arg_conv;
41002 this_arg_conv.inner = (void*)(this_arg & (~1));
41003 this_arg_conv.is_owned = false;
41004 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41005 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
41006 *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv);
41007 return (uintptr_t)ret_ret;
41010 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) {
41011 LDKChannelManager channelmanager_conv;
41012 channelmanager_conv.inner = (void*)(channelmanager & (~1));
41013 channelmanager_conv.is_owned = false;
41014 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
41015 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
41016 CHECK_ACCESS(keys_manager_ptr);
41017 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
41018 LDKCurrency network_conv = LDKCurrency_from_js(network);
41019 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
41020 CHECK_ACCESS(amt_msat_ptr);
41021 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
41022 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
41023 LDKStr description_conv = str_ref_to_owned_c(description);
41024 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
41025 *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);
41026 return (uintptr_t)ret_conv;
41029 void __attribute__((export_name("TS_DefaultRouter_free"))) TS_DefaultRouter_free(uint32_t this_obj) {
41030 LDKDefaultRouter this_obj_conv;
41031 this_obj_conv.inner = (void*)(this_obj & (~1));
41032 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41033 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41034 DefaultRouter_free(this_obj_conv);
41037 uint32_t __attribute__((export_name("TS_DefaultRouter_new"))) TS_DefaultRouter_new(uint32_t network_graph, uint32_t logger) {
41038 LDKNetworkGraph network_graph_conv;
41039 network_graph_conv.inner = (void*)(network_graph & (~1));
41040 network_graph_conv.is_owned = false;
41041 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
41042 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
41043 CHECK_ACCESS(logger_ptr);
41044 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41045 LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv);
41046 uintptr_t ret_ref = 0;
41047 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41048 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41049 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41050 ret_ref = (uintptr_t)ret_var.inner;
41051 if (ret_var.is_owned) {
41057 uint32_t __attribute__((export_name("TS_DefaultRouter_as_Router"))) TS_DefaultRouter_as_Router(uint32_t this_arg) {
41058 LDKDefaultRouter this_arg_conv;
41059 this_arg_conv.inner = (void*)(this_arg & (~1));
41060 this_arg_conv.is_owned = false;
41061 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41062 LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
41063 *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
41064 return (uintptr_t)ret_ret;
41067 uint32_t __attribute__((export_name("TS_ChannelManager_as_Payer"))) TS_ChannelManager_as_Payer(uint32_t this_arg) {
41068 LDKChannelManager this_arg_conv;
41069 this_arg_conv.inner = (void*)(this_arg & (~1));
41070 this_arg_conv.is_owned = false;
41071 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41072 LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer");
41073 *ret_ret = ChannelManager_as_Payer(&this_arg_conv);
41074 return (uintptr_t)ret_ret;
41077 uint32_t __attribute__((export_name("TS_SiPrefix_from_str"))) TS_SiPrefix_from_str(jstring s) {
41078 LDKStr s_conv = str_ref_to_owned_c(s);
41079 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
41080 *ret_conv = SiPrefix_from_str(s_conv);
41081 return (uintptr_t)ret_conv;
41084 uint32_t __attribute__((export_name("TS_Invoice_from_str"))) TS_Invoice_from_str(jstring s) {
41085 LDKStr s_conv = str_ref_to_owned_c(s);
41086 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
41087 *ret_conv = Invoice_from_str(s_conv);
41088 return (uintptr_t)ret_conv;
41091 uint32_t __attribute__((export_name("TS_SignedRawInvoice_from_str"))) TS_SignedRawInvoice_from_str(jstring s) {
41092 LDKStr s_conv = str_ref_to_owned_c(s);
41093 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
41094 *ret_conv = SignedRawInvoice_from_str(s_conv);
41095 return (uintptr_t)ret_conv;
41098 jstring __attribute__((export_name("TS_Invoice_to_str"))) TS_Invoice_to_str(uint32_t o) {
41100 o_conv.inner = (void*)(o & (~1));
41101 o_conv.is_owned = false;
41102 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41103 LDKStr ret_str = Invoice_to_str(&o_conv);
41104 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
41109 jstring __attribute__((export_name("TS_SignedRawInvoice_to_str"))) TS_SignedRawInvoice_to_str(uint32_t o) {
41110 LDKSignedRawInvoice o_conv;
41111 o_conv.inner = (void*)(o & (~1));
41112 o_conv.is_owned = false;
41113 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41114 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
41115 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
41120 jstring __attribute__((export_name("TS_Currency_to_str"))) TS_Currency_to_str(uint32_t o) {
41121 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
41122 LDKStr ret_str = Currency_to_str(o_conv);
41123 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
41128 jstring __attribute__((export_name("TS_SiPrefix_to_str"))) TS_SiPrefix_to_str(uint32_t o) {
41129 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
41130 LDKStr ret_str = SiPrefix_to_str(o_conv);
41131 jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);